Skip to content

Decompiling A Secondary Tileset

grunt-lucas edited this page Sep 14, 2024 · 5 revisions

Note: this tutorial assumes that the porytiles executable exists on your system path. It also assumes your pokeemerald project is stored at the $HOME location. If your executable or project lives elsewhere, you'll need to change those paths in the commands below.

Table Of Contents

Choosing Our Tileset

For the purposes of this tutorial, we will be decompiling the tileset we compiled in the Compiling A Secondary Tileset tutorial. If you want to follow along exactly, please go back and complete the tutorial so that you have a compiled version of the tileset featured there. You may also need to complete Compiling A Primary Tileset, since decompilation requires both the original compiled secondary tileset as well as its intended paired primary.

Decompilation Command

Like with primary decompilation, secondary decompilation is pretty simple. We'll use the following command to decompile our tileset. Each argument and option will be explained below:

porytiles decompile-secondary -o decompiled-secondary-tileset $HOME/pokeemerald/data/tilesets/primary/porytiles_secondary_tutorial $HOME/pokeemerald/data/tilesets/primary/porytiles_primary_tutorial $HOME/pokeemerald/include/constants/metatile_behaviors.h

-o decompiled-secondary-tileset: like compilation, the -o option controls the output location. In this case, we'll write our output to a new directory called decompiled-secondary-tileset in the current working directory. If it doesn't exist, Porytiles will create it. If there is already content there, Porytiles will overwrite it without prompting.

$HOME/pokeemerald/data/tilesets/primary/porytiles_secondary_tutorial: this is the Porymap-format tileset we want to decompile. Here, we assume you are using the Porymap-format version of the tileset from the Compiling A Secondary Tileset tutorial. If you'll be using a different tileset, replace this path with the path to your tileset.

$HOME/pokeemerald/data/tilesets/primary/porytiles_primary_tutorial: this is the Porymap-format primary tileset that pairs with the secondary tileset we want to decompile. Here, we assume you are using the Porymap-format version of the tileset from the Compiling A Primary Tileset tutorial. If you'll be using a different tileset, replace this path with the path to your tileset.

$HOME/pokeemerald/include/constants/metatile_behaviors.h: like compilation, you need to supply a behaviors header (so Porytiles will know about the text labels that correspond to the behavior integral values). Replace this path with the actual path to your pokeemerald (or pokefirered/pokeruby) project's behaviors header.

And that's it! Check the output directory to see your Porytiles-format tileset, i.e. your decompiled layer PNGs and attributes CSV. You can now easily edit these and recompile them with compile-secondary!

A Note On Animations

As noted in Decompiling A Primary Tileset, Porytiles does not currently support automatic animation decompilation. The work for this feature is tracked in Issue #27. Check the A Note On Animations section of Decompiling A Primary Tileset, for more details.