GBA: Fix getting game info for multiboot ROMs

This commit is contained in:
Vicki Pfau 2024-08-11 20:04:35 -07:00
parent 8ab2681bca
commit b12858e974
2 changed files with 7 additions and 2 deletions

View File

@ -25,6 +25,7 @@ Other fixes:
- GB: Fix uninitialized save data when loading undersized temporary saves
- GB, GBA Core: Fix memory leak if reloading debug symbols
- GB Serialize: Prevent loading invalid states where LY >= 144 in modes other than 1
- GBA: Fix getting game info for multiboot ROMs
- GBA Audio: Fix crash if audio FIFOs and timers get out of sync
- GBA Audio: Fix crash in audio subsampling if timing lockstep breaks
- GBA Core: Fix loading symbols from ELF files if the file doesn't end with .elf

View File

@ -408,10 +408,14 @@ bool GBALoadMB(struct GBA* gba, struct VFile* vf) {
gba->mbVf = vf;
vf->seek(vf, 0, SEEK_SET);
memset(gba->memory.wram, 0, GBA_SIZE_EWRAM);
vf->read(vf, gba->memory.wram, GBA_SIZE_EWRAM);
off_t read = vf->read(vf, gba->memory.wram, GBA_SIZE_EWRAM);
if (read < 0) {
return false;
}
if (gba->cpu && gba->memory.activeRegion == GBA_REGION_IWRAM) {
gba->cpu->memory.setActiveRegion(gba->cpu, gba->cpu->gprs[ARM_PC]);
}
gba->romCrc32 = doCrc32(gba->memory.wram, read);
return true;
}
@ -856,7 +860,7 @@ void GBAGetGameInfo(const struct GBA* gba, struct mGameInfo* info) {
struct GBACartridge* cart = NULL;
if (gba->memory.rom) {
cart = (struct GBACartridge*) gba->memory.rom;
} else if (gba->isPristine && gba->memory.wram) {
} else if (gba->mbVf && gba->memory.wram) {
cart = (struct GBACartridge*) gba->memory.wram;
}