Turbo config refactor followup.

In the Turbo config dialog, remove the selection list for entering the
value and leave only the spin control. Allow values above 600%, up to
4000%.

Reintroduce the speedup_frame_skip config variable, defaulting to 9, use
it for turbo selection values > 600%, with speedup_throttle == 0.

The rationale for this is that on average modern hardware, throttle
values above 500% or 600% will not be effective.

The default is now shown as 1000%, which is:

frame_skip == 9 && speedup == 1,

where:

speedup == 1 is equivalent to throttle == 0,

as was the case before the turbo config changes.

Values above 600% are automatically rounded up or down to the nearest
100%, on entry and on click of the up/down arrows of the spin control.

The frame skip checkbox is cleared and disabled for the "Unlimited"
setting (throttle == 0), and set and disabled for values > 600%, to
reflect the mechanism to the user.

When the value again enters the modifiable range in the spin control,
the previous value of the checkbox is restored.

Misc:

- Turn off translation of percentage values in the xrc.

- Remove the size element for the throttle selection list in the general
  config dialog xrc, it breaks the layout on GTK3.

- Add a note about passing wxWidgets_CONFIG_EXECUTABLE to cmake to
  select wxWidgets version to README.md.

Hopefully this will reduce confusion and present a nicer UI.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2020-05-14 17:47:32 +00:00
parent 51b66714c5
commit 1347026d40
12 changed files with 213 additions and 258 deletions

View File

