camthesaxman
reverse engineer of teh pokeymanz
- 23
- Posts
- 8
- Years
- Seen Feb 16, 2018
Hi everyone!
I'm currently working on this project to decompile Pokemon Ruby and Sapphire into matching C code. When this project becomes complete enough, it will be a great resource for hackers since you can easily edit png sprites and modify the game's code using high level C instead of assembly. Pokemon Ruby was originally written in C, and built using the open-source GCC 2.9 compiler. Our basic procedure is taking a piece of disassembled code, rewriting it in C, compiling it with GCC 2.9, and then verifying that the compiled code matches exactly, byte for byte, what is in the ROM. Since the code that we wrote compiles to the same assembly as the original ROM, our code is extremely similar to what is in Game Freak's original source code. We currently have 20% of the code decompiled, which is a significant portion, and all of the sprites and text have been dumped. If anyone knows ARM assembly and C programming, feel free to contribute and speed up this process. If you have any questions, post here or ask on the #pret IRC channel on freenode.net.
For example, here is the function that generates a wild Pokemon.
I'm currently working on this project to decompile Pokemon Ruby and Sapphire into matching C code. When this project becomes complete enough, it will be a great resource for hackers since you can easily edit png sprites and modify the game's code using high level C instead of assembly. Pokemon Ruby was originally written in C, and built using the open-source GCC 2.9 compiler. Our basic procedure is taking a piece of disassembled code, rewriting it in C, compiling it with GCC 2.9, and then verifying that the compiled code matches exactly, byte for byte, what is in the ROM. Since the code that we wrote compiles to the same assembly as the original ROM, our code is extremely similar to what is in Game Freak's original source code. We currently have 20% of the code decompiled, which is a significant portion, and all of the sprites and text have been dumped. If anyone knows ARM assembly and C programming, feel free to contribute and speed up this process. If you have any questions, post here or ask on the #pret IRC channel on freenode.net.
For example, here is the function that generates a wild Pokemon.
Code:
static bool8 GenerateWildMon(struct WildPokemonInfo *wildMonInfo, u8 area, bool8 checkRepel)
{
u8 wildMonIndex = 0;
u8 level;
switch (area)
{
case 0:
wildMonIndex = ChooseWildMonIndex_Land();
break;
case 1:
wildMonIndex = ChooseWildMonIndex_Water();
break;
case 2:
wildMonIndex = ChooseWildMonIndex_Water();
break;
}
level = ChooseWildMonLevel(&wildMonInfo->wildPokemon[wildMonIndex]);
if (checkRepel == TRUE && RepelCheck(level) == FALSE)
return FALSE;
else
{
CreateWildMon(wildMonInfo->wildPokemon[wildMonIndex].species, level);
return TRUE;
}
}