Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tutorial on How to Make your own Cheat Codes on Dolphin
Tutorial on How to Make your own Cheat Codes on Dolphin

This guide will teach you how to become an actual real Code Creator. Many people in the MKWii community claim to be code creators, but they don't even know what ASM is. You cannot call yourself a code creator just because you nop'd a random address or modified a floating point value in the game. To be a code creator, you have to (from scratch), make an ASM code based on a breakpoint that effected a desired function of the game all done by yourself.

Now I got that monkey off my back, let's begin.

Chapter 1. Requirements

Before you can start creating ASM codes, you are going to need to be well familiar with the following items:
Homebrew Channel
Making GCT's (Ocarina Cheat Code manager)
USB Loaders
Wiimm's WIT & SZS Tools (be able to learn it easily if you haven't yet)
Gecko Codetype Documentation


Basically here's the level you should already be at:
- Played at least a few months on mkwii with cheat codes
- Made/experimented with some 04-type (32bit) codes
- Can port codes, make activators, make deactivators, etc
- Know what bytes. half-words, and words are
- Know at least 50% of the gecko codetype documentation
- Know most of the terms/slang of hacking/cheating in MKWii 
- Played quite a bit w/ USB Loaders (understand good amount of info with ISOs/WBFSs)
- At least is intuitive enough to learn WIT & SZS Tools easily if you don't already know how to use those Tools

Ok, once you are around that level that I described, then you are good to proceed in this guide. If not, don't even bother, you will have to absorb so much info too quickly, that you will simply not learn anything. You have to crawl before you can walk.

Chapter 2. Dolphin & Aldelaro5's RAM Viewer

While USB Geckos are superior, finding one is quite the challenge. Luckily, we have Dolphin and a RAM Viewer made by a person named Aldelaro5.

Windows Users:
Download the latest dev version of Dolphin -

You CANNOT use a public/stable release. Those versions are VERY outdated, making codes with those types of dolphins is simply not possible.

The download package will be in 7z format, you will need some third party archiver/extractor (such as WinRAR). Extract the download. You will see an application named Dolphin.exe. This is the application you would run to launch Dolphin.

Download the latest version of Aldelaro5's RAM Viewer-

Unzip the download. You will see an application called Dolphin-memory-engine.exe. This is the application you would run to launch the RAM Viewer.

Linux Users:
Install the latest dev version of Dolphin from source code. Tutorial for that is HERE

You CANNOT use a public/stable release. Those versions are VERY outdated, making codes with those types of dolphins is simply not possible.

Install the RAM Viewer from source code, Guide for that is HERE


Once you have both of those installed, you should follow this guide HERE so you can play online (with your own NAND) to test online codes when needed.

NOTE to Windows users reading the Guide to Inject NAND Backup and Play Online (Dolphin) thread: Just open Dolphin via the application file and follow all the steps after the Linux command - dolphin-emu. 

Once you have done all 3 of those steps, you need to familiarize yourself with Dolphin and the RAM Viewer. Play some basic mkwii on Dolphin just to learn how Dolphin works. Nothing crazy.

Chapter 3. PowerPC Assembly

There's no way around it, you're going to have to learn how to read and write PowerPC ASM. This is needed because later on we will use a program to compile ASM into an actual cheat codes. How can you compile ASM if you can't read/write it?

When you read the links I'm about to provide, you MUST ACTUALLY READ THEM! Don't be inpatient and 'skim' through just looking for things that catch your eye. You have to buckle down and take the time to read everything.

Now here are the links I want you to read, read them in the order i listed. Do not proceed further in this guide until you are confident that you can pass a quiz if I were to give you one.

Link #1 - IBM HERE (an article about the basics of IBM's PowerPC) 
Link #2 - WiiBrew HERE (an article going over quite a bit of the Wii's ASM) 

Chapter 4. Overview of Dolphin

Dolphin comes with a debugger mode. It is needed to make cheat codes. The debug mode has many features allowing you to see what is actually happening at the lower levels of MKWii.

There are a variety of panels/tabs that come with the debug mode. However, we will only be focusing on the following three:
Code (will be called Code View in this guide)

There is another tab/panel called Memory to view the game's memory, but we will use Aldelaro5's RAM Viewer instead because Dolphin's memory view is not live, it is simple garbage.

Launch Dolphin Debug Mode--