@ -204,6 +204,10 @@ Note for distro packagers, we use the CMake module
[GNUInstallDirs](https://cmake.org/cmake/help/v2.8.12/cmake.html#module:GNUInstallDirs) [GNUInstallDirs](https://cmake.org/cmake/help/v2.8.12/cmake.html#module:GNUInstallDirs)
to configure installation directories. to configure installation directories.
On Unix to use a different version of wxWidgets, set
`wxWidgets_CONFIG_EXECUTABLE` to the path to the `wx-config` script you want to
use.
## MSys2 Notes ## MSys2 Notes
To run the resulting binary, you can simply type: To run the resulting binary, you can simply type:

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-05-04 01:24+0000\n" "POT-Creation-Date: 2020-05-09 07:12+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"
@ -17,51 +17,51 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n" "Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: wxvbam.cpp:240 #: wxvbam.cpp:226
msgid "visualboyadvance-m" msgid "visualboyadvance-m"
msgstr "" msgstr ""
#: wxvbam.cpp:454 #: wxvbam.cpp:440
msgid "Could not create main window" msgid "Could not create main window"
msgstr "" msgstr ""
#: wxvbam.cpp:526 #: wxvbam.cpp:511
msgid "Save built-in XRC file and exit" msgid "Save built-in XRC file and exit"
msgstr "" msgstr ""
#: wxvbam.cpp:529 #: wxvbam.cpp:514
msgid "Save built-in vba-over.ini and exit" msgid "Save built-in vba-over.ini and exit"
msgstr "" msgstr ""
#: wxvbam.cpp:532 #: wxvbam.cpp:517
msgid "Print configuration path and exit" msgid "Print configuration path and exit"
msgstr "" msgstr ""
#: wxvbam.cpp:535 #: wxvbam.cpp:520
msgid "Start in full-screen mode" msgid "Start in full-screen mode"
msgstr "" msgstr ""
#: wxvbam.cpp:539 #: wxvbam.cpp:524
msgid "Delete shared link state first, if it exists" msgid "Delete shared link state first, if it exists"
msgstr "" msgstr ""
#: wxvbam.cpp:546 #: wxvbam.cpp:531
msgid "List all settable options and exit" msgid "List all settable options and exit"
msgstr "" msgstr ""
#: wxvbam.cpp:549 #: wxvbam.cpp:534
msgid "ROM file" msgid "ROM file"
msgstr "" msgstr ""
#: wxvbam.cpp:551 #: wxvbam.cpp:536
msgid "<config>=<value>" msgid "<config>=<value>"
msgstr "" msgstr ""
#: wxvbam.cpp:582 #: wxvbam.cpp:567
msgid "Configuration/build error: can't find built-in xrc" msgid "Configuration/build error: can't find built-in xrc"
msgstr "" msgstr ""
#: wxvbam.cpp:590 #: wxvbam.cpp:575
#, c-format #, c-format
msgid "" msgid ""
"Wrote built-in configuration to %s.\n" "Wrote built-in configuration to %s.\n"
@ -70,11 +70,11 @@ msgid ""
"built-in:" "built-in:"
msgstr "" msgstr ""
#: wxvbam.cpp:605 #: wxvbam.cpp:590
msgid "Configuration is read from, in order:" msgid "Configuration is read from, in order:"
msgstr "" msgstr ""
#: wxvbam.cpp:619 #: wxvbam.cpp:604
#, c-format #, c-format
msgid "" msgid ""
"Wrote built-in override file to %s\n" "Wrote built-in override file to %s\n"
@ -82,13 +82,13 @@ msgid ""
"from search path:" "from search path:"
msgstr "" msgstr ""
#: wxvbam.cpp:625 #: wxvbam.cpp:610
msgid "" msgid ""
"\n" "\n"
"\tbuilt-in" "\tbuilt-in"
msgstr "" msgstr ""
#: wxvbam.cpp:636 #: wxvbam.cpp:621
msgid "" msgid ""
"Options set from the command line are saved if any configuration changes are " "Options set from the command line are saved if any configuration changes are "
"made in the user interface.\n" "made in the user interface.\n"
@ -97,13 +97,13 @@ msgid ""
"\n" "\n"
msgstr "" msgstr ""
#: wxvbam.cpp:657 #: wxvbam.cpp:642
msgid "" msgid ""
"The commands available for the Keyboard/* option are:\n" "The commands available for the Keyboard/* option are:\n"
"\n" "\n"
msgstr "" msgstr ""
#: wxvbam.cpp:691 #: wxvbam.cpp:676
msgid "Bad configuration option or multiple ROM files given:\n" msgid "Bad configuration option or multiple ROM files given:\n"
msgstr "" msgstr ""
@ -286,62 +286,62 @@ msgstr ""
msgid "Confirm" msgid "Confirm"
msgstr "" msgstr ""
#: guiinit.cpp:2681 #: guiinit.cpp:2712
msgid "Main icon not found" msgid "Main icon not found"
msgstr "" msgstr ""
#: guiinit.cpp:2691 #: guiinit.cpp:2722
msgid "Browse" msgid "Browse"
msgstr "" msgstr ""
#: guiinit.cpp:2705 #: guiinit.cpp:2736
msgid "Main display panel not found" msgid "Main display panel not found"
msgstr "" msgstr ""
#: guiinit.cpp:2854 #: guiinit.cpp:2885
#, 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:2868 #: guiinit.cpp:2899
#, 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:3006 #: guiinit.cpp:3037
#, c-format #, c-format
msgid "Invalid menu item %s; removing" msgid "Invalid menu item %s; removing"
msgstr "" msgstr ""
#: guiinit.cpp:3214 #: guiinit.cpp:3245
msgid "Code" msgid "Code"
msgstr "" msgstr ""
#: guiinit.cpp:3223 #: guiinit.cpp:3254
msgid "Description" msgid "Description"
msgstr "" msgstr ""
#: guiinit.cpp:3297 xrc/CheatAdd.xrc:31 #: guiinit.cpp:3328 xrc/CheatAdd.xrc:31
msgid "Address" msgid "Address"
msgstr "" msgstr ""
#: guiinit.cpp:3298 #: guiinit.cpp:3329
msgid "Old Value" msgid "Old Value"
msgstr "" msgstr ""
#: guiinit.cpp:3299 #: guiinit.cpp:3330
msgid "New Value" msgid "New Value"
msgstr "" msgstr ""
#: guiinit.cpp:3811 #: guiinit.cpp:3846
msgid "Menu commands" msgid "Menu commands"
msgstr "" msgstr ""
#: guiinit.cpp:3834 #: guiinit.cpp:3869
msgid "Other commands" msgid "Other commands"
msgstr "" msgstr ""
#: guiinit.cpp:3945 #: guiinit.cpp:3980
msgid "JoyBus host invalid; disabling" msgid "JoyBus host invalid; disabling"
msgstr "" msgstr ""
@ -804,18 +804,18 @@ msgstr ""
msgid "Could not initialize the sound driver!" msgid "Could not initialize the sound driver!"
msgstr "" msgstr ""
#: cmdevents.cpp:2772 #: cmdevents.cpp:2768
msgid "Nintendo GameBoy (+Color+Advance) emulator." msgid "Nintendo GameBoy (+Color+Advance) emulator."
msgstr "" msgstr ""
#: cmdevents.cpp:2773 #: cmdevents.cpp:2769
msgid "" msgid ""
"Copyright (C) 1999-2003 Forgotten\n" "Copyright (C) 1999-2003 Forgotten\n"
"Copyright (C) 2004-2006 VBA development team\n" "Copyright (C) 2004-2006 VBA development team\n"
"Copyright (C) 2007-2017 VBA-M development team" "Copyright (C) 2007-2017 VBA-M development team"
msgstr "" msgstr ""
#: cmdevents.cpp:2774 #: cmdevents.cpp:2770
msgid "" msgid ""
"This program is free software: you can redistribute it and/or modify\n" "This program is free software: you can redistribute it and/or modify\n"
"it under the terms of the GNU General Public License as published by\n" "it under the terms of the GNU General Public License as published by\n"
@ -831,35 +831,35 @@ msgid ""
"along with this program. If not, see http://www.gnu.org/licenses ." "along with this program. If not, see http://www.gnu.org/licenses ."
msgstr "" msgstr ""
#: cmdevents.cpp:3076 #: cmdevents.cpp:3072
msgid "LAN link is already active. Disable link mode to disconnect." msgid "LAN link is already active. Disable link mode to disconnect."
msgstr "" msgstr ""
#: cmdevents.cpp:3082 #: cmdevents.cpp:3078
msgid "Network is not supported in local mode." msgid "Network is not supported in local mode."
msgstr "" msgstr ""
#: opts.cpp:560 opts.cpp:865 #: opts.cpp:561 opts.cpp:866
#, 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:577 opts.cpp:877 #: opts.cpp:578 opts.cpp:878
#, 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:584 opts.cpp:593 opts.cpp:885 opts.cpp:893 #: opts.cpp:585 opts.cpp:594 opts.cpp:886 opts.cpp:894
#, 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:653 opts.cpp:674 opts.cpp:962 opts.cpp:988 #: opts.cpp:654 opts.cpp:675 opts.cpp:963 opts.cpp:989
#, c-format #, c-format
msgid "Invalid key binding %s for %s" msgid "Invalid key binding %s for %s"
msgstr "" msgstr ""
#: opts.cpp:848 #: opts.cpp:849
#, c-format #, c-format
msgid "Invalid flag option %s - %s ignored" msgid "Invalid flag option %s - %s ignored"
msgstr "" msgstr ""
@ -1148,22 +1148,22 @@ msgstr ""
msgid "CONTROL" msgid "CONTROL"
msgstr "" msgstr ""
#: widgets/sdljoy.cpp:129 #: widgets/sdljoy.cpp:130
#, c-format #, c-format
msgid "Connected game controller %d" msgid "Connected game controller %d"
msgstr "" msgstr ""
#: widgets/sdljoy.cpp:143 #: widgets/sdljoy.cpp:144
#, c-format #, c-format
msgid "Disconnected game controller %d" msgid "Disconnected game controller %d"
msgstr "" msgstr ""
#: widgets/sdljoy.cpp:229 #: widgets/sdljoy.cpp:230
#, c-format #, c-format
msgid "Connected joystick %d" msgid "Connected joystick %d"
msgstr "" msgstr ""
#: widgets/sdljoy.cpp:246 #: widgets/sdljoy.cpp:247
#, c-format #, c-format
msgid "Disconnected joystick %d" msgid "Disconnected joystick %d"
msgstr "" msgstr ""
@ -2396,104 +2396,8 @@ msgstr ""
msgid "0 = no throttle" msgid "0 = no throttle"
msgstr "" msgstr ""
#: xrc/GeneralConfig.xrc:114 xrc/SpeedupConfig.xrc:45 #: xrc/GeneralConfig.xrc:114 xrc/SpeedupConfig.xrc:36
msgid "Full Speed/No Limit" msgid "Unlimited"
msgstr ""
#: xrc/GeneralConfig.xrc:115 xrc/SpeedupConfig.xrc:46
msgid "25%"
msgstr ""
#: xrc/GeneralConfig.xrc:116 xrc/SpeedupConfig.xrc:47
msgid "50%"
msgstr ""
#: xrc/GeneralConfig.xrc:117 xrc/SpeedupConfig.xrc:48
msgid "75%"
msgstr ""
#: xrc/GeneralConfig.xrc:118 xrc/SoundConfig.xrc:45 xrc/SpeedupConfig.xrc:49
msgid "100%"
msgstr ""
#: xrc/GeneralConfig.xrc:119 xrc/SpeedupConfig.xrc:50
msgid "125%"
msgstr ""
#: xrc/GeneralConfig.xrc:120 xrc/SpeedupConfig.xrc:51
msgid "150%"
msgstr ""
#: xrc/GeneralConfig.xrc:121 xrc/SpeedupConfig.xrc:52
msgid "175%"
msgstr ""
#: xrc/GeneralConfig.xrc:122 xrc/SpeedupConfig.xrc:53
msgid "200%"
msgstr ""
#: xrc/GeneralConfig.xrc:123 xrc/SpeedupConfig.xrc:54
msgid "225%"
msgstr ""
#: xrc/GeneralConfig.xrc:124 xrc/SpeedupConfig.xrc:55
msgid "250%"
msgstr ""
#: xrc/GeneralConfig.xrc:125 xrc/SpeedupConfig.xrc:56
msgid "275%"
msgstr ""
#: xrc/GeneralConfig.xrc:126 xrc/SpeedupConfig.xrc:57
msgid "300%"
msgstr ""
#: xrc/GeneralConfig.xrc:127 xrc/SpeedupConfig.xrc:58
msgid "325%"
msgstr ""
#: xrc/GeneralConfig.xrc:128 xrc/SpeedupConfig.xrc:59
msgid "350%"
msgstr ""
#: xrc/GeneralConfig.xrc:129 xrc/SpeedupConfig.xrc:60
msgid "375%"
msgstr ""
#: xrc/GeneralConfig.xrc:130 xrc/SpeedupConfig.xrc:61
msgid "400%"
msgstr ""
#: xrc/GeneralConfig.xrc:131 xrc/SpeedupConfig.xrc:62
msgid "425%"
msgstr ""
#: xrc/GeneralConfig.xrc:132 xrc/SpeedupConfig.xrc:63
msgid "450%"
msgstr ""
#: xrc/GeneralConfig.xrc:133 xrc/SpeedupConfig.xrc:64
msgid "475%"
msgstr ""
#: xrc/GeneralConfig.xrc:134 xrc/SpeedupConfig.xrc:65
msgid "500%"
msgstr ""
#: xrc/GeneralConfig.xrc:135 xrc/SpeedupConfig.xrc:66
msgid "525%"
msgstr ""
#: xrc/GeneralConfig.xrc:136 xrc/SpeedupConfig.xrc:67
msgid "550%"
msgstr ""
#: xrc/GeneralConfig.xrc:137 xrc/SpeedupConfig.xrc:68
msgid "575%"
msgstr ""
#: xrc/GeneralConfig.xrc:138 xrc/SpeedupConfig.xrc:69
msgid "600%"
msgstr "" msgstr ""
#: xrc/IOViewer.xrc:4 #: xrc/IOViewer.xrc:4
@ -3712,7 +3616,7 @@ msgstr ""
msgid "Speedup Throttle" msgid "Speedup Throttle"
msgstr "" msgstr ""
#: xrc/SpeedupConfig.xrc:84 #: xrc/SpeedupConfig.xrc:83
msgid "Frame skip" msgid "Frame skip"
msgstr "" msgstr ""

View File

@ -114,6 +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 OPT_NO_SPEEDUP_THROTTLE_FRAME_SKIP
}; };
@ -256,7 +257,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 = 100; uint32_t speedup_throttle = 0;
uint32_t speedup_frame_skip = 9;
bool speedup_throttle_frame_skip = true; bool speedup_throttle_frame_skip = true;
const char* preparedCheatCodes[MAX_CHEATS]; const char* preparedCheatCodes[MAX_CHEATS];
@ -392,6 +394,7 @@ struct option argOptions[] = {
{ "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 }, { "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 },
@ -554,7 +557,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("speedupThrottle", 100); speedup_throttle = ReadPref("speedupThrottle", 0);
speedup_frame_skip = ReadPref("speedupFrameSkip", 9);
speedup_throttle_frame_skip = ReadPref("speedupThrottleFrameSkip", 1); speedup_throttle_frame_skip = ReadPref("speedupThrottleFrameSkip", 1);
tripleBuffering = ReadPref("tripleBuffering", 0); tripleBuffering = ReadPref("tripleBuffering", 0);
useBios = ReadPrefHex("useBiosGBA"); useBios = ReadPrefHex("useBiosGBA");
@ -1364,6 +1368,10 @@ 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:
if (optarg)
speedup_frame_skip = atoi(optarg);
break;
case OPT_NO_SPEEDUP_THROTTLE_FRAME_SKIP: case OPT_NO_SPEEDUP_THROTTLE_FRAME_SKIP:
speedup_throttle_frame_skip = false; speedup_throttle_frame_skip = false;
break; break;

View File

@ -147,6 +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 bool speedup_throttle_frame_skip;
extern int preparedCheats; extern int preparedCheats;

View File

@ -4946,11 +4946,12 @@ void gbEmulate(int ticksToStop)
int framesToSkip = systemFrameSkip; int framesToSkip = systemFrameSkip;
static bool speedup_throttle_set = false; static bool speedup_throttle_set = false;
bool turbo_button_pressed = (gbJoymask[0] >> 10) & 1;
#ifndef __LIBRETRO__ #ifndef __LIBRETRO__
static uint32_t last_throttle; static uint32_t last_throttle;
if ((gbJoymask[0] >> 10) & 1) { if (turbo_button_pressed) {
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);
@ -4960,13 +4961,13 @@ void gbEmulate(int ticksToStop)
if (speedup_throttle_set) { if (speedup_throttle_set) {
if (speedup_throttle_frame_skip) { if (speedup_throttle_frame_skip) {
if (speedup_throttle == 0) if (speedup_throttle == 0)
framesToSkip += 9; framesToSkip += speedup_frame_skip;
else if (speedup_throttle > 100) else if (speedup_throttle > 100)
framesToSkip += std::ceil(double(speedup_throttle) / 100.0) - 1; framesToSkip += std::ceil(double(speedup_throttle) / 100.0) - 1;
} }
} }
else else
framesToSkip = 9; framesToSkip = speedup_frame_skip;
} }
else if (speedup_throttle_set) { else if (speedup_throttle_set) {
throttle = last_throttle; throttle = last_throttle;
@ -4975,7 +4976,7 @@ void gbEmulate(int ticksToStop)
speedup_throttle_set = false; speedup_throttle_set = false;
} }
#else #else
if ((gbJoymask[0] >> 10) & 1) if (turbo_button_pressed)
framesToSkip = 9; framesToSkip = 9;
#endif #endif

