Hello,
I've been seeing a lot of people attempt their luck at creating NTR Cheatplugins and I see the same naive mistake over and over. Please refer to the following picture:
But, before we begin I think I should explain the gateshark format a bit, since most people don't seem to understand it.
Warning, this post might get a little bit technical. This tutorial requires to read a lot and utilize C. If you don't know how to code in C, learn it first. I won't answer any basic questions about this programming language. ( Google is always helpful ) Also you should've already taken a look at the demo plugins @cell9 provided to us to understand how these work.
I'd advise you to declare a uint32 variable called offset for simplification and direct translation. If you want to advance even further you have to think a bit more then just this tutorial
So a gateshark code is made out of multiple smaller codes, which can read, write and compare RAM from the Nintendo 3ds. All Gateshark codes follow this pattern:
except for the 0xD codes, which are the following:
Z is the operation that shall be executed. For a full list take a look here
X is the offset for the RAM.
Y is the Data used for this code.
Alright, now how do we translate these codes?
The most basic Gateshark codes are the 0x0, 0x1, and 0x2 codes, which are used to write RAM.
The 0x0 Code write a 32 bit Integer value at the address X + Offset,
This means write Integer Y to X + Offset.
We can represent that in C by:
The 0x1 Code write a 16 bit Short value at the address X + Offset,
This means write Short Y to X + Offset.
The 0x2 Code write a 8 bit Byte value at the address X + Offset,
This means write Byte Y to X + Offset.
Please note that you should always try to minimize the amount of bytes you want to write, or else there might be some (negative) sideeffects.
Next are the Gateshark codes to compare RAM. Comparing Integers is from 0x3 to 0x6 and comparing Short are from 0x7 to 0xA. Please refer to the wiki post here for further information about these codes. These are 'if'-statements.
After that we have another very important gateshark code, the 0xB code. This reads a 32 Bit integer value from the Ram and uses it as the new offset. This is used for Pointers. We can use
The 0xC code is used for loops. The loop statement is executed Y times and ends with a 0xD1 command which increases the the offset by Y of the 0xD1 command. It's a basic 'For' loop.
Most people use the 0xDC code in front of a 0xD1 code to increase the offset ( I'll come back to this one later ), but it isn't necessary, as you can increase it in the 0xD1 block.
And now to the 0xD codes. There are a lot of these codes. ( 14 to be exact ), but we will only be focusing on the more important codes. The 0xD0, 0xD2, 0xD3, 0xDC and the 0xDD code.
The D0 code closes the latest conditional statement (0x3 to 0xA codes ), just like we would close our conditional statement in C.
The D2 code closes all if statements and escapes a 0xC loop.
D3 is a very commonly used code. Most people use it at the beginning of their gateshark code to declare the offset. However this one if not necessary if the Y block in all 0.
To increase an offset you use the DC block. It increases the offset by Y.
And last the DD code. A new code introduced by gateshark. It's used to test for button combinations. Close it with a D0 code. I'd recommend using a menu for plugins though. If you want to use keys anyways - A quick google search will give you your needed information. ( or just look at some other plugins )
And we are done. If you have any questions regarding parsing gateshark to NTR take a look at this small wiki post first. It has a collection of all gateshark codes. Including the not mentioned dxData codes.
If you want to test a gateshark code if it works, but don't have a gateway card, feel free to use my fork of the NTR debugger which includes a gateshark tab. ( Please note, that not all codes will work. Codes that must be constantly executed like moonjumps, or similar can't be done using this ).
Credits:
@cell9 for his awesome work on NTR.
I've been seeing a lot of people attempt their luck at creating NTR Cheatplugins and I see the same naive mistake over and over. Please refer to the following picture:
Warning, this post might get a little bit technical. This tutorial requires to read a lot and utilize C. If you don't know how to code in C, learn it first. I won't answer any basic questions about this programming language. ( Google is always helpful ) Also you should've already taken a look at the demo plugins @cell9 provided to us to understand how these work.
I'd advise you to declare a uint32 variable called offset for simplification and direct translation. If you want to advance even further you have to think a bit more then just this tutorial
So a gateshark code is made out of multiple smaller codes, which can read, write and compare RAM from the Nintendo 3ds. All Gateshark codes follow this pattern:
Code:
ZXXXXXXX YYYYYYYY
Code:
ZZXXXXXX YYYYYYYY
Z is the operation that shall be executed. For a full list take a look here
X is the offset for the RAM.
Y is the Data used for this code.
Alright, now how do we translate these codes?
The most basic Gateshark codes are the 0x0, 0x1, and 0x2 codes, which are used to write RAM.
The 0x0 Code write a 32 bit Integer value at the address X + Offset,
Code:
0XXXXXXX YYYYYYYY--> WRITEU32(XXXXXXX + Offset, YYYYYYYY);
We can represent that in C by:
The 0x1 Code write a 16 bit Short value at the address X + Offset,
Code:
1XXXXXXX 0000YYYY--> WRITEU16(XXXXXXX + Offset, YYYY);
The 0x2 Code write a 8 bit Byte value at the address X + Offset,
Code:
2XXXXXXX 000000YY --> WRITEU8(XXXXXXX + Offset, YY);
Please note that you should always try to minimize the amount of bytes you want to write, or else there might be some (negative) sideeffects.
Next are the Gateshark codes to compare RAM. Comparing Integers is from 0x3 to 0x6 and comparing Short are from 0x7 to 0xA. Please refer to the wiki post here for further information about these codes. These are 'if'-statements.
After that we have another very important gateshark code, the 0xB code. This reads a 32 Bit integer value from the Ram and uses it as the new offset. This is used for Pointers. We can use
Code:
Offset = READU32(X+Offset);
The 0xC code is used for loops. The loop statement is executed Y times and ends with a 0xD1 command which increases the the offset by Y of the 0xD1 command. It's a basic 'For' loop.
Code:
C0000000 00000063 <- Start the Loop | Repeat 0x63 times.
**some other instructions*
D1000000 00000010 <- End the loop and increase the offset by 0x10 bytes
And now to the 0xD codes. There are a lot of these codes. ( 14 to be exact ), but we will only be focusing on the more important codes. The 0xD0, 0xD2, 0xD3, 0xDC and the 0xDD code.
The D0 code closes the latest conditional statement (0x3 to 0xA codes ), just like we would close our conditional statement in C.
The D2 code closes all if statements and escapes a 0xC loop.
D3 is a very commonly used code. Most people use it at the beginning of their gateshark code to declare the offset. However this one if not necessary if the Y block in all 0.
To increase an offset you use the DC block. It increases the offset by Y.
And last the DD code. A new code introduced by gateshark. It's used to test for button combinations. Close it with a D0 code. I'd recommend using a menu for plugins though. If you want to use keys anyways - A quick google search will give you your needed information. ( or just look at some other plugins )
And we are done. If you have any questions regarding parsing gateshark to NTR take a look at this small wiki post first. It has a collection of all gateshark codes. Including the not mentioned dxData codes.
If you want to test a gateshark code if it works, but don't have a gateway card, feel free to use my fork of the NTR debugger which includes a gateshark tab. ( Please note, that not all codes will work. Codes that must be constantly executed like moonjumps, or similar can't be done using this ).
Credits:
@cell9 for his awesome work on NTR.