Simplified (Beginner's) MKW Cheat Code Documentation
#1
Simplified (Beginner's) MKW Cheat Code Documentation:

NOTE: All cheat code examples provided in this thread are fake/made-up codes.

This thread will help out the beginner about basic format/documentation of MKWii Cheat Codes. This is meant for somebody who has just learned/is-learning how to play MKWii with cheat codes. Or somebody who is at the very start of learning how to make their own codes.



Intro

Cheat codes are applied in the game by what is called a code handler. The code handler that is universally used for Wii gaming is called Gecko. The Gecko code handler will make modifications to the game's Random Access Memory (RAM or usually just called Memory) depending on what cheat codes are on a person's GCT file. The GCT file is what a person uses to apply codes they ant to play with in the game. If you don't know how to make GCT files to play codes with, tutorial for that is HERE.

Various Wii Disc/ISO Homebrew applications (such as USB Loader GX) all have the Gecko codehandler implemented in them. The Gecko Code Handler even has it's own HBC application for playing Wii Discs with cheats (Gecko OS). 



Memory

The game's memory is the following range...
80000000 thru 817FFFFF
90000000 thru 93FFFFFF

All values for memory is in Hexadecimal (Hex for short). If you don't know what Hex is, you can find plenty of info about it on google. Most codes that you see will preform actions that change/modify instructions in "Mem 80". Mem 80 meaning any memory address that begins with '80'. It is also called "static" memory. The static memory is where almost all of the game's instructions (read by the Wii's CPU) are stored.

"Mem 81" (any address starting at 81), and "Mem 90" (any address starting at 90) are called "dynamic memory". Usually, various values are stored here that are read by the instructions stored in static memory. Values in dynamic memory are rarely ever in the same spot after each race and/or after each time the game is booted. There is also some small regions in static memory that behave like dynamic memory, just an fyi.

View of Memory:
Here is a screenshot of the very start of static memory (for the American MKW - http://mkwii.org/pics/other/staticmem.png

The Hex values you see are compiled byte code of various instructions. 



Bit Reference

Each instruction has a memory address value that its last digit begins in 0, 4, 8, or C. Thus each instruction is 4 bytes (8 digits) long. There are 8 bits in each byte. Since each instruction is 4 bytes long, that means each instruction is 32 bits in length.

32 bits = 8 digits of numbers = 4 bytes (Also called a word)
16 bits = 4 digits of numbers = 2 bytes (Also called a halfword)
8 bits = 2 digits of numbers = 1 byte



Code Handler Basic Formats / Basic Gecko Code Documentation

Alright. Now that you understand Hex, Memory, and Bits. Here is a list of basic formats used in a lot of MKW Cheat Codes... Remember that all values are in Hexadecimal.

~~~

32 Bit RAM Write

04XXXXXX YYYYYYYY: 32 bit code. The Y Values overwrite the default 32 bit RAM value at memory location 80XXXXXX. These type of codes are the most common. 99% of 32 bit codes will end in the digit 0, 4, 8, or C.

Example:
0456A308 38A00001

This code will replace the default 32 bit value at address 8056A308 with the value 38A00001.

~~~

Nop

04XXXXXX 60000000: Any 32 bit code that writes the value 60000000 at a location in memory. A nop bascially cancel's out an instruction.

Example:
0485E300 60000000

This code will replace the default 32 bit value of address 8085E300 with the value 60000000.

~~~

Controller Line

283PXXXX YYYYZZZZ: Called the Controller Line. Contains the controller memory address location (usually called controller address value) 'XXXX' and button values (ZZZZ). YYYY is a Hexadecimal equation result to allow the ZZZZ button values to be pressed while other buttons are being pressed. 

P values:
3 = Korean MKWii (NTSC-K)
4 = All Other Versions (NTSC-U, PAL, & NTSC-J) 

If a code contains two controller lines, the first line is also known was the 'activator', and the second line is also known as the 'deactivator'.

Example:
28341462 DFFF2000

4 is the P value (for non-Korean MKWii)
1462 is the XXXX value for NTSC-U Wheel & Chuck
2000 is the ZZZZ value for the Minus Button
DFFF is the YYYY value for the eqaution result to allow the user to press the Minus button while other buttons are being pressed to activate/deactivate code(s).

Thread listing all the XXXX, ZZZZ values - http://mkwii.org/showthread.php?tid=44
Thread teaching you how to fill in XXXX, YYYY, & ZZZZ values - http://mkwii.org/showthread.php?tid=29

~~~

16 Bit RAM Write

02XXXXXX 0000YYYY: 16 bit code. The Y values overwrite the default 16 bit RAM value at memory location 0x80XXXXXX.

Example:
0211D2C2 0000FFFF

This code will replace the default 16 bit value of address 8011D2C2 with the value FFFF.

~~~

8 Bit RAM Write

00XXXXXX 000000YY: 8 bit code: The Y values overwrite the default 8 bit RAM value at memory location 0x80XXXXXX.

Example:
0077AB0F 00000003

This code will replace the default 8 bit value of address 8077AB0F with the value 03.

~~~

Insert ASM

C2XXXXXX 000000YY: 'Insert ASM' code. At offset address XXXXXX a certain amount of code (placed underneath the first line) written in Assembly Language (ASM) will be excuted. The amount of lines underneath the 'C2' line designates the YY value (in hex).C2 Codes that have an even number for the YY value will always end with "60000000 00000000"

Example:
C2565088 00000002
38A00010 90BE0020 
60000000 00000000

NOTE: Insert ASM Codes are for those who can read/write ASM and know how to create codes via Dolphin w/ RAM Viewer. I provided the Insert ASM code info as just a reference for Noobs to at least know what kind of code it is when they see them.

~~~

Halfway & Final Terminators

E0000000 00000000: The Halfway Terminator. It is placed after a code to allow a secondary controller address to be added afterwards for deactivation purposes.

E0000000 80008000: The Final Terminator: This is needed at the very end for most codes so multiple codes in a GCT file don't conflict.

Example:
28341462 FFEF0010
040F4B4C 60000000
E0000000 00000000 <- Halfway Terminator
28341462 DFFF2000
040F4B4C 922F0000
E0000000 80008000 <- Final Terminator

~~~

Off/On Switch

CC000000 00000000: Off/on switch. Sometimes called the 'Repeater Line'. It replaces the use of a Halfway Terminator + Second Controller Line to allow the same button to be used to both activate and deactivate a code.

Example:
28341462 FFEF0010
040F4B4C 60000000
CC000000 00000000 <-- Off/On Switch
040F4B4C 922F0000
E0000000 80008000

~~~

String Write

06XXXXXX 000000YY
ZZZZZZZZ ZZZZZZZZ
...

The XXXXXX is for memory location 80XXXXXX where the string write begins. YY designates how many bytes the string is in length. If the string length is not divisible by 0x8, then extra 0's are added at the end of the string so the last row of compiled code is completed/full-length. Z values is the string contents

Example
0600151C 00000018
60000000 380000FF
3B800000 3F808042
639C5BEC 7C630A14

60000000 is written at memory address 8000151C
380000FF is written at memory address 80001520
3B800000 is written at memory address 80001524

etc etc...



More examples

28348200 00001080 <-- PAL GCN Start button for Activation (if other buttons are not being pressed)
0074CBBF 00000000 <-- 8 bit RAM Write Value
E0000000 00000000 <-- Halfway Terminator to allow the use of a second controller line to deactivate
28348200 00000880 <-- PAL GCN Y button for De-Activation (if other buttons are not being pressed)
0074CBBF 00000001 <-- 8 bit RAM Write back to Default Value
E0000000 80008000 <-- Final Terminator

~~~

28341462 DFFF2000 <-- NTSC-U Minus Button for Activation (other buttons are allowed to also be pressed)
02383AF2 0000270F <-- 16 bit RAM Write Value
CC000000 00000000 <-- Off/On Switch placed here to allow the user to also use the Minus Button for De-Activation
02383AF2 000038A0 <-- 16 bit RAM Write back to Default Value
E0000000 80008000 <-- Final Terminator

~~~

28336200 FB7F0480 <-- NTSC-K GCN X button for Activation
C2009604 00000002 <-- Insert ASM code at Address 80009604
3BE01000 B3E00000 <-- Some ASM Contents
60000000 00000000 <-- YY value for ASM code is 02, therefore this line is here
E0000000 00000000 <-- Halfway Terminator
28336200 FF3F00C0 <-- NTSC-K L Button for De-Activation
04009604 B3E00000 <-- 32 bit RAM Write back to Default Value (needed for deactivating an Insert ASM Code)
E0000000 80008000 <-- Final Terminator
Reply
#2
Hello. Great simplification for this documentation so inexperienced people like me can understand this better. I have a question however. For the "Execute ASM" codetype, should I insert it under the finished C2 code or above it? I wanna try to write simple instructions so I can at least understand how it works.

Example:

C2531130 00000002
3803000F 38030001
60000000 00000000
C0000000 00000002
4E800020 00000000

or

C0000000 00000002
4E800020 00000000
C2531130 00000002
3803000F 38030001
60000000 00000000
Reply
#3
Its always good practice to have codes listed in BA order, lower to higher. C0 codes are executed before the game's RAM. So therefore, they always go before. Even if you have it switched, this still shouldn't effect the codes unless one of the codes has a 'F0' line which tells the code handler there are no more codes.
Reply
#4
(08-09-2018, 08:19 PM)zak Wrote: Its always good practice to have codes listed in BA order, lower to higher. C0 codes are executed before the game's RAM. So therefore, they always go before. Even if you have it switched, this still shouldn't effect the codes unless one of the codes has a 'F0' line which tells the code handler there are no more codes.

Okay then. I see. So the question is, I just put the amount of total lines below the C0 codes in the 2nd part of C0? Like if there are 4 lines below the C0, I should put C0000000 00000004? I know that C2 just inserts the ASM, but doesn't execute it.

Example:

C0000000 00000004
4E800020 00000000
C2531130 00000002
3803FFFF 38030001
60000000 00000000
Reply
#5
(08-10-2018, 12:27 AM)420 Matt Wrote:
(08-09-2018, 08:19 PM)zak Wrote: Its always good practice to have codes listed in BA order, lower to higher. C0 codes are executed before the game's RAM. So therefore, they always go before. Even if you have it switched, this still shouldn't effect the codes unless one of the codes has a 'F0' line which tells the code handler there are no more codes.

Okay then. I see. So the question is, I just put the amount of total lines below the C0 codes in the 2nd part of C0? Like if there are 4 lines below the C0, I should put C0000000 00000004? I know that C2 just inserts the ASM, but doesn't execute it.

Example:

C0000000 00000004
4E800020 00000000
C2531130 00000002
3803FFFF 38030001
60000000 00000000

C0000000 00000001 <-- would be 1 for 1 line of code underneath for that specific code
4E800020 00000000
C2531130 00000002
3803FFFF 38030001
60000000 00000000

The number for amount of lines underneath a code is for each individual code.

Here's an example of a mix of codes in a GCT file

C0000000 00000002 <-- an execute asm code
7CBA0255 2C000001
4E800020 00000000
04563100 60000000 <-- a 32 bit code
C2578804 00000002 <-- insert asm code
380000001 90F00000
60000000 00000000
0278500C 00001CA0 <-- a 16 bit code
Reply
#6
(08-10-2018, 01:15 AM)zak Wrote:
(08-10-2018, 12:27 AM)420 Matt Wrote:
(08-09-2018, 08:19 PM)zak Wrote: Its always good practice to have codes listed in BA order, lower to higher. C0 codes are executed before the game's RAM. So therefore, they always go before. Even if you have it switched, this still shouldn't effect the codes unless one of the codes has a 'F0' line which tells the code handler there are no more codes.

Okay then. I see. So the question is, I just put the amount of total lines below the C0 codes in the 2nd part of C0? Like if there are 4 lines below the C0, I should put C0000000 00000004? I know that C2 just inserts the ASM, but doesn't execute it.

Example:

C0000000 00000004
4E800020 00000000
C2531130 00000002
3803FFFF 38030001
60000000 00000000

C0000000 00000001 <-- would be 1 for 1 line of code underneath for that specific code
4E800020 00000000
C2531130 00000002
3803FFFF 38030001
60000000 00000000

The number for amount of lines underneath a code is for each individual code.

Here's an example of a mix of codes in a GCT file

C0000000 00000002 <-- an execute asm code
7CBA0255 2C000001
4E800020 00000000
04563100 60000000 <-- a 32 bit code
C2578804 00000002 <-- insert asm code
380000001 90F00000
60000000 00000000
0278500C 00001CA0 <-- a 16 bit code

Ah ok. I see. Tongue So do I just need one line under the Execute ASM to have my C2 code work properly? Just to be sure. Smile
Reply
#7
(08-10-2018, 03:09 AM)420 Matt Wrote:
(08-10-2018, 01:15 AM)zak Wrote:
(08-10-2018, 12:27 AM)420 Matt Wrote:
(08-09-2018, 08:19 PM)zak Wrote: Its always good practice to have codes listed in BA order, lower to higher. C0 codes are executed before the game's RAM. So therefore, they always go before. Even if you have it switched, this still shouldn't effect the codes unless one of the codes has a 'F0' line which tells the code handler there are no more codes.

Okay then. I see. So the question is, I just put the amount of total lines below the C0 codes in the 2nd part of C0? Like if there are 4 lines below the C0, I should put C0000000 00000004? I know that C2 just inserts the ASM, but doesn't execute it.

Example:

C0000000 00000004
4E800020 00000000
C2531130 00000002
3803FFFF 38030001
60000000 00000000

C0000000 00000001 <-- would be 1 for 1 line of code underneath for that specific code
4E800020 00000000
C2531130 00000002
3803FFFF 38030001
60000000 00000000

The number for amount of lines underneath a code is for each individual code.

Here's an example of a mix of codes in a GCT file

C0000000 00000002 <-- an execute asm code
7CBA0255 2C000001
4E800020 00000000
04563100 60000000 <-- a 32 bit code
C2578804 00000002 <-- insert asm code
380000001 90F00000
60000000 00000000
0278500C 00001CA0 <-- a 16 bit code

Ah ok. I see. Tongue So do I just need one line under the Execute ASM to have my C2 code work properly? Just to be sure. Smile
You don't need an execute ASM code to make a C2 code work. They are separate cheat codes. Just use your C2 code by itself.
Reply
#8
(08-10-2018, 04:21 AM)zak Wrote:
(08-10-2018, 03:09 AM)420 Matt Wrote:
(08-10-2018, 01:15 AM)zak Wrote:
(08-10-2018, 12:27 AM)420 Matt Wrote:
(08-09-2018, 08:19 PM)zak Wrote: Its always good practice to have codes listed in BA order, lower to higher. C0 codes are executed before the game's RAM. So therefore, they always go before. Even if you have it switched, this still shouldn't effect the codes unless one of the codes has a 'F0' line which tells the code handler there are no more codes.

Okay then. I see. So the question is, I just put the amount of total lines below the C0 codes in the 2nd part of C0? Like if there are 4 lines below the C0, I should put C0000000 00000004? I know that C2 just inserts the ASM, but doesn't execute it.

Example:

C0000000 00000004
4E800020 00000000
C2531130 00000002
3803FFFF 38030001
60000000 00000000

C0000000 00000001 <-- would be 1 for 1 line of code underneath for that specific code
4E800020 00000000
C2531130 00000002
3803FFFF 38030001
60000000 00000000

The number for amount of lines underneath a code is for each individual code.

Here's an example of a mix of codes in a GCT file

C0000000 00000002 <-- an execute asm code
7CBA0255 2C000001
4E800020 00000000
04563100 60000000 <-- a 32 bit code
C2578804 00000002 <-- insert asm code
380000001 90F00000
60000000 00000000
0278500C 00001CA0 <-- a 16 bit code

Ah ok. I see. Tongue So do I just need one line under the Execute ASM to have my C2 code work properly? Just to be sure. Smile
You don't need an execute ASM code to make a C2 code work. They are separate cheat codes. Just use your C2 code by itself.
Oh okay then. I see. Tongue
Reply
#9
I have a question regarding the C2 codetype. So do I need to end every C2 code with "60000000 00000000"? Or can I put the default RAM value for the first part of the last line? I know most C2 codes end in 60000000, but I have seen some ASM codes that don't end like that. EG: Bully's Invincibility hack.
Reply
#10
Are you making your own C2 code? If so, you should be at the level of coding/hacking to where you already know this stuff and the more advanced stuff as well. C2 codes are made through a 'compiler'. Sometimes when you write ASM instructions, you need a 'nop' at the end. This nop causes the C2 code to end with '60000000 00000000' once the code is compiled.

Whatever C2 codes you want to play with it, just grab them from the Codes Forum and make a GCT with them (don't add anything/delete from them except for button activator/deactivator lines if the codes requires it). There's a tutorial on how to make GCTs in the Guides/How-To forum.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)