mirror of https://github.com/mgba-emu/mgba.git
Core: Don't attempt to restore rewind diffs past start of rewind
This commit is contained in:
parent
d1ce973756
commit
3f4d2f6086
1
CHANGES
1
CHANGES
|
@ -18,6 +18,7 @@ Other fixes:
|
||||||
- Core: Fix memory leak in opening games from the library
|
- Core: Fix memory leak in opening games from the library
|
||||||
- Core: Fix memory searches for relative values (fixes mgba.io/i/2135)
|
- Core: Fix memory searches for relative values (fixes mgba.io/i/2135)
|
||||||
- Core: Fix portable mode on macOS
|
- Core: Fix portable mode on macOS
|
||||||
|
- Core: Don't attempt to restore rewind diffs past start of rewind
|
||||||
- GB Core: Fix GBC colors setting breaking default model overrides (fixes mgba.io/i/2161)
|
- GB Core: Fix GBC colors setting breaking default model overrides (fixes mgba.io/i/2161)
|
||||||
- GBA: Fix out of bounds ROM accesses on patched ROMs smaller than 32 MiB
|
- GBA: Fix out of bounds ROM accesses on patched ROMs smaller than 32 MiB
|
||||||
- Qt: Fix infrequent deadlock when using sync to video
|
- Qt: Fix infrequent deadlock when using sync to video
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
DEFINE_VECTOR(mCoreRewindPatches, struct PatchFast);
|
DEFINE_VECTOR(mCoreRewindPatches, struct PatchFast);
|
||||||
|
|
||||||
void _rewindDiff(struct mCoreRewindContext* context);
|
static void _rewindDiff(struct mCoreRewindContext* context);
|
||||||
|
|
||||||
#ifndef DISABLE_THREADING
|
#ifndef DISABLE_THREADING
|
||||||
THREAD_ENTRY _rewindThread(void* context);
|
THREAD_ENTRY _rewindThread(void* context);
|
||||||
|
@ -136,17 +136,19 @@ bool mCoreRewindRestore(struct mCoreRewindContext* context, struct mCore* core)
|
||||||
}
|
}
|
||||||
--context->current;
|
--context->current;
|
||||||
|
|
||||||
struct PatchFast* patch = mCoreRewindPatchesGetPointer(&context->patchMemory, context->current);
|
if (context->size) {
|
||||||
size_t size2 = context->previousState->size(context->previousState);
|
struct PatchFast* patch = mCoreRewindPatchesGetPointer(&context->patchMemory, context->current);
|
||||||
size_t size = context->currentState->size(context->currentState);
|
size_t size2 = context->previousState->size(context->previousState);
|
||||||
if (size2 < size) {
|
size_t size = context->currentState->size(context->currentState);
|
||||||
size = size2;
|
if (size2 < size) {
|
||||||
|
size = size2;
|
||||||
|
}
|
||||||
|
void* current = context->currentState->map(context->currentState, size, MAP_READ);
|
||||||
|
void* previous = context->previousState->map(context->previousState, size, MAP_WRITE);
|
||||||
|
patch->d.applyPatch(&patch->d, previous, size, current, size);
|
||||||
|
context->currentState->unmap(context->currentState, current, size);
|
||||||
|
context->previousState->unmap(context->previousState, previous, size);
|
||||||
}
|
}
|
||||||
void* current = context->currentState->map(context->currentState, size, MAP_READ);
|
|
||||||
void* previous = context->previousState->map(context->previousState, size, MAP_WRITE);
|
|
||||||
patch->d.applyPatch(&patch->d, previous, size, current, size);
|
|
||||||
context->currentState->unmap(context->currentState, current, size);
|
|
||||||
context->previousState->unmap(context->previousState, previous, size);
|
|
||||||
struct VFile* nextState = context->previousState;
|
struct VFile* nextState = context->previousState;
|
||||||
context->previousState = context->currentState;
|
context->previousState = context->currentState;
|
||||||
context->currentState = nextState;
|
context->currentState = nextState;
|
||||||
|
|
Loading…
Reference in New Issue