ASM Code Example (Part I)

Started by Nutmeg, January 23, 2011, 02:06:18 AM

Previous topic - Next topic

toonlink444

In the begining there was nothing. Then it exploded
New blog!! Check it out for hacking Smash Bros Brawl!! http://letshackblank.blogspot.com/

Deathwolf

lolz

toonlink444

So if I understand correctly you can move values to a different register. Why would you do that?
In the begining there was nothing. Then it exploded
New blog!! Check it out for hacking Smash Bros Brawl!! http://letshackblank.blogspot.com/

Deathwolf

you can WRITE your own value to a free register

example you write 99999999 to r12 and then store value from r12 into address 80123456 (r31)

lis r12,0x9999
ori r12,r12,0x9999
stw r12,0(r31)

r12 = value 99999999
r31 = address 80123456
lolz

toonlink444

In the begining there was nothing. Then it exploded
New blog!! Check it out for hacking Smash Bros Brawl!! http://letshackblank.blogspot.com/

Deathwolf

stw = 32 bit = XXXXXXXX
sth = 16 bit = XXXX
stb = 8 bit = XX
lolz

toonlink444

Ok I'll try again with this info.
In the begining there was nothing. Then it exploded
New blog!! Check it out for hacking Smash Bros Brawl!! http://letshackblank.blogspot.com/

dcx2

Don't use r13.  It's a special register that holds a very special pointer that you do not want to mess with, ever.

Ditto for r1 and r2.

r12 is usually the safest register.  Then, in decreasing order of safety, it goes from r11 to r3, and then r0.

The non-volatile registers, r14-r31, are safe to use if you back them up with a stack frame.

---

As far as toonlink's C2 code, look at the address.  800028C8  That looks like it belongs to the code handler.

I think you found the wrong write breakpoint.  Set your write breakpoint again, then copy and paste the registers into a spoiler.  If you use Gecko.NET you will probably have to switch the view mode to "Text View" from "Edit View" so you can copy and paste.  Then we'll know if your breakpoint was right.

---

Nutmeg, if you want, I can split this discussion into a separate thread if it's too off-topic for your thread.

toonlink444

r13 was an example. And sure I can do that. I've been trying different values but I saved the first address. I'll also show the address I'm looking at now.
In the begining there was nothing. Then it exploded
New blog!! Check it out for hacking Smash Bros Brawl!! http://letshackblank.blogspot.com/

toonlink444

Here's the first one. The origanal breakpoint. Bully@Wiiplaza said the smash value is 00000001. I've been looking for that but I can't find it, so I'm left in the dark. [spoiler]CR:42000088  XER:00000000  CTR:8082CBE4 DSIS:02400000
DAR:806289BC SRR0:80044964 SRR1:0000B032   LR:8084FC14
  r0:0000000E   r1:805B4E70   r2:805A9320   r3:806289B4
  r4:80627EA0   r5:0000000D   r6:00000000   r7:0000000D
  r8:000000FF   r9:00000008  r10:000000FF  r11:805B4E70
r12:80817150  r13:805A4420  r14:00000000  r15:00000000
r16:00000000  r17:00000000  r18:00000000  r19:00000000
__________________________________________________
80044964:  90030008   stw   r0,8(r3)
80044968:  4E800020   blr   
8004496C:  80A40000   lwz   r5,0(r4)
80044970:  80C40004   lwz   r6,4(r4)
80044974:  2C050000   cmpwi   r5,0
80044978:  4182000C   beq-   0x80044984[/spoiler]
In the begining there was nothing. Then it exploded
New blog!! Check it out for hacking Smash Bros Brawl!! http://letshackblank.blogspot.com/

dcx2

80044964:  90030008   stw   r0,8(r3)

That's not what you said before.

800028C8: 90030008    stw r0,8(r3)

Did you happen to have an 04 code type writing to the address the first time?  That would explain why you hit that breakpoint.  That write you hit was probably the code handler executing your 04 code.

The 80044964 looks like a bad breakpoint to try to use.  It's not destroying a stack frame (you would see mtlr and addi right before the blr).  So that means it's probably a short function that's meant to copy data between pointers in r4 and r3...you'll hit these with write breakpoints sometimes.

When you hit that breakpoint, press step two times.  After the second step, you'll see the ASM change to address 8084FC14 (because it will execute the blr, which will branch to the LR, which is 8084FC14).  Looking around that function might help you.

EDIT: or, you can use Gecko.NET, and hit "Step Out".  This will take you to the function that called the one your breakpoint was in

toonlink444

I used the step out button and I got, 801E797C:  800DC388  lwz  r0,-15480(r13)
What do you do with the negitive? Just leave it?
In the begining there was nothing. Then it exploded
New blog!! Check it out for hacking Smash Bros Brawl!! http://letshackblank.blogspot.com/

dcx2

I think you found a different breakpoint again.

We should move this discussion to your "finding the final smash value" thread.  I can help you in greater detail there tomorrow.

toonlink444

In the begining there was nothing. Then it exploded
New blog!! Check it out for hacking Smash Bros Brawl!! http://letshackblank.blogspot.com/

Nutmeg

Quote from: dcx2 on January 24, 2011, 09:09:57 PM
Nutmeg, if you want, I can split this discussion into a separate thread if it's too off-topic for your thread.

Do what you like.  If you feel that it is cluttering the topic, then go ahead and delete it.

If it really gets out of hand, I'll shoot you a pm.  As for now, do what you like.   It makes me feel helpful when so many people post under my thread. xD
I'm inbetween your legs... that's not awkward.