Allowing for more than 0x06 generic minimugs

This is a problem I encountered a while back working on EN. If you want to expand the generic minimugs, the game can’t actually read entries greater than 0x06. For whatever aethereal reason, it just won’t work. Which means the Etrurians can’t have their own unique generic icon. Ideally, I’d have one for each enemy faction, but the game can’t even display 0x07 (which it has a graphic for by default).

My generic minimugs in EN:

[spoiler=The Problem, in picture form]

Okay, so I’m going to try and repoint everything just to confirm that it still cannot read entries > 0x06.

There’s a generic minimug pointer array at 193DA0.

30 00 00 00 E4 CA 0C 08 E4 EB 0C 08 E4 C0 0C 08 
E4 C2 0C 08 E4 C4 0C 08 E4 C6 0C 08 E4 C8 0C 08

It’s quite bizarre; the first entry seems to denote “use minimug from portrait data”, whereas the second points to the last minimug graphic (the one I can’t get to display). The third entry points to the graphics displayed for 0x01. Then, the pointer array seems to continue for another three lines (I’m not sure what any of this does, because changing these pointers seem to have no effect on minimug displays).

04 CD 0C 08 04 CD 0C 08 04 CD 0C 08 80 BF 3F 08
30 BF 3F 08 DC BE 3F 08 80 BE 3F 08 DC BD 3F 08
34 BD 3F 08 00 00 00 00 00 00 00 00 08 00 00 00

Yes, I’ve tried repointing the graphics and repointing the array.

193DA4 = Table for generic mini-mug graphic pointers (7 entries)
193DC0 = Table for generic mini-mug palette pointers (7 entries)

007598 = Routine for loading generic mini-mug graphic pointers.
0075C8 = Routine for loading generic mini-mug palette pointers.

The first pointer is skipped, so only 6 of the graphics/palettes are usable as mini-mugs.

Make all 7 table entries read:
0075C4 : Change 00 81 to FF 80
0075FC : Change 00 81 to FF 80

Then we’ll need to adjust the data in the tables:

At 193DA4, overwrite data with:
E4 BE 0C 08 E4 C0 0C 08 E4 C2 0C 08 E4 C4 0C 08 E4 C6 0C 08 E4 C8 0C 08 E4 CA 0C 08

At 193DC0, change the first palette pointer to: 04 CD 0C 08


Applied the changes, and I’m getting some weird results.

[spoiler=Explanation with pictures]
0x01 (Should be 0x07) that red palette is kinda neat tho
0x02 (Wild Missingo appeared!)

And then everything after 0x03 seems to be off by +1.
0x03 (Knight Helm should be 0x02)
0x04 (Shield should be 0x03)
0x07 (Sacaean Horse should be 0x06)

Ideally, I’d like to repoint both of the tables to allow for more than 0x07. FE8 does NPC variants with a green palette (that’d be neat to port over), and there are a few others I’d like to include in EN.

Oh, your pointer tables are in different locations.
Your graphic pointer table is at BE2384
Your palette pointer table is at BE23B0

Thanks for catching that! I thought I undid that repoint, but apparently not.

Anyways, I tried to take advantage of the repointed tables (moved the palette table down to BE23D0) and add some more generic minimugs. Same glitch, except now it won’t allow for entries > 0x07. Would it be possible to just have an arbitary limit based on the number of entries in the table?

[spoiler=Pictures are worth 1,000 words]


The routines simply don’t just read the pointer tables from the ROM; they load 7 table entries into RAM then read it. This isn’t done just one time, but apparently every time a generic mini-mug needs to be used. The stack pointer gets reset afterwards anyways, so it makes me wonder if loading the table into RAM is even necessary or just the code being weird. Also, the palette routine calls another routine near the end that might mess with something else too.

This seems worth looking into for FireShell btw.

Try this. This should allow you to have 254 generic mini-mugs.

Graphic routine: 007598
00 B5 04 49 40 18 80 00 03 49 40 18 00 68 02 BC 08 47 00 00 FF 80 FF FF A4 3D 19 08

Pointer to graphic table located at: 0075B0

Palette routine: 0075C8
00 B5 06 4A 80 18 80 00 05 4A 80 18 00 68 49 01 20 22 F9 F7 53 FD 01 BC 07 47 00 00 FF 80 FF FF C0 3D 19 08

Pointer to palette table located at: 0075E8


Gryz, you are a beautiful person. Works like a charm!