Structure of codes

Started by doomkaiber001, November 17, 2010, 07:24:33 PM

Previous topic - Next topic

doomkaiber001

Can someone teach me about the structure of codes? Thanks.

Bully@Wiiplaza

there are a lot of different code structures...
ask for specific ones.
My Wii hacking site...
http://bullywiihacks.com/

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

~Bully

doomkaiber001

How about this one?

Super Smash Bros Brawl PAL
P1 Samus' Blaster is always full   - agrs700

4A000000 81000000
1425E9C6 00000007

James0x57

code lines in this post from agrs700

First line:
4A000000 81000000

Second line:
1425E9C6 00000007


And that code should have a 3rd line:
E0000000 80008000


wiiztec

Or you could just do this

0525E9C6 00000007
If there's any code at all that you want to be button activated, or even able to toggle on & off, and I have the game, just PM me and I'll make it happen

James0x57



dcx2

Codes are arranged in lines of two 32-bit values in hexadecimal.  Thus, 0525E9C6 00000007 as wiiztec said.  Each hex digit corresponds to 4 bits, 8 digits * 4 bits = 32 bits total.  I will refer to these as the "first code word" (0525E9C6) and "second code word" (00000007)

The first 7 bits of the first code word determine the code type.  The remaining 25 bits of the first word, and all 32 bits of the second word, will have different meanings depending on the code type.  For a list of the code types, see the following page.

http://geckocodes.org/index.php?arsenal=1

Following is a diagram of the binary breakdown of the first code word, assuming the remaining 25 bits are an address (which is typical, but not always true)


Hex Digit  |         First         |        Second         |        Third     |   Fourth ...
Bit#       |   0   1   2   |   3   |   4   5   6   |   7   |   8   9  10  11  |   12     ...
is         |   Code Type   | ba/po | Code Sub Type |  address or operands...................


The first 8 bits of the first word are 05.  In binary, this is 0000 0101.  The code type is 000, which is the Direct RAM Write Code Type.  The 0 indicates this uses the ba.  The 010 indicates a 32-bit Write Code Subtype.  The remaining 1 is added to the address, which is why 0525E9C6 writes to the address 8125E9C6.  The value written is specified by the second word.

Other code types are more complicated; they may make use of the second code word or even extra lines to specify other parameters (like the Serial Write), or the remaining 25 bits of the first word may not be an address (like Gecko Register Code Types).  But the first 7 bits of the first word always determine what the other bits mean.

doomkaiber001

Ok, there are a couple of things I don't quite understand;
I couldn't find 05 in the link?
And why does 0525E9C6 become 8125E9C6? I understand the 'Add 1' part, but what makes the 05 become 8? Thanks for all the help.

GMO

Quote from: doomkaiber001 on November 18, 2010, 04:47:41 PM
Ok, there are a couple of things I don't quite understand;
I couldn't find 05 in the link?
And why does 0525E9C6 become 8125E9C6? I understand the 'Add 1' part, but what makes the 05 become 8? Thanks for all the help.

8125E9C6 is the RAM address
http://gamemasterzer0.blogspot.com
For Codes, Guides, & Support Codemasters-Project
USB Gecko Facebook Page - My Wii's 4.1 U | 4.0 E

dcx2

You didn't find an 05 code type because there isn't one.  It's an 04 code type.  Remember, hex digits are 4 bits, but code types only use 7 bits.  That 8th bit - a 1 in the case of an 05 - is part of the address.

This is a cause of great confusion.  Just remember that code types will never be odd because that last bit isn't part of the code type.  If the second digit is odd, subtract 1.

By default, the ba and po are 80000000.  Additionally, only the first 7 bits of the ba are used, but all 32 bits of the po are used.  There are other code types that modify the ba and po, so that you can access other memory ranges like 9xxxxxxx.

Recall the colored text above.  Notice how the 04 code type uses the ba, and the 14 code type uses the po.  If the first digit is even it uses the ba, and if it's odd it uses the po instead.

James0x57

Since you're just starting with this, if you need replies with less (potentially intimidating) technical jargon, don't hesitate to ask. ^^


doomkaiber001

lol thanks James! So by writing, you mean? I have an idea, but don't want to be humiliated if...

James0x57

Not a problem!

'write' is to change something in memory


(all following numbers are hexidecimal)


For your previous question:
The 80000000 that is automatically added to calculate the address comes from one of two places..
If the first digit of the write codetype is:
* even: then you use the 'ba' to get that 80000000
* odd: then you use the 'po' to get that 80000000

This code type: http://geckocodes.org/index.php?arsenal=1&ct=42 will change the 'ba' to other values instead of the default 80000000.

This code type: http://geckocodes.org/index.php?arsenal=1&ct=4A will change the 'po' to other values instead of the default 80000000.

This code type changes them both AND breaks out of any if/then logic in the code: E0000000 80008000




When the second digit of a codetype is odd, you're adding 1000000 to the address calculation. (see dcx2's post if you really want to know why)



So:
15222220 0000000A
first digit is odd, so use 'po' (default value is 80000000)
second digit is odd, so add 1000000
Address = 81222220


doomkaiber001

Ok! That makes alot of sense. So... How is the second code word dependant on the first? How do you determine it?

James0x57

The second word in a 04 codetyped code is simply the value that you write to the address!

If the code was to write how much money you had, the value would be that amount (in hexadecimal).


Make sense? Do you need a better understanding of the memory address/value relation?