Code Creation

Last updated: 08-02-2022

Creating Our First Codes

We are going to create 2 basic codes, a simple static code, and a pointer code with a loop. For most codes we need a few things. Most of these we already have, but others we need to understand what we are trying to accomplish. Most of the codes you will create will write a specific value, over and over again, until they are turned off. This gives us unlimited items of that amount. This is good, but it doesn't allow the player to collect any more of the item either. So if we set our Apple Gem code to, say, 10. This would probably help a lot of players at the start of the game, but may not help them near the end of the game. So should we give them 9,000,000 instead? Well, maybe not, as that could actually make the game unplayable, or it could be more than what the game allows which would cause a crash. It is your responsibility as the cheat creator to find a happy medium. For these examples, we are going to use 0d999 which is 0x3E7. We are going to create a simple static code for Apple Gems and a Pointer code for all of our other Gems.

Simple Static Code

Since we now know almost everything we need, we can fill in most of our code now. We will be using a Code Type 0x0. So let's start with the base, then start filling in with what we know.

0TMR00AA AAAAAAAA VVVVVVVV

Since we know we are going to use 0x3E7 as our value, we can replace the Vs with it (remember we need 8 characters, so the rest of the Vs need to be 0)

0TMR00AA AAAAAAAA 000003E7

Now, we can start working on the rest of it. T represents the size of the memory value. Since we know that our Apple Gems are a 32-bit value, we can replace T with 4 (4 bytes = 32-bits). This leaves us with M, R, and A left. R is what register we want to use. For this example, I'm going to use 9, just to help you visualize that any letter needs to be replaced. Although, F is a common generic register that doesn't usually have any conflicts (a lot of code creators use this as a default). So now we have:

04M900AA AAAAAAAA 000003E7

So how do we get M and A? Edizon-SE will provide that information if you look at your bookmark.

Cheats_1.jpg

Make sure you have the right bookmark highlighted (1). As you can see, it is HEAP + 008B76D390 u32 (2). We can replace our M with 1 (which is for HEAP) and our As with 008B76D390. So our code now looks like this:

04190000 8B76D390 000003E7

Remember that each set is 8 characters long and our offset was 10, so it needs to be split up, but that is also why the Code Type has that built in for us. We will come back to this when we put together our cheat file.

Now with these simple static codes, Edizon-SE can actually create these codes for us. If you hold ZL and press A while highlighting a bookmark, Edizon-SE will create a cheat for you and add it to the cheat list. We can then use Breeze to view and edit our codes.

Cheats_2.jpg

As you can see, the code we created and the code Edizon-SE created are almost identical (only difference is which register was used). Now let's work on a pointer codes!

Pointer Codes

We are going to take a pointer we found and create a code from it. For this one we are going to do this in 2 parts. The first part is a simple pointer code, but the second we are going to add a loop to combine codes together. We are going to focus on the Elemental gems and Rare gems, so let's take a look at what we have.

Fire Gems: [[[[main+A12000]+68]+1CC8]+F0]+2BD8 Water Gems: [[[[main+A12000]+68]+1CC8]+F0]+2BDC Light Gems: [[[[main+A12000]+68]+1CC8]+F0]+2BE0 Rare Gems: [[[[main+A12000]+68]+1CC8]+F0]+2BE4

We need to have similar pointers for the second part to work, but normally it is not required. I would still recommend it, since it will help with updating codes for updates. For this example, we will need the smallest starting point (this will make sense in a moment), which is our Fire Gems. In order to use a pointer, we need to use a Code Type 0x5 to load the pointer into a register. So let's take a look at it, then work through it.

5TMR00AA AAAAAAAA

We have to fill out T, M, R, and A. Generally speaking, you should always use 8 for T since pointer addresses can get very large.

58MR00AA AAAAAAAA

For M, we need to figure out where in memory we are starting from. Luckily for us, our pointer tells us where it starts from: [[[[MAIN+A12000]+68]+1CC8]+F0]+2BD8 so we can fill M with 0 for MAIN.

580R00AA AAAAAAAA

Now R is pretty simple since we just need to choose a register. So let's use the default of F.

580F00AA AAAAAAAA

Now, all that is left is A, which is our offset. We will find it here: [[[[main+A12000]+68]+1CC8]+F0]+2BD8 Remember we have 10 A but only 6 from our pointer, so fill in the extra with 0. So we end up with this:

580F0000 00A12000

This will be the first line of our code, but now we need to establish the rest of our pointer. There is a second part to Code Type 0x5 which can be added to our code to complete our pointer:

5T0R10AA AAAAAAAA

As you can see, it is the same as the regular code with the exception of character 5 which is now a 1 instead of 0. We need to transfer all of our other variables except for A because that will change. We now have:

580F10AA AAAAAAAA

We will use this for the rest of our pointers that are inside the brackets [ ]. For each line will need this and replace the offset. Which gives us these:

580F1000 00000068 580F1000 00001CC8 580F1000 000000F0

The last line we need is for the final offset. This offset is outside of the brackets [ ], so instead of being imported we will need to add it. (Note there are such thing as Negative Pointers, where it will be a negative instead of the positive sign. These are extremely rare, and will need to be manually found instead of using PointerSearcher.) Since we need to do math, we will need to use Code Type 0x7. We won't be using Code Type 0x9 as we only have 1 register being used, and we want to keep it as simple as possible for now. Code Type 0x7 is this:

