• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Tutorial Setting up Eclipse with the disassemblies!

Gamer2020

Well-known member
#1
Introduction

This is a tutorial on setting up Eclipse for working with the disassemblies. Please keep in mind that this is simply my way of doing things. There are always going to be different ways of setting things up. I am doing this on Windows but some steps may be similar on other operating systems. This setup should technically work for any console Makefile project that is C/C++ but you will have to make adjustments where necessary. If you have any improvements or suggestions, please let me know.

The first thing you should do is download DevkitPro to install DevkitARM. It can be downloaded from here. The version shouldn't matter, but I think I read somewhere that Pokeruby has issues with earlier versions of DevkitARM.

Download and run the installer. I personally install everything except for Programmer's Notepad. All you should need is what is marked in the screenshot below.


Running through the installer should be straight forward. Once the installation is done, you will just need to make sure it installed properly. The quickest way is to make sure the environment variables are set and that make can be called from a command prompt.



Eclipse is a free IDE that actually contains some advanced features. There are many different versions but the one we want is the C/C++ one. Downloads for it can be found here.

Eclipse actually supports GDB with a plugin. This means we may one day be able to do source level debugging with the disassemblies. Unfortunaley I have not been able to get it fully working yet. It seems that we will have to use Mars Eclipse and to make a custom Makefile. I have decided to tackle this further down the road. I will add it to this tutorial when done.

Download and install the version of Eclipse that you want to use. As long as it is the C/C++ one it should work. There is plenty of documentation out there on installing Eclipse so I won't cover it here.
Select a folder for your workspace. I tend to use "C:\devkitPro\GBAworkspace" but any location should work. I would recommend having a folder for each console you are going to be working on.


Once you click on "Launch", you should see the following window. You should uncheck "Always show Welcome at startup", then click on the icon in the screenshot below or close the welcome view.

At this point go ahead and download the disassembly you want to use. You can have multiple disassemblies in your workspace, but let's only use one for now. Once downloaded, extract the disassembly and put it in your workspace folder. If your folder has a different name than what the ROM compiles to I would change to the final ROM name. For example, I am changing "pokeemerald-master" to "pokeemerald" as the ROM compiles to pokeemerald.gba in the end. If you are using Pokeruby or Pokeemerald, don't forget to copy the tools.


Now let's open the disassembly in Eclipse. Go to "File - New - Makefile Project with Existing Code", as seen in the screenshot below.


On the window that opens, Click the browse button and select the folder of your disassembly. When done click finish.


At this point your disassembly is loaded and you can edit files in the IDE.

Right click on your disassembly in the Project Explorer and go to Properties.


In the Properties window click on "C/C++ Build" and change the settings to reflect the following screenshot. When done click on the "Apply and Close" button.


Click on the "Build Target" tab on the right of Eclipse. This is where we will create the build targets that let us compile the ROM.


Right click on the disassembly in the "Build Targets" view and clock on the "New" option.


Enter the settings for your build command. It should look similar to the screenshot below. When done, click the "OK" button.


Do the same for any other build targets you may need. An example is a making a build target to clean the project.


Now if you double click on your Build Target it should run.


Your ROM should now be compiled.
You can configure external tools in Eclipse. This makes it so you can launch emulators and other things right from Eclipse. I'll show you a quick example on how to set up an emulator.

In the menu go to the External Tools Configurations.


In the window that comes up, configure your emulator in a similar fashion as the screenshots below.




You will then be able to launch the tool from the menu. Please note that if you used the file name in the arguments like I did int eh screenshots above, you will need to select the project in the Project Explorer before trying to launch the tool.



Other tools can be configured in a similar matter.
 
Last edited:

Deokishisu

Active member
#2
I just want to put in my two cents and say how easy and quick this was to follow. Starting from zero on this new computer, I had pokeruby open and ready to edit in about five minutes. The only thing some people may need is the Java Runtime Environment (JRE) because Eclipse needs it to run. If you already have a preferred IDE that works with C/C++, you could opt to use that one instead and save even more time.

All-in-all, this guide is super noob friendly and a great start for anyone who wants to get into working with the disassemblies.
 
#3
Nice tutorial! I had trouble with the other one posted here, but this one worked. Thx a lot!
I agree with Deokishisu that it would be very helpful to mention, that java has to be installed before running eclipse.
 
