• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Forum moderator applications are now open! Click here for details.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Dissassembly] Setting up and using the Pokeruby/Pokeemerald dissassembly

camthesaxman

reverse engineer of teh pokeymanz
23
Posts
7
Years
  • Age 28
  • Seen Feb 16, 2018
I want to point out that installing Cygwin isn't necessary. It is simpler to follow the instructions in INSTALL.md and use MSYS, which comes bundled with devkitPro and doesn't require you to edit the .bashrc file.

Git is also not required, unless you want to contribute to the project. You can simply navigate to https://github.com/pret/pokeruby, click the green "Clone or download" and click "Download ZIP". Extract this to C:\devkitPro\msys\home\<Username>. Download the tools from https://github.com/pret/pokeruby-tools and copy the tools folder over the tools folder in your pokeruby-master directory. After that, go into your start menu, and in the devkitPro folder, there should be a "MSys" shortcut (it has a blue M icon). Click that to open the MSYS environment (this works a bit like Cygwin, same commands and everything), and navigate to that pokeruby-master directory with the following command.
Code:
cd pokeruby-master
Now, your tools should be set up, and you can build the ROM with the "make" command.
Code:
make
It will take a few minutes to build, so be patient. After that, you can edit files and re-build the ROM with "make".


If you want to contribute to pokeruby and need to use git, the official Git for Windows can be used with MSYS. You can find it here https://git-scm.com/download/win. During the installer, choose the option to run Git from the command prompt, but NOT the included Unix utilities.
guis7EE.png

After that, git should be usable from anywhere, so run
Code:
git clone https://github.com/pret/pokeruby.git
in MSYS to download the repository.
 
Last edited:
1
Posts
6
Years
I get a message typing "git pull origin master": Unable to find remote helper for 'https'
And @camthesaxman, "cd pokeruby-master" not works with me, I wrote "C:\devkitPro\msys\home\pokeruby-master" instead.
But for now I try to make a hack with this.
In any case thanks to both.
 
Last edited:

Lunos

Random Uruguayan User
3,108
Posts
15
Years
I want to point out that installing Cygwin isn't necessary. It is simpler to follow the instructions in INSTALL.md and use MSYS, which comes bundled with devkitPro and doesn't require you to edit the .bashrc file.

Git is also not required, unless you want to contribute to the project. You can simply navigate to https://github.com/pret/pokeruby, click the green "Clone or download" and click "Download ZIP". Extract this to C:\devkitPro\msys\home\<Username>. Download the tools from https://github.com/pret/pokeruby-tools and copy the tools folder over the tools folder in your pokeruby-master directory. After that, go into your start menu, and in the devkitPro folder, there should be a "MSys" shortcut (it has a blue M icon). Click that to open the MSYS environment (this works a bit like Cygwin, same commands and everything), and navigate to that pokeruby-master directory with the following command.
Code:
cd pokeruby-master
Now, your tools should be set up, and you can build the ROM with the "make" command.
Code:
make
It will take a few minutes to build, so be patient. After that, you can edit files and re-build the ROM with "make".

This method seems to be working fine. During the process, scaninc.exe crashes but it apparently doesn't harm the building process itself.
COKAeSn.png
 
Last edited:

Awec

Maniacal Egotist ~
25
Posts
16
Years
  • Seen Nov 21, 2023
I tried building it, and it made a rom successfully but the rom was unplayable.
 
24
Posts
8
Years
  • Age 31
  • Seen Nov 3, 2018
I tried building it, and it made a rom successfully but the rom was unplayable.

You need to ensure you have devkit r46 or newer. Although r45 will build a ROM, it wont be a matching ROM and have corrupted audio and such.

Please do
Code:
make compare
instead of make so you can be sure your ROM matches.
 

Awec

Maniacal Egotist ~
25
Posts
16
Years
  • Seen Nov 21, 2023
I did make compare and it said the rom matched, but it wouldn't play on VBA for some reason. Worked fine when I tried Bizhawk though.
 
24
Posts
8
Years
  • Age 31
  • Seen Nov 3, 2018
I did make compare and it said the rom matched, but it wouldn't play on VBA for some reason. Worked fine when I tried Bizhawk though.

You need to set VBA's Save type to Flash 128K. Flash 128K is required to run gen 3 Pokemon games.
 

camthesaxman

reverse engineer of teh pokeymanz
23
Posts
7
Years
  • Age 28
  • Seen Feb 16, 2018
I fixed the scaninc issue yesterday, so you shouldn't have any more problems with that if you re-download the tools.
 

Lunos

Random Uruguayan User
3,108
Posts
15
Years
The guys from the Pret Team helped me with a little problem that I had and I think that it is worth bringing up over here, just in case anyone decides to build Pokeemerald.

If anyone uses the standalone devkitARM like me, the entry to put in the ".bashrc" file is:
export DEVKITARM=/cygdrive/c/devkitARM/
qrGdBV1.png


