• 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?".
  • 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

24
Posts
8
Years
  • Age 31
  • Seen Nov 3, 2018
Setting up and using Pokeruby/Pokeemerald​

Pok%C3%A9mon_Ruby-title.png

Pok%C3%A9mon_Emerald-title.png

Part 0: An Introduction
Spoiler:

Part 1: Following pokeruby's INSTALL.md

Linux

Install devkitARM.

Then run the following commands.

Code:
	export DEVKITPRO=/opt/devkitPro
	echo "export DEVKITPRO=$DEVKITPRO" >> ~/.bashrc
	export DEVKITARM=$DEVKITPRO/devkitARM
	echo "export DEVKITARM=$DEVKITARM" >> ~/.bashrc

	git clone [url]https://github.com/pret/pokeruby[/url]
	git clone [url]https://github.com/pret/agbcc[/url]

	cd agbcc
	./build.sh
	./install.sh ../pokeruby

	cd ../pokeruby

To build pokeruby.gba:

Code:
make -j4

Mac

Install devkitARM.

Then in Terminal, run the following commands.

Code:
	xcode-select --install

	export DEVKITPRO=${HOME}/devkitPro
	echo "export DEVKITPRO=${DEVKITPRO}" >> ~/.bashrc
	export DEVKITARM=${DEVKITPRO}/devkitARM
	echo "export DEVKITARM=${DEVKITARM}" >> ~/.bashrc

	git clone [url]https://github.com/pret/pokeruby[/url]
	git clone [url]https://github.com/pret/agbcc[/url]

	cd agbcc
	./build.sh
	./install.sh ../pokeruby

	cd ../pokeruby

To build pokeruby.gba:

Code:
	make -j4

Windows

Install devkitARM to the default directory (C:/devkitpro).

Then download Cygwin setup-x86_64.exe for 64-bit Windows, setup-x86.exe for 32-bit.

Run the Cygwin setup and leave the default settings. At "Select Packages", set the view to "Full" and choose to install the following:

  • make
  • git
  • gcc-core
  • gcc-g++
  • libpng-devel

In the Cygwin terminal, enter these commands:

Code:
	export DEVKITPRO=/cygdrive/c/devkitpro
	echo export DEVKITPRO=$DEVKITPRO >> ~/.bashrc
	export DEVKITARM=$DEVKITPRO/devkitARM
	echo export DEVKITARM=$DEVKITARM >> ~/.bashrc

	git clone [url]https://github.com/pret/pokeruby[/url]
	git clone [url]https://github.com/pret/agbcc[/url]

	cd agbcc
	./build.sh
	./install.sh ../pokeruby

	cd ../pokeruby

To build pokeruby.gba:

Code:
	make -j4

Compiling Sapphire and later revisions

When you simply enter make and don't specify a target, then Pokémon Ruby 1.0 will be built. However, Sapphire can also be built, along with revisions 1 and 2 of both Ruby and Sapphire. Here is a listing of each ROM that can be made, along with the command to make the ROM.

Code:
Version      | Command
-------------|---------------------
Ruby 1.0     | make ruby
Ruby 1.1     | make ruby_rev1
Ruby 1.2     | make ruby_rev2
Sapphire 1.0 | make sapphire
Sapphire 1.1 | make sapphire_rev1
Sapphire 1.2 | make sapphire_rev2

Faster builds

After the first build, subsequent builds are faster. You can further speed up the build:

Parallel build

This significantly speeds up the build on modern machines.

By default make only runs a single thread. You can tell make to run on multiple threads with make -j. See the manfile for usage (man make).

The optimal value for -j is the number of logical cores on your machine. You can run nproc to see the exact number.

Code:
	$ nproc
	8

If you have 8 cores, run:

Code:
	make -j8

-j on its own will spawn a new thread for each job. A clean build will have thousands of jobs, which will be slower than not using -j at all.

Disable the dependency scanning

If you've only changed .c or .s files, you can turn off the dependency scanning temporarily. Changes to any other files will be ignored, and the build will either fail or not reflect those changes.

Code:
	make NODEP=1

Part 2: Making changes and test them
Spoiler:

Conclusion:

You'll be able to make code changes with the disassembly similar to this fashion. To note: pokeemerald nor pokefirered is not ready for production yet, obviously, but this tutorial will teach you how to use it on a most basic level. Although this does and will open up gen 3 tremendously: there is much work to be done; we need to work more on pokefirered sometime down the line. Hopefully, now that you know how to setup the dissassemblies, you know how to make changes and eventually contribute to our cause. Thanks for reading.
 
Last edited:
58
Posts
10
Years
  • Age 26
  • Seen Nov 16, 2023
I installed devkitPro Updater v3.0.3 on my Windows 10 (64 bit) and followed the instructions and got 2 popped up messages through the installation process

then opened msys2 and received an error message, I didn't encounter that error message in a different PC.
 
1,309
Posts
12
Years
  • Age 31
  • Seen Nov 24, 2023