Last edited:
#4
Good tutorial indeed :) But you could make it even better by linking to concepts of Github, repositories, forks and such. I haven't really ever used forking, but as I understand it, you can
1. make a fork of master branch disassembly repository at some commit X,
2. start doing your own changes to your own disassembly codebase, and
3. later on merge the new features implemented in the disassembly since commit X.

And well.. every rom hacker should be using Github for version control anyway. Personally I didn't know about it until 2013 or so, and had simply been keeping a little bit outdated backup of the whole rom hacking content (current version of rom file, almost all backups of the rom file since I had started hacking, general documents, documentation of my own modifications, tools etc.) in two different PCs. If the hard drive of the other one had broken down, I would have still had had the whole content (as possibly a bit outdated version) in another one. But Github takes care of all this and much more for you.

Of course, private repositories in Github cost $9 per month, but at least most pokered and pokecrystal hackers seem to use public repositories for their projects. I personally keep mine in a private one because, but only because Github also offers a student license which practically grants you private repositories for free, and I use it also for non-hacking related school stuff so not doing anything totally bad in that sense either :)
 
OP
OP
Gamer2020

Gamer2020

Well-known member
#5
I just want to put in my two cents and say how easy and quick this was to follow. Starting from zero on this new computer, I had pokeruby open and ready to edit in about five minutes. The only thing some people may need is the Java Runtime Environment (JRE) because Eclipse needs it to run. If you already have a preferred IDE that works with C/C++, you could opt to use that one instead and save even more time.

All-in-all, this guide is super noob friendly and a great start for anyone who wants to get into working with the disassemblies.
Thank you! I'll make a note that Java is needed.

Nice tutorial! I had trouble with the other one posted here, but this one worked. Thx a lot!
I agree with Deokishisu that it would be very helpful to mention, that java has to be installed before running eclipse.
Ok, thanks.

Good tutorial indeed :) But you could make it even better by linking to concepts of Github, repositories, forks and such. I haven't really ever used forking, but as I understand it, you can
1. make a fork of master branch disassembly repository at some commit X,
2. start doing your own changes to your own disassembly codebase, and
3. later on merge the new features implemented in the disassembly since commit X.

And well.. every rom hacker should be using Github for version control anyway. Personally I didn't know about it until 2013 or so, and had simply been keeping a little bit outdated backup of the whole rom hacking content (current version of rom file, almost all backups of the rom file since I had started hacking, general documents, documentation of my own modifications, tools etc.) in two different PCs. If the hard drive of the other one had broken down, I would have still had had the whole content (as possibly a bit outdated version) in another one. But Github takes care of all this and much more for you.

Of course, private repositories in Github cost $9 per month, but at least most pokered and pokecrystal hackers seem to use public repositories for their projects. I personally keep mine in a private one because, but only because Github also offers a student license which practically grants you private repositories for free, and I use it also for non-hacking related school stuff so not doing anything totally bad in that sense either :)
While I agree, using Github is beyond the scope of this tutorial. I'm sure there must be some kind of Git plugin for Eclipse but I just use the Github GUI.
 
#6
True - I agree that Github is out of the scope of the stuff you introduce here, but I think you could either way tell the readers to rather clone both the disassembly and pokeruby-tools rather than telling to just download them. The latter can be easily interpreted as simply clicking the "Download as zip file" button from the repository page which of course can be done but doesn't allow the hacker to easily make use of the changes done to those downloaded repository files later on.
 
OP
OP
Gamer2020

Gamer2020

Well-known member
#7
True - I agree that Github is out of the scope of the stuff you introduce here, but I think you could either way tell the readers to rather clone both the disassembly and pokeruby-tools rather than telling to just download them. The latter can be easily interpreted as simply clicking the "Download as zip file" button from the repository page which of course can be done but doesn't allow the hacker to easily make use of the changes done to those downloaded repository files later on.
I understand but I am only concerned with setting up Eclipse in this tutorial. Everything else is left up to the reader.
 
#11
Pokefirered is nowhere near a usable state, so yes, for the time being it is suggested to use Pokeruby or Pokeemerald in terms of disassembly and decompilation projects.
excellent, but now I have a question ... can I change the graphics that I know, the HP BOX, Sprite with this?
 

Lunos

Well-known member
#12
excellent, but now I have a question ... can I change the graphics that I know, the HP BOX, Sprite with this?
I think that all the graphical assets were dumped, so yeah, you just have to edit whatever .png file you want. Exploring the folders and their content depends on you though.