ASM Button Roller

Started by Deathwolf, January 23, 2012, 08:25:36 PM

Previous topic - Next topic

Deathwolf

How would you create an ASM Button Roller? I've seen one by mdmwii but I can't post it because it's an online code.
The code should work like: if button is once pressed - enable code 1
                                        if button (the same) is again pressed - enable code 2
lolz

goemon_guy

Just a suggestion, but you could do something that stores whether you have pressed the button before.

e.g. - Button you want to press is 1 on the Wii Remote

lis r12,0xXXXX
lhz r12,0xXXXX(r12) # load button data into r12
li r14,0 # makes sure r14 is 0

cmpwi r12,0x200 # button 1 pressed?
bne- _ORIGINAL
addi r14,r14,1      # increase "button pressed"

-code #1 to enable after you pressed 1 once-

cmpwi r14,2          # Have you pressed button 1 twice?
bne- _ORIGINAL   # if not, skip the injected code

-code #2 to enable after you pressed 1 again-

_ORIGINAL:
#original instruction

Something alone those lines should work, if I did it correctly.
-Currently hacking the following game(s):
...
Request a code via PM, if you wish.

Deathwolf

That looks really good, I'll try that out and tell you if it works or not. Anyways thanks for your answer  :)
lolz

Bully@Wiiplaza

#3
yeah, very good goemon_guy.

Then, if you want the counter (last condition in your code was true) to reset after some specific value, you e.g. execute li r14, 0.

Like this:

cmpwi r14, 0x0A # pressed 10 times?
bne- _END
li r14, 0 # reset counter
_END:

So it will always execute another code part each time you press that button.
I just realised this way of coding after reading the thread. It´s great to learn something new every day. ;D
My Wii hacking site...
http://bullywiihacks.com/

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

~Bully

Bully@Wiiplaza

EDIT:
This won´t work.
We need to load and store to the RAM or otherwise our counter gets lost.
Each time the upper ending was reached, reset counter to 0.
My Wii hacking site...
http://bullywiihacks.com/

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

~Bully

Stuff

I did this for friend swap also. I'll probably just release the source code for it cuz that's my most complex code ever.
It checks if the button is pressed and then if it was already being pressed(since asm runs every frame and whatnot) so that it doesn't double execute. Then it stores the fact that it was pressed in memory, then it checks if this is the first time it was pressed and decides what to do. All the way in the beginning, if the button is not being pressed, it writes 0 to the "already pressed" byte. This way the code won't turbo if you hold the button. It only runs if it was 0.

lis r5, CONTROL@ha
lhz r5, CONTROL@l(r5)
cmplwi r5, BACKBTN ### not
bne- 0x14              ###
li r5, 0                   ###
stw r5, 0x14(r20)   ###
stb r5, 0x18(r20)   ###
stb r5, 0x28(r20)   ### important
cmplwi r5, SWAPBTN ##if pressed
beq- _NOPE   ##bad name. before I changed it it was if not pressed and I kept the name.
li r5, 0              ##else
stb r5, 0x16(r20) ##write not pressed
b _FIN                   ##and end
_NOPE:
lbz r5, 0x16(r20)   ##then if held
cmplwi r5, 0
li r5, 1
stb r5, 0x16(r20)   ##store pressed
bne- _FIN       #end
lbz r5, 0x17(r20) ##load nth press
xori r5, r5, 1        ##change it
stb r5, 0x17(r20)  ##store it
cmplwi r5, 0          ##if 1st time pressed. (if 0 it was second press)
bne- _FIRST         ##only 2 possible executions in this example, but you can get funky and add more.


It's a little mixed up, but if it ain't broke don't fix it.
.make Stuff happen.
Dropbox. If you don't have one, get it NOW! +250MB free if you follow my link :p.

Mod code Generator ~50% complete but very usable:
http://dl.dropbox.com/u/24514984/modcodes/modcodes.htm

Bully@Wiiplaza

what about using the one shot button activator address?
My Wii hacking site...
http://bullywiihacks.com/

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

~Bully

Stuff

ah that would work better. But I was using the control pad digits we have in geckocodes and there's no one shot near them. :( It would probably be better to find one >.>. The code would be a few lines shorter.
.make Stuff happen.
Dropbox. If you don't have one, get it NOW! +250MB free if you follow my link :p.

Mod code Generator ~50% complete but very usable:
http://dl.dropbox.com/u/24514984/modcodes/modcodes.htm

Bully@Wiiplaza

Quote from: Stuff on February 11, 2012, 08:08:21 PM
ah that would work better. But I was using the control pad digits we have in geckocodes and there's no one shot near them. :( It would probably be better to find one >.>. The code would be a few lines shorter.
yeah, just find the 32bit button activator (0000XXXX) and the next four bytes will be the one shot button activator.
It gets written for one frame each time you press. Maybe you can write some good template for that one. ;D
My Wii hacking site...
http://bullywiihacks.com/

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

~Bully

Stuff

It should be the same minus the held check:

cmplwi r5, SWAPBTN ##if pressed
beq- _NOPE   ##bad name. before I changed it it was if not pressed and I kept the name.

b _FIN                   ##and end
_NOPE:

lbz r5, 0x17(r20) ##load nth press
xori r5, r5, 1        ##change it
stb r5, 0x17(r20)  ##store it
cmplwi r5, 0          ##if 1st time pressed. (if 0 it was second press)
bne- _FIRST         ##only 2 possible executions in this example, but you can get funky and add more.

That should work.
.make Stuff happen.
Dropbox. If you don't have one, get it NOW! +250MB free if you follow my link :p.

Mod code Generator ~50% complete but very usable:
http://dl.dropbox.com/u/24514984/modcodes/modcodes.htm

sniper82

hi leute wen ich das richtig versteh wollt ihr es doch so machen oder?

drücke b code 1 aktevieren
drücke b erneut springe zu code 2

stelle mir das so vor.

drücke b, für 1 sec. oder weniger code 1 wird akteviert

drücke b erneut für 2 sec.# asm vergleichs anweisung cmpwi 
vergleiche mit nicht benutzter adresse im spiel, wo wir unseren wert hinschreiben


wen wert stimmt
asm anweisung springe zu code 1# asm anweisung addiere zu code 1 xx
ersetze wert aus code 1 gegen code 1 + xx

code ende

den jetzt müste die anweisung ja immer wider auf den wert von code 1 zugreifen
der schon unseren neuen wert geschrieben hat
unseren neuen wert zu rechnen.

sollte ich falsch liegen sagt es bitte, oder stelle ich mir das zu einfach vor.
leider kann ich das nicht in asm schreiben da ich nicht alle begriffe kenne.
-----------------------------------------------------------------------
hi people who I understand this correctly you want to do it yet so right?

press acts fours b code 1
b press jump again to code 2

imagine to be so.

press b, for 1 sec or less code 1 is the fourth Act

press b again for 2 sec # asm instruction comparatively cmpwi
compare with unused address in the game, where we write our value


Who agrees value
asm instruction to jump code 1 # asm instruction add up to code 1 xx
replace value of a code against code 1 + xx

code end

the value now Müster the instructions always resist the access code of a
who has already written our new value
our expected new value.

I should say it wrong please, I ask myself that before or too easy.
Unfortunately I can not write in asm since I do not know all the concepts.
Translation by Goggle. I unfortunately only speak German

Stop ACTA and Sopa
http://wiird.l0nk.org/forum/index.php/topic,9178.0.html