Speedup/Turbo/Throttle fixes.

Fix throttle=0 (unlimited speed) settings for both the Speedup/Turbo
config panel and the general throttle setting and make 100 the default.

Replace the speedup frame skip option with a "Frame skip" checkbox,
which enables skipping the appropriate number of frames if vsync or very
low system performance is in effect. The systemFrameSkip (under video
config) is added to this value.

With speedup_throttle=100, the old speedup behavior is used with 9
frames skipped.

With speedup_throttle == 0 && speedup_throttle_frame_skip, skip 9
frames at full speed, which is exactly the same as the old behavior,
since throttle == 0 is equivalent to speedup == true.

Hopefully these changes will make the turbo config dialog more useful
for users, by default frame skipping to work around vsync will be
enabled, and users can uncheck the "Frame skip" checkbox for a smoother
experience.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2020-03-27 09:27:17 +00:00
parent d6cc14ef10
commit 8e3978b314
9 changed files with 130 additions and 384 deletions

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-03-13 14:40+0000\n" "POT-Creation-Date: 2020-03-27 09:03+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -111,238 +111,237 @@ msgstr ""
msgid "Start!" msgid "Start!"
msgstr "" msgstr ""
#: guiinit.cpp:82 xrc/NetLink.xrc:99 #: guiinit.cpp:96 xrc/NetLink.xrc:99
msgid "Connect" msgid "Connect"
msgstr "" msgstr ""
#: guiinit.cpp:98 #: guiinit.cpp:113
msgid "You must enter a valid host name" msgid "You must enter a valid host name"
msgstr "" msgstr ""
#: guiinit.cpp:99 #: guiinit.cpp:114
msgid "Host name invalid" msgid "Host name invalid"
msgstr "" msgstr ""
#: guiinit.cpp:117 #: guiinit.cpp:132
msgid "Waiting for clients..." msgid "Waiting for clients..."
msgstr "" msgstr ""
#: guiinit.cpp:118 #: guiinit.cpp:133
#, c-format #, c-format
msgid "Server IP address is: %s\n" msgid "Server IP address is: %s\n"
msgstr "" msgstr ""
#: guiinit.cpp:120 #: guiinit.cpp:135
msgid "Waiting for connection..." msgid "Waiting for connection..."
msgstr "" msgstr ""
#: guiinit.cpp:121 #: guiinit.cpp:136
#, c-format #, c-format
msgid "Connecting to %s\n" msgid "Connecting to %s\n"
msgstr "" msgstr ""
#: guiinit.cpp:154 #: guiinit.cpp:169
msgid "" msgid ""
"Error occurred.\n" "Error occurred.\n"
"Please try again." "Please try again."
msgstr "" msgstr ""
#: guiinit.cpp:221 guiinit.cpp:274 #: guiinit.cpp:236 guiinit.cpp:289
msgid "Select cheat file" msgid "Select cheat file"
msgstr "" msgstr ""
#: guiinit.cpp:222 #: guiinit.cpp:237
msgid "VBA cheat lists (*.clt)|*.clt|CHT cheat lists (*.cht)|*.cht" msgid "VBA cheat lists (*.clt)|*.clt|CHT cheat lists (*.cht)|*.cht"
msgstr "" msgstr ""
#: guiinit.cpp:241 panel.cpp:417 #: guiinit.cpp:256 panel.cpp:417
msgid "Loaded cheats" msgid "Loaded cheats"
msgstr "" msgstr ""
#: guiinit.cpp:275 #: guiinit.cpp:290
msgid "VBA cheat lists (*.clt)|*.clt" msgid "VBA cheat lists (*.clt)|*.clt"
msgstr "" msgstr ""
#: guiinit.cpp:293 #: guiinit.cpp:308
msgid "Saved cheats" msgid "Saved cheats"
msgstr "" msgstr ""
#: guiinit.cpp:324 guiinit.cpp:343 #: guiinit.cpp:339 guiinit.cpp:358
msgid "Restore old values?" msgid "Restore old values?"
msgstr "" msgstr ""
#: guiinit.cpp:325 guiinit.cpp:344 #: guiinit.cpp:340 guiinit.cpp:359
msgid "Removing cheats" msgid "Removing cheats"
msgstr "" msgstr ""
#: guiinit.cpp:735 xrc/JoyPanel.xrc:364 #: guiinit.cpp:750 xrc/JoyPanel.xrc:364
msgid "GameShark" msgid "GameShark"
msgstr "" msgstr ""
#: guiinit.cpp:736 cmdevents.cpp:676 #: guiinit.cpp:751 cmdevents.cpp:676
msgid "GameGenie" msgid "GameGenie"
msgstr "" msgstr ""
#: guiinit.cpp:738 #: guiinit.cpp:753
msgid "Generic Code" msgid "Generic Code"
msgstr "" msgstr ""
#: guiinit.cpp:739 #: guiinit.cpp:754
msgid "GameShark Advance" msgid "GameShark Advance"
msgstr "" msgstr ""
#: guiinit.cpp:740 #: guiinit.cpp:755
msgid "CodeBreaker Advance" msgid "CodeBreaker Advance"
msgstr "" msgstr ""
#: guiinit.cpp:741 #: guiinit.cpp:756
msgid "Flashcart CHT" msgid "Flashcart CHT"
msgstr "" msgstr ""
#: guiinit.cpp:809 guiinit.cpp:1064 #: guiinit.cpp:824 guiinit.cpp:1079
msgid "Number cannot be empty" msgid "Number cannot be empty"
msgstr "" msgstr ""
#: guiinit.cpp:847 #: guiinit.cpp:862
#, c-format #, c-format
msgid "Search produced %d results. Please refine better" msgid "Search produced %d results. Please refine better"
msgstr "" msgstr ""
#: guiinit.cpp:859 #: guiinit.cpp:874
msgid "Search produced no results" msgid "Search produced no results"
msgstr "" msgstr ""
#: guiinit.cpp:1022 #: guiinit.cpp:1037
msgid "8-bit " msgid "8-bit "
msgstr "" msgstr ""
#: guiinit.cpp:1026 #: guiinit.cpp:1041
msgid "16-bit " msgid "16-bit "
msgstr "" msgstr ""
#: guiinit.cpp:1030 #: guiinit.cpp:1045
msgid "32-bit " msgid "32-bit "
msgstr "" msgstr ""
#: guiinit.cpp:1036 #: guiinit.cpp:1051
msgid "signed decimal" msgid "signed decimal"
msgstr "" msgstr ""
#: guiinit.cpp:1040 #: guiinit.cpp:1055
msgid "unsigned decimal" msgid "unsigned decimal"
msgstr "" msgstr ""
#: guiinit.cpp:1044 #: guiinit.cpp:1059
msgid "unsigned hexadecimal" msgid "unsigned hexadecimal"
msgstr "" msgstr ""
#: guiinit.cpp:1522 #: guiinit.cpp:1537
#, c-format #, c-format
msgid "%d frames = %.2f ms" msgid "%d frames = %.2f ms"
msgstr "" msgstr ""
#: guiinit.cpp:1534 #: guiinit.cpp:1549
msgid "Default device" msgid "Default device"
msgstr "" msgstr ""
#: guiinit.cpp:1721 #: guiinit.cpp:1736
msgid "Desktop mode" msgid "Desktop mode"
msgstr "" msgstr ""
#: guiinit.cpp:1728 #: guiinit.cpp:1743
#, c-format #, c-format
msgid "%d x %d - %dbpp @ %dHz" msgid "%d x %d - %dbpp @ %dHz"
msgstr "" msgstr ""
#: guiinit.cpp:1841 cmdevents.cpp:746 xrc/DisplayConfig.xrc:85 #: guiinit.cpp:1856 cmdevents.cpp:746 xrc/DisplayConfig.xrc:85
#: xrc/DisplayConfig.xrc:135 xrc/DisplayConfig.xrc:221 #: xrc/DisplayConfig.xrc:135 xrc/DisplayConfig.xrc:221
#: xrc/GameBoyAdvanceConfig.xrc:32 xrc/GameBoyAdvanceConfig.xrc:204 #: xrc/GameBoyAdvanceConfig.xrc:32 xrc/GameBoyAdvanceConfig.xrc:204
#: xrc/GeneralConfig.xrc:114 xrc/SoundConfig.xrc:219 xrc/SoundConfig.xrc:309 #: xrc/SoundConfig.xrc:219 xrc/SoundConfig.xrc:309
#: xrc/SpeedupConfig.xrc:45 xrc/SpeedupConfig.xrc:120
msgid "None" msgid "None"
msgstr "" msgstr ""
#: guiinit.cpp:1882 #: guiinit.cpp:1897
#, c-format #, c-format
msgid "No usable rpi plugins found in %s" msgid "No usable rpi plugins found in %s"
msgstr "" msgstr ""
#: guiinit.cpp:1902 xrc/DisplayConfig.xrc:107 #: guiinit.cpp:1917 xrc/DisplayConfig.xrc:107
msgid "Plugin" msgid "Plugin"
msgstr "" msgstr ""
#: guiinit.cpp:1930 #: guiinit.cpp:1945
msgid "Please select a plugin or a different filter" msgid "Please select a plugin or a different filter"
msgstr "" msgstr ""
#: guiinit.cpp:1931 #: guiinit.cpp:1946
msgid "Plugin selection error" msgid "Plugin selection error"
msgstr "" msgstr ""
#: guiinit.cpp:2130 #: guiinit.cpp:2145
msgid "This will clear all user-defined accelerators. Are you sure?" msgid "This will clear all user-defined accelerators. Are you sure?"
msgstr "" msgstr ""
#: guiinit.cpp:2130 #: guiinit.cpp:2145
msgid "Confirm" msgid "Confirm"
msgstr "" msgstr ""
#: guiinit.cpp:2724 #: guiinit.cpp:2681
msgid "Main icon not found" msgid "Main icon not found"
msgstr "" msgstr ""
#: guiinit.cpp:2734 #: guiinit.cpp:2691
msgid "Browse" msgid "Browse"
msgstr "" msgstr ""
#: guiinit.cpp:2748 #: guiinit.cpp:2705
msgid "Main display panel not found" msgid "Main display panel not found"
msgstr "" msgstr ""
#: guiinit.cpp:2897 #: guiinit.cpp:2854
#, c-format #, c-format
msgid "Duplicate menu accelerator: %s for %s and %s; keeping first" msgid "Duplicate menu accelerator: %s for %s and %s; keeping first"
msgstr "" msgstr ""
#: guiinit.cpp:2911 #: guiinit.cpp:2868
#, c-format #, c-format
msgid "Menu accelerator %s for %s overrides default for %s ; keeping menu" msgid "Menu accelerator %s for %s overrides default for %s ; keeping menu"
msgstr "" msgstr ""
#: guiinit.cpp:3041 #: guiinit.cpp:2998
#, c-format #, c-format
msgid "Invalid menu item %s; removing" msgid "Invalid menu item %s; removing"
msgstr "" msgstr ""
#: guiinit.cpp:3242 #: guiinit.cpp:3206
msgid "Code" msgid "Code"
msgstr "" msgstr ""
#: guiinit.cpp:3251 #: guiinit.cpp:3215
msgid "Description" msgid "Description"
msgstr "" msgstr ""
#: guiinit.cpp:3325 xrc/CheatAdd.xrc:31 #: guiinit.cpp:3289 xrc/CheatAdd.xrc:31
msgid "Address" msgid "Address"
msgstr "" msgstr ""
#: guiinit.cpp:3326 #: guiinit.cpp:3290
msgid "Old Value" msgid "Old Value"
msgstr "" msgstr ""
#: guiinit.cpp:3327 #: guiinit.cpp:3291
msgid "New Value" msgid "New Value"
msgstr "" msgstr ""
#: guiinit.cpp:3847 #: guiinit.cpp:3799
msgid "Menu commands" msgid "Menu commands"
msgstr "" msgstr ""
#: guiinit.cpp:3870 #: guiinit.cpp:3822
msgid "Other commands" msgid "Other commands"
msgstr "" msgstr ""
#: guiinit.cpp:3981 #: guiinit.cpp:3933
msgid "JoyBus host invalid; disabling" msgid "JoyBus host invalid; disabling"
msgstr "" msgstr ""
@ -839,27 +838,27 @@ msgstr ""
msgid "Network is not supported in local mode." msgid "Network is not supported in local mode."
msgstr "" msgstr ""
#: opts.cpp:550 opts.cpp:855 #: opts.cpp:552 opts.cpp:857
#, c-format #, c-format
msgid "Invalid value %s for option %s; valid values are %s%s%s" msgid "Invalid value %s for option %s; valid values are %s%s%s"
msgstr "" msgstr ""
#: opts.cpp:567 opts.cpp:867 #: opts.cpp:569 opts.cpp:869
#, c-format #, c-format
msgid "Invalid value %d for option %s; valid values are %d - %d" msgid "Invalid value %d for option %s; valid values are %d - %d"
msgstr "" msgstr ""
#: opts.cpp:574 opts.cpp:583 opts.cpp:875 opts.cpp:883 #: opts.cpp:576 opts.cpp:585 opts.cpp:877 opts.cpp:885
#, c-format #, c-format
msgid "Invalid value %f for option %s; valid values are %f - %f" msgid "Invalid value %f for option %s; valid values are %f - %f"
msgstr "" msgstr ""
#: opts.cpp:643 opts.cpp:664 opts.cpp:952 opts.cpp:978 #: opts.cpp:645 opts.cpp:666 opts.cpp:954 opts.cpp:980
#, c-format #, c-format
msgid "Invalid key binding %s for %s" msgid "Invalid key binding %s for %s"
msgstr "" msgstr ""
#: opts.cpp:838 #: opts.cpp:840
#, c-format #, c-format
msgid "Invalid flag option %s - %s ignored" msgid "Invalid flag option %s - %s ignored"
msgstr "" msgstr ""
@ -1072,22 +1071,22 @@ msgstr ""
msgid "programming error; aborting!" msgid "programming error; aborting!"
msgstr "" msgstr ""
#: panel.cpp:2404 panel.cpp:2435 #: panel.cpp:2399 panel.cpp:2429
#, c-format #, c-format
msgid "Unable to begin recording to %s (%s)" msgid "Unable to begin recording to %s (%s)"
msgstr "" msgstr ""
#: panel.cpp:2463 #: panel.cpp:2457
#, c-format #, c-format
msgid "Error in audio/video recording (%s); aborting" msgid "Error in audio/video recording (%s); aborting"
msgstr "" msgstr ""
#: panel.cpp:2469 #: panel.cpp:2463
#, c-format #, c-format
msgid "Error in audio recording (%s); aborting" msgid "Error in audio recording (%s); aborting"
msgstr "" msgstr ""
#: panel.cpp:2479 #: panel.cpp:2473
#, c-format #, c-format
msgid "Error in video recording (%s); aborting" msgid "Error in video recording (%s); aborting"
msgstr "" msgstr ""
@ -2386,6 +2385,10 @@ msgstr ""
msgid "0 = no throttle" msgid "0 = no throttle"
msgstr "" msgstr ""
#: xrc/GeneralConfig.xrc:114 xrc/SpeedupConfig.xrc:45
msgid "Full Speed/No Limit"
msgstr ""
#: xrc/GeneralConfig.xrc:115 xrc/SpeedupConfig.xrc:46 #: xrc/GeneralConfig.xrc:115 xrc/SpeedupConfig.xrc:46
msgid "25%" msgid "25%"
msgstr "" msgstr ""
@ -3506,15 +3509,15 @@ msgstr ""
msgid "Players:" msgid "Players:"
msgstr "" msgstr ""
#: xrc/NetLink.xrc:41 xrc/SpeedupConfig.xrc:122 #: xrc/NetLink.xrc:41
msgid "2" msgid "2"
msgstr "" msgstr ""
#: xrc/NetLink.xrc:49 xrc/SpeedupConfig.xrc:123 #: xrc/NetLink.xrc:49
msgid "3" msgid "3"
msgstr "" msgstr ""
#: xrc/NetLink.xrc:56 xrc/SpeedupConfig.xrc:124 #: xrc/NetLink.xrc:56
msgid "4" msgid "4"
msgstr "" msgstr ""
@ -3687,117 +3690,5 @@ msgid "Speedup Throttle"
msgstr "" msgstr ""
#: xrc/SpeedupConfig.xrc:84 #: xrc/SpeedupConfig.xrc:84
msgid "Speedup Frame Skip" msgid "Frame skip"
msgstr ""
#: xrc/SpeedupConfig.xrc:102
msgid "# of frames:"
msgstr ""
#: xrc/SpeedupConfig.xrc:121
msgid "1"
msgstr ""
#: xrc/SpeedupConfig.xrc:125
msgid "5"
msgstr ""
#: xrc/SpeedupConfig.xrc:126
msgid "6"
msgstr ""
#: xrc/SpeedupConfig.xrc:127
msgid "7"
msgstr ""
#: xrc/SpeedupConfig.xrc:128
msgid "8"
msgstr ""
#: xrc/SpeedupConfig.xrc:129
msgid "9"
msgstr ""
#: xrc/SpeedupConfig.xrc:130
msgid "10"
msgstr ""
#: xrc/SpeedupConfig.xrc:131
msgid "11"
msgstr ""
#: xrc/SpeedupConfig.xrc:132
msgid "12"
msgstr ""
#: xrc/SpeedupConfig.xrc:133
msgid "13"
msgstr ""
#: xrc/SpeedupConfig.xrc:134
msgid "14"
msgstr ""
#: xrc/SpeedupConfig.xrc:135
msgid "15"
msgstr ""
#: xrc/SpeedupConfig.xrc:136
msgid "16"
msgstr ""
#: xrc/SpeedupConfig.xrc:137
msgid "17"
msgstr ""
#: xrc/SpeedupConfig.xrc:138
msgid "18"
msgstr ""
#: xrc/SpeedupConfig.xrc:139
msgid "19"
msgstr ""
#: xrc/SpeedupConfig.xrc:140
msgid "20"
msgstr ""
#: xrc/SpeedupConfig.xrc:141
msgid "21"
msgstr ""
#: xrc/SpeedupConfig.xrc:142
msgid "22"
msgstr ""
#: xrc/SpeedupConfig.xrc:143
msgid "23"
msgstr ""
#: xrc/SpeedupConfig.xrc:144
msgid "24"
msgstr ""
#: xrc/SpeedupConfig.xrc:145
msgid "25"
msgstr ""
#: xrc/SpeedupConfig.xrc:146
msgid "26"
msgstr ""
#: xrc/SpeedupConfig.xrc:147
msgid "27"
msgstr ""
#: xrc/SpeedupConfig.xrc:148
msgid "28"
msgstr ""
#: xrc/SpeedupConfig.xrc:149
msgid "29"
msgstr ""
#: xrc/SpeedupConfig.xrc:150
msgid "30"
msgstr "" msgstr ""

