From 48d499c5647f067831a702720b16ad1a0ab32d5e Mon Sep 17 00:00:00 2001 From: saulfabreg Wii VC Project Date: Fri, 20 May 2022 14:07:39 -0500 Subject: [PATCH] Add "Enable Turbo Mode" toggle to the Video Settings menu (based on InfiniteBlueGX's code) (#441) * Add "Enable Turbo Mode" toggle to the Video Settings menu * Add "Enable Turbo Mode" toggle to the Video Settings menu * Add "Enable Turbo Mode" toggle to the Video Settings menu * Add "Enable Turbo Mode" toggle to the Video Settings menu * Add Spanish translation to "Enable Turbo Mode" option * forgot to update setting order for Enable Turbo Mode option (fixes not appearing On/Off option) --- source/input.cpp | 12 +++++++----- source/lang/es.lang | 3 +++ source/menu.cpp | 8 +++++++- source/preferences.cpp | 3 +++ source/vbagx.h | 1 + 5 files changed, 21 insertions(+), 6 deletions(-) diff --git a/source/input.cpp b/source/input.cpp index c2a71a6..27f49c5 100644 --- a/source/input.cpp +++ b/source/input.cpp @@ -880,11 +880,13 @@ static u32 DecodeJoy(unsigned short pad) u32 J = StandardMovement(pad); // Turbo feature - if(userInput[0].pad.substickX > 70 || - userInput[0].WPAD_Stick(1,0) > 70 || - userInput[0].wiidrcdata.substickX > 45) - J |= VBA_SPEED; - + if (GCSettings.TurboModeEnabled == 1) + { + if(userInput[0].pad.substickX > 70 || + userInput[0].WPAD_Stick(1,0) > 70 || + userInput[0].wiidrcdata.substickX > 45) + J |= VBA_SPEED; + } // Report pressed buttons (gamepads) u32 pad_btns_h = userInput[pad].pad.btns_h; // GCN u32 wiidrcp_btns_h = userInput[pad].wiidrcdata.btns_h; diff --git a/source/lang/es.lang b/source/lang/es.lang index 84b2df9..f35493c 100644 --- a/source/lang/es.lang +++ b/source/lang/es.lang @@ -181,6 +181,9 @@ msgstr "Holandés" msgid "Enabled" msgstr "Activado" +msgid "Enable Turbo Mode" +msgstr "Activar Modo Turbo" + msgid "English" msgstr "Inglés" diff --git a/source/menu.cpp b/source/menu.cpp index 273afa1..e9a661b 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -3098,6 +3098,7 @@ static int MenuSettingsVideo() sprintf(options.name[i++], "GB Mono Colorization"); sprintf(options.name[i++], "GB Palette"); sprintf(options.name[i++], "GBA Frameskip"); + sprintf(options.name[i++], "Enable Turbo Mode"); options.length = i; for(i=0; i < options.length; i++) @@ -3208,6 +3209,11 @@ static int MenuSettingsVideo() case 8: GCSettings.gbaFrameskip ^= 1; break; + case 9: + GCSettings.TurboModeEnabled++; + if (GCSettings.TurboModeEnabled > 1) + GCSettings.TurboModeEnabled = 0; + break; } if(ret >= 0 || firstRun) @@ -3289,7 +3295,7 @@ static int MenuSettingsVideo() sprintf (options.value[8], "On"); else sprintf (options.value[8], "Off"); - + sprintf (options.value[9], "%s", GCSettings.TurboModeEnabled == 1 ? "On" : "Off"); optionBrowser.TriggerUpdate(); } diff --git a/source/preferences.cpp b/source/preferences.cpp index 1e45b48..24da5eb 100644 --- a/source/preferences.cpp +++ b/source/preferences.cpp @@ -197,6 +197,7 @@ preparePrefsData () createXMLSetting("yshift", "Vertical Video Shift", toStr(GCSettings.yshift)); createXMLSetting("colorize", "Colorize Mono Gameboy", toStr(GCSettings.colorize)); createXMLSetting("gbaFrameskip", "GBA Frameskip", toStr(GCSettings.gbaFrameskip)); + createXMLSetting("TurboModeEnabled", "Turbo Mode Enabled", toStr(GCSettings.TurboModeEnabled)); createXMLSection("Menu", "Menu Settings"); @@ -512,6 +513,7 @@ decodePrefsData () loadXMLSetting(&GCSettings.yshift, "yshift"); loadXMLSetting(&GCSettings.colorize, "colorize"); loadXMLSetting(&GCSettings.gbaFrameskip, "gbaFrameskip"); + loadXMLSetting(&GCSettings.TurboModeEnabled, "TurboModeEnabled"); // Menu Settings @@ -658,6 +660,7 @@ DefaultSettings () GCSettings.yshift = 0; // vertical video shift GCSettings.colorize = 0; // Colorize mono gameboy games GCSettings.gbaFrameskip = 1; // Turn auto-frameskip on for GBA games + GCSettings.TurboModeEnabled = 1; // Enabled by default GCSettings.WiimoteOrientation = 0; GCSettings.ExitAction = 0; diff --git a/source/vbagx.h b/source/vbagx.h index 44d6393..064d2dd 100644 --- a/source/vbagx.h +++ b/source/vbagx.h @@ -95,6 +95,7 @@ struct SGCSettings int Rumble; int language; int PreviewImage; + int TurboModeEnabled; // 0 - disabled, 1 - enabled int AutoloadGame; int OffsetMinutesUTC; // Used for clock on MBC3 and TAMA5