Porting Fired Tilesets to Emerald (alternate version) - pret/pokeemerald GitHub Wiki

by smithk200

This is a guide I found helpful in porting over FR/LG tilesets to pokeemerald.

First, follow the tutorial on enabling triple-layer metatiles. https://github.com/pret/pokeemerald/wiki/Triple-layer-metatiles

include/fieldmap.h

Go to include/fieldmap.h and change both NUM_TILES_IN_PRIMARY and NUM_METATILES_IN_PRIMARY to 640. Also, change NUM_PALS_IN_PRIMARY to 7.

src/data/tilesets

Go to src/data/tilesets and open graphics.h. Make a new entry at the bottom of the file. In this instance I will use the tileset for Pallet Town.

const u16 gTilesetPalettes_PalletTown[][16] =
{
    INCBIN_U16("data/tilesets/secondary/pallet_town/palettes/00.gbapal"),
    INCBIN_U16("data/tilesets/secondary/pallet_town/palettes/01.gbapal"),
    INCBIN_U16("data/tilesets/secondary/pallet_town/palettes/02.gbapal"),
    INCBIN_U16("data/tilesets/secondary/pallet_town/palettes/03.gbapal"),
    INCBIN_U16("data/tilesets/secondary/pallet_town/palettes/04.gbapal"),
    INCBIN_U16("data/tilesets/secondary/pallet_town/palettes/05.gbapal"),
    INCBIN_U16("data/tilesets/secondary/pallet_town/palettes/06.gbapal"),
    INCBIN_U16("data/tilesets/secondary/pallet_town/palettes/07.gbapal"),
    INCBIN_U16("data/tilesets/secondary/pallet_town/palettes/08.gbapal"),
    INCBIN_U16("data/tilesets/secondary/pallet_town/palettes/09.gbapal"),
    INCBIN_U16("data/tilesets/secondary/pallet_town/palettes/10.gbapal"),
    INCBIN_U16("data/tilesets/secondary/pallet_town/palettes/11.gbapal"),
    INCBIN_U16("data/tilesets/secondary/pallet_town/palettes/12.gbapal"),
    INCBIN_U16("data/tilesets/secondary/pallet_town/palettes/13.gbapal"),
    INCBIN_U16("data/tilesets/secondary/pallet_town/palettes/14.gbapal"),
    INCBIN_U16("data/tilesets/secondary/pallet_town/palettes/15.gbapal"),
};

Add this line directly underneath the lines of code you just pasted:

const u32 gTilesetTiles_PalletTown[] = INCBIN_U32("data/tilesets/secondary/pallet_town/tiles.4bpp.lz");

Next, open up metatiles.h. Paste the code at the bottom (replace as necessary)

const u16 gMetatiles_PalletTown[] = INCBIN_U16("data/tilesets/secondary/pallet_town/metatiles.bin");
const u16 gMetatileAttributes_PalletTown[] = INCBIN_U16("data/tilesets/secondary/pallet_town/metatile_attributes.bin");

Next, go into headers.h. Paste this code on the bottom:

const struct Tileset gTileset_PalletTown =
{
    .isCompressed = TRUE,
    .isSecondary = TRUE,
    .tiles = gTilesetTiles_PalletTown,
    .palettes = gTilesetPalettes_PalletTown,
    .metatiles = gMetatiles_PalletTown,
    .metatileAttributes = gMetatileAttributes_PalletTown,
    .callback = NULL,
};

data/tilesets/secondary

(This works for data/tilesets/primary too, this part is easy.)

(WARNING: For the tilesets to work in-game, you will have to repeat all the above steps until you have all the tilesets named. If you do not define the names in the game's code, the game WILL NOT be able to read them and you CANNOT use them in porymap!!!)

Download this repository: https://github.com/ExpoSeed/pokeemerald/tree/frlg-tilesets

Next, copy and paste the files from data/tilesets/secondary from ExpoSeed's repository into your own.

That's all! Hope this helps!

Note: if things still look corrupted, run make clean and then make -j in Ubuntu to see your changes in-game.