How to Launch the Debug Mode (Linux): 
If you are on the latest dev version (or 8200 series and later), Dolphin is built with the Qt engine. This means you no longer need to manually boot the debug mode. It can be used when booting Dolphin normally, allowing you to use the debugging tabs/panels at any time. However if this fails, then type this command in your terminal -- dolphin-emu -d

How to Launch the Debug Mode (Windows):
All dev versions for Windows require manually starting the debug mode. Go to the folder where your Dolphin application file is at. Do Shift+Right click inside that folder. Command prompt will appear. Now just type --- Dolphin.exe -d

At the top, click on View, you will see a list of features including the ones I mentioned earlier. Select (to checkmark): Breakpoints, Code View, and Registers.



This is how all codes begin. A user sets a breakpoint thinking that breakpoint will effect a certain function of the game. If their guess is correct, the game will pause and they would work from there.

There are two main breakpoints: Instruction & Memory

Without going into too much detail too early...

Instruction Breakpoints are used when you are working on an existing ASM code (want to modify it, change it). 
Memory Breakpoints are used when you are making a new code from scratch

Code View:

Dolphin should already be running, boot your MKWii ISO/WBFS. Once it has booted, pause the game. You can now see the Code View.

The Code View lets you view the game's assembly code. It takes the hex view of the games memory and decompiles it all to ASM, so you know what functions are being done for every address. You should be able to understand a lot of games functions since you have read up on ASM. The code view can only be seen when the game is paused.


Your game should still be paused (unless you un-paused it yourself). Take a good look at the Registers.

For all ASM functions, there are bytes/data stored, moved, added, loaded etc. The game does this on the PowerPC's Registers. Since you are required to know Gecko Code documentation, think of the Registers like Gecko Registers. 

There are 32 Normal Integer Registers (numbers within any Register are always in hexadecimal). Starting at r0 all the way to r31. For basic coding, these are the only registers you need to be concerned with. There are other types such as Link Register, Floating Point Registers, etc. Don't worry about those until you have made quite a bit of simple ASM codes.

Whenever a change is done to a Register from the previous ASM function in the Code View, those Register(s) will be highlighted in RED.

Since these Registers work like gecko registers, you can load data into a Register, and use it for later. You can also set an address location for a Register, or add the values of two Registers. The possibilities are endless.

Every ASM code depends on the Registers. Get familiar with the Registers!

Chapter 5. Overview of RAM Viewer

Dolphin should already be opened with your game paused. Go ahead and open your RAM viewer.

Pic of RAM Viewer -

The RAM Viewer is very helpful, you can see what changes are happening live in the game. This can help you find undiscovered functions, values that nobody has seen before. USB Geckos never had this feature, so there's still quite a bit left on the table to be done on code making. 

Once your RAM viewer is opened, it should already be hooked to Dolphin. If not, hook it, and open the memory viewer. To keep confusion away during this guide, the term "memory viewer" will be the actual view of the game's memory from the RAM Viewer program; and 'RAM Viewer' is Aldelaro5's overall program itself. On the RAM Viewer, you will seem some options such as First Scan, a drop down menu with the word Byte on it, etc. These options allow you to narrow down a search for a desired value.

Pic of Memory Viewer w/ MKWii running - 

For example: You can use the drop down menu that says Byte on it, change it to Array of Bytes, and enter in a desired string of hex, then hit first scan. A list of matching results with their memory addresses will appear. You can then choose 'Add All' to add the results below. Once those list of addresses are at the bottom, you can right click one of them and choose 'browse at this address'. Once you do that, go back to the memory viewer, you will see that you were negatived to that desired address.

And that's how you basically use the RAM viewer. Theres other things such as "next scan", but I'm already overwhelming you enough.

Pic of many panels (game paused) -

Chapter 6. ASMWiiRD.exe

Unfortunately, dolphin doesn't come with an ASM compiler. There are only two programs that can compile PowerPC ASM. WiiRDGUI and DevKitpro. DevKitpro is a hassle to install and to use in general, so we always stick to WiiRDGui. 

Download WiiRD GUI - HERE (Linux users will need the Wine emulator to run it. Do a quick google search to figure out how to install Wine on your Linux Machine)

Extract the download. In the contents of the folder, you will see asmwiird.exe. This is the compiler. Open it. If it is your first time using the compiler, you will be asked to set the directory. Obviously, set the directory of the one that contains asmwiird.exe.

