FE5 Portrait Insertion Tutorial

So, you’re looking to add a portrait to FE5, eh?

The steps for doing this are kind of roundabout, so here’s a list of tools you’ll need:

yy-chr
fe45_comp
Graphics editor of your choice (I use GIMP)
Usenti
hex editor of your choice
something to insert with (Might I recommend EA?)

Alright, let’s get started.

Step 0: Get yourself a portrait

This should be obvious. I’m going to use this Est mug as an example.

First, we need to format it. The portrait needs to be split into two segments, both the same size. Then, you need two talk frames.

Mine is misaligned and lacks talk frames. Don’t worry about that. The upper talk frame is for the fully opened mouth, and the lower is for the partially opened mouth.

Go ahead and save it. Next up, open Usenti and load your formatted portrait. We need to fix the palette. Like GBA portraits, you have 15+BG colors to work with. The transparent color is the first color in the palette. For this Est example, my BG is a pale green.

https://puu.sh/v8bvZ/949360a658.png

We need to change the BG color to be the first entry in the palette. Left-click the first color in the palette and right-click on your BG color. Alt+S to quick swap the colors, or you can do Palette>Quick Swap.

Be sure to save the image after that.

Step 1: Converting the image

While Usenti is still open, open up yy-chr. Make a new file, set the graphic format to 4bpp SNES.

Copy the portrait from Usenti into yy-chr. It’ll probably look horrifying in the default palette, but that doesn’t matter.

https://puu.sh/v8cgT/0e57cce996.png

Save that with whatever name you’d like. The actual size of the portrait is only 0x800 bytes, but yy-chr pads new images out to 0x2000 by default. Open it in a hex editor and trim the file down to 0x800 if you need to. Be sure to save.

Step 2: Compression

To compress your image, simply drag the file on to fe45_comp. It’ll give you a file with a .fe4 extension. It should also tell you the size of the compressed file. Write it down if you need it.

Step 3: Getting the right palette

In Usenti, click Image>Export and select GBA Source as the type. Hit Save and it should bring up a dialogue with export options. Uncheck all options but Pal. Be sure to set the color count to 16. Your options should look like this:

https://puu.sh/v8eGp/880c8cf142.png

It should have a file path in that ‘File’ box, though. Click OK to generate your .pal.bin file.

Step 4: Preparing for insertion

There’s a table at 0x6512A that consists of a portrait pointer and a palette byte for each portrait. The first entry seems to be a default, and the second one is Leaf’s, continuing on as normal.

The pointers are in their mapped format. Find the portrait you’d like to replace. Write down which pointer in the table you’re going to be replacing. After each pointer is a byte that dictates the palette to use. Multiply this number by 0x20 and add it to 0x354000 to get the offset of the palette. This is where your palette should be inserted to.

Step 5: Insertion considerations

I don’t suppose you know how to convert a location in the ROM to the mapped format it needs to be in, do you? If not, I’d suggest inserting using EA. Here’s an example of how I’d insert using EA:


#ifndef EA_FE5LIB_EVENT
//I already have these defined in my FE5 library

//In your RAWs folder for EA, you'll need a definition for SPTR:
/*

##SNES Pointer, unaligned
SPTR, 0, 3, -game:FE6:FE7:FE8 -repeatable -priority:low -indexMode:8 -offsetMod:1
	Value, 0, 3

*/

	#define FE5Ptr(pointer) "(((0x800000+((pointer&0xFF0000)+0x8000)*2))|(pointer&0xFFFF))+((((pointer&0xFFFF)-0x8000)&0x80000000)/0x10000)"

	#define PortraitTable 0x6512A

	#define PaletteTable 0x354000

	#define FE5Mug(offset, palnum, slot) "PUSH; ORG PortraitTable+(slot*4); SPTR FE5Ptr(offset); BYTE palnum; POP"

#endif

PUSH
ORG 0x1FB703 //Large free space block

	EstMug:

	#incbin "Est.bin.fe4"

	FE5Mug(EstMug, 0, 1)

	ORG PaletteTable+(0x20*0) //palette 0

	#incbin "Est.pal.bin"

POP

Step 6: Enjoy

https://puu.sh/v8ife/333fe19685.png

And there you have it!

12 Likes