Codestype explanation

Started by Bully@Wiiplaza, August 04, 2011, 06:24:44 PM

Previous topic - Next topic

Bully@Wiiplaza

I found the following code:

Weapon Shrieker [Ozelot]
42000000 90000000
04F0BD1C 00000002
ACF0C35F FEF00000
04F0BD1C 00000001
E0000000 80008000

It let´s the player shoot any weapon with rapidfire.
But what´s the ACF0C35F FEF00000 line doing?
It seems like it´s setting a counter and continuously writes 02 and then 01 as value.
Very fast.

Can someone explain why this happens and also how to do it in ASM?
Thx ;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

According to http://www.geckocodes.org/index.php?arsenal=1#AC

ACF0C35F FEF00000

is non-sense.  The code handler would probably treat it like

AC00C359 FEF00000

Bully@Wiiplaza

Quote from: dcx2 on August 04, 2011, 08:11:43 PM
According to http://www.geckocodes.org/index.php?arsenal=1#AC

ACF0C35F FEF00000

is non-sense.  The code handler would probably treat it like

AC00C359 FEF00000
yeah but it actually works... :o
Idk what ozelot thought when he wrote that line...
My Wii hacking site...
http://bullywiihacks.com/

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

~Bully

Stuff

Is it alright if I post this here? I don't want to start a thread for every codetype, and this thread has such a perfect name.

A2______ KN00MMMM(gecko register if != )

8210000E 9014C0E4
42000000 90000000
A214CBFC EF000000
A8000008 0000005A
E0000000 80008000

After looking the the counter if in the code list, I thought it would be a good way to test any new conditional codetypes I come across.(Still need to understand it more, but whatever.) So I looked at A2(why I skipped A0 is beyond me). I read it, and it looks like a good way to compare 16bits in 2 addresses. Just store one value in a gr and compare it to F with the 2nd address in _______. I look at the addresses of the 1st 2 monsters in mh3 with this and if this worked, I should be able to see the counter going up in the codelist. But no. Instead, the game freezes as soon as I send the code. I tried instead putting the 2nd address in another gr and it still freezes. It freezes whether I expect the condition to be true or false. I just can't compare 2 grs. And it's that line. Any other if in it's place doesn't freeze the game. So I think the codetype might be documented wrong.
.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

dcx2

#4
If ([grN] and not(MMMM))!=([grK] and not(MMMM))

The brackets mean "pointer goes here".  So instead of

8210000E 9014C0E4

You should use

8000000E 9014C0E4

Your original line was saying "take the 16-bit value out of 9014C0E4 and use it as a pointer".  Well, a 16-bit read of that address probably results in 0000XXXX, which is not a valid address, hence the crash.  You could probably press Step Into on the bp tab after the crash to see where and why it crashed.

Also, the Gecko Register ifs are 32-bit compares AFAIK.  lol the code type is specifically "16 bit if's" hahaha

EDIT:

might also want to review the second code in this post.  http://wiird.l0nk.org/forum/index.php/topic,8671.msg72146.html#msg72146

Using the 4E code and a 9421 code, you can have a gr over-write the operand of a code that doesn't normally use gr's.

Stuff

That didn't cause a freeze, but it never returned true. :/

42000000 90000000
A214CBFC EF000000

Does that also have to be a pointer? I think these gecko ifs suck then. I'm trying to compare 2 addresses without hogging up 2 gecko registers, and I have to add another 2 lines for that.

8210000E 9014C0E6
4E000016 00000000
9411000E 00000000
42000000 90000000
2A14CBFE 00000000
A8000008 0000005A
E0000000 80008000

So now the count up only works if the monsters have different hp as expected. And from the looks of it, if I put stuff after A8 it would delay the line after it by until 5A frames pass. but look at all them lines. XD

4E is a beast and you be OD'in with it, dcx2. lol
Still wish I could just compare the 2 addresses with a gr if.
.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

dcx2

This should have worked, except that you won't see the effect until after 5A frames.  I am surprised if it doesn't work...maybe try swapping E and F?

8000000E 9014C0E4
42000000 90000000
A214CBFC EF000000
A8000008 0000005A
E0000000 80008000

Stuff

#7
Now that I look at it, I think it might've been a typo. should be 9014C0E6 and A214CBFE like in my last post. At some point I noticed the hp is in the 2nd 16 bits. I'll try this again.

Quote from: dcx2 on August 15, 2011, 02:11:43 AMI am surprised if it doesn't work...maybe try swapping E and F?
That's like saying if 3=5 makes more sense than if 5=3. XD I'll try it though.

It worked. Thanks. Not the  E and F swapping XD.
9014C0E4 and 9014CBFC are both 0000(unless something has 65536+hp >.>), so it was checking if there weren't equal and returned false. That's why it didn't work before.
.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

dcx2

"corner cases" as these are called, where the gr = F, are quite often handled by custom code.  Sometimes it might work for one corner case and not the other.  Though the alignment problem may actually have been what caused it to fail.

Stuff

