How to make an increase/decrease ASM code?

Started by Bully@Wiiplaza, September 28, 2010, 12:08:15 PM

Previous topic - Next topic

Bully@Wiiplaza

Hey guys,
I was wondering how you can make such a code, because I only know, how to do it with direct RAM write...

example Fifa10 (R4X69)

[spoiler][increase/decrease Home Goals]
28187210 00000200
4A000000 809FD093
A8000008 00000008
94010000 00000000
86000000 00000001
94010000 00000000
E0000000 80008000
28187210 00000100
4A000000 809FD093
A8000008 00000008
94010000 00000000
86000000 FFFFFFFF
94010000 00000000
E0000000 80008000[/spoiler]

for this game, it works always, but not every game is as "kind" as fifa and may use non static adresses ...
But how to generally make this same score manipulation code from fifa in ASM? An example, how mdmwii made one:

mario kart wii (RMCP01)

[spoiler][Battle hacking - PAL -mdmwii]
C2538730 0000000A
3E208000 82311508
7C84002E 7C008800
40820038 3E208034
A231XXXX 2C11YYYY
40820014 8A240023
3A310001 9A240023
48000018 2C11ZZZZ
40820010 8A240023
3A31FFFF 9A240023
60000000 00000000
C27EEFB0 00000003
3FA08000 1CA00004
90BD1508 1FA00248
60000000 00000000
04539878 60000000

xxxx= controller address
yyyy= increase button
zzzz=decrease button

instructions:
lis r17,-32768
lwz r17,5384(r17)
lwzx r4,r4,r0
cmpw r0,r17
bne- 0x38
lis r17,-32716
lhz r17,XXXX(r17)
cmpwi r17,YYYY
bne- 0x14
lbz r17,35(r4)
addi r17,r17,1
stb r17,35(r4)
b 0x18
cmpwi r17,ZZZZ
bne- 0x10
lbz r17,35(r4)
subi r17,r17,1
stb r17,35(r4)
nop[/spoiler]

Thx for replyz and use line explanations ect. pls ;D
My Wii hacking site...
http://bullywiihacks.com/

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

~Bully

dcx2

inc -

lbz r17,35(r4)
addi r17,r17,1
stb r17,35(r4)

dec -

lbz r17,35(r4)
subi r17,r17,1
stb r17,35(r4)

The rest is just making sure that the code is currently processing the right pointer in r4 by testing r0 (cmpw r0,r17/bne will skip other pointers, I think) and testing button activators (cmpwi r17/bne)

Bully@Wiiplaza

Quote from: dcx2 on September 28, 2010, 01:02:27 PM
inc -

lbz r17,35(r4)
addi r17,r17,1
stb r17,35(r4)

dec -

lbz r17,35(r4)
subi r17,r17,1
stb r17,35(r4)

The rest is just making sure that the code is currently processing the right pointer in r4 by testing r0 (cmpw r0,r17/bne will skip other pointers, I think) and testing button activators (cmpwi r17/bne)

Means that I also could only use these parts?

Button Activator for increase
lbz r17,35(r4)
addi r17,r17,1
stb r17,35(r4)
Terminator
Button Activator for decrease
lbz r17,35(r4)
subi r17,r17,1
stb r17,35(r4)

for sure, I need to refer to the right registers and stuff.

Would that work?
My Wii hacking site...
http://bullywiihacks.com/

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

~Bully

dcx2

ASM does not usually have terminators.

Assuming that you did the button activators correctly, that is the general template.  Note that cmpwi/bne is how you do the non-masked button activators (i.e. 00000001 for left [I think] and ONLY left, no other keys).  To do masked button activators (i.e. FFFE0001 for left with or without other keys), you must use andi./beq.

Bully@Wiiplaza

yeah I don´t care about button activators in ASM, the normal 28 line is "good enough" :p
But it´s cool though, if you can do them in ASM 8)
My Wii hacking site...
http://bullywiihacks.com/

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

~Bully

Deathwolf

just load into address with lis,ori and read 16 bit with lhz xD
lolz

dcx2

You can't use 28-code type button activators with C2 hooks.  The 28-code will conditionally apply the C2 hook; once applied, nothing will un-apply the C2 hook.

In order to make a 28-code work with a C2 hook, you will need an E2-code (endif + else), which will patch the original instruction/"anti-code" when you aren't using the button activator.

It really is much easier to just use ASM button activators.  And the code will be shorter.

Bully@Wiiplaza

#7
Quote from: Deathwolf on September 28, 2010, 08:41:19 PM
just load into address with lis,ori and read 16 bit with lhz xD
you load the button adress into a register with lis and ori, I couldn´t find out further with this reply... :rolleyes:
Anyway, i bet there is already a thread for button activator in ASM, but where? :eek:

found it: http://wiird.l0nk.org/forum/index.php/topic,6496.0.html

@dcx2:
thanks for letting me know, i thought it works with 28 aswell... :-\
My Wii hacking site...
http://bullywiihacks.com/

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

~Bully

Deathwolf

lolz

dcx2

@Bully - yeah, that's a good thread.  A few posts down is a pretty good post I made, with a line-by-line breakdown.  I also mention the WiiRD-style template

28 if-equal button activator
C2 hook
E2 else
04 write original instruction
E0 terminator

Honestly, ASM button activators are easy once you understand how branching works.

Bully@Wiiplaza

#10
hey I picked out your post:

You can also do it in pure ASM.

lis r12,0xXXXX      # r12 = controller pointer
ori r12,r12,0xYYYY
lhz r12,0(r12)      # r12 = controller value
cmpwi r12,ZZZZ      # compare r12 to ZZZZ
bne- 0x0C         # if Not Equal, branch
lis r12,0x4100      # if equal, write 41000000...
stw r12,428(r28)      # ...to 428(r28)
lwz r6,428(r28)      # bne- would take you here

You insert the button activator value in the ZZZZ values, don´t you?

should work then :)
My Wii hacking site...
http://bullywiihacks.com/

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

~Bully

Deathwolf

Quote from: Bully@Wiiplaza on September 28, 2010, 08:55:05 PM
hey I picked out your post:

You can also do it in pure ASM.

lis r12,0x8040      # r12 = controller pointer
ori r12,r12,0xA5E0
lhz r12,0(r12)      # r12 = controller value
cmpwi r12,YYYY      # compare r12 to YYYY
bne- 0x0C         # if Not Equal, branch
lis r12,0x4100      # if equal, write 41000000...
stw r12,428(r28)      # ...to 428(r28)
lwz r6,428(r28)      # bne- would take you here

should work :)

bne- 0xXX, it not every time 0C. PyiiASMH will calculate it for you.

lis r12,0x8040      # r12 = load into button address
ori r12,r12,0xA5E0
lhz r12,0(r12)      # r12 = read 16 bit (2bytes)
cmpwi r12,YYYY      # compare r12 to YYYY
bne- 0x0C         # if Not Equal, branch
lis r12,0x4100      # if equal, write 41000000...
stw r12,428(r28)      # ...to 428(r28)
lwz r6,428(r28)      # bne- would take you here

or use andi. r12,r12,YYYY
lolz

Bully@Wiiplaza

PyshASM doesn´t work for me...
I still use ASMWiiRD :eek:
My Wii hacking site...
http://bullywiihacks.com/

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

~Bully

Deathwolf

lolz

Bully@Wiiplaza

My Wii hacking site...
http://bullywiihacks.com/

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

~Bully