From 9b1bf3ad508765efec7f93e10a9a19b9e64b2dac Mon Sep 17 00:00:00 2001 From: saulfabreg Wii VC Project Date: Fri, 20 May 2022 14:11:46 -0500 Subject: [PATCH] Add "Enable Turbo Mode" toggle to the Video Settings menu (based on InfiniteBlueGX's code) (#467) * 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 * Update README.md * Update README.md * Add Spanish translation to "Enable Turbo Mode" option --- source/fceugx.h | 1 + source/lang/es.lang | 3 +++ source/menu.cpp | 7 +++++++ source/pad.cpp | 12 +++++++----- source/preferences.cpp | 3 +++ 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/source/fceugx.h b/source/fceugx.h index 6bdd243..5c4dd1a 100644 --- a/source/fceugx.h +++ b/source/fceugx.h @@ -121,6 +121,7 @@ struct SGCSettings int Rumble; int language; int PreviewImage; + int TurboModeEnabled; // 0 - disabled, 1 - enabled }; void ExitApp(); diff --git a/source/lang/es.lang b/source/lang/es.lang index c0609fd..0c04e26 100644 --- a/source/lang/es.lang +++ b/source/lang/es.lang @@ -721,6 +721,9 @@ msgstr "Desactivado" msgid "distributed, or modified under the terms of the" msgstr "distribuido, o modificado bajo los términos de" +msgid "Enable Turbo Mode" +msgstr "Activar Modo Turbo" + msgid "FDS BIOS file is invalid!" msgstr "¡Archivo de BIOS de FDS inválido!" diff --git a/source/menu.cpp b/source/menu.cpp index b9af417..5e40c9e 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -3319,6 +3319,7 @@ static int MenuSettingsVideo() sprintf(options.name[i++], "Zapper Crosshair"); sprintf(options.name[i++], "Sprite Limit"); sprintf(options.name[i++], "Video Mode"); + sprintf(options.name[i++], "Enable Turbo Mode"); options.length = i; for(i=0; i < options.length; i++) @@ -3417,6 +3418,11 @@ static int MenuSettingsVideo() if(GCSettings.videomode > 4) GCSettings.videomode = 0; break; + case 10: + GCSettings.TurboModeEnabled++; + if (GCSettings.TurboModeEnabled > 1) + GCSettings.TurboModeEnabled = 0; + break; } if(ret >= 0 || firstRun) @@ -3476,6 +3482,7 @@ static int MenuSettingsVideo() case 4: sprintf (options.value[9], "PAL (60Hz)"); break; } + sprintf (options.value[10], "%s", GCSettings.TurboModeEnabled == 1 ? "On" : "Off"); optionBrowser.TriggerUpdate(); } diff --git a/source/pad.cpp b/source/pad.cpp index a8f0be0..2545298 100644 --- a/source/pad.cpp +++ b/source/pad.cpp @@ -631,11 +631,13 @@ void GetJoy() // Turbo mode // RIGHT on c-stick and on classic ctrlr right joystick - if(userInput[0].pad.substickX > 70 || userInput[0].WPAD_StickX(1) > 70 || userInput[0].wiidrcdata.substickX > 45) - turbomode = 1; - else - turbomode = 0; - + if (GCSettings.TurboModeEnabled == 1) + { + if(userInput[0].pad.substickX > 70 || userInput[0].WPAD_StickX(1) > 70 || userInput[0].wiidrcdata.substickX > 45) + turbomode = 1; + else + turbomode = 0; + } // request to go back to menu if(MenuRequested()) ScreenshotRequested = 1; // go to the menu diff --git a/source/preferences.cpp b/source/preferences.cpp index 75015e7..7aa6580 100644 --- a/source/preferences.cpp +++ b/source/preferences.cpp @@ -155,6 +155,7 @@ preparePrefsData () createXMLSetting("hideoverscan", "Video Cropping", toStr(GCSettings.hideoverscan)); createXMLSetting("xshift", "Horizontal Video Shift", toStr(GCSettings.xshift)); createXMLSetting("yshift", "Vertical Video Shift", toStr(GCSettings.yshift)); + createXMLSetting("TurboModeEnabled", "Turbo Mode Enabled", toStr(GCSettings.TurboModeEnabled)); createXMLSection("Menu", "Menu Settings"); @@ -329,6 +330,7 @@ decodePrefsData () loadXMLSetting(&GCSettings.hideoverscan, "hideoverscan"); loadXMLSetting(&GCSettings.xshift, "xshift"); loadXMLSetting(&GCSettings.yshift, "yshift"); + loadXMLSetting(&GCSettings.TurboModeEnabled, "TurboModeEnabled"); // Menu Settings @@ -456,6 +458,7 @@ DefaultSettings () sprintf (GCSettings.ArtworkFolder, "%s/artwork", APPFOLDER); // Path to artwork files GCSettings.AutoLoad = 1; // Auto Load RAM GCSettings.AutoSave = 1; // Auto Save RAM + GCSettings.TurboModeEnabled = 1; // Enabled by default } /****************************************************************************