git.y1.nz

SameBoy

Accurate GB/GBC emulator
download: https://git.y1.nz/archives/sameboy.tar.gz
README | Files | Log | Refs | LICENSE

commit df248736c8ecf4d088a7dd5c0444dea34db0e17c
parent 6829ebf44a6a2a92e317b0de885a221be3c64d88
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Fri, 27 Jan 2023 18:00:21 +0200

Better rewind speed (use a different amount of rewind pops rather than clock multiplier)

Diffstat:
MiOS/GBViewController.m32++++++++++++--------------------
1 file changed, 12 insertions(+), 20 deletions(-)

diff --git a/iOS/GBViewController.m b/iOS/GBViewController.m @@ -537,8 +537,10 @@ static void rumbleCallback(GB_gameboy_t *gb, double amp) if (_rewind) { _rewind = false; GB_rewind_pop(&_gb); - if (!GB_rewind_pop(&_gb)) { - self.runMode = GBRunModeRewindPaused; + for (unsigned i = [[NSUserDefaults standardUserDefaults] integerForKey:@"GBRewindSpeed"]; i--;) { + if (!GB_rewind_pop(&_gb)) { + self.runMode = GBRunModeRewindPaused; + } } } if (_runMode != GBRunModeRewindPaused) { @@ -709,24 +711,14 @@ static void rumbleCallback(GB_gameboy_t *gb, double amp) [_audioClient stop]; } - switch (_runMode) { - case GBRunModeNormal: - case GBRunModeRewindPaused: - GB_set_turbo_mode(&_gb, false, false); - GB_set_clock_multiplier(&_gb, 1.0); - break; - case GBRunModeTurbo: { - double multiplier = [[NSUserDefaults standardUserDefaults] doubleForKey:@"GBTurboSpeed"]; - GB_set_turbo_mode(&_gb, multiplier == 1, false); - GB_set_clock_multiplier(&_gb, multiplier); - break; - } - case GBRunModeRewind: { - double multiplier = [[NSUserDefaults standardUserDefaults] doubleForKey:@"GBRewindSpeed"]; - GB_set_turbo_mode(&_gb, false, false); - GB_set_clock_multiplier(&_gb, multiplier); - break; - } + if (_runMode == GBRunModeTurbo) { + double multiplier = [[NSUserDefaults standardUserDefaults] doubleForKey:@"GBTurboSpeed"]; + GB_set_turbo_mode(&_gb, multiplier == 1, false); + GB_set_clock_multiplier(&_gb, multiplier); + } + else { + GB_set_turbo_mode(&_gb, false, false); + GB_set_clock_multiplier(&_gb, 1.0); } }

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.