hmm. Interesting. Well I was editing my post when you posted. It was the alignment/\, but I guess I'll keep an eye out for corner cases.
.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

Stuff

#10
Some more codetypes. This time I'm tackling flow control and address range check and stuff. I already thought about how these could be used. But I gotta make sure I understand. First CE.

CE00000T XXXXYYYY

if XXXX<=ba<YYYY
else false
apply Endif if T=1.

Looks like an if to me. So I guess it needs a endif as well? And does it apply 1 endif or end all ifs?
I guess this would go well with F6 or maybe something that changes the pointer(DE) to something unknown.

64000000 0000000P

So I think it can't come back to the next line after it's done. I was messing with the code list and I think it didn't run the next code after 64000000 0000000P. I want to know if I'm right in believing that.
I can imagine using this to make a while loop by going back to a previous line while something is true. I could do a for loop with set and execute repeat. You could get real funky with this and gecko registers.

F0000000 00000000
Tells the code handler that there are no more codes in the code list. The code handler exits.

>.> for what? Does 'code handler exits' mean that it'll stop executing codes completely when it reaches this? Does it end ifs?

Going back to the masking thing, lets say I want to do 'if <MMMMXXXX', but I want to keep 0 out of the possible trues. I'll use 2331 for X. I really don't want to do do if>0 after, because that's another line. So I put a bit of thought into this. If I make M=DCCE it would do Z%2331=2331? But then I got lost. This is definitely not gonna take me anywhere. It looks like it might be true unless Z is 0 or 2331 because there's no remainder for those 2. This would turn out to be a better if in quest than the one I had using the timer.
.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

dcx2

#11
CE code type - Yes, it is an if and requires its own end-if or a terminator.  T = 1 will apply exactly one end-if.  Adding 1 to if codes in general will apply one end-if.

CE is fairly useless because you will never load the ba with a random pointer due to the ba addressing restriction (i.e. it masks off the lower 25 bits and only uses the upper 7 when calculating addresses)  For much the same reason, 46 is pretty useless too (it will always create ba = 80000000).

In contrast its cousins, DE and 4E, are extremely powerful.  Every time you load a pointer into the po from the game (i.e. 48 code type, or any code type which does po = [xxxxxxxx]), you should do a DE check.  If you load the po explicitly (i.e. 4A code, or po = xxxxxxxx), then you know the address would be valid so you don't need to DE check.

F6 codes sortof DE check themselves, because they either find the address they're looking for, or they fail and do not execute; the po never has a chance to be an illegal address.

---

64 is used to "jump" execution of the code list from one address to another.  What you're trying to accomplish might be better with a 66 Goto instead of a 64 Return.  You probably intend to jump over code  lines instead of addresses.  But you could probably use Gosub to set up the pointer for a Return.

---

All of the cheat codes are executed sequentially every frame, almost like a sort of program.  F0/FE/FF code type indicates the end of the code list.  It tells the code handler that it can stop executing cheats for this frame and return to the game.  The next time the code handler's hook is executed, it will run through all the cheats again.  It doesn't *technically* apply any end-ifs, but since the code handler will be done executing any un-ended ifs are moot.

Imagine it goes something like this.

while (codetype != 0xF0) { executeNextCode(); }

---

You're misunderstanding how masking works.  The "remainder" shortcut is misleading and only works for remainders that are powers of 2.

In order to understand masking, you have to know how hex maps to binary.  When I say 0xFC, you need to see 0b1111 1100.  Each hex digit has a corresponding binary pattern.  0xF = 0b1111, which is why "all 1s" is 0xFFFFFFFF.  Alternating 1s and 0s, i.e. 0b0101 0101, would be 0x55.

For code types, the mask bits M will "ignore" any bits that are 1.  So let's say your mask was 0x0002.  It would count up from 0, to 1, and when it got to 2 it would look like 0 again because that bit is masked.  3 -> 1.  4 -> 4.  5 -> 5.  6 -> 4.  7 ->5.  8 -> 8.  Do you see now why the remainder shortcut is misleading?

Code type masks are the exact opposite of ASM masks.  0's are masked instead of 1's.  Hence the "& not(MMMM)" part of the code type mask; this is what makes 1's mask.

Stuff

Thanks for the DE suggestion. I probably would've never thought about that. I would've always assumed if the pointer was there, it would always be there. I'll try to keep that in mind.

---

Oh I see. Didn't think binary would come in handy ever >.>. I'll have to find a binary<->hex converter. Seeing this, I don't think I can keep 0 from returning true in a if less than :/ . It just needed to be 0. Yeah. The remainder thing is quite misleading. lol.
.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

dcx2

For binary <-> hex, use Windows Calculator in Scientific mode.  F5 switches to Hex, F6 decimal, F7 octal, and F8 binary.  Windows Calculator can also do binary operations like AND, OR, NOT, and XOR.  After a while, though, you just kinda know.

Stuff

4A100 : po += XXXXXXXX

5A010 : po = po+XXXXXXXX

I looked at this many times. To me, they mean the same thing. So for what?
.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