Fix a bug where controller-triggered rewind doesn't resume after reaching the buffer end

This commit is contained in:
Lior Halphon 2025-07-11 23:14:03 +03:00
parent 8cce6f7b13
commit 08d58aa992
1 changed files with 11 additions and 3 deletions

View File

@ -723,7 +723,7 @@ static void rumbleCallback(GB_gameboy_t *gb, double amp)
[_backgroundView fadeOverlayOut];
}
else {
if (self.runMode == GBRunModeRewind && _runModeFromController) {
if ((self.runMode == GBRunModeRewind || self.runMode == GBRunModePaused) && _runModeFromController) {
[self setRunMode:GBRunModeNormal];
_runModeFromController = false;
}
@ -1354,14 +1354,22 @@ static void rumbleCallback(GB_gameboy_t *gb, double amp)
GB_rewind_pop(&_gb);
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"GBDynamicSpeed"]) {
if (!GB_rewind_pop(&_gb)) {
self.runMode = GBRunModePaused;
dispatch_sync(dispatch_get_main_queue(), ^{
if (_runMode == GBRunModeRewind) {
self.runMode = GBRunModePaused;
}
});
_rewindOver = true;
}
}
else {
for (unsigned i = [[NSUserDefaults standardUserDefaults] integerForKey:@"GBRewindSpeed"]; i--;) {
if (!GB_rewind_pop(&_gb)) {
self.runMode = GBRunModePaused;
dispatch_sync(dispatch_get_main_queue(), ^{
if (_runMode == GBRunModeRewind) {
self.runMode = GBRunModePaused;
}
});
_rewindOver = true;
}
}