mirror of https://github.com/mgba-emu/mgba.git
Core: Don't save state if core fails to serialize
This commit is contained in:
parent
472faf3881
commit
c665f939e7
1
CHANGES
1
CHANGES
|
@ -38,6 +38,7 @@ Bugfixes:
|
||||||
- SDL: Fix race condition with audio thread when starting
|
- SDL: Fix race condition with audio thread when starting
|
||||||
- GB: Fix flickering when screen is strobed quickly
|
- GB: Fix flickering when screen is strobed quickly
|
||||||
- FFmpeg: Fix overflow and general issues with audio encoding
|
- FFmpeg: Fix overflow and general issues with audio encoding
|
||||||
|
- Core: Don't save state if core fails to serialize
|
||||||
Misc:
|
Misc:
|
||||||
- SDL: Remove scancode key input
|
- SDL: Remove scancode key input
|
||||||
- GBA Video: Clean up unused timers
|
- GBA Video: Clean up unused timers
|
||||||
|
|
|
@ -160,10 +160,9 @@ static bool _savePNGState(struct mCore* core, struct VFile* vf, struct mStateExt
|
||||||
|
|
||||||
size_t stateSize = core->stateSize(core);
|
size_t stateSize = core->stateSize(core);
|
||||||
void* state = anonymousMemoryMap(stateSize);
|
void* state = anonymousMemoryMap(stateSize);
|
||||||
if (!state) {
|
if (!state || !core->saveState(core, state)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
core->saveState(core, state);
|
|
||||||
|
|
||||||
uLongf len = compressBound(stateSize);
|
uLongf len = compressBound(stateSize);
|
||||||
void* buffer = malloc(len);
|
void* buffer = malloc(len);
|
||||||
|
@ -343,15 +342,14 @@ bool mCoreSaveStateNamed(struct mCore* core, struct VFile* vf, int flags) {
|
||||||
UNUSED(flags);
|
UNUSED(flags);
|
||||||
#endif
|
#endif
|
||||||
vf->truncate(vf, stateSize);
|
vf->truncate(vf, stateSize);
|
||||||
struct GBASerializedState* state = vf->map(vf, stateSize, MAP_WRITE);
|
void* state = vf->map(vf, stateSize, MAP_WRITE);
|
||||||
if (!state) {
|
if (!state || !core->saveState(core, state)) {
|
||||||
mStateExtdataDeinit(&extdata);
|
mStateExtdataDeinit(&extdata);
|
||||||
if (cheatVf) {
|
if (cheatVf) {
|
||||||
cheatVf->close(cheatVf);
|
cheatVf->close(cheatVf);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
core->saveState(core, state);
|
|
||||||
vf->unmap(vf, state, stateSize);
|
vf->unmap(vf, state, stateSize);
|
||||||
vf->seek(vf, stateSize, SEEK_SET);
|
vf->seek(vf, stateSize, SEEK_SET);
|
||||||
mStateExtdataSerialize(&extdata, vf);
|
mStateExtdataSerialize(&extdata, vf);
|
||||||
|
|
Loading…
Reference in New Issue