git.y1.nz

SameBoy

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

commit e1075b1bdc36baebf348d0c5b16c28acc968b6ed
parent b2bbd9cfdc11d0e36aefaad0a1d873d768102dc8
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Fri, 27 Jan 2023 14:55:51 +0200

Turbo and rewind speed controls

Diffstat:
MiOS/GBSettingsViewController.m16++++++++++++++++
MiOS/GBViewController.m21++++++++++++++++++++-
MiOS/main.m2++
3 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/iOS/GBSettingsViewController.m b/iOS/GBSettingsViewController.m @@ -131,6 +131,22 @@ static NSString const *typeLightTemp = @"typeLightTemp"; ] }, @{ + @"header": @"Turbo Speed", + @"items": @[ + @{@"type": typeRadio, @"pref": @"GBTurboSpeed", @"title": @"200%", @"value": @2,}, + @{@"type": typeRadio, @"pref": @"GBTurboSpeed", @"title": @"400%", @"value": @4,}, + @{@"type": typeRadio, @"pref": @"GBTurboSpeed", @"title": @"Uncapped", @"value": @1,}, + ] + }, + @{ + @"header": @"Rewind Speed", + @"items": @[ + @{@"type": typeRadio, @"pref": @"GBRewindSpeed", @"title": @"100%", @"value": @1,}, + @{@"type": typeRadio, @"pref": @"GBRewindSpeed", @"title": @"200%", @"value": @2,}, + @{@"type": typeRadio, @"pref": @"GBRewindSpeed", @"title": @"400%", @"value": @4,}, + ] + }, + @{ @"header": @"Emulated Revisions", @"items": @[ QUICK_SUBMENU(@"Game Boy", @[ diff --git a/iOS/GBViewController.m b/iOS/GBViewController.m @@ -708,7 +708,26 @@ static void rumbleCallback(GB_gameboy_t *gb, double amp) if (_runMode == GBRunModeRewindPaused) { [_audioClient stop]; } - GB_set_turbo_mode(&_gb, runMode == GBRunModeTurbo, false); + + 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; + } + } } - (AVCaptureDevice *)captureDevice diff --git a/iOS/main.m b/iOS/main.m @@ -19,6 +19,8 @@ int main(int argc, char * argv[]) @"GBSGBModel": @(GB_MODEL_SGB2), @"GBRumbleMode": @(GB_RUMBLE_CARTRIDGE_ONLY), @"GBButtonHaptics": @YES, + @"GBTurboSpeed": @1, + @"GBRewindSpeed": @1, @"GBCurrentTheme": @"Lime (Game Boy)", // Default themes

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