Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- You can't expect learning something just by reading and observing you must practice to integrate the knowledge. This is how I learned PPC:
- I first read Modding Tutorials: "Advanced [PowerPC] Author: Bad Luck Brian, PowerPC Lessons, By: Bad Luck Brian".
- I Uploaded it here: https://www.mediafire.com/file/2djl9p9u2esmm79/Lessons%5BAdvanced-PPC%5D.pdf/file
- Then I also used PPC Compiler By Choco uploaded here: https://www.mediafire.com/file/0es6ry30hv637ob/PPC_Compiler.exe/file
- Then I tried making a RPC and uderstand what it did so I ported MW3 FPS RPC by VezahHFH on different cods to practice: https://pastebin.com/uZ7VSfiq
- /*
- * MW3 FPS RPC by VezahHFH!
- * This function get written at the FPS Offset 0x027720C and FPS Turned ON
- * The offset 0x10050000 is filled with null bytes and that space will be used for setting arguments to the RPC
- *Since I don't use C# for a while I always use his Call function it works all cods if you where to change game you might want to change the offset 0x10050000 another null byte area and what function you want to overwrite (so 0x027720C would change) this works all games*/
- Put the ppc code in choco PPC compiler to get the bytes tho the syntax is a bit different than what's presented below you must add % in front of registers. Ex:
- lis %r28, 0x1005
- lwz %r12, 0x48(%r28)
- ---------------------------------------------------------------------------------------------------------------------------------------
- MW3 FPS RPC by VezahHFH Explained
- ---------------------------------------------------------------------------------------------------------------------------------------
- /*
- lis r28, 0x1005 this instruction should be written in memory at 0x027720C and compiled is equal to 4 bytes 0x3F,0x80,0x10,0x05 r28 = 0x10050000
- lwz r12, 0x48(r28) equivalent in C++ to (int r12 = *(int*)0x10050048;) r12 gets 4 bytes from 0x10050048 r28 temporary = 0x10050048
- cmpwi r12, 0 compares r12 to 0 HERE r12 is the function we want to call or 0 as we didn't call any functtion in this case jump to the end of the code this changes depending the game
- beq 0x74 makes it jump to 0x277290 if r12 = 0 so jump if we didn't call nothing
- lwz r3, 0x00(r28) equivalent in C++ to (int r3 = *(int*)0x10050000;) read 4 bytes at 0x10050000 and put in as first argument
- lwz r4, 0x04(r28) equivalent in C++ to (int r4 = *(int*)0x10050004;) read 4 bytes at 0x10050004 and put in as 2nd argument
- lwz r5, 0x08(r28)
- lwz r6, 0x0C(r28)
- lwz r7, 0x10(r28)
- lwz r8, 0x14(r28)
- lwz r9, 0x18(r28)
- lwz r10, 0x1C(r28)
- lwz r11, 0x20(r28)
- lfs f1, 0x24(r28) same thing than above but with float registers so float arguments
- lfs f2, 0x28(r28)
- lfs f3, 0x2C(r28)
- lfs f4, 0x30(r28)
- lfs f5, 0x34(r28)
- lfs f6, 0x38(r28)
- lfs f7, 0x3C(r28)
- lfs f8, 0x40(r28)
- lfs f9, 0x44(r28)
- mtctr r12 move r12 in count register
- bctrl jump to count register basically call value stored at 0x10050048
- li r4, 0 r4 = 0
- stw r4, 0x48(r28) write 4 bytes (should be 4 nullbytes at 0x10050048 to avoid calling same function twice
- stw r3, 0x4C(r28) r3 always contain the return value if function returns something so we store it at 0x1005004C
- stfs f1, 0x50(r28) if the return is a float it will be written at 0x10050050
- b 0x14 jump to end of function this changes depending on the game you can also nop until you reach the end of the branch
- */
- ready for compiler
- lis %r28, 0x1005
- lwz %r12, 0x48(%r28)
- cmpwi %r12, 0
- beq 0x74
- lwz %r3, 0x00(%r28)
- lwz %r4, 0x04(%r28)
- lwz %r5, 0x08(%r28)
- lwz %r6, 0x0C(%r28)
- lwz %r7, 0x10(%r28)
- lwz %r8, 0x14(%r28)
- lwz %r9, 0x18(%r28)
- lwz %r10, 0x1C(%r28)
- lwz %r11, 0x20(%r28)
- lfs %f1, 0x24(%r28)
- lfs %f2, 0x28(%r28)
- lfs %f3, 0x2C(%r28)
- lfs %f4, 0x30(%r28)
- lfs %f5, 0x34(%r28)
- lfs %f6, 0x38(%r28)
- lfs %f7, 0x3C(%r28)
- lfs %f8, 0x40(%r28)
- lfs %f9, 0x44(%r28)
- mtctr %r12
- bctrl
- li %r4, 0
- stw %r4, 0x48(%r28)
- stw %r3, 0x4C(%r28)
- stfs %f1, 0x50(%r28)
- b 0x14
- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- If interested for a PPC Class and you don't wanna learn by yourself inbox me
- Skype: Jo-Milk
- Twitter: @jomilk15
Add Comment
Please, Sign In to add comment