Help to include both Teams Item Hack into one C2 Hook

Started by Bully@Wiiplaza, February 19, 2011, 11:50:39 AM

Previous topic - Next topic

Bully@Wiiplaza

Hey,
I made this code for Mario Sports Mix:

[spoiler]Item Hack (Blue Team) [Bully@Wiiplaza]
C218B14C 00000006
2C050000 40820020
9421FFF0 91610008
3D60XXXX 616BXXXX
916300DC 81610008
38210010 806300DC
60000000 00000000
X Values:
FFFFFFFF = No Items Mode
00000000 = Green Shell
00000001 = Red Shell
00000002 = Minishroom
00000003 = Bob-omb
00000004 = Star
00000005 = Banana
00000006 = Slippery Minishroom[/spoiler]

Assembly:
[spoiler]cmpwi r5,0 # are we team blue? (cmpwi r5, 1 # are we team red?)
bne- 0x20 # if not, go the end (no item hack)
stwu r1,-16(r1) # stack frame
stw r11,8(r1) # stack frame
lis r11,XXXX # load first half item value
ori r11,r11,XXXX # load second half of item value
stw r11,220(r3) # store the value
lwz r11,8(r1) # end stack frame
addi r1,r1,16 # end stack frame
lwz r3,220(r3) # original instruction (branch would take me here)
[/spoiler]

If 5 = 1, red team´s item value is loaded
If 5 = 0, blue team´s item value is loaded

How would I include these two things into one C2 code to hack specific items for each team like I did for each single team above? Because I can´t hook one adress twice... :(
Thx for helping, I always search a little challenge in ASM, even if it´s not needed for this game! ;)
My Wii hacking site...
http://bullywiihacks.com/

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

~Bully

Y.S.

How about this?
[spoiler].set No_Items,-1
.set Green_Shell,0
.set Red_Shell,1
.set Minishroom,2
.set Bob_omb,3
.set Star,4
.set Banana,5
.set Slippery_Minishroom,6

.set Item_red,Green_Shell
.set Item_blue,Bob_omb

cmpwi r5,0
beq- _BLUE

_RED:
lis r12,Item_red@h
ori r12,r12,Item_red@l
b _STORE

_BLUE:
li r12,Item_blue@h
ori r12,r12,Item_blue@l

_STORE:
stw r12,220(r3)
lwz r3,220(r3)[/spoiler]

hetoan2

but if the values are stagnant, why use assembly at all?

and @Y.S. i like your use of notation ;)


Check out my site with codes obviously...
http://hetoan2.com/

and youtube...
http://youtube.com/hetoan2