The PokéCommunity Forums

The PokéCommunity Forums (https://www.pokecommunity.com/index.php)
-   Binary Hack Tutorials (https://www.pokecommunity.com/forumdisplay.php?f=66)
-   -   [Dissassembly] Setting up and using the Pokeruby/Pokeemerald dissassembly (https://www.pokecommunity.com/showthread.php?t=399015)

camthesaxman October 4th, 2017 9:14 AM

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.
http://i.imgur.com/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.

NathanHaze October 10th, 2017 4:26 AM

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.

Lunos October 11th, 2017 4:33 PM

Quote:

Originally Posted by camthesaxman (Post 9768003)
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.
https://i.imgur.com/COKAeSn.png

Awec October 12th, 2017 3:06 PM

I tried building it, and it made a rom successfully but the rom was unplayable.

ProjectRevoTPP October 14th, 2017 8:26 AM

Quote:

Originally Posted by Awec (Post 9773207)
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 October 21st, 2017 2:03 PM

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.

ProjectRevoTPP October 21st, 2017 4:30 PM

Quote:

Originally Posted by Awec (Post 9778540)
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 October 23rd, 2017 6:52 PM

I fixed the scaninc issue yesterday, so you shouldn't have any more problems with that if you re-download the tools.

Lunos December 11th, 2017 11:55 AM

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/
https://i.imgur.com/qrGdBV1.png

And of course, the devkitARM folder must be in "C:", in this case.

slawter666 January 4th, 2018 7:08 AM

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.

Phenom2122 February 3rd, 2018 5:14 AM

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?

Sierraffinity February 3rd, 2018 8:09 PM

Quote:

Originally Posted by Phenom2122 (Post 9835559)
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).

Phenom2122 February 4th, 2018 2:42 AM

Quote:

Originally Posted by Diegoisawesome (Post 9835865)
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 February 4th, 2018 12:30 PM

Quote:

Originally Posted by Phenom2122 (Post 9835952)
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

Phenom2122 February 5th, 2018 1:00 AM

Quote:

Originally Posted by BluRose (Post 9836186)
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.

Deokishisu February 7th, 2018 9:48 AM

Quote:

Originally Posted by Phenom2122 (Post 9836422)
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.

hjk321 July 12th, 2018 8:03 AM

Quote:

Originally Posted by ProjectRevoTPP (Post 9745083)
[(Sorry Linux and Mac)

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

Delta231 July 13th, 2018 5:49 AM

Quote:

Originally Posted by hjk321 (Post 9900095)
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.

hjk321 July 13th, 2018 2:02 PM

Quote:

Originally Posted by Delta231 (Post 9900456)
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.

Thx bro

ProjectRevoTPP July 15th, 2018 1:18 PM

I've updated the guide.

Lunos July 16th, 2018 4:11 AM

It might be a good idea to add whatever other commands are not mentioned in the main post, Revo.
Like make clean or make clear, for example.

kelario27 September 26th, 2018 1:31 PM

Quote:

Originally Posted by camthesaxman (Post 9780142)
I fixed the scaninc issue yesterday, so you shouldn't have any more problems with that if you re-download the tools.

11 months after this post, I'm having this issue and your post is the only thing on the entire web that mentions it.

McPaul April 28th, 2019 1:04 AM

It is impossible for me to understand this tutorial, so much info is missing...

I want to install pokeemerald, why everything is saying pokeruby? I just don't understand a SINGLE PART IT'S TO HARD!!!!!

Delta231 April 28th, 2019 6:36 AM

Quote:

Originally Posted by McPaul (Post 10011687)
It is impossible for me to understand this tutorial, so much info is missing...

I want to install pokeemerald, why everything is saying pokeruby? I just don't understand a SINGLE PART IT'S TO HARD!!!!!

This thread is quite outdated, I prefer you to read this instead.

McPaul April 28th, 2019 7:17 AM

Quote:

Originally Posted by Delta231 (Post 10011748)
This thread is quite outdated, I prefer you to read this instead.

Thanks, but it explains even less...


All times are GMT -8. The time now is 8:49 AM.


Like our Facebook Page Follow us on Twitter © 2002 - 2018 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2016 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.

Acknowledgements
Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2023.