The left hand box is where you would write your ASM from scratch!! The right hand box is the result of the ASM (the actual cheat code). If you have some ASM in the left hand box and hit the right arrow key, your code will be compiled. If there are any errors on your part, the code will not compile and the program will give a vague answer on why the compilation fail.

Obviously you can insert an already made ASM code in the righthand box, and then decompile it by hitting the left arrow button.

Finally address field is for your base address, So address of 80654320 with make a complied code start with C2654320. 

Chapter 7. Pros and Cons of Dolphin vs USB Gecko

USB gecko is obviously better than Dolphin. There are many features than it can do that Dolphin can't.
- Pointer Searches
- Inject/Remove Codes Live
- Dump RAM beyond mem90 (such as hardware RAM for controllers, video/graphics RAM, etc)

The 'inject codes live' is the real issue here. Lets say you have a finalzied code, well you simply can't just inject it into dolphin and try it. The only codes you can try live in Dolphin are RAM-fill type (single liner codes). You can do this by clicking in on your memory viewer of the RAM viewer, so a cursor marker appears and type in the values you want to replace in RAM. Effects are instant.

So for all other codes you have some options:
If the testing of the code doesn't require you viewing live memory, then you can just make a GCT and test it on a physical Wii.
If the testing of the code REQUIRES the assistance of the memory viewer, then here's what you need to do:
You would need to make the GCT, then use WIT and SZS Tools to extract the ISO, patch the main.dol with GCT and, rebuild the ISO , so then you can run it on Dolphin.

Dolphin can add cheat codes, but you can only use the ones from via download (i know right, wth were the dolphin devs thinking). I have heard there are ways of adding your own codes to the codes list in Dolphin itself but it can render some cheat codes inoperable. Patching the ISO via WIT/SZS Tools insures the correct VBI hooktype so if a code doesn't work, you know its the code thats wrong, and not Dolphin being screwy.

Chapter 8. Direction of Attack

Ok lets sum up the direction of attack when it comes to making codes, then we can actually get started. Here's a quick reference of what is done to make codes.

Dolphin Launched -> Game Launched -> RAM Viewer Launched, Memory viewer opened -> Searches/Scans preformed -> Desired value found -> Breakpoint set on address of desired value -> Game pauses, code view is viewed to see what address the function is at -> Registers are viewed to actually know what is going on in regards to the ASM function -> You know what ASM to write based on the Code and Registers view -> ASM written in compiler, code is made -> GCT made -> Codes are tested -> Tests successful, Ports to other regions are done, Code is officially created

And thats the gist of how this works. Ok before we begin, get something to eat and drink, get your insulin levels to full power (lol), lets get started.

Chapter 9. Making your first code

Alright for this guide, we want to make code to change our position online (Position Modifier Code). Let's pretend you have a friend who is ready to help you make your first code.

Launch dolphin debug mode (bring up the Code View, Breakpoints, and Registers tabs/panels), boot your game, launch the RAM viewer and open the memory viewer. You open a room, your friend joins, and a race is started.

For demo purposes, let's pretend you are on the USA game (RMCE01)

So we start the race in first place. Let's say we are going to guess that the game puts the value '01' for first place. Keep in mind that with code making, you will have to do a lot of guess work with trail and error. This is where intuition kicks in. You got to have the ability to think of something out of nothing, or to work on something with limited known factors.

On the RAM Viewer, make sure Byte is selected on the drop down menu. Change 'Base to Use' from Decimal to Hex. Enter 01 for the search field..

Click First Scan!

Let's say we end up with 1,226,594 results. Well thats no good, we need to narrow down the results. In fact, there's so many results, the RAM Viewer will not list them to prevent itself from crashing. Don't worry though, the RAM Viewer still actually knows all the results. 

Alright so you tell your friend to go ahead of you, you are now in 2nd place. In your search field, change the byte value from 01 to 02.

Click Next Scan!

The Next Scan feature will use your current 1,226,594 results and rerun the search using 02 this time. Any results that don't match 02 will be removed from the results list thus narrowing down the results.

Now we are down to 98 results. At this point this is a small enough list for the RAM viewer to list the results on the lefthand box. Ok, get back into 1st place again, change the byte value back to 01. Hit Next Scan again!