View File

@ -3792,11 +3792,12 @@ void CPULoop(int ticks)
int framesToSkip = systemFrameSkip; int framesToSkip = systemFrameSkip;
static bool speedup_throttle_set = false; static bool speedup_throttle_set = false;
bool turbo_button_pressed = (joy >> 10) & 1;
#ifndef __LIBRETRO__ #ifndef __LIBRETRO__
static uint32_t last_throttle; static uint32_t last_throttle;
if ((joy >> 10) & 1) { if (turbo_button_pressed) {
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);
@ -3806,13 +3807,13 @@ void CPULoop(int ticks)
if (speedup_throttle_set) { if (speedup_throttle_set) {
if (speedup_throttle_frame_skip) { if (speedup_throttle_frame_skip) {
if (speedup_throttle == 0) if (speedup_throttle == 0)
framesToSkip += 9; framesToSkip += speedup_frame_skip;
else if (speedup_throttle > 100) else if (speedup_throttle > 100)
framesToSkip += std::ceil(double(speedup_throttle) / 100.0) - 1; framesToSkip += std::ceil(double(speedup_throttle) / 100.0) - 1;
} }
} }
else else
framesToSkip = 9; framesToSkip = speedup_frame_skip;
} }
else if (speedup_throttle_set) { else if (speedup_throttle_set) {
throttle = last_throttle; throttle = last_throttle;
@ -3821,7 +3822,7 @@ void CPULoop(int ticks)
speedup_throttle_set = false; speedup_throttle_set = false;
} }
#else #else
if ((joy >> 10) & 1) if (turbo_button_pressed)
framesToSkip = 9; framesToSkip = 9;
#endif #endif