You might be better off following the INSTALL.md instructions for pokéemerald/pokéruby as those are updated more frequently and this guide is a little outdated at the moment.
 

LCCoolJ95

Limited Capacity
638
Posts
14
Years
Okay, so I downloaded pokeemerald, got devkitARM, and got the tools from https://github.com/pret/pokeruby-tools and put it in pokeemerald.

I don't really understand the last part: You can then build pokeemerald using make in the MSYS environment provided with devkitARM.

It's kind of vague, no offense. Do I need a ROM? Is the ROM already made?
 
49
Posts
5
Years
  • Age 29
  • Seen Dec 27, 2023
Okay, so I downloaded pokeemerald, got devkitARM, and got the tools from github and put it in pokeemerald.

I don't really understand the last part: You can then build pokeemerald using make in the MSYS environment provided with devkitARM.

It's kind of vague, no offense. Do I need a ROM? Is the ROM already made?

No ROM is needed, you basicly make your own ROM from the code.
You open the programm MSYS or MSYS2 depending on which one you have installed. Its, as far as I can tell, a alternate command line tool like cmd on windows.
In this window you navigate to the main folder of your downloaded source code of pokeemerald. To do so you use "cd DRIVELETTTER:/" to change drives, "ls" to list all files and folders and "cd FOLDERNAME" to enter a folder, "cd .." to get up one folder (all commands without "").
Once inside the correct folder you type in "make" and wait. Once it has finished, you can find the newly made ROM (.gba file) inside the same folder.
Hope it helps

PS: If my explanation isnt clear enough, look for a basic toturial on how to navigate a linux terminal.
 

Delta231

A noob
681
Posts
7
Years
Okay, so I downloaded pokeemerald, got devkitARM, and got the tools from https://github.com/pret/pokeruby-tools and put it in pokeemerald.

I don't really understand the last part: You can then build pokeemerald using make in the MSYS environment provided with devkitARM.

It's kind of vague, no offense. Do I need a ROM? Is the ROM already made?

The ROM is already made when you are done with compiling.
 
Last edited:
534
Posts
11
Years
  • Age 26
  • Seen Jul 24, 2023
Okay, I'm just gonna say it. The INSTALL.md file is actually really bad. Just trying to make the file, it says "You can then build pokeemerald using make in the MSYS environment provided with devkitARM." First of all, MSys doesn;t open, only MSys does. Next, I did everything before that (get Devkit, put the pokeruby tools in the file). But then, it says make...make what? Look, I'm not a very good programmer, but don't you have to explain what you're using the command to do? What file executes the make command? Honestly, if these guys have the intelligence to do all this other stuff, why not "make" a better tutorial lol

Hey, don't take this offensively. Actually, if you try a little harder, I think you'll get it. After installing devkit, open MSys (labelled as MSys2 now for me). It's a batch file you can see in the Start Menu>devkitPro>MSys2. This is a command-line based application. You don't really need programming skills to run a command-line. All you need to know is how to change directory to the one where you store your pokeemerald or pokeruby. After changing directory, type "make" and press enter. That's all it takes. And by the way, if you still find it hard following what I just said, why don't you try your hand at pokeruby first. They have a more in-depth installation instructions. This is due to the fact that pokeemerald was based on pokeruby in some way, making pokeruby the predecessor. And maybe you are missing some pre-requisites which you can easily look up. I had a lot of trouble with this as well in the beginning. But I did my best, on my own, looking things up on Google, until I got it.

P.S. English is not my first language. Do excuse my sentence structure.
 
1
Posts
5
Years
  • Age 32
  • Seen Nov 21, 2019
Hello; this is my first post. I have somewhat of a specific problem: I followed all the steps to the letter, but halfway through my "make" I get this error message:

>>tools/jsonproc/jsonproc.exe src/data/wild_encounters.json src/data/wild_encounters.json.txt src/data/wild_encounters.h
>>JSONPROC_ERROR: [inja.exception.render_error] function 'setVarInt' (2) not found
>>make: *** [json_data_rules.mk:6: src/data/wild_encounters.h] Error 1
>>make: *** Deleting file 'src/data/wild_encounters.h'

I had a dig around in "wild_encounters.json", and the function "setVarInt" doesn't seem to be defined there. Any insight you could give me would be very helpful.
 
794
Posts
10
Years
Hello; this is my first post. I have somewhat of a specific problem: I followed all the steps to the letter, but halfway through my "make" I get this error message:

>>tools/jsonproc/jsonproc.exe src/data/wild_encounters.json src/data/wild_encounters.json.txt src/data/wild_encounters.h
>>JSONPROC_ERROR: [inja.exception.render_error] function 'setVarInt' (2) not found
>>make: *** [json_data_rules.mk:6: src/data/wild_encounters.h] Error 1
>>make: *** Deleting file 'src/data/wild_encounters.h'

I had a dig around in "wild_encounters.json", and the function "setVarInt" doesn't seem to be defined there. Any insight you could give me would be very helpful.

This is most likely caused by the tools being outdated. Re-build them using build_tools.sh.
 
Back
Top