[V1.1] Portrait Formatter, by Crazycolorz5

Goal: The program was written to be able to take in a portrait in modern format (see Figure 1) and output a series of dumps that can then be inserted and pointed to by EA.

Figure 1: Normal Modern Format

This is complicated by the fact that different sections of the portrait are stored in different places by the ROM, with the chibi also being LZ77 compressed. They are also cut up into different sections than our format.

  • Mug (see Figure 2 for format)
  • Minimug
  • Palette (see Figure 4)
  • Mouth Frames (see Figure 3 for format)

Are all stored in (potentially) different locations and pointed to. All of the output in those figures were generated by this portrait formatter.

Figure 2: Chopped Up, ROM-Format Mug

Figure 3: Chopped Up, ROM-Format Frames

Figure 4: Palette Dump

Usage:
You can simply drag and drop the formatted portrait with the executable and tell it to Open With. This will generate several dump files. Then install the portrait with EA, as detailed in the Installing Everything With EA guide.

The tl;dr is install each part of your data and use the macro

#define MugTable 0x8ACBC4
#define setMugEntry(mugEntry, mugLocation, minimugLocation, paletteLocation, framesLocation, mouthX, mouthY, eyeX, eyeY, eyeControl) "ORG MugTable+mugEntry*0x1C; POIN mugLocation; POIN minimugLocation; POIN paletteLocation; POIN framesLocation; WORD 0x00000000; BYTE mouthX mouthY eyeX eyeY"

You will need to determine mouthX/Y and eyeX/Y based on the portrait itself, or based on trial and error.

Alternatively, if you’re using #incext, the formatter outputs the portrait in the order of mug (0x1004 bytes), frames (0x600 bytes), palette (0x20 bytes), then minimug (variable number of bytes).
Thus, you should use the macro defined in Tools/Tool Helpers.txt, replicated here:

//For use with PortraitFormatter
#define setMugEntry(mugEntry, mugLocation, mouthX, mouthY, eyeX, eyeY) "PUSH; ORG PortraitTable+mugEntry*0x1C; POIN mugLocation; POIN mugLocation+0x1624; POIN mugLocation+0x1604; POIN mugLocation+0x1004; WORD 0x00000000; BYTE mouthX mouthY eyeX eyeY; WORD 0x01; POP"
#define setMugEntry(mugEntry, mugLocation, mouthX, mouthY, eyeX, eyeY, eyeControl) "PUSH; ORG PortraitTable+mugEntry*0x1C; POIN mugLocation; POIN mugLocation+0x1624; POIN mugLocation+0x1604; POIN mugLocation+0x1004; WORD 0x00000000; BYTE mouthX mouthY eyeX eyeY; WORD eyeControl; POP"

Another alternative is to give the flag -o <outputfilename> and this will output a SINGLE .dmp file that can be #incbin'd and used with the second set of macros above.

The Formatter currently supports 24-bit depth RGB with and without Transparency (Alpha channel).

You can also use it by command line (esp if you build from source – requires JuicyPixels). Syntax is
./PortraitFormatter <filename.png> [-o <outputfilename.dmp>] [--output-png] [--to-stdout] [--help]
The --output-png option generates images like Figures 2-4.

Download:
PortraitFormatter V1.1.exe

Source (links to the Dropbox copy I’m working on):
PortraitFormatter.hs
V0.0 Source .zip

7 Likes

Updated to version 1.0. This adds support for EA’s new #incext. Not much else changed, but this makes it much more useful/easy to use and install.

1 Like

All the progress we’ve made in making this shit less of a hassle and now we’re going back.

I mean, it basically just does what FEditor does. It can be inlined with #incext, too. It’s not like the Graphicors experience any end-user changes.