7T0RC000 VVVVVVVV

We have T, R, C, and V that we need to setup. Since this is all a part of the same code, we need to keep our T and R values the same. So our line now looks like this:

780FC000 VVVVVVVV

For C, we need to know what operand we are going to do. Since we are adding, we want 0. V is the value we want to add, which is our final part of our pointer: [[[[main+A12000]+68]+1CC8]+F0]+2BD8 so we end up with this:

780F0000 00002BD8

With this last line, we have finished loading the address we want to change into the register. We can now use Code Type 0x6 to write a value to that address stored in the register. Code Type 0x6 looks like this:

6T0RIor0 VVVVVVVV VVVVVVVV

This Code Type is a little more complicated with more variables. We have T, R, I, o, r, and V. We know what we need for R (since we already loaded the address from the pointer into this register). T is the size of the value we want to write to the address. We need to make sure we use the right size here. Since we know that the value we want is a 32-bit value we will replace T with 4 (32-bits equals 4-bytes). V is also simple since it is the value we want to write to memory. Since we wanted 0d999 gems, we want to write 0x3E7 (remember to replace all the Vs that we don't use with 0s). So we now have this:

640FIor0 00000000 000003E7

For I, o, and r we don't need to use. I would suggest reading over the explanation on the website, but for now realize that these are advanced uses and that we aren't going to use them for now. We will set all three of them to 0. This leaves us with the completed code of:

640F0000 00000000 000003E7

We add all these lines together and we have our completed code!

580F0000 00A12000 580F1000 00000068 580F1000 00001CC8 580F1000 000000F0 780F0000 00002BD8 640F0000 00000000 000003E7

Before we move onto the 2nd part, I want you to go ahead and create pointer codes for the rest of the values we found. Follow the steps and you should be fine.

Complex Pointer Code

Hopefully you are feeling comfortable with creating pointer codes at this point. We will now use a loop to combine all 4 gem codes (except for apple gems, but we will get to that later). First, let's look at our loop code type, which is Code Type 0x3.

Start Loop 300R0000 VVVVVVVV End Loop 310R0000

As you can see, this is very simple. We just need a separate register (R) for a loop counter, and a Value (V) for the number of times we want to loop. This will allow us to repeat instructions however many times we want. If you look at our 4 gem pointers, you will notice that each one is 4-bytes away from each other. So we can simply add 4 to the end of the pointer to move to the next address. We can use the loop to accomplish this. I'm going to use E for our register (R) and 4 for our Loop Count (V). We can use this loop in one of two ways. The first way is easier but crude. The second way takes a little more work, but looks better. Let's start with the first way. Our loop now will look like this:

300E0000 00000004 640F0000 00000000 000003E7 780F0000 00000004 310E0000

We can simply add our pointer to the beginning of this code and it will work:

580F0000 00A12000 580F1000 00000068 580F1000 00001CC8 580F1000 000000F0 780F0000 00002BD8 300E0000 00000004 640F0000 00000000 000003E7 780F0000 00000004 310E0000

This code will set all 4 gems to 0d999. Let's take a look at the 2nd way. The 2nd way removes 4 bytes from the end of the pointer and adds it to the start of the loop. This gives us the following code:

580F0000 00A12000 580F1000 00000068 580F1000 00001CC8 580F1000 000000F0 780F0000 00002BD4 300E0000 00000004 780F0000 00000004 640F0000 00000000 000003E7 310E0000

We can go even further by adding Apple Gems to this code. We know that Apple Gems are 0x30 bytes before Fire Gems that our current codes use. We could just use the Apple Gem pointer to point to the Apple Gem address, set those gems to 0d999, then add 0x26 to get -0x4 from our Fire Gems, then start our loop. This would look something like this:

580F0000 00A12000 580F1000 00000068 580F1000 00001CC8 580F1000 000000F0 780F0000 00002BA8 640F0000 00000000 000003E7 780F0000 00000026 300E0000 00000004 780F0000 00000004 640F0000 00000000 000003E7 310E0000

Creating a Cheat File

Now all of these codes should work, but we need to set them up to allow them to be used by Edizon-SE or Breeze. Each code needs a Display Name. A Display Name need to explain what the code does, but also simple enough to not block the screen. Anything inside of a bracket will be displayed, but it is important to be careful when using special characters. Some special characters will cause an error and cause the cheat file to be unusable. For the last code we created, I would name something like [All Gems x999]. It's simple and let's the user know what it will do. Remember that Info file we created? Well that TID and BID are going to play an important part now. We need to create a text file with the same BID as our game's patch version. I created an example with all the codes I've created so far in this section of the guide.

Cheats_3.jpg

We now need to place the file in the correct location and our cheats should show up. For Atmosphere, the correct location is SDCARD:/atmosphere/contents/TID/cheats/BID.txt Replacing TID and BID with the correct info (again from our info file). We can also place our cheats in SDCARD:/switch/edizon/cheats and SDCARD:/switch/breeze/cheats. These have their own requirements, so if you want to use them, make sure you read up on it.

Next we will go over what to do after you created your cheat file.

Next