WiiRd forum

Wii & Gamecube Hacking => Wii Game hacking help => Topic started by: leeharris100 on August 02, 2008, 08:42:51 AM

Title: What exactly does this do?
Post by: leeharris100 on August 02, 2008, 08:42:51 AM
Hello,

I just ran across the infinite up B code for Brawl. I am getting into the ASM part of Gecko and if someone could help explain this to me it would help the learning process a LOT. I don't really understand the point of the D2 section, because it seems like this code is functional without it.

Thanks!

4A000000 8077F780
D2000000 00000003
2C1C0010 40820008
3B80000F 939E0038
60000000 00000000
Title: What exactly does this do?
Post by: James0x57 on August 02, 2008, 10:06:45 AM
The reason it doesn't do anything differently is because when you removed that line from the code you had already activated the code when the line was still there.

4A000000 8077F780 1
D2000000 00000003 2
2C1C0010 40820008 3
3B80000F 939E0038 4
60000000 00000000 5

1 sets pointer to 8077F780
2 writes into memory a branch at the pointer (at the pointer should be an assembly instruction) that jumps to the ASM in the next lines until 00000000 is reached. (Which is in 00000003 lines)
3&4 are custom ASM that WiiRD writes to empty memory in game
5 "60000000" is the ASM instruction 'nop' which means 'do nothing'. The 0 part is where the WiiRD codehandler branches back to the ASM (at the pointer address+4).

Removing line 2 (after activating it while it was there) does not restore the ASM instruction that was originally at the pointer address (where line 2 wrote a branch to the custom ASM instructions). Therefor the ASM at the pointer is STILL a branch to the custom ASM.
Removing that line also turned the 3rd line into a greater than conditional. Maybe you got lucky and didn't get activated. I don't know what WiiRD would do if it reached line 4 or 5. Probably blow up though. ;p



ALSO, that code should have the E0000000 80008000 line at the end of it since it modified the pointer address! (alternitavly, it could use 4A000000 80000000 at the end)
Title: What exactly does this do?
Post by: leeharris100 on August 02, 2008, 10:16:05 AM
Do you know where I can find documentation on the type of ASM used in that code? I have no idea what that is!

Thanks again for the help :)
Title: What exactly does this do?
Post by: James0x57 on August 02, 2008, 10:20:55 AM
It's PowerPC ASM
This is a fantastic reference: http://www.nersc.gov/vendor_docs/ibm/asm/mastertoc.htm

I don't have a stand-alone disassembler (or an assembler) to tell you what instructions those are though.


btw, I could describe that code visually, if you'd like me to.
Title: What exactly does this do?
Post by: Nuke on August 02, 2008, 10:30:43 AM
NOP is every code hackers friend :love


awesome explanation Jame0x57
Title: What exactly does this do?
Post by: shark2003 on August 02, 2008, 11:32:18 AM
What the Hell is NOP???
Title: What exactly does this do?
Post by: James0x57 on August 02, 2008, 11:38:33 AM
Quote from: James0x57;1209"60000000" is the ASM instruction 'nop' which means 'do nothing'.
Read the thread before replying, please.
Title: What exactly does this do?
Post by: leeharris100 on August 03, 2008, 10:52:42 AM
So in order to get similar results, I will have to find a PPC ASM assembler and insert it into after line 2?

I can't find a PPC ASM assembler, will I get the same results with an x86 assembler? There seems to be plenty of those!
Title: What exactly does this do?
Post by: James0x57 on August 04, 2008, 06:35:46 AM
WiiRD has a PowerPC assembler/disassembler built right in.
If you go to the disassembler tab you can poke ASM instructions right into the game (which also lets you see their assembled equivalent). Only problem with that is, all the ASM instructions are in decimal, which is completely stupid. (so li r0,0x10 would have to be written li r0,16)
I had an assembler for GCN (which used PowerPC too) but I can't find it..