[GBA] Spirit: Stallion of the Cimarron – restore unused horse?

Started by redunka, March 20, 2023, 12:34:36 PM

Previous topic - Next topic

redunka

Hi, everyone! I know this isn't a particularly interesting game, but I guess it got me curious enough to dig into its case. The post might get long as I'll try to document everything I've discovered so far, so I apologize in advance.

The goal of this game is to save Spirit from rustlers, but before that you'll have to guide 4 of his horse friends to their homeland.
One horse (Rain) is the same for each run, while 3 others are random, or, to be exact, the very first launch will always have specific ones, but restarting the game from main menu will randomize them.
Instruction booklet states that there's 8 of these random horses, but in reality the one named Cloud will never appear, although some people claim they had encountered a horse with glitched palette whose stats screen would crash the game.
Either way, that horse's proper palette and name banner for the stats screen are still in the ROM, yet they never get called (at least not normally), as far as I can tell.
Here's me replacing another horse's data to show how it was apparently supposed to look like in-game:



Its palette is located at 0x19840C-0x19842B (USA ROM), which is exactly before palettes for the rest of horses.
Two pieces of compressed graphics for its name banner are at 0x39DC78-0x39DCEF and 0x39DCF0-0x39DD6B - between banners for Buttercup and Dream (same as in manual, so Cloud was likely meant to be one of semi-random starter horses).
Addresses for palettes and banners for 9 used horses are referenced at 0x3A6BD4-0x3A6BF7 and 0x3A98C0-0x3A9907 respectively, but the data for Cloud doesn't seem to be mentioned anywhere in the ROM.
So far I only tried changing (at 0x8BC) the starting point of palettes' addresses list to make room for one more, but looks like the game insists on loading 9 palettes only, and in a certain order too, basically ignoring whichever palette is addressed last.
Haven't really tried messing with name banners, but I suspect they also have similar hardcoded limits somewhere...

I'm afraid that I might be lacking necessary knowledge to find and patch the relevant code myself, so any help or advices would be greatly appreciated!

FAST6191

I might start by doing a character selection cheat and seeing if you can force it that way -- if it is just that the random has some kind of if 9 then set to 8 or something then a cheat forcing it always be 9 might well do the deed, usually how we get play as boss or unlock hidden character cheats.

After that then time to poke at the code for it all. Resetting to menu randomises things is an interesting tidbit for this, and if the palettes are generated at that time then great (bit more annoying if you have to go into the game and encounter them first)

redunka

Thank you for reply!

Well, it doesn't look like the horse is simply disabled, seeing how there's nothing in the ROM that would point to its data at all; it's like it's almost totally unimplemented.
The aforementioned area 0x3A6BD4-0x3A6BF7 contains pointers to palettes for just 9 horses, including Spirit & Rain, while Cloud would be 10th, but is not there.
It's even worse for name banners, as their pointers (also only 9 horses) are surrounded by other data, so they would need to be relocated before trying to add more, but that could be dealt with later anyway.

For now I'm trying to find how exactly the game decides which of those 9 used palettes it wants to load.
Palette gets written into memory when you get close enough to a horse, but luckily the game starts in a hub area where you can check all horses for this specific run by walking around a bit.
While messing with debugger I got to this part where the palette's number (7 here) gets copied from r0 to r4 for it to be added to 0x83A6BD4 later, but I'm yet to understand where this number comes from to r0 initially, so the hunt continues...



P.S. Useless piece of info, but now I can see how people could possibly receive a horse with bugged palette sometimes: if that value somehow becomes 9 the game would try to load wrong data (a compressed sprite, to be exact) as a palette, which would result in a weird dark blue/brown horse.