View File

@ -114,7 +114,7 @@ enum named_opts
OPT_WINDOW_POSITION_Y, OPT_WINDOW_POSITION_Y,
OPT_WINDOW_WIDTH, OPT_WINDOW_WIDTH,
OPT_SPEEDUP_THROTTLE, OPT_SPEEDUP_THROTTLE,
OPT_SPEEDUP_FRAME_SKIP OPT_NO_SPEEDUP_THROTTLE_FRAME_SKIP
}; };
#define SOUND_MAX_VOLUME 2.0 #define SOUND_MAX_VOLUME 2.0
@ -256,8 +256,8 @@ uint32_t autoFrameSkipLastTime;
uint32_t movieLastJoypad; uint32_t movieLastJoypad;
uint32_t movieNextJoypad; uint32_t movieNextJoypad;
uint32_t throttle = 100; uint32_t throttle = 100;
uint32_t speedup_throttle = 0; uint32_t speedup_throttle = 100;
uint32_t speedup_frame_skip = 9; bool speedup_throttle_frame_skip = true;
const char* preparedCheatCodes[MAX_CHEATS]; const char* preparedCheatCodes[MAX_CHEATS];
@ -391,8 +391,8 @@ struct option argOptions[] = {
{ "synchronize", required_argument, 0, OPT_SYNCHRONIZE }, { "synchronize", required_argument, 0, OPT_SYNCHRONIZE },
{ "thread-priority", required_argument, 0, OPT_THREAD_PRIORITY }, { "thread-priority", required_argument, 0, OPT_THREAD_PRIORITY },
{ "throttle", required_argument, 0, 'T' }, { "throttle", required_argument, 0, 'T' },
{ "speedup_throttle", required_argument, 0, OPT_SPEEDUP_THROTTLE }, { "speedup-throttle", required_argument, 0, OPT_SPEEDUP_THROTTLE },
{ "speedup_frame_skip", required_argument, 0, OPT_SPEEDUP_FRAME_SKIP }, { "no-speedup-throttle-frame-skip", no_argument, 0, OPT_NO_SPEEDUP_THROTTLE_FRAME_SKIP },
{ "triple-buffering", no_argument, &tripleBuffering, 1 }, { "triple-buffering", no_argument, &tripleBuffering, 1 },
{ "use-bios", no_argument, &useBios, 1 }, { "use-bios", no_argument, &useBios, 1 },
{ "use-bios-file-gb", no_argument, &useBiosFileGB, 1 }, { "use-bios-file-gb", no_argument, &useBiosFileGB, 1 },
@ -554,8 +554,8 @@ void LoadConfig()
soundRecordDir = ReadPrefString("soundRecordDir"); soundRecordDir = ReadPrefString("soundRecordDir");
threadPriority = ReadPref("priority", 2); threadPriority = ReadPref("priority", 2);
throttle = ReadPref("throttle", 100); throttle = ReadPref("throttle", 100);
speedup_throttle = ReadPref("speedup_throttle", 0); speedup_throttle = ReadPref("speedupThrottle", 100);
speedup_frame_skip = ReadPref("speedup_frame_skip", 9); speedup_throttle_frame_skip = ReadPref("speedupThrottleFrameSkip", 1);
tripleBuffering = ReadPref("tripleBuffering", 0); tripleBuffering = ReadPref("tripleBuffering", 0);
useBios = ReadPrefHex("useBiosGBA"); useBios = ReadPrefHex("useBiosGBA");
useBiosFileGB = ReadPref("useBiosGB", 0); useBiosFileGB = ReadPref("useBiosGB", 0);
@ -1364,9 +1364,8 @@ int ReadOpts(int argc, char ** argv)
if (optarg) if (optarg)
speedup_throttle = atoi(optarg); speedup_throttle = atoi(optarg);
break; break;
case OPT_SPEEDUP_FRAME_SKIP: case OPT_NO_SPEEDUP_THROTTLE_FRAME_SKIP:
if (optarg) speedup_throttle_frame_skip = false;
speedup_frame_skip = atoi(optarg);
break; break;
} }
} }

