From 2bf8feb299284aaef683eb9c395ca36ad9854aa8 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Mon, 27 May 2024 23:06:16 +0300 Subject: [PATCH] Fix a bug causing newly imported ROMs to sometime incorrectly prefer SGB over CGB --- iOS/GBViewController.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/iOS/GBViewController.m b/iOS/GBViewController.m index 204cd1381..5a95f7d7e 100644 --- a/iOS/GBViewController.m +++ b/iOS/GBViewController.m @@ -491,9 +491,11 @@ static void rumbleCallback(GB_gameboy_t *gb, double amp) // Newly played ROM, pick the best model uint8_t *rom = GB_get_direct_access(&_gb, GB_DIRECT_ACCESS_ROM, NULL, NULL); - if ((rom[0x143] & 0x80) && !GB_is_cgb(&_gb)) { + if ((rom[0x143] & 0x80)) { + if (!GB_is_cgb(&_gb)) { GB_switch_model_and_reset(&_gb, [[NSUserDefaults standardUserDefaults] integerForKey:@"GBCGBModel"]); } + } else if ((rom[0x146] == 3) && !GB_is_sgb(&_gb)) { GB_switch_model_and_reset(&_gb, [[NSUserDefaults standardUserDefaults] integerForKey:@"GBSGBModel"]); }