Apparently, this is more of an issue than i thought it should be........
How to inject ASM codes (C2xx xxxx) directly into the iso
(the way I do it)
Quick shoutout to Guese, I´ve learned how to do this by looking at his inject of the "Salty Runback" code
0.preperation:
you will need:
- a working ASM code for your version of smash
- an iso (preferably vanilla)
- a debug version of Dolphin that can execute memory break points
- some tool to extract/replace the dol (google "gc-rebuilder" or "gc-tool")
- a hex editor ( pretty much all work, I use HxD because that was already installed on my computer for work reasons)
- some basic knowledge about how ASM and dolphin work generally
- ASM <> WiiRd converter
0.1 quick recap (what are we actually trying to do?)
for this tutorial I am going to use the shortened code from achilles
Always Skip Results Screen & KO Stars Function Normally
(Gecko, 1.02) [Sham Rock, Achilles]
C21A415C 0000000E
3803FFFF 2C0B0020
41820064 2C000004
4082005C 3AC00000
3E608045 6273226F
3E40804D 6252672F
8E320001 8E930E84
7E31A214 8E930004
7E31A214 8E930004
7E31A214 8E930004
7E31A214 2C1100FF
41800008 3A2000FF
9A320000 3AD60001
2C160004 41A0FFC4
38000000 00000000
To reiterate IE´s beginners Tutorial, here´s in what it does in pictures:
normally (without the code)
http://imgur.com/MgQw6Gv
with the the code active
http://imgur.com/tSDKo5C
In a nutshell, this is what we have to "hard" code into the dol.
1.Finding free space in the dol
-Extract the dol, then load it up in your hex editor and look for some free space (a lot of 00´s)
In this case i took 0x1420 since it´s where the other "skip result screen" would be injected ( the one where your placement was shown in form of the stars) because you could only have one of those two active anyway.
http://imgur.com/GBAwLJp
-Insert the code and add a little something to make it easy to find it later on.
I add FEDCBA98 at the end since it´s normally not found in the game´s memory, ever, so I can find it easily with a single memory search.
http://imgur.com/8WTksL5
-Save and insert the dol into the iso
2.Checking if the memory space is safe to inject
-load up the iso in dolphin and search for FEDCBA98, it will only give you 1 result, from there you can find where you inserted the code into the game permanently
here you can see it @80004420
http://imgur.com/4zW0GvJ
-to check if it´s safe to use that space load up the develop version of dolphin and simply put 1 big memory-breakpoint for all the memory addresses we just modified (80004420 - 8000448c) and just play a bit. If the game never breaks, it never uses those memory addresses and it´s safe to use them.
3.Adding the branches to and from the code
-now that we know the memory is not used by the game, we can add 2 simple branches to and from the custom code
lazy method with ASM<>WiiRd converter that doesn´t require any thought:
branching backwards
b 0x (FFFF FFFF - (end memory address - start memory address) )+1
in this case
(FFFF FFFF - (801a415c - 80004420) )+ 1 = FFE602C4
--> enter "b 0xFFE602C4" into converter
--> 4BE602C4 assembler instruction that has to be inserted into the dol where the code would normally be injected
branching forward
b 0x end address - start address
801a4160 - 8000448c = 19FCD4
--> enter "b 0x19FCD4" into converter
--> 4819FCD4 assembler instruction that has to be inserted where we wrote "FEDCBA98"
3.1.Finding the injection point (801A415C) in the dol
Just like in the previous post I made on injection you can find it with a simple hex search by looking at the surrounding instructions
address code line hex instructions
801a415c subi r0, r3, 1 3803ffff
801a4160 stb r0, 0x0003 (r31) 981f0003
801a4164 li r0, 0 38000000
801a4168 stb r0, 0x0005 (r31) 981f0005
search for "3803ffff981f000338000000981f0005" in the dol
1 result @1A0D3C, meaning that´s the point the branch backwards has to be inserted
4. Testing
-insert everything now properly and give it a test run
@1A0D3C replace "3803ffff" with "4BE602C4" and replace "FEDCBA98" from the beginning with "4819FCD4"
works--> done
http://imgur.com/OFjbonf
Always skip the result screen + normal kill counters
-game skips the result screen after a match
[achilles]
Version -- DOL Offset ------ Hex to Replace -------
1.02 ------ 0x1A0D3C ---- 3803FFFF -> 4BE602C4 ----
@ 0x1420 onward
3803FFFF 2C0B0020
41820064 2C000004
4082005C 3AC00000
3E608045 6273226F
3E40804D 6252672F
8E320001 8E930E84
7E31A214 8E930004
7E31A214 8E930004
7E31A214 8E930004
7E31A214 2C1100FF
41800008 3A2000FF
9A320000 3AD60001
2C160004 41A0FFC4
38000000 4819FCD4
that´s pretty much all there is to it.