And of course, the devkitARM folder must be in "C:", in this case.
 
106
Posts
15
Years
  • Seen May 29, 2019
I've recently endeavoured to learn C to make use of this project, specifically to insert a looping idle animation for the sprites rather than have a static image.

So before making edits to the ROM i wanted to try to get graphics loaded in a seperate .c file. I thought it would be as simple as choosing the location of the image and displaying it on screen (for a static image anyway) however that does not seem to be the case and searching on google has confused me further.

I only started learning C last night so I am very new to it, if someone could point me in the right direction so I know what I need to learn it would be most appreciated.
 
Last edited:
51
Posts
9
Years
  • Age 38
  • Seen Dec 20, 2022
I just have to say that this is absolutely incredible and I never in my wildest dreams thought that I would see something like this. I just have a few questions.

- Where does it get it's source data from? I just ran Pokeemerald and it doesn't need a source ROM but still produces a bunch of source files and images. I feel kinda stupid asking this but does this mean that the game is shipped with Pokeemerald? I was under the impression that I would need to drop a ROM into the folder or something but clearly that's not the case.

- How exactly do I tell what has been decompiled and what hasn't? Is the stuff in the 'asm' folder still not done? This ties in with my first question. How is this tool able to produce an Emerald ROM while not needing a source ROM and while still being incomplete?

- What implications does this have for other games? Would the same principle behind decompiling Pokemon Emerald also apply to other GBA games like Golden Sun or Megaman Battle Network?
 
Last edited:

Sierraffinity

Desperately trying to retire from ROM hacking
1,069
Posts
16
Years
I just have to say that this is absolutely incredible and I never in my wildest dreams thought that I would see something like this. I just have a few questions.

- Where does it get it's source data from? I just ran Pokeemerald and it doesn't need a source ROM but still produces a bunch of source files and images. I feel kinda stupid asking this but does this mean that the game is shipped with Pokeemerald? I was under the impression that I would need to drop a ROM into the folder or something but clearly that's not the case.

- How exactly do I tell what has been decompiled and what hasn't? Is the stuff in the 'asm' folder still not done? This ties in with my first question. How is this tool able to produce an Emerald ROM while not needing a source ROM and while still being incomplete?

- What implications does this have for other games? Would the same principle behind decompiling Pokemon Emerald also apply to other GBA games like Golden Sun or Megaman Battle Network?
The source data is all included there in the repository. It used to require a ROM from which data would be extracted, but a few weeks ago we went on a crusade to extract all the unextracted data from the ROM so now it's no longer necessary.
Everything in the 'asm' directory is raw assembly that hasn't been decompiled into C yet. The extracted assembly code, when compiled, matches what was in the ROM already, it's just less useful in assembly form than in C form, which is why the project isn't yet complete.
Yes, the same principle could be applied to decompile other games, but the games would need to fit certain criteria in order for decompilation into C to be possible (such as level of optimization used when building).
 
51
Posts
9
Years
  • Age 38
  • Seen Dec 20, 2022
The source data is all included there in the repository. It used to require a ROM from which data would be extracted, but a few weeks ago we went on a crusade to extract all the unextracted data from the ROM so now it's no longer necessary.
Everything in the 'asm' directory is raw assembly that hasn't been decompiled into C yet. The extracted assembly code, when compiled, matches what was in the ROM already, it's just less useful in assembly form than in C form, which is why the project isn't yet complete.
Yes, the same principle could be applied to decompile other games, but the games would need to fit certain criteria in order for decompilation into C to be possible (such as level of optimization used when building).

Thanks for the response. Before actually trying this out I was under the impression that there was still a long way to go but it sounds like for all intents and purposes, we can already modify every aspect of the game with what we've got so far. This is just incredible. The ROM modding scene has definitely come a long way since I started out hex editing Emerald on my phone years ago. And I feel almost like I'm getting left further and further behind in terms of knowledge every time I visit this community after a long absence. Here's to hoping that some great bug free modding tools arise from this. Very exciting. Thanks to you and everyone involved in this.
 

BluRose

blu rass
811
Posts
9
Years
Thanks for the response. Before actually trying this out I was under the impression that there was still a long way to go but it sounds like for all intents and purposes, we can already modify every aspect of the game with what we've got so far. This is just incredible. The ROM modding scene has definitely come a long way since I started out hex editing Emerald on my phone years ago. And I feel almost like I'm getting left further and further behind in terms of knowledge every time I visit this community after a long absence. Here's to hoping that some great bug free modding tools arise from this. Very exciting. Thanks to you and everyone involved in this.
but that's just the thing
there is absolutely nothing that will require a tool anymore after everything is decompiled
want to edit anything about pokémon?
src/data/pokemon/, sprites in data/graphics/pokemon/
want to add in lines of text for use in a scripted event? no more repointing! append it to a file in
data/text/maps/
want to script, but hate xse's at-times wrong labels?
data/scripts
want to make your party menu look entirely different?
change some constants in the arrays of
src/field/party_menu.c
soon, over will be the days of hacky methods of doing things in favor for nice projects like this one that's been in progress for two days
the one thing that, solely for organizational purposes, i'd still like to have, is a map tool. which padz and touched are both independently working on
 
