Shortening up same assembly codings?

Started by Bully@Wiiplaza, June 09, 2011, 03:56:11 PM

Previous topic - Next topic

Bully@Wiiplaza

Is there a reasonable way to shorten the following up?

Hook: 80123458
li r0,0
stw r0,0(r3)

Hook: 80223458
li r0,0
stw r0,0(r3)

Hook: 80323458
li r0,0
stw r0,0(r3)

C2123458 00000002
38000000 90030000
60000000 00000000
C2323458 00000002
38000000 90030000
60000000 00000000
C2323458 00000002
38000000 90030000
60000000 00000000

Same coding is hooked to 3 different addresses, but I don´t want to repeat the assembly each time.

Possible to do?
My Wii hacking site...
http://bullywiihacks.com/

My youtube account with a lot of hacking videos...
http://www.youtube.com/user/BullyWiiPlaza

~Bully

dcx2

Not really.  A C2 code needs a back-branch to get back to the original hook.

There may be a way to replace your hooks with bl's, but it would be awkward and probably just as many lines.  If you had like ten C2 codes then setting up a bl might be more economical.

Bully@Wiiplaza

Quote from: dcx2 on June 09, 2011, 05:31:02 PM
There may be a way to replace your hooks with bl's
thx for your answer :D
Could you provide an example on how to use these hooks with bl´s or isn´t it possible to tell without having more information?
You could also invent additional stuff though, if needed.
My Wii hacking site...
http://bullywiihacks.com/

My youtube account with a lot of hacking videos...
http://www.youtube.com/user/BullyWiiPlaza

~Bully

dcx2

First you'd need to make sure each function you hooked was not a leaf function.  Leaf functions don't preserve LR and if you bl you will over-write LR.

Second, you'd need somewhere to place your ASM.  Probably in the code handler's code section.

Third, your ASM must end with blr.

Fourth, you'd need to find the address of where your ASM loaded.  This will change depending on what codes you have applied, so you'd probably need a way to get the address at runtime.  Sounds like a 4E code.

Fifth, you'd need to write branches at the hook addresses to your ASM using the address from step four.  There's a code type for doing this, I think.

Sixth, you'd need to set the LSB of each branch, to turn the b into a bl.