17 results now, better. Do this procedure again to narrow down the results once more. You might be around 8 - 12 results at this moment. You can now stick with your current byte value (don't change positions while doing this ofc), and just hit Next Scan really fast repeatedly. Eventually you will get down to 5 results.

Let's pretend this is our list of memory addresses (5 results)

NOTE: Your list of memory addresses will be different! In fact, every time you 'make' this Position Modifier Code, the list of memory addresses will always be different. Because those addresses are known as 'dynamic', meaning they change per every race and/or game boot. I listed these random ones for demo purposes only.

Click the 'Add All' button to put all the addresses in the lower box.

Right click on your first address (80E5C416), and select 'Browse memory at this address'. Your memory viewer will auto navigate to that address. In your memory viewer, the byte (01/02) will be at that address.

Okay so you are probably thinking... Hey let's Breakpoint this address and get started! Wrong. PowerPC ASM functions in 32 bit strings. What does this mean? This means you can only breakpoint addresses that end in 0, 4, 8, or C. Well the address 80E5C416 ends in 6. This means we use the 0/4/8/C address that comes before. So our breakpoint address is 80E5C414.

Okay so now you are thinking again... Alright now we can Breakpoint! Wrong, but normally you would be right. Remember I told you there would be a lot of trail and error. I have already made this code myself and I know that the second address from our results list is the correct address. To save you time, don't bother breakpointing the first result address. I hope you understand now that code making takes patience and a willingness to deal with failure.

So the second result from our list of addresses was 80E62214. On the RAM Viewer, right click on the address and browse to in on the memory viewer. Feel free to swap positions with your friend and watch the memory viewer. The byte at the address in the memory viewer will swap between 01 and 02 accordingly when your position is being swapped in game. Dolphin's own memory viewer can't do this.

It's Breakpoint time!

Go to your Breakpoints tab. Click the New button (has a plus symbol on it).

Instruction Breakpoint will be auto selected. If you have been reading and paying attention, you will know we need the Memory Breakpoint instead. Select Memory Breakpoint. Address will be auto selected, while the other option is Range. Don't ever worry about Range until you have become a well seasoned code creator.

Set the address to 80E62214.

Condition will be auto selected on write. Let's talk about Read VS Write Breakpoints before continuing any further:

Which one do we set? Read or Write? Well this all depends on the scenario. Let's say you have a static value, and you know that the game reads said value later on during a certain event in the game. Well, you would use a Read Breakpoint because we want to know what address of the game (ASM functions) that's read the static value before utilizing it.

Let's say we have a value that changes while you are in the race, or changes periodically after certain events in the game, or a value that's constantly changing nonstop. We would use a Write Breakpoint because we need to figure out what address (ASM functions) is writing the value.

Just use some common sense, thats all. So obviously, we will set a Write Breakpoint to make our code.


Back to the Breakpoints Tab. Leave the condition to Write. Action will be auto selected on 'Write to Log and Break'. Unless you are an advanced code, we will only need to use 'Break'. Plus logging bogs down quite a bit on your computer's performance. Change Action to 'Break'.


The game will now pause. Obviously, this will allow us to see the Code View. If the game doesn't pause, your assumptions were incorrect and the Breakpoint failed. Remember, you will fail a lot when making codes!

Take a look at your Code View. The address that the game 'broke' on will be highlighted in GREEN.

This should be the address 8053A484 with the ASM: stb r7, 0x0020 (r3)

Address will be different if you weren't using the USA game.

You should know what this ASM instruction is. It is very basic. Let's break it down...

stb = Store Byte

So we know we will be storing a byte value, ok.

stb r7 = Store the Byte of Register 7

Ok the ASM function is wanting to store the byte of Register 7. But to where? Before continuing, look at your Registers tab. Take a look at Register 7. Let's say when the game paused from the breakpoint, you were in 2nd place, this meant that 01/02 byte value would obviously be 02. What does Register 7 say? 00000002

Starting to understand how this coding stuff works? Good, back to the ASM function.

stb r7, 0x0020 (r3) = Store the Byte of Register 7 into Register 3 plus offset of 20. 

Whenever you have a store ASM function, the second Register (plus the offset) is the location of the memory address that the byte/halfword/word will be stored to.

Take a look at Register 3. It contains a Mem 80 Address. Now add 20 (in Hex ofc), and what do you get? You get our initail address from the list of results from the RAM Viewer (2nd result ofc): 80E62503

Now you understand how the Registers work? Good  Tongue

Please note that when bytes and halfwords are used in Registers for integer values, they start on the right side of the 32 bit string of said Register. So if a Register has a value 20002540. Sth (store halfword) would use the '2540' portion of the Register and stb (store byte) would use the '40' portion. When dealing with memory address locations of Registers, bytes and halfwords start at exactly the memory address location. So let's say a Register has a memory address of 80654100 and the 32 bit string/value at the address is 16739AA0, the byte of that address would be '16', and the halfword would be '1673'. This probably confused you more, but you will get use to it in due time.


Going back to our ASM function: stb r7, 0x0020 (r3)

We know the integer value of Register 7 and we know where the memory address of where it is being stored (written) to.


Since we know how the game is writing our position value, let's manipulate it!

Obviously, we need to change the value of Register 7 before the ASM function stores/writes that value to memory address location of Register 3; offset 0x0020.

This is simple to do, we will do a Load Immediate command into Register 7.
li r7, X

Now X is the value that we want to have, let's say we want 1st (01) place.

li r7, 1

If desired, you can write the byte value in hex form: li r7, 0x0001

Its good to use hex when dealing with values of halfwords and words. But for using bytes, sticking to decimal will suffice.

Open up your ASMWiiRD.exe file! Time to compile!

Let's put in our first ASM instruction that we've come up with so far.

li r7, 1

Ok so we have our value of Register 7 set to what we want, now we can let the game use it's original ASM function to store that value to the proper memory address location. Simply add in the original ASM function after our Load Immediate function.

li r7, 1
stb r7, 0x0020 (r3)

CAUTION: in MOST codes you will need to have the address's original ASM function (aka deactivator), or else you could break some other function of the game or the code might not work at all.

Almost done, one final step. In any ASM, you need an odd amount of instructions. If you ASM has an odd amount, we are good to compile. If not, we just add a simple 'nop' command. Since we have 2 instructions, we have an even amount and need to add the nop.

li r7, 1
stb r7, 0x0020 (r3)

In actuality, when using ASMWiiRD.exe, you don't ever need to add the nop. The program will do it for you. But it's good practice to naturally include the nop.

Now just add in your address (the one the game 'broke' on, highlighted in Green in the Code View)


Click the right arrow button to compile the code!

C253A484 00000002
38E00001 98E30020
60000000 00000000

Take a look at your compilation. We see our '1' value from the ASM function li r7, 1.

You can remove the '01' and plug in an 'XX' value to allow you to choose any position you want. Remember the game is always in Hex. So 12th position would be 0C for the XX value.

Chapter 10. Testing/Porting Your Codes

For a code like this, we don't need the assistance of the memory viewer. So we can test this on a normal physical Wii Console. Make a standard GCT, add your code, and test it with your friend(s). If a code requires the memory viewer for assitance, you will need to do the WBFS/ISO patching to patch the GCT on your main.dol, and then you can test the WBFS/ISO w/ codes on Dolphin.

Test your code. If it works, success! If not... back to the drawing board. When a code fails, you always check your 'source' first. Source is another term for your ASM that you wrote for the compiler. If there's no mistakes there, then maybe your Breakpoints were off, or the results from the memory viewer search were not what you were needing to find.

Once your code is a success. Port your code to all the other regions. You should already know how to do this. Post your new code if desired. Remember to add credits to prevent others from taking credit in the future for your codes!
While USB Geckos are superior, finding one is quite the challenge. Luckily, we have Dolphin and a RAM Viewer made by person named Aldelaro5.

You CANNOT use a public/stable release. Those versions are VERY outdated, making codes with those types of dolphins is simply not possible.

1. Download the latest dev version of Dolphin HERE.

2. Once Downloaded, open the zip folder, there you will find a folder named: "Dolphin-x64" (for 64 bit versions.

3. Open the Folder and Run the application named "Dolphin"

Second, you need the RAM Viewer.

1. Download the latest version of aldelaro5's dolphin memory engine (This will prompt an auto download) HERE

2. open the zip folder, and put the folder entitled "Windows" wherever you want.



1. Run Dolphin with your iso

2. Open the memory engine, and click "hook"

Good Job xD
Windows support added!

Thank you Phyz!

Forum Jump:

Users browsing this thread: 1 Guest(s)