mirror of https://github.com/mgba-emu/mgba.git
GB Core: Fix extracting SRAM when none is present
This commit is contained in:
parent
0234cb07b8
commit
853cdf2880
2
CHANGES
2
CHANGES
|
@ -3,6 +3,8 @@ Emulation fixes:
|
|||
- GB Memory: Fix OAM DMA from top 8 kB
|
||||
- GB MBC: Fix MBC1 RAM enable bit selection
|
||||
- GB MBC: Fix MBC2 bit selection
|
||||
Other fixes:
|
||||
- GB Core: Fix extracting SRAM when none is present
|
||||
|
||||
0.8.2: (2020-06-14)
|
||||
Emulation fixes:
|
||||
|
|
|
@ -822,9 +822,13 @@ static size_t _GBCoreSavedataClone(struct mCore* core, void** sram) {
|
|||
vf->seek(vf, 0, SEEK_SET);
|
||||
return vf->read(vf, *sram, vf->size(vf));
|
||||
}
|
||||
*sram = malloc(gb->sramSize);
|
||||
memcpy(*sram, gb->memory.sram, gb->sramSize);
|
||||
return gb->sramSize;
|
||||
if (gb->sramSize) {
|
||||
*sram = malloc(gb->sramSize);
|
||||
memcpy(*sram, gb->memory.sram, gb->sramSize);
|
||||
return gb->sramSize;
|
||||
}
|
||||
*sram = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool _GBCoreSavedataRestore(struct mCore* core, const void* sram, size_t size, bool writeback) {
|
||||
|
|
Loading…
Reference in New Issue