Fix PokeMe64 bug #10 - Sprites error Pokemon Silver

Turns out that Pokemon Silver has the IconPointers list at a different rom offset for some reason.

This was an oversight during my testing because I don't personally own Pokemon Silver.

Fix: Use the right rom offset
This commit is contained in:
Philippe Symons 2024-10-08 12:18:39 +02:00
parent feff0c5327
commit aae97aec6e

View File

@ -12,7 +12,7 @@ Gen2IconDecoder::Gen2IconDecoder(IRomReader& romReader, Gen2GameType gameType)
uint8_t* Gen2IconDecoder::decode(Gen2PokemonIconType iconType, bool firstFrame)
{
const uint32_t romOffset = (gameType_ == Gen2GameType::CRYSTAL) ? 0x8EBBF : 0x8EA70;
uint32_t romOffset = (gameType_ == Gen2GameType::CRYSTAL) ? 0x8EBBF : 0x8EA70;
const uint8_t MAX_NUM_TILES = 4;
const uint8_t TILE_WIDTH = 8;
const uint8_t TILE_HEIGHT = 8;
@ -24,6 +24,21 @@ uint8_t* Gen2IconDecoder::decode(Gen2PokemonIconType iconType, bool firstFrame)
const uint8_t bankIndex = 0x23;
uint16_t pointer;
switch(gameType_)
{
case Gen2GameType::GOLD:
romOffset = 0x8EA70;
break;
case Gen2GameType::SILVER:
romOffset = 0x8EA56;
break;
case Gen2GameType::CRYSTAL:
romOffset = 0x8EBBF;
break;
default:
return buffer_;
}
// read IconPointers table entry
romReader_.seek(romOffset);
romReader_.advance(((uint32_t)iconType) * ENTRY_SIZE);