Last edited:
51
Posts
9
Years
  • Age 38
  • Seen Dec 20, 2022
but that's just the thing
there is absolutely nothing that will require a tool anymore after everything is decompiled
want to edit anything about pokémon?
src/data/pokemon/, sprites in data/graphics/pokemon/
want to add in lines of text for use in a scripted event? no more repointing! append it to a file in
data/text/maps/
want to script, but hate xse's at-times wrong labels?
data/scripts
want to make your party menu look entirely different?
change some constants in the arrays of
src/field/party_menu.c
soon, over will be the days of hacky methods of doing things in favor for nice projects like this one that's been in progress for two days
the one thing that, solely for organizational purposes, i'd still like to have, is a map tool. which padz and touched are both independently working on

I know that you could just use Notepad++ and whatever your favourite image editing tools are to get the job done but without some tools to go along with this, I think that a lot of modders that are closer to the beginner level are just going to use the old tools anyway because they wont know what to do with any of this.

I mean, if you're going to be making a map editor, why stop there? Let it also be an image editor that automatically loads the correct palette, asign a text editor to it for easily hunting out that one script that you want to edit on a specific map. Throw in a pokemon editor so that while you're editing wild encounters for a certain map you can also tweak something about a pokemon that you've just thought of. Let it also act as a sort of 'mod manager', injecting or removing code from other sources such as Day and Night systems etc. You can't have a day and night system without a map editor that supports it. In order to change things you need to have an overview of everything or you're going to run into errors and forgetfulness, that's why this modding scene has been a bit of a mess for a while, you have to hunt through hundreds of obscure tools, many with the same features as each other, just to find that one feature that isn't in any of the rest. I mean for years the only choice of map editing has been to juggle between Advance Map 1.92 and 1.95. A map editor is the perfect basis for a Skyrim Creation Kit style editor and I for one would love to see a one stop shop tool that supports these disassembly projects.

Of course, it sounds like I'm just shouting commands about it, well that's not what I'm doing. I just hope at the least whatever tools come from this stay open source and that all the tool makers at least come to some sort of agreement so that we don't end up with situations like now where you have ten million different ini files to edit for ten million different tools while they all could just share the same ini and make everyone's life easier.

Edit: I hope that this map editor has a plugin system at the very least.
 
Last edited:
I know that you could just use Notepad++ and whatever your favourite image editing tools are to get the job done but without some tools to go along with this, I think that a lot of modders that are closer to the beginner level are just going to use the old tools anyway because they wont know what to do with any of this.

I mean, if you're going to be making a map editor, why stop there? Let it also be an image editor that automatically loads the correct palette, asign a text editor to it for easily hunting out that one script that you want to edit on a specific map. Throw in a pokemon editor so that while you're editing wild encounters for a certain map you can also tweak something about a pokemon that you've just thought of. Let it also act as a sort of 'mod manager', injecting or removing code from other sources such as Day and Night systems etc. You can't have a day and night system without a map editor that supports it. In order to change things you need to have an overview of everything or you're going to run into errors and forgetfulness, that's why this modding scene has been a bit of a mess for a while, you have to hunt through hundreds of obscure tools, many with the same features as each other, just to find that one feature that isn't in any of the rest. I mean for years the only choice of map editing has been to juggle between Advance Map 1.92 and 1.95. A map editor is the perfect basis for a Skyrim Creation Kit style editor and I for one would love to see a one stop shop tool that supports these disassembly projects.

Of course, it sounds like I'm just shouting commands about it, well that's not what I'm doing. I just hope at the least whatever tools come from this stay open source and that all the tool makers at least come to some sort of agreement so that we don't end up with situations like now where you have ten million different ini files to edit for ten million different tools while they all could just share the same ini and make everyone's life easier.

Edit: I hope that this map editor has a plugin system at the very least.

I think you may be misunderstanding the ease with which everything except probably mapping and sound design will be with the disassembly. If you wanted Day/Night Wild Pokemon, for example, you would just add a check for the time and load another wild encounter table (that you just appended to the end). For a lot of the features that a map editor would traditionally need to support, there's no need for that support in a hacking environment where we have a full disassembly. Creating tools to work with the disassembly for things that would just be text edits in the source is not only limiting but completely unnecessary. If someone wanted to change the base stats structure but have been relying on tools to edit the source, their tool for editing Pokemon would immediately break and they'd have no idea what to do.
 
Last edited:

Delta231

A noob
681
Posts
7
Years
Well I mean it was already impossible to hack on those platforms anyways (unless you just wanna use a hex editor or something)

This tutorial is pretty much outdated. I prefer you to read the Install.md from PokeRuby Repo.

And you can compile it in any platform seriously and you don't need any hex editor.
 
Back
Top