View File

@ -2322,8 +2322,18 @@ EVT_HANDLER(SpeedupConfigure, "Speedup / Turbo options...")
{ {
wxDialog* dlg = GetXRCDialog("SpeedupConfig"); wxDialog* dlg = GetXRCDialog("SpeedupConfig");
unsigned save_speedup_throttle = speedup_throttle;
unsigned save_speedup_frame_skip = speedup_frame_skip;
bool save_speedup_throttle_frame_skip = speedup_throttle_frame_skip;
if (ShowModal(dlg) == wxID_OK) if (ShowModal(dlg) == wxID_OK)
update_opts(); update_opts();
else {
// Restore values if cancel pressed.
speedup_throttle = save_speedup_throttle;
speedup_frame_skip = save_speedup_frame_skip;
speedup_throttle_frame_skip = save_speedup_throttle_frame_skip;
}
} }
EVT_HANDLER(UIConfigure, "UI Settings...") EVT_HANDLER(UIConfigure, "UI Settings...")

View File

@ -2357,46 +2357,90 @@ public:
} }
} throttle_ctrl; } throttle_ctrl;
// manage speedup key throttle spinctrl/canned setting choice interaction
static class SpeedupThrottleCtrl_t : public wxEvtHandler { static class SpeedupThrottleCtrl_t : public wxEvtHandler {
public: public:
wxSpinCtrl* speedup_throttle_spin; wxSpinCtrl* speedup_throttle_spin;
wxChoice* speedup_throttle_sel; wxCheckBox* frame_skip_cb;
// set speedup_throttle_sel from speedup_throttle
void SetSpeedupThrottleSel(wxSpinEvent& evt)
{
(void)evt; // unused params
DoSetSpeedupThrottleSel(speedup_throttle_spin->GetValue());
}
void DoSetSpeedupThrottleSel(uint32_t val)
{
if (val <= 600 && val != 100) {
speedup_throttle_sel->SetSelection(std::round((double)val / 25));
}
else
speedup_throttle_sel->SetSelection(4);
}
// set speedup_throttle from speedup_throttle_sel
void SetSpeedupThrottle(wxCommandEvent& evt) void SetSpeedupThrottle(wxCommandEvent& evt)
{ {
(void)evt; // unused params unsigned val = speedup_throttle_spin->GetValue();
uint32_t val = speedup_throttle_sel->GetSelection() * 25;
if (val <= 600 && val != 100) { evt.Skip(false);
speedup_throttle_spin->SetValue(val);
if (val == 0) {
speedup_throttle = 0;
speedup_frame_skip = 0;
speedup_throttle_frame_skip = false;
frame_skip_cb->SetValue(false);
frame_skip_cb->Disable();
if (evt.GetEventType() == wxEVT_TEXT)
return; // Do not update value if user cleared text box.
} }
else else if (val <= 600) {
speedup_throttle_spin->SetValue(100); speedup_throttle = val;
frame_skip_cb->SetValue(prev_frame_skip_cb);
frame_skip_cb->Enable();
}
else { // val > 600
speedup_throttle = 0;
unsigned rounded = std::round((double)val / 100) * 100;
speedup_frame_skip = rounded / 100 - 1;
// Round up or down to the nearest 100%.
// For example, when the up/down buttons are pressed on the spin
// control.
if ((int)(val - rounded) > 0)
speedup_frame_skip++;
else if ((int)(val - rounded) < 0)
speedup_frame_skip--;
speedup_throttle_frame_skip = true;
frame_skip_cb->SetValue(true);
frame_skip_cb->Disable();
val = (speedup_frame_skip + 1) * 100;
}
speedup_throttle_spin->SetValue(val);
} }
void SetSpeedupFrameSkip(wxCommandEvent& evt)
{
(void)evt; // Unused param.
bool checked = frame_skip_cb->GetValue();
speedup_throttle_frame_skip = prev_frame_skip_cb = checked;
}
void Init(wxShowEvent& ev) void Init(wxShowEvent& ev)
{ {
uint32_t val = 0;
if (speedup_throttle != 0)
val = speedup_throttle;
else if (speedup_frame_skip != 0)
val = (speedup_frame_skip + 1) * 100;
speedup_throttle_spin->SetValue(val);
frame_skip_cb->SetValue(speedup_throttle_frame_skip);
prev_frame_skip_cb = frame_skip_cb->GetValue();
if (val > 600 || val == 0)
frame_skip_cb->Disable();
ev.Skip(); ev.Skip();
DoSetSpeedupThrottleSel(speedup_throttle);
} }
private:
bool prev_frame_skip_cb = true;
} speedup_throttle_ctrl; } speedup_throttle_ctrl;
///////////////////////////// /////////////////////////////
@ -3416,23 +3460,39 @@ bool MainFrame::BindControls()
NULL, &throttle_ctrl); NULL, &throttle_ctrl);
d->Fit(); d->Fit();
} }
// SpeedUp Key Config // SpeedUp Key Config
d = LoadXRCDialog("SpeedupConfig"); d = LoadXRCDialog("SpeedupConfig");
{ {
getsc_uint("SpeedupThrottle", speedup_throttle); speedup_throttle_ctrl.frame_skip_cb = SafeXRCCTRL<wxCheckBox>(d, "SpeedupThrottleFrameSkip");
getcbb("SpeedupThrottleFrameSkip", speedup_throttle_frame_skip); speedup_throttle_ctrl.speedup_throttle_spin = SafeXRCCTRL<wxSpinCtrl>(d, "SpeedupThrottleSpin");
speedup_throttle_ctrl.speedup_throttle_spin = sc;
speedup_throttle_ctrl.speedup_throttle_sel = SafeXRCCTRL<wxChoice>(d, "SpeedupThrottleSel"); speedup_throttle_ctrl.speedup_throttle_spin->Connect(wxEVT_SPIN_UP,
speedup_throttle_ctrl.speedup_throttle_spin->Connect(wxEVT_COMMAND_SPINCTRL_UPDATED,
wxSpinEventHandler(SpeedupThrottleCtrl_t::SetSpeedupThrottleSel),
NULL, &speedup_throttle_ctrl);
speedup_throttle_ctrl.speedup_throttle_sel->Connect(wxEVT_COMMAND_CHOICE_SELECTED,
wxCommandEventHandler(SpeedupThrottleCtrl_t::SetSpeedupThrottle), wxCommandEventHandler(SpeedupThrottleCtrl_t::SetSpeedupThrottle),
NULL, &speedup_throttle_ctrl); NULL, &speedup_throttle_ctrl);
speedup_throttle_ctrl.speedup_throttle_spin->Connect(wxEVT_SPIN_DOWN,
wxCommandEventHandler(SpeedupThrottleCtrl_t::SetSpeedupThrottle),
NULL, &speedup_throttle_ctrl);
speedup_throttle_ctrl.speedup_throttle_spin->Connect(wxEVT_SPIN,
wxCommandEventHandler(SpeedupThrottleCtrl_t::SetSpeedupThrottle),
NULL, &speedup_throttle_ctrl);
speedup_throttle_ctrl.speedup_throttle_spin->Connect(wxEVT_TEXT,
wxCommandEventHandler(SpeedupThrottleCtrl_t::SetSpeedupThrottle),
NULL, &speedup_throttle_ctrl);
speedup_throttle_ctrl.frame_skip_cb->Connect(wxEVT_CHECKBOX,
wxCommandEventHandler(SpeedupThrottleCtrl_t::SetSpeedupFrameSkip),
NULL, &speedup_throttle_ctrl);
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();
} }
d = LoadXRCDialog("UIConfig"); d = LoadXRCDialog("UIConfig");
{ {
getcbb("HideMenuBar", gopts.hide_menu_bar); getcbb("HideMenuBar", gopts.hide_menu_bar);

View File

@ -290,8 +290,9 @@ opt_desc opts[] = {
INTOPT("preferences/skipBios", "SkipIntro", wxTRANSLATE("Skip BIOS initialization"), skipBios, 0, 1), INTOPT("preferences/skipBios", "SkipIntro", wxTRANSLATE("Skip BIOS initialization"), skipBios, 0, 1),
INTOPT("preferences/skipSaveGameCheats", "", wxTRANSLATE("Do not overwrite cheat list when loading state"), skipSaveGameCheats, 0, 1), INTOPT("preferences/skipSaveGameCheats", "", wxTRANSLATE("Do not overwrite cheat list when loading state"), skipSaveGameCheats, 0, 1),
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-600%, 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-3000%, 0 = no throttle)"), speedup_throttle, 0, 3000),
UINTOPT("preferences/speedupFrameSkip", "", wxTRANSLATE("Number of frames to skip with speedupThrottle == 0 (no throttle)"), speedup_frame_skip, 0, 300),
BOOLOPT("preferences/speedupThrottleFrameSkip", "", wxTRANSLATE("Use frame skip for speedup throttle"), speedup_throttle_frame_skip), 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),

View File

@ -111,33 +111,32 @@
<object class="sizeritem"> <object class="sizeritem">
<object class="wxChoice" name="ThrottleSel"> <object class="wxChoice" name="ThrottleSel">
<content> <content>
<item>Full Speed/No Limit</item> <item>Unlimited</item>
<item>25%</item> <item translate="0">25%</item>
<item>50%</item> <item translate="0">50%</item>
<item>75%</item> <item translate="0">75%</item>
<item>100%</item> <item translate="0">100%</item>
<item>125%</item> <item translate="0">125%</item>
<item>150%</item> <item translate="0">150%</item>
<item>175%</item> <item translate="0">175%</item>
<item>200%</item> <item translate="0">200%</item>
<item>225%</item> <item translate="0">225%</item>
<item>250%</item> <item translate="0">250%</item>
<item>275%</item> <item translate="0">275%</item>
<item>300%</item> <item translate="0">300%</item>
<item>325%</item> <item translate="0">325%</item>
<item>350%</item> <item translate="0">350%</item>
<item>375%</item> <item translate="0">375%</item>
<item>400%</item> <item translate="0">400%</item>
<item>425%</item> <item translate="0">425%</item>
<item>450%</item> <item translate="0">450%</item>
<item>475%</item> <item translate="0">475%</item>
<item>500%</item> <item translate="0">500%</item>
<item>525%</item> <item translate="0">525%</item>
<item>550%</item> <item translate="0">550%</item>
<item>575%</item> <item translate="0">575%</item>
<item>600%</item> <item translate="0">600%</item>
</content> </content>
<size>40,-1d</size>
</object> </object>
<flag>wxALL|wxALIGN_CENTRE_VERTICAL</flag> <flag>wxALL|wxALIGN_CENTRE_VERTICAL</flag>
<border>5</border> <border>5</border>

View File

@ -42,7 +42,7 @@
</object> </object>
<object class="sizeritem"> <object class="sizeritem">
<object class="wxButton" name="Volume100"> <object class="wxButton" name="Volume100">
<label>100%</label> <label translate="0">100%</label>
</object> </object>
</object> </object>
<object class="spacer"> <object class="spacer">

View File

@ -31,44 +31,10 @@
<border>5</border> <border>5</border>
</object> </object>
<object class="sizeritem"> <object class="sizeritem">
<object class="wxSpinCtrl" name="SpeedupThrottle"> <object class="wxSpinCtrl" name="SpeedupThrottleSpin">
<value>0</value> <value>0</value>
<min>0</min> <min>0</min>
<max>600</max> <max>4000</max>
</object>
<flag>wxALL|wxALIGN_CENTRE_VERTICAL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxChoice" name="SpeedupThrottleSel">
<content>
<item>Full Speed/No Limit</item>
<item>25%</item>
<item>50%</item>
<item>75%</item>
<item>100%</item>
<item>125%</item>
<item>150%</item>
<item>175%</item>
<item>200%</item>
<item>225%</item>
<item>250%</item>
<item>275%</item>
<item>300%</item>
<item>325%</item>
<item>350%</item>
<item>375%</item>
<item>400%</item>
<item>425%</item>
<item>450%</item>
<item>475%</item>
<item>500%</item>
<item>525%</item>
<item>550%</item>
<item>575%</item>
<item>600%</item>
</content>
<size>40,-1d</size>
</object> </object>
<flag>wxALL|wxALIGN_CENTRE_VERTICAL</flag> <flag>wxALL|wxALIGN_CENTRE_VERTICAL</flag>
<border>5</border> <border>5</border>