WiiRd forum

Wii & Gamecube Hacking => Wii Game hacking help => Topic started by: live2play on April 09, 2010, 03:02:58 AM

Title: 03 & 05 Code Types
Post by: live2play on April 09, 2010, 03:02:58 AM
I see references to the 03 code type being a 16-bit write to BA=81000000+Address and 05 code type being a 32-bit write to BA=81000000_Address.  However, I don't see these codes in the code type URL.  Is there a more updated code types document?
Title: Re: 03 & 05 Code Types
Post by: wiiztec on April 09, 2010, 03:53:12 AM
No but it's basicly add 1 to the codetype to add 1 to the second character of the address your writing to/checking if the BA is 90 then it's 91 if 92 then 93

there's 01 03 05 11 13 15 07 17 21 31 29 39 25 35 27 37 ect.
Title: Re: 03 & 05 Code Types
Post by: dcx2 on April 09, 2010, 09:51:55 PM
The Code Type document is a little verbose, so allow me to highlight some specific parts.

QuoteCT : Code Type. Range from 0 to 7. It's the 3 first bits of the first number of a code. Because of this, you'll notice that in the codes all the CT are actually multiplied by 2 : CT1 : 2..., CT2 : 4... CT3 : 6...,..., CT7 : E... . The fourth bit is used to tell the code handler to use the pointer instead of the base address. That means that you'll know if the base address is used by looking at the first number of a code. If it's even it's the base address, if it's odd it's the pointer.

CST : Code Sub Type. It's the 3 first bits of the second number of a code. Because of this, you'll notice that in the codes all the CST are actually multiplied by 2 : CST1 : 2..., CST2 : 4... CST3 : 6...,..., CST7 : E... . The fourth bit is actually a part of the address (____).

So, for an 03 code type (in binary: 0000 0011), the first digit is 0, which means Code Type 0, Base Address.  The second digit is 3, which means Code Sub Type 1, and the last bit is part of the address.

Put another way, we normally at a code like 03234567 and think that the first eight bits (03) are the code type and the last 24 bits (234567) are the address.  This erroneously implies that the codetype/address looks like this in binary (codetype is bold, address is underlined)

0000 0011 0010 0011 0100 0101 0110 0111 (THIS IS WRONG, ADDRESS IS NOT 24 BITS)

The address is NOT 24 bits.  It is actually 25 bits.  Below is the correct breakdown of address and code type.

0000 0011 0010 0011 0100 0101 0110 0111 (THIS IS CORRECT, ADDRESS IS 25 BITS)

In summary, there is no "03" code type because the bit that makes it "03" vs "02" is not a part of the code type, but a part of the address!