mirror of
https://github.com/risingPhil/libpokemegb.git
synced 2026-03-21 17:44:24 -05:00
Also fix Japanese pokemon name retrieval in gen I
This commit is contained in:
parent
f449806efe
commit
01649d2d2f
|
|
@ -69,6 +69,7 @@ const char *Gen1GameReader::getPokemonName(uint8_t index) const
|
|||
static char result[20];
|
||||
uint8_t encodedText[0xA];
|
||||
uint32_t numRead;
|
||||
const uint16_t entrySize = (localization_ != (uint8_t)Gen1LocalizationLanguage::JAPANESE) ? 0xA : 0x6;
|
||||
const uint32_t romOffset = gen1_getRomOffsets(gameType_, (Gen1LocalizationLanguage)localization_).names;
|
||||
|
||||
if(!romOffset)
|
||||
|
|
@ -78,10 +79,10 @@ const char *Gen1GameReader::getPokemonName(uint8_t index) const
|
|||
}
|
||||
|
||||
romReader_.seek(romOffset);
|
||||
romReader_.advance((index - 1) * 0xA);
|
||||
romReader_.advance((index - 1) * entrySize);
|
||||
|
||||
// max 10 bytes
|
||||
numRead = romReader_.readUntil(encodedText, 0x50, 0xA);
|
||||
numRead = romReader_.readUntil(encodedText, 0x50, entrySize);
|
||||
|
||||
gen1_decodePokeText(encodedText, numRead, result, sizeof(result), (Gen1LocalizationLanguage)localization_);
|
||||
return result;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user