View File

@ -147,7 +147,7 @@ extern uint32_t movieLastJoypad;
extern uint32_t movieNextJoypad; extern uint32_t movieNextJoypad;
extern uint32_t throttle; extern uint32_t throttle;
extern uint32_t speedup_throttle; extern uint32_t speedup_throttle;
extern uint32_t speedup_frame_skip; extern bool speedup_throttle_frame_skip;
extern int preparedCheats; extern int preparedCheats;
extern const char *preparedCheatCodes[MAX_CHEATS]; extern const char *preparedCheatCodes[MAX_CHEATS];

View File

@ -1,4 +1,5 @@
//#include "../win32/stdafx.h" // would fix LNK2005 linker errors for MSVC //#include "../win32/stdafx.h" // would fix LNK2005 linker errors for MSVC
#include <cmath>
#include <assert.h> #include <assert.h>
#include <memory.h> #include <memory.h>
#include <stdio.h> #include <stdio.h>
@ -4944,26 +4945,29 @@ void gbEmulate(int ticksToStop)
if ((gbLcdTicksDelayed <= 0) && (gbLCDChangeHappened)) { if ((gbLcdTicksDelayed <= 0) && (gbLCDChangeHappened)) {
int framesToSkip = systemFrameSkip; int framesToSkip = systemFrameSkip;
#ifndef __LIBRETRO__
static bool speedup_throttle_set = false; static bool speedup_throttle_set = false;
#ifndef __LIBRETRO__
static uint32_t last_throttle; static uint32_t last_throttle;
if ((gbJoymask[0] >> 10) & 1) { if ((gbJoymask[0] >> 10) & 1) {
if (speedup_throttle != 0) { if (speedup_throttle != 100 && !speedup_throttle_set && throttle != speedup_throttle) {
if (!speedup_throttle_set && throttle != speedup_throttle) {
last_throttle = throttle; last_throttle = throttle;
throttle = speedup_throttle; throttle = speedup_throttle;
soundSetThrottle(speedup_throttle); soundSetThrottle(speedup_throttle);
speedup_throttle_set = true; speedup_throttle_set = true;
} }
}
else {
if (speedup_frame_skip)
framesToSkip = speedup_frame_skip;
speedup_throttle_set = false; if (speedup_throttle_set) {
if (speedup_throttle_frame_skip) {
if (speedup_throttle == 0)
framesToSkip += 9;
else if (speedup_throttle > 100)
framesToSkip += std::ceil(double(speedup_throttle) / 100.0) - 1;
} }
} }
else
framesToSkip = 9;
}
else if (speedup_throttle_set) { else if (speedup_throttle_set) {
throttle = last_throttle; throttle = last_throttle;
soundSetThrottle(last_throttle); soundSetThrottle(last_throttle);
@ -5033,11 +5037,7 @@ void gbEmulate(int ticksToStop)
speedup = false; speedup = false;
#ifndef __LIBRETRO__ if (newmask & 1 && !speedup_throttle_set)
if (newmask & 1 && speedup_throttle == 0)
#else
if (newmask & 1)
#endif
speedup = true; speedup = true;
gbCapture = (newmask & 2) ? true : false; gbCapture = (newmask & 2) ? true : false;

View File

@ -1,3 +1,4 @@
#include <cmath>
#include <memory.h> #include <memory.h>
#include <stdarg.h> #include <stdarg.h>
#include <stddef.h> #include <stddef.h>
@ -3792,26 +3793,29 @@ void CPULoop(int ticks)
} else { } else {
int framesToSkip = systemFrameSkip; int framesToSkip = systemFrameSkip;
#ifndef __LIBRETRO__
static bool speedup_throttle_set = false; static bool speedup_throttle_set = false;
#ifndef __LIBRETRO__
static uint32_t last_throttle; static uint32_t last_throttle;
if ((joy >> 10) & 1) { if ((joy >> 10) & 1) {
if (speedup_throttle != 0) { if (speedup_throttle != 100 && !speedup_throttle_set && throttle != speedup_throttle) {
if (!speedup_throttle_set && throttle != speedup_throttle) {
last_throttle = throttle; last_throttle = throttle;
throttle = speedup_throttle; throttle = speedup_throttle;
soundSetThrottle(speedup_throttle); soundSetThrottle(speedup_throttle);
speedup_throttle_set = true; speedup_throttle_set = true;
} }
}
else {
if (speedup_frame_skip)
framesToSkip = speedup_frame_skip;
speedup_throttle_set = false; if (speedup_throttle_set) {
if (speedup_throttle_frame_skip) {
if (speedup_throttle == 0)
framesToSkip += 9;
else if (speedup_throttle > 100)
framesToSkip += std::ceil(double(speedup_throttle) / 100.0) - 1;
} }
} }
else
framesToSkip = 9;
}
else if (speedup_throttle_set) { else if (speedup_throttle_set) {
throttle = last_throttle; throttle = last_throttle;
soundSetThrottle(last_throttle); soundSetThrottle(last_throttle);
@ -3855,11 +3859,7 @@ void CPULoop(int ticks)
speedup = false; speedup = false;
#ifndef __LIBRETRO__ if (ext & 1 && !speedup_throttle_set)
if (ext & 1 && speedup_throttle == 0)
#else
if (ext & 1)
#endif
speedup = true; speedup = true;
capture = (ext & 2) ? true : false; capture = (ext & 2) ? true : false;

View File

@ -2357,17 +2357,6 @@ public:
} }
} throttle_ctrl; } throttle_ctrl;
// manage speedup key frame skip spinctrl/canned setting choice interaction
static class SpeedupFrameSkipCtrl_t : public wxEvtHandler {
public:
wxSpinCtrl* speedup_frame_skip_spin;
wxChoice* speedup_frame_skip_sel;
void SetSpeedupFrameSkipSel(wxSpinEvent& evt);
void DoSetSpeedupFrameSkipSel(uint32_t val);
void SetSpeedupFrameSkip(wxCommandEvent& evt);
void Init(wxShowEvent& ev);
} speedup_frame_skip_ctrl;
// manage speedup key throttle spinctrl/canned setting choice interaction // manage speedup key throttle spinctrl/canned setting choice interaction
static class SpeedupThrottleCtrl_t : public wxEvtHandler { static class SpeedupThrottleCtrl_t : public wxEvtHandler {
public: public:
@ -2383,14 +2372,11 @@ public:
void DoSetSpeedupThrottleSel(uint32_t val) void DoSetSpeedupThrottleSel(uint32_t val)
{ {
if (val > 0 && val <= 600) { if (val <= 600 && val != 100) {
speedup_throttle_sel->SetSelection(std::round((double)val / 25)); speedup_throttle_sel->SetSelection(std::round((double)val / 25));
speedup_frame_skip_ctrl.DoSetSpeedupFrameSkipSel(0);
wxCommandEvent nil;
speedup_frame_skip_ctrl.SetSpeedupFrameSkip(nil);
} }
else else
speedup_throttle_sel->SetSelection(0); speedup_throttle_sel->SetSelection(4);
} }
// set speedup_throttle from speedup_throttle_sel // set speedup_throttle from speedup_throttle_sel
@ -2399,14 +2385,11 @@ public:
(void)evt; // unused params (void)evt; // unused params
uint32_t val = speedup_throttle_sel->GetSelection() * 25; uint32_t val = speedup_throttle_sel->GetSelection() * 25;
if (val > 0 && val <= 600) { if (val <= 600 && val != 100) {
speedup_throttle_spin->SetValue(val); speedup_throttle_spin->SetValue(val);
speedup_frame_skip_ctrl.DoSetSpeedupFrameSkipSel(0);
wxCommandEvent nil;
speedup_frame_skip_ctrl.SetSpeedupFrameSkip(nil);
} }
else else
speedup_throttle_spin->SetValue(0); speedup_throttle_spin->SetValue(100);
} }
void Init(wxShowEvent& ev) void Init(wxShowEvent& ev)
@ -2416,47 +2399,6 @@ public:
} }
} speedup_throttle_ctrl; } speedup_throttle_ctrl;
// set speedup_frame_skip_sel from speedup_frame_skip
void SpeedupFrameSkipCtrl_t::SetSpeedupFrameSkipSel(wxSpinEvent& evt)
{
(void)evt; // unused params
DoSetSpeedupFrameSkipSel(speedup_frame_skip_spin->GetValue());
}
void SpeedupFrameSkipCtrl_t::DoSetSpeedupFrameSkipSel(uint32_t val)
{
if (val > 0 && val <= 30) {
speedup_frame_skip_sel->SetSelection(val);
speedup_throttle_ctrl.DoSetSpeedupThrottleSel(0);
wxCommandEvent nil;
speedup_throttle_ctrl.SetSpeedupThrottle(nil);
}
else
speedup_frame_skip_sel->SetSelection(0);
}
// set speedup_frame_skip from speedup_frame_skip_sel
void SpeedupFrameSkipCtrl_t::SetSpeedupFrameSkip(wxCommandEvent& evt)
{
(void)evt; // unused params
uint32_t val = speedup_frame_skip_sel->GetSelection();
if (val > 0 && val <= 30) {
speedup_frame_skip_spin->SetValue(val);
speedup_throttle_ctrl.DoSetSpeedupThrottleSel(0);
wxCommandEvent nil;
speedup_throttle_ctrl.SetSpeedupThrottle(nil);
}
else
speedup_frame_skip_spin->SetValue(0);
}
void SpeedupFrameSkipCtrl_t::Init(wxShowEvent& ev)
{
ev.Skip();
DoSetSpeedupFrameSkipSel(speedup_frame_skip);
}
///////////////////////////// /////////////////////////////
//Check if a pointer from the XRC file is valid. If it's not, throw an error telling the user. //Check if a pointer from the XRC file is valid. If it's not, throw an error telling the user.
template <typename T> template <typename T>
@ -3470,6 +3412,7 @@ bool MainFrame::BindControls()
d = LoadXRCDialog("SpeedupConfig"); d = LoadXRCDialog("SpeedupConfig");
{ {
getsc_uint("SpeedupThrottle", speedup_throttle); getsc_uint("SpeedupThrottle", speedup_throttle);
getcbb("SpeedupThrottleFrameSkip", speedup_throttle_frame_skip);
speedup_throttle_ctrl.speedup_throttle_spin = sc; speedup_throttle_ctrl.speedup_throttle_spin = sc;
speedup_throttle_ctrl.speedup_throttle_sel = SafeXRCCTRL<wxChoice>(d, "SpeedupThrottleSel"); speedup_throttle_ctrl.speedup_throttle_sel = SafeXRCCTRL<wxChoice>(d, "SpeedupThrottleSel");
speedup_throttle_ctrl.speedup_throttle_spin->Connect(wxEVT_COMMAND_SPINCTRL_UPDATED, speedup_throttle_ctrl.speedup_throttle_spin->Connect(wxEVT_COMMAND_SPINCTRL_UPDATED,
@ -3481,19 +3424,6 @@ bool MainFrame::BindControls()
d->Connect(wxEVT_SHOW, wxShowEventHandler(SpeedupThrottleCtrl_t::Init), d->Connect(wxEVT_SHOW, wxShowEventHandler(SpeedupThrottleCtrl_t::Init),
NULL, &speedup_throttle_ctrl); NULL, &speedup_throttle_ctrl);
d->Fit(); d->Fit();
getsc_uint("SpeedupFrameSkip", speedup_frame_skip);
speedup_frame_skip_ctrl.speedup_frame_skip_spin = sc;
speedup_frame_skip_ctrl.speedup_frame_skip_sel = SafeXRCCTRL<wxChoice>(d, "SpeedupFrameSkipSel");
speedup_frame_skip_ctrl.speedup_frame_skip_spin->Connect(wxEVT_COMMAND_SPINCTRL_UPDATED,
wxSpinEventHandler(SpeedupFrameSkipCtrl_t::SetSpeedupFrameSkipSel),
NULL, &speedup_frame_skip_ctrl);
speedup_frame_skip_ctrl.speedup_frame_skip_sel->Connect(wxEVT_COMMAND_CHOICE_SELECTED,
wxCommandEventHandler(SpeedupFrameSkipCtrl_t::SetSpeedupFrameSkip),
NULL, &speedup_frame_skip_ctrl);
d->Connect(wxEVT_SHOW, wxShowEventHandler(SpeedupFrameSkipCtrl_t::Init),
NULL, &speedup_frame_skip_ctrl);
d->Fit();
} }
#define getcbbe(n, o) getbe(n, o, cb, wxCheckBox, CB) #define getcbbe(n, o) getbe(n, o, cb, wxCheckBox, CB)
wxBoolIntEnValidator* bienval; wxBoolIntEnValidator* bienval;

View File

@ -292,7 +292,7 @@ opt_desc opts[] = {
INTOPT("preferences/skipSaveGameBattery", "", wxTRANSLATE("Do not overwrite native (battery) save when loading state"), skipSaveGameBattery, 0, 1), INTOPT("preferences/skipSaveGameBattery", "", wxTRANSLATE("Do not overwrite native (battery) save when loading state"), skipSaveGameBattery, 0, 1),
UINTOPT("preferences/throttle", "", wxTRANSLATE("Throttle game speed, even when accelerated (0-500%, 0 = no throttle)"), throttle, 0, 600), UINTOPT("preferences/throttle", "", wxTRANSLATE("Throttle game speed, even when accelerated (0-500%, 0 = no throttle)"), throttle, 0, 600),
UINTOPT("preferences/speedupThrottle", "", wxTRANSLATE("Set throttle for speedup key (0-600%, 0 = no throttle)"), speedup_throttle, 0, 600), UINTOPT("preferences/speedupThrottle", "", wxTRANSLATE("Set throttle for speedup key (0-600%, 0 = no throttle)"), speedup_throttle, 0, 600),
UINTOPT("preferences/speedupFrameSkip", "", wxTRANSLATE("Set frame skip for speedup key (0-30)"), speedup_frame_skip, 0, 30), BOOLOPT("preferences/speedupThrottleFrameSkip", "", wxTRANSLATE("Use frame skip for speedup throttle"), speedup_throttle_frame_skip),
INTOPT("preferences/useBiosGB", "BootRomGB", wxTRANSLATE("Use the specified BIOS file for GB"), useBiosFileGB, 0, 1), INTOPT("preferences/useBiosGB", "BootRomGB", wxTRANSLATE("Use the specified BIOS file for GB"), useBiosFileGB, 0, 1),
INTOPT("preferences/useBiosGBA", "BootRomEn", wxTRANSLATE("Use the specified BIOS file"), useBiosFileGBA, 0, 1), INTOPT("preferences/useBiosGBA", "BootRomEn", wxTRANSLATE("Use the specified BIOS file"), useBiosFileGBA, 0, 1),
INTOPT("preferences/useBiosGBC", "BootRomGBC", wxTRANSLATE("Use the specified BIOS file for GBC"), useBiosFileGBC, 0, 1), INTOPT("preferences/useBiosGBC", "BootRomGBC", wxTRANSLATE("Use the specified BIOS file for GBC"), useBiosFileGBC, 0, 1),

View File

@ -111,7 +111,7 @@
<object class="sizeritem"> <object class="sizeritem">
<object class="wxChoice" name="ThrottleSel"> <object class="wxChoice" name="ThrottleSel">
<content> <content>
<item>None</item> <item>Full Speed/No Limit</item>
<item>25%</item> <item>25%</item>
<item>50%</item> <item>50%</item>
<item>75%</item> <item>75%</item>

View File

@ -42,7 +42,7 @@
<object class="sizeritem"> <object class="sizeritem">
<object class="wxChoice" name="SpeedupThrottleSel"> <object class="wxChoice" name="SpeedupThrottleSel">
<content> <content>
<item>None</item> <item>Full Speed/No Limit</item>
<item>25%</item> <item>25%</item>
<item>50%</item> <item>50%</item>
<item>75%</item> <item>75%</item>
@ -80,86 +80,12 @@
<border>5</border> <border>5</border>
</object> </object>
<object class="sizeritem"> <object class="sizeritem">
<object class="wxStaticText"> <object class="wxCheckBox" name="SpeedupThrottleFrameSkip">
<label>Speedup Frame Skip</label> <label>Frame skip</label>
<font>
<weight>bold</weight>
</font>
</object> </object>
<flag>wxALL</flag> <flag>wxALL</flag>
<border>5</border> <border>5</border>
</object> </object>
<object class="sizeritem">
<object class="wxBoxSizer">
<orient>wxVERTICAL</orient>
<object class="sizeritem">
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
<object class="wxBoxSizer">
<orient>wxHORIZONTAL</orient>
<object class="sizeritem">
<object class="wxStaticText">
<label># of frames:</label>
<size>60,-1d</size>
</object>
<flag>wxALL|wxALIGN_CENTRE_VERTICAL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxSpinCtrl" name="SpeedupFrameSkip">
<value>9</value>
<min>0</min>
<max>30</max>
</object>
<flag>wxALL|wxALIGN_CENTRE_VERTICAL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxChoice" name="SpeedupFrameSkipSel">
<content>
<item>None</item>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
<item>10</item>
<item>11</item>
<item>12</item>
<item>13</item>
<item>14</item>
<item>15</item>
<item>16</item>
<item>17</item>
<item>18</item>
<item>19</item>
<item>20</item>
<item>21</item>
<item>22</item>
<item>23</item>
<item>24</item>
<item>25</item>
<item>26</item>
<item>27</item>
<item>28</item>
<item>29</item>
<item>30</item>
</content>
<size>40,-1d</size>
</object>
<flag>wxALL|wxALIGN_CENTRE_VERTICAL</flag>
<border>5</border>
</object>
</object>
</object>
</object>
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
</object>
<object class="sizeritem"> <object class="sizeritem">
<flag>wxALL|wxEXPAND</flag> <flag>wxALL|wxEXPAND</flag>
<border>5</border> <border>5</border>