all repos — mgba @ 35a13753bb414253c5901013b3dcc1b05ff9dc6c

mGBA Game Boy Advance Emulator

Core: Fix mVL state size discrepancies
Vicki Pfau vi@endrift.com
Thu, 03 Aug 2017 18:44:26 -0700
commit

35a13753bb414253c5901013b3dcc1b05ff9dc6c

parent

51a6079e91fd1c11896ce08742e54a7adc67e4c8

1 files changed, 10 insertions(+), 2 deletions(-)

jump to
M src/feature/video-logger.csrc/feature/video-logger.c

@@ -687,8 +687,16 @@ }

void mVideoLogContextRewind(struct mVideoLogContext* context, struct mCore* core) { _readHeader(context); - if (core && core->stateSize(core) == context->initialStateSize) { - core->loadState(core, context->initialState); + if (core) { + size_t size = core->stateSize(core); + if (size <= context->initialStateSize) { + core->loadState(core, context->initialState); + } else { + void* extendedState = anonymousMemoryMap(size); + memcpy(extendedState, context->initialState, context->initialStateSize); + core->loadState(core, extendedState); + mappedMemoryFree(extendedState, size); + } } off_t pointer = context->backing->seek(context->backing, 0, SEEK_CUR);