mirror of https://github.com/mgba-emu/mgba.git
GB Core: Fix extracting SRAM when none is present
This commit is contained in:
parent
91dd493f95
commit
8f1148498e
1
CHANGES
1
CHANGES
|
@ -24,6 +24,7 @@ Other fixes:
|
||||||
- All: Improve export headers (fixes mgba.io/i/1738)
|
- All: Improve export headers (fixes mgba.io/i/1738)
|
||||||
- Core: Ensure ELF regions can be written before trying
|
- Core: Ensure ELF regions can be written before trying
|
||||||
- Debugger: Don't skip undefined instructions when debugger attached
|
- Debugger: Don't skip undefined instructions when debugger attached
|
||||||
|
- GB Core: Fix extracting SRAM when none is present
|
||||||
- Qt: Force OpenGL paint engine creation thread (fixes mgba.io/i/1642)
|
- Qt: Force OpenGL paint engine creation thread (fixes mgba.io/i/1642)
|
||||||
- Qt: Fix static compilation in MinGW (fixes mgba.io/i/1769)
|
- Qt: Fix static compilation in MinGW (fixes mgba.io/i/1769)
|
||||||
Misc:
|
Misc:
|
||||||
|
|
|
@ -822,10 +822,14 @@ static size_t _GBCoreSavedataClone(struct mCore* core, void** sram) {
|
||||||
vf->seek(vf, 0, SEEK_SET);
|
vf->seek(vf, 0, SEEK_SET);
|
||||||
return vf->read(vf, *sram, vf->size(vf));
|
return vf->read(vf, *sram, vf->size(vf));
|
||||||
}
|
}
|
||||||
|
if (gb->sramSize) {
|
||||||
*sram = malloc(gb->sramSize);
|
*sram = malloc(gb->sramSize);
|
||||||
memcpy(*sram, gb->memory.sram, gb->sramSize);
|
memcpy(*sram, gb->memory.sram, gb->sramSize);
|
||||||
return gb->sramSize;
|
return gb->sramSize;
|
||||||
}
|
}
|
||||||
|
*sram = NULL;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static bool _GBCoreSavedataRestore(struct mCore* core, const void* sram, size_t size, bool writeback) {
|
static bool _GBCoreSavedataRestore(struct mCore* core, const void* sram, size_t size, bool writeback) {
|
||||||
struct GB* gb = core->board;
|
struct GB* gb = core->board;
|
||||||
|
|
Loading…
Reference in New Issue