[config] Make usage of Option less verbose

* Add convenience direct accessors to individual Options.
* Move BasicOptionObserver to a separate header and allow it to
  observer multiple options. This also removes the include for
  "config/option.h" for using this observer, reducing build time.
* Never skip the "Plugin" option when changing filters. This is
  already handled properly in the GameArea class. If the plugin is
  unusable, GameArea resets the filter to the default value.
* Make the OptionID names slightly less long and fix the inconsistent
  naming in the enum.
This commit is contained in:
Fabrice de Gans 2022-10-23 17:48:14 -07:00 committed by Rafael Kitover
parent 0a104a9a9d
commit 080be1a325
15 changed files with 611 additions and 594 deletions

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-10-21 17:50-0700\n"
"POT-Creation-Date: 2022-10-23 17:33-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -21,51 +21,51 @@ msgstr ""
msgid "visualboyadvance-m"
msgstr ""
#: wxvbam.cpp:482
#: wxvbam.cpp:483
msgid "Could not create main window"
msgstr ""
#: wxvbam.cpp:553
#: wxvbam.cpp:554
msgid "Save built-in XRC file and exit"
msgstr ""
#: wxvbam.cpp:556
#: wxvbam.cpp:557
msgid "Save built-in vba-over.ini and exit"
msgstr ""
#: wxvbam.cpp:559
#: wxvbam.cpp:560
msgid "Print configuration path and exit"
msgstr ""
#: wxvbam.cpp:562
#: wxvbam.cpp:563
msgid "Start in full-screen mode"
msgstr ""
#: wxvbam.cpp:565
#: wxvbam.cpp:566
msgid "Set a configuration file"
msgstr ""
#: wxvbam.cpp:569
#: wxvbam.cpp:570
msgid "Delete shared link state first, if it exists"
msgstr ""
#: wxvbam.cpp:576
#: wxvbam.cpp:577
msgid "List all settable options and exit"
msgstr ""
#: wxvbam.cpp:579
#: wxvbam.cpp:580
msgid "ROM file"
msgstr ""
#: wxvbam.cpp:581
#: wxvbam.cpp:582
msgid "<config>=<value>"
msgstr ""
#: wxvbam.cpp:612
#: wxvbam.cpp:613
msgid "Configuration/build error: can't find built-in xrc"
msgstr ""
#: wxvbam.cpp:620
#: wxvbam.cpp:621
#, c-format
msgid ""
"Wrote built-in configuration to %s.\n"
@ -74,11 +74,11 @@ msgid ""
"built-in:"
msgstr ""
#: wxvbam.cpp:635
#: wxvbam.cpp:636
msgid "Configuration is read from, in order:"
msgstr ""
#: wxvbam.cpp:649
#: wxvbam.cpp:650
#, c-format
msgid ""
"Wrote built-in override file to %s\n"
@ -86,13 +86,13 @@ msgid ""
"from search path:"
msgstr ""
#: wxvbam.cpp:655
#: wxvbam.cpp:656
msgid ""
"\n"
"\tbuilt-in"
msgstr ""
#: wxvbam.cpp:670
#: wxvbam.cpp:671
msgid ""
"Options set from the command line are saved if any configuration changes are "
"made in the user interface.\n"
@ -101,17 +101,17 @@ msgid ""
"\n"
msgstr ""
#: wxvbam.cpp:678
#: wxvbam.cpp:679
msgid ""
"The commands available for the Keyboard/* option are:\n"
"\n"
msgstr ""
#: wxvbam.cpp:689
#: wxvbam.cpp:690
msgid "Configuration file not found."
msgstr ""
#: wxvbam.cpp:722
#: wxvbam.cpp:723
msgid "Bad configuration option or multiple ROM files given:\n"
msgstr ""
@ -163,7 +163,7 @@ msgstr ""
msgid "VBA cheat lists (*.clt)|*.clt|CHT cheat lists (*.cht)|*.cht"
msgstr ""
#: guiinit.cpp:264 panel.cpp:510
#: guiinit.cpp:264 panel.cpp:506
msgid "Loaded cheats"
msgstr ""
@ -187,7 +187,7 @@ msgstr ""
msgid "GameShark"
msgstr ""
#: guiinit.cpp:759 cmdevents.cpp:679
#: guiinit.cpp:759 cmdevents.cpp:705
msgid "GameGenie"
msgstr ""
@ -334,7 +334,7 @@ msgid "Text files (*.txt;*.log)|*.txt;*.log|"
msgstr ""
#: viewers.cpp:562 viewers.cpp:772 gfxviewers.cpp:1600 gfxviewers.cpp:1742
#: cmdevents.cpp:1161 cmdevents.cpp:1239 cmdevents.cpp:1309 cmdevents.cpp:1378
#: cmdevents.cpp:1187 cmdevents.cpp:1265 cmdevents.cpp:1335 cmdevents.cpp:1404
#: viewsupt.cpp:1180
msgid "Select output file"
msgstr ""
@ -421,11 +421,11 @@ msgid ""
"Table (*.act)|*.act"
msgstr ""
#: gfxviewers.cpp:1601 gfxviewers.cpp:1743 cmdevents.cpp:1162 viewsupt.cpp:1181
#: gfxviewers.cpp:1601 gfxviewers.cpp:1743 cmdevents.cpp:1188 viewsupt.cpp:1181
msgid "PNG images|*.png|BMP images|*.bmp"
msgstr ""
#: cmdevents.cpp:108
#: cmdevents.cpp:134
msgid ""
"GameBoy Advance Files (*.agb;*.gba;*.bin;*.elf;*.mb;*.zip;*.7z;*.rar)|*.agb;"
"*.gba;*.bin;*.elf;*.mb;*.agb.gz;*.gba.gz;*.bin.gz;*.elf.gz;*.mb.gz;*.agb.z;*."
@ -435,368 +435,368 @@ msgid ""
"*.7z;*.rar|"
msgstr ""
#: cmdevents.cpp:120
#: cmdevents.cpp:146
msgid "Open ROM file"
msgstr ""
#: cmdevents.cpp:137
#: cmdevents.cpp:163
msgid ""
"GameBoy Files (*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*."
"gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*."
"gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
msgstr ""
#: cmdevents.cpp:144
#: cmdevents.cpp:170
msgid "Open GB ROM file"
msgstr ""
#: cmdevents.cpp:161
#: cmdevents.cpp:187
msgid ""
"GameBoy Color Files (*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*."
"gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*."
"gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
msgstr ""
#: cmdevents.cpp:168
#: cmdevents.cpp:194
msgid "Open GBC ROM file"
msgstr ""
#: cmdevents.cpp:587 cmdevents.cpp:703 cmdevents.cpp:742 cmdevents.cpp:815
#: cmdevents.cpp:613 cmdevents.cpp:729 cmdevents.cpp:768 cmdevents.cpp:841
msgid "Unknown"
msgstr ""
#: cmdevents.cpp:595
#: cmdevents.cpp:621
msgid "ROM"
msgstr ""
#: cmdevents.cpp:599
#: cmdevents.cpp:625
msgid "ROM+MBC1"
msgstr ""
#: cmdevents.cpp:603
#: cmdevents.cpp:629
msgid "ROM+MBC1+RAM"
msgstr ""
#: cmdevents.cpp:607
#: cmdevents.cpp:633
msgid "ROM+MBC1+RAM+BATT"
msgstr ""
#: cmdevents.cpp:611
#: cmdevents.cpp:637
msgid "ROM+MBC2"
msgstr ""
#: cmdevents.cpp:615
#: cmdevents.cpp:641
msgid "ROM+MBC2+BATT"
msgstr ""
#: cmdevents.cpp:619
#: cmdevents.cpp:645
msgid "ROM+MMM01"
msgstr ""
#: cmdevents.cpp:623
#: cmdevents.cpp:649
msgid "ROM+MMM01+RAM"
msgstr ""
#: cmdevents.cpp:627
#: cmdevents.cpp:653
msgid "ROM+MMM01+RAM+BATT"
msgstr ""
#: cmdevents.cpp:631
#: cmdevents.cpp:657
msgid "ROM+MBC3+TIMER+BATT"
msgstr ""
#: cmdevents.cpp:635
#: cmdevents.cpp:661
msgid "ROM+MBC3+TIMER+RAM+BATT"
msgstr ""
#: cmdevents.cpp:639
#: cmdevents.cpp:665
msgid "ROM+MBC3"
msgstr ""
#: cmdevents.cpp:643
#: cmdevents.cpp:669
msgid "ROM+MBC3+RAM"
msgstr ""
#: cmdevents.cpp:647
#: cmdevents.cpp:673
msgid "ROM+MBC3+RAM+BATT"
msgstr ""
#: cmdevents.cpp:651
#: cmdevents.cpp:677
msgid "ROM+MBC5"
msgstr ""
#: cmdevents.cpp:655
#: cmdevents.cpp:681
msgid "ROM+MBC5+RAM"
msgstr ""
#: cmdevents.cpp:659
#: cmdevents.cpp:685
msgid "ROM+MBC5+RAM+BATT"
msgstr ""
#: cmdevents.cpp:663
#: cmdevents.cpp:689
msgid "ROM+MBC5+RUMBLE"
msgstr ""
#: cmdevents.cpp:667
#: cmdevents.cpp:693
msgid "ROM+MBC5+RUMBLE+RAM"
msgstr ""
#: cmdevents.cpp:671
#: cmdevents.cpp:697
msgid "ROM+MBC5+RUMBLE+RAM+BATT"
msgstr ""
#: cmdevents.cpp:675
#: cmdevents.cpp:701
msgid "ROM+MBC7+BATT"
msgstr ""
#: cmdevents.cpp:683
#: cmdevents.cpp:709
msgid "GameShark V3.0"
msgstr ""
#: cmdevents.cpp:687
#: cmdevents.cpp:713
msgid "ROM+POCKET CAMERA"
msgstr ""
#: cmdevents.cpp:691
#: cmdevents.cpp:717
msgid "ROM+BANDAI TAMA5"
msgstr ""
#: cmdevents.cpp:695
#: cmdevents.cpp:721
msgid "ROM+HuC-3"
msgstr ""
#: cmdevents.cpp:699
#: cmdevents.cpp:725
msgid "ROM+HuC-1"
msgstr ""
#: cmdevents.cpp:749 dialogs/display-config.cpp:338 xrc/DisplayConfig.xrc:85
#: cmdevents.cpp:775 dialogs/display-config.cpp:338 xrc/DisplayConfig.xrc:85
#: xrc/DisplayConfig.xrc:135 xrc/DisplayConfig.xrc:221
#: xrc/GameBoyAdvanceConfig.xrc:32 xrc/GameBoyAdvanceConfig.xrc:204
#: xrc/SoundConfig.xrc:219 xrc/SoundConfig.xrc:309
msgid "None"
msgstr ""
#: cmdevents.cpp:851 cmdevents.cpp:873
#: cmdevents.cpp:877 cmdevents.cpp:899
msgid "Select Dot Code file"
msgstr ""
#: cmdevents.cpp:853 cmdevents.cpp:875
#: cmdevents.cpp:879 cmdevents.cpp:901
msgid "e-Reader Dot Code (*.bin;*.raw)|*.bin;*.raw"
msgstr ""
#: cmdevents.cpp:894 cmdevents.cpp:1089
#: cmdevents.cpp:920 cmdevents.cpp:1115
msgid "Select battery file"
msgstr ""
#: cmdevents.cpp:895 cmdevents.cpp:1090
#: cmdevents.cpp:921 cmdevents.cpp:1116
msgid "Battery file (*.sav)|*.sav|Flash save (*.dat)|*.dat"
msgstr ""
#: cmdevents.cpp:903
#: cmdevents.cpp:929
msgid ""
"Importing a battery file will erase any saved games (permanently after the "
"next write). Do you want to continue?"
msgstr ""
#: cmdevents.cpp:904 cmdevents.cpp:932 cmdevents.cpp:1052
#: cmdevents.cpp:930 cmdevents.cpp:958 cmdevents.cpp:1078
msgid "Confirm import"
msgstr ""
#: cmdevents.cpp:910 panel.cpp:453
#: cmdevents.cpp:936 panel.cpp:449
#, c-format
msgid "Loaded battery %s"
msgstr ""
#: cmdevents.cpp:912
#: cmdevents.cpp:938
#, c-format
msgid "Error loading battery %s"
msgstr ""
#: cmdevents.cpp:921
#: cmdevents.cpp:947
msgid "Select code file"
msgstr ""
#: cmdevents.cpp:922
#: cmdevents.cpp:948
msgid "Gameshark Code File (*.spc;*.xpc)|*.spc;*.xpc"
msgstr ""
#: cmdevents.cpp:922
#: cmdevents.cpp:948
msgid "Gameshark Code File (*.gcf)|*.gcf"
msgstr ""
#: cmdevents.cpp:931
#: cmdevents.cpp:957
msgid ""
"Importing a code file will replace any loaded cheats. Do you want to "
"continue?"
msgstr ""
#: cmdevents.cpp:948
#: cmdevents.cpp:974
#, c-format
msgid "Cannot open file %s"
msgstr ""
#: cmdevents.cpp:958
#: cmdevents.cpp:984
#, c-format
msgid "Unsupported code file %s"
msgstr ""
#: cmdevents.cpp:1028
#: cmdevents.cpp:1054
#, c-format
msgid "Loaded code file %s"
msgstr ""
#: cmdevents.cpp:1030
#: cmdevents.cpp:1056
#, c-format
msgid "Error loading code file %s"
msgstr ""
#: cmdevents.cpp:1041 cmdevents.cpp:1117
#: cmdevents.cpp:1067 cmdevents.cpp:1143
msgid "Select snapshot file"
msgstr ""
#: cmdevents.cpp:1042
#: cmdevents.cpp:1068
msgid ""
"GS & PAC Snapshots (*.sps;*.xps)|*.sps;*.xps|GameShark SP Snapshots (*.gsv)|"
"*.gsv"
msgstr ""
#: cmdevents.cpp:1042
#: cmdevents.cpp:1068
msgid "Gameboy Snapshot (*.gbs)|*.gbs"
msgstr ""
#: cmdevents.cpp:1051
#: cmdevents.cpp:1077
msgid ""
"Importing a snapshot file will erase any saved games (permanently after the "
"next write). Do you want to continue?"
msgstr ""
#: cmdevents.cpp:1076
#: cmdevents.cpp:1102
#, c-format
msgid "Loaded snapshot file %s"
msgstr ""
#: cmdevents.cpp:1078
#: cmdevents.cpp:1104
#, c-format
msgid "Error loading snapshot file %s"
msgstr ""
#: cmdevents.cpp:1101
#: cmdevents.cpp:1127
#, c-format
msgid "Wrote battery %s"
msgstr ""
#: cmdevents.cpp:1103 panel.cpp:762
#: cmdevents.cpp:1129 panel.cpp:755
#, c-format
msgid "Error writing battery %s"
msgstr ""
#: cmdevents.cpp:1111
#: cmdevents.cpp:1137
msgid "EEPROM saves cannot be exported"
msgstr ""
#: cmdevents.cpp:1118
#: cmdevents.cpp:1144
msgid "Gameshark Snapshot (*.sps)|*.sps"
msgstr ""
#: cmdevents.cpp:1132
#: cmdevents.cpp:1158
msgid "Exported from VisualBoyAdvance-M"
msgstr ""
#: cmdevents.cpp:1144
#: cmdevents.cpp:1170
#, c-format
msgid "Saved snapshot file %s"
msgstr ""
#: cmdevents.cpp:1146
#: cmdevents.cpp:1172
#, c-format
msgid "Error saving snapshot file %s"
msgstr ""
#: cmdevents.cpp:1186 sys.cpp:557
#: cmdevents.cpp:1212 sys.cpp:557
#, c-format
msgid "Wrote snapshot %s"
msgstr ""
#: cmdevents.cpp:1207 cmdevents.cpp:1277 cmdevents.cpp:1348 cmdevents.cpp:1412
#: cmdevents.cpp:1233 cmdevents.cpp:1303 cmdevents.cpp:1374 cmdevents.cpp:1438
msgid " files ("
msgstr ""
#: cmdevents.cpp:1443
#: cmdevents.cpp:1469
msgid "Select file"
msgstr ""
#: cmdevents.cpp:1760 cmdevents.cpp:1853
#: cmdevents.cpp:1786 cmdevents.cpp:1879
msgid "Select state file"
msgstr ""
#: cmdevents.cpp:1761 cmdevents.cpp:1854
#: cmdevents.cpp:1787 cmdevents.cpp:1880
msgid "VisualBoyAdvance saved game files|*.sgm"
msgstr ""
#: cmdevents.cpp:1884 cmdevents.cpp:1894 cmdevents.cpp:1905
#: cmdevents.cpp:1910 cmdevents.cpp:1920 cmdevents.cpp:1931
#, c-format
msgid "Current state slot #%d"
msgstr ""
#: cmdevents.cpp:1975
#: cmdevents.cpp:2001
msgid "Cannot use Colorizer Hack when GB BIOS File is enabled."
msgstr ""
#: cmdevents.cpp:2190
#: cmdevents.cpp:2216
msgid "Sound enabled"
msgstr ""
#: cmdevents.cpp:2190
#: cmdevents.cpp:2216
msgid "Sound disabled"
msgstr ""
#: cmdevents.cpp:2203 cmdevents.cpp:2217
#: cmdevents.cpp:2229 cmdevents.cpp:2243
#, c-format
msgid "Volume: %d%%"
msgstr ""
#: cmdevents.cpp:2292
#: cmdevents.cpp:2318
msgid "Set to 0 for pseudo tty"
msgstr ""
#: cmdevents.cpp:2294
#: cmdevents.cpp:2320
msgid "Port to wait for connection:"
msgstr ""
#: cmdevents.cpp:2295
#: cmdevents.cpp:2321
msgid "GDB Connection"
msgstr ""
#: cmdevents.cpp:2348
#: cmdevents.cpp:2374
#, c-format
msgid "Waiting for connection at %s"
msgstr ""
#: cmdevents.cpp:2355
#: cmdevents.cpp:2381
#, c-format
msgid "Waiting for connection on port %d"
msgstr ""
#: cmdevents.cpp:2358
#: cmdevents.cpp:2384
msgid "Waiting for GDB..."
msgstr ""
#: cmdevents.cpp:2802 panel.cpp:255 panel.cpp:369
#: cmdevents.cpp:2808 panel.cpp:250 panel.cpp:364
msgid "Could not initialize the sound driver!"
msgstr ""
#: cmdevents.cpp:2906
#: cmdevents.cpp:2912
msgid "Nintendo GameBoy (+Color+Advance) emulator."
msgstr ""
#: cmdevents.cpp:2907
#: cmdevents.cpp:2913
msgid ""
"Copyright (C) 1999-2003 Forgotten\n"
"Copyright (C) 2004-2006 VBA development team\n"
"Copyright (C) 2007-2020 VBA-M development team"
msgstr ""
#: cmdevents.cpp:2908
#: cmdevents.cpp:2914
msgid ""
"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"
@ -812,29 +812,29 @@ msgid ""
"along with this program. If not, see http://www.gnu.org/licenses ."
msgstr ""
#: cmdevents.cpp:3168
#: cmdevents.cpp:3165
msgid "Cannot use GB BIOS when Colorizer Hack is enabled."
msgstr ""
#: cmdevents.cpp:3233
#: cmdevents.cpp:3226
msgid "LAN link is already active. Disable link mode to disconnect."
msgstr ""
#: cmdevents.cpp:3239
#: cmdevents.cpp:3232
msgid "Network is not supported in local mode."
msgstr ""
#: opts.cpp:542 opts.cpp:563 opts.cpp:768
#: opts.cpp:543 opts.cpp:564 opts.cpp:769
#, c-format
msgid "Invalid key binding %s for %s"
msgstr ""
#: opts.cpp:691 opts.cpp:700 opts.cpp:709 opts.cpp:718 config/option.cpp:477
#: opts.cpp:692 opts.cpp:701 opts.cpp:710 opts.cpp:719 config/option.cpp:462
#, c-format
msgid "Invalid value %s for option %s"
msgstr ""
#: opts.cpp:790
#: opts.cpp:791
#, c-format
msgid "Unknown option %s with value %s"
msgstr ""
@ -914,177 +914,177 @@ msgstr ""
msgid "Error setting up server socket (%d)"
msgstr ""
#: panel.cpp:169
#: panel.cpp:164
#, c-format
msgid "%s is not a valid ROM file"
msgstr ""
#: panel.cpp:170 panel.cpp:231 panel.cpp:307
#: panel.cpp:165 panel.cpp:226 panel.cpp:302
msgid "Problem loading file"
msgstr ""
#: panel.cpp:230
#: panel.cpp:225
#, c-format
msgid "Unable to load Game Boy ROM %s"
msgstr ""
#: panel.cpp:267
#: panel.cpp:262
msgid ""
"Cannot use GB BIOS file when Colorizer Hack is enabled, disabling GB BIOS "
"file."
msgstr ""
#: panel.cpp:283 panel.cpp:383
#: panel.cpp:278 panel.cpp:378
#, c-format
msgid "Could not load BIOS %s"
msgstr ""
#: panel.cpp:306
#: panel.cpp:301
#, c-format
msgid "Unable to load Game Boy Advance ROM %s"
msgstr ""
#: panel.cpp:542
#: panel.cpp:538
msgid " player "
msgstr ""
#: panel.cpp:710
#: panel.cpp:703
#, c-format
msgid "Loaded state %s"
msgstr ""
#: panel.cpp:710
#: panel.cpp:703
#, c-format
msgid "Error loading state %s"
msgstr ""
#: panel.cpp:734
#: panel.cpp:727
#, c-format
msgid "Saved state %s"
msgstr ""
#: panel.cpp:734
#: panel.cpp:727
#, c-format
msgid "Error saving state %s"
msgstr ""
#: panel.cpp:944
#: panel.cpp:931
#, c-format
msgid "Fullscreen mode %dx%d-%d@%d not supported; looking for another"
msgstr ""
#: panel.cpp:982
#: panel.cpp:969
#, c-format
msgid "Fullscreen mode %dx%d-%d@%d not supported"
msgstr ""
#: panel.cpp:987
#: panel.cpp:974
#, c-format
msgid "Valid mode: %dx%d-%d@%d"
msgstr ""
#: panel.cpp:995
#: panel.cpp:982
#, c-format
msgid "Chose mode %dx%d-%d@%d"
msgstr ""
#: panel.cpp:999
#: panel.cpp:986
#, c-format
msgid "Failed to change mode to %dx%d-%d@%d"
msgstr ""
#: panel.cpp:1087
#: panel.cpp:1074
msgid "Not a valid GBA cartridge"
msgstr ""
#: panel.cpp:1255
#: panel.cpp:1242
msgid "No memory for rewinding"
msgstr ""
#: panel.cpp:1265
#: panel.cpp:1252
msgid "Error writing rewind state"
msgstr ""
#: panel.cpp:2285
#: panel.cpp:2269
msgid "Enabling EGL VSync."
msgstr ""
#: panel.cpp:2287
#: panel.cpp:2271
msgid "Disabling EGL VSync."
msgstr ""
#: panel.cpp:2294
#: panel.cpp:2278
msgid "Enabling GLX VSync."
msgstr ""
#: panel.cpp:2296
#: panel.cpp:2280
msgid "Disabling GLX VSync."
msgstr ""
#: panel.cpp:2314
#: panel.cpp:2297
msgid "Failed to set glXSwapIntervalEXT"
msgstr ""
#: panel.cpp:2323
#: panel.cpp:2306
msgid "Failed to set glXSwapIntervalSGI"
msgstr ""
#: panel.cpp:2332
#: panel.cpp:2315
msgid "Failed to set glXSwapIntervalMESA"
msgstr ""
#: panel.cpp:2339
#: panel.cpp:2322
msgid "No support for wglGetExtensionsStringEXT"
msgstr ""
#: panel.cpp:2342
#: panel.cpp:2325
msgid "No support for WGL_EXT_swap_control"
msgstr ""
#: panel.cpp:2351
#: panel.cpp:2334
msgid "Failed to set wglSwapIntervalEXT"
msgstr ""
#: panel.cpp:2357
#: panel.cpp:2340
msgid "No VSYNC available on this platform"
msgstr ""
#: panel.cpp:2453
#: panel.cpp:2439
msgid "memory allocation error"
msgstr ""
#: panel.cpp:2456
#: panel.cpp:2442
msgid "error initializing codec"
msgstr ""
#: panel.cpp:2459
#: panel.cpp:2445
msgid "error writing to output file"
msgstr ""
#: panel.cpp:2462
#: panel.cpp:2448
msgid "can't guess output format from file name"
msgstr ""
#: panel.cpp:2467
#: panel.cpp:2453
msgid "programming error; aborting!"
msgstr ""
#: panel.cpp:2479 panel.cpp:2508
#: panel.cpp:2465 panel.cpp:2494
#, c-format
msgid "Unable to begin recording to %s (%s)"
msgstr ""
#: panel.cpp:2536
#: panel.cpp:2522
#, c-format
msgid "Error in audio/video recording (%s); aborting"
msgstr ""
#: panel.cpp:2542
#: panel.cpp:2528
#, c-format
msgid "Error in audio recording (%s); aborting"
msgstr ""
#: panel.cpp:2552
#: panel.cpp:2538
#, c-format
msgid "Error in video recording (%s); aborting"
msgstr ""
@ -1540,38 +1540,39 @@ msgstr ""
msgid "Invalid value %s for option %s; valid values are %s"
msgstr ""
#: config/option.cpp:330
#: config/option.cpp:315
#, c-format
msgid "Invalid value %f for option %s; valid values are %f - %f"
msgstr ""
#: config/option.cpp:348 config/option.cpp:366
#: config/option.cpp:333 config/option.cpp:351
#, c-format
msgid "Invalid value %d for option %s; valid values are %d - %d"
msgstr ""
#: config/option.cpp:458
#: config/option.cpp:443
#, c-format
msgid "Invalid value %d for option %s; valid values are %s"
msgstr ""
#: dialogs/display-config.cpp:370
#: dialogs/display-config.cpp:369
#, c-format
msgid "No usable rpi plugins found in %s"
msgstr ""
#: dialogs/display-config.cpp:400
#, c-format
msgid "Using pixel filter: %s"
#: dialogs/display-config.cpp:401 dialogs/display-config.cpp:443
#: xrc/DisplayConfig.xrc:107
msgid "Plugin"
msgstr ""
#: dialogs/display-config.cpp:408
#, c-format
msgid "Using interframe blending: %s"
msgid "Using pixel filter: %s"
msgstr ""
#: dialogs/display-config.cpp:438 xrc/DisplayConfig.xrc:107
msgid "Plugin"
#: dialogs/display-config.cpp:415
#, c-format
msgid "Using interframe blending: %s"
msgstr ""
#: widgets/keyedit.cpp:122 widgets/keyedit.cpp:280

View File

@ -755,6 +755,7 @@ set(
wxutil.cpp
config/game-control.cpp
config/internal/option-internal.cpp
config/option-observer.cpp
config/option.cpp
config/user-input.cpp
dialogs/display-config.cpp
@ -799,6 +800,8 @@ set(
wxutil.h
config/game-control.h
config/internal/option-internal.h
config/option-id.h
config/option-observer.h
config/option.h
config/user-input.h
dialogs/display-config.h

View File

@ -2555,35 +2555,34 @@ EVT_HANDLER(GameBoyConfigure, "Game Boy options...")
update_opts();
}
// FIXME: These should be changed so AdjustSize() is called somewhere else.
EVT_HANDLER(SetSize1x, "1x")
{
config::Option::ByID(config::OptionID::kDisplayScale)->SetDouble(1);
config::OptDispScale()->SetDouble(1);
}
EVT_HANDLER(SetSize2x, "2x")
{
config::Option::ByID(config::OptionID::kDisplayScale)->SetDouble(2);
config::OptDispScale()->SetDouble(2);
}
EVT_HANDLER(SetSize3x, "3x")
{
config::Option::ByID(config::OptionID::kDisplayScale)->SetDouble(3);
config::OptDispScale()->SetDouble(3);
}
EVT_HANDLER(SetSize4x, "4x")
{
config::Option::ByID(config::OptionID::kDisplayScale)->SetDouble(4);
config::OptDispScale()->SetDouble(4);
}
EVT_HANDLER(SetSize5x, "5x")
{
config::Option::ByID(config::OptionID::kDisplayScale)->SetDouble(5);
config::OptDispScale()->SetDouble(5);
}
EVT_HANDLER(SetSize6x, "6x")
{
config::Option::ByID(config::OptionID::kDisplayScale)->SetDouble(6);
config::OptDispScale()->SetDouble(6);
}
EVT_HANDLER(GameBoyAdvanceConfigure, "Game Boy Advance options...")
@ -2763,17 +2762,12 @@ EVT_HANDLER_MASK(DisplayConfigure, "Display options...", CMDEN_NREC_ANY)
EVT_HANDLER_MASK(ChangeFilter, "Change Pixel Filter", CMDEN_NREC_ANY)
{
const wxString& filter_plugin =
config::Option::ByID(config::OptionID::kDisplayFilterPlugin)
->GetString();
// Skip the filter plugin if it is not set.
config::Option::ByID(config::OptionID::kDisplayFilter)
->NextFilter(filter_plugin == wxEmptyString);
config::OptDispFilter()->NextFilter();
}
EVT_HANDLER_MASK(ChangeIFB, "Change Interframe Blending", CMDEN_NREC_ANY)
{
config::Option::ByID(config::OptionID::kDisplayIFB)->NextInterframe();
config::OptDispIFB()->NextInterframe();
}
EVT_HANDLER_MASK(SoundConfigure, "Sound options...", CMDEN_NREC_ANY)
@ -2966,24 +2960,16 @@ EVT_HANDLER(wxID_ABOUT, "About...")
EVT_HANDLER(Bilinear, "Use bilinear filter with 3d renderer")
{
GetMenuOptionBool("Bilinear", &gopts.bilinear);
// Force new panel with new bilinear option
if (panel->panel) {
panel->panel->Destroy();
panel->panel = nullptr;
}
// Force new panel with new bilinear option.
panel->ResetPanel();
update_opts();
}
EVT_HANDLER(RetainAspect, "Retain aspect ratio when resizing")
{
GetMenuOptionBool("RetainAspect", &gopts.retain_aspect);
// Force new panel with new aspect ratio options.
if (panel->panel) {
panel->panel->Destroy();
panel->panel = nullptr;
}
panel->ResetPanel();
update_opts();
}
@ -3137,7 +3123,7 @@ EVT_HANDLER(FrameSkipAuto, "Auto Skip frames.")
EVT_HANDLER(Fullscreen, "Enter fullscreen mode at startup")
{
GetMenuOptionConfig("Fullscreen", config::OptionID::kgeometryfullScreen);
GetMenuOptionConfig("Fullscreen", config::OptionID::kGeomFullScreen);
}
EVT_HANDLER(PauseWhenInactive, "Pause game when main window loses focus")
@ -3196,11 +3182,7 @@ EVT_HANDLER(VSync, "Wait for vertical sync")
{
GetMenuOptionInt("VSync", &vsync, 1);
update_opts();
if (panel->panel) {
panel->panel->Destroy();
panel->panel = nullptr;
}
panel->ResetPanel();
}
void MainFrame::EnableNetworkMenu()

View File

@ -162,15 +162,15 @@ std::array<Option, kNbOptions>& Option::All() {
// translation initialization has already happened.
static std::array<Option, kNbOptions> g_all_opts = {
/// Display
Option(OptionID::kDisplayBilinear, &gopts.bilinear),
Option(OptionID::kDisplayFilter, &g_owned_opts.filter),
Option(OptionID::kDisplayFilterPlugin, &g_owned_opts.filter_plugin),
Option(OptionID::kDisplayIFB, &g_owned_opts.interframe),
Option(OptionID::kDisplayKeepOnTop, &gopts.keep_on_top),
Option(OptionID::kDisplayMaxThreads, &gopts.max_threads, 1, 256),
Option(OptionID::kDisplayRenderMethod, &g_owned_opts.render_method),
Option(OptionID::kDisplayScale, &g_owned_opts.video_scale, 1, 6),
Option(OptionID::kDisplayStretch, &gopts.retain_aspect),
Option(OptionID::kDispBilinear, &gopts.bilinear),
Option(OptionID::kDispFilter, &g_owned_opts.filter),
Option(OptionID::kDispFilterPlugin, &g_owned_opts.filter_plugin),
Option(OptionID::kDispIFB, &g_owned_opts.interframe),
Option(OptionID::kDispKeepOnTop, &gopts.keep_on_top),
Option(OptionID::kDispMaxThreads, &gopts.max_threads, 1, 256),
Option(OptionID::kDispRenderMethod, &g_owned_opts.render_method),
Option(OptionID::kDispScale, &g_owned_opts.video_scale, 1, 6),
Option(OptionID::kDispStretch, &gopts.retain_aspect),
/// GB
Option(OptionID::kGBBiosFile, &gopts.gb_bios),
@ -202,93 +202,93 @@ std::array<Option, kNbOptions>& Option::All() {
Option(OptionID::kGBAROMDir, &gopts.gba_rom_dir),
/// General
Option(OptionID::kGeneralAutoLoadLastState, &gopts.autoload_state),
Option(OptionID::kGeneralBatteryDir, &gopts.battery_dir),
Option(OptionID::kGeneralFreezeRecent, &gopts.recent_freeze),
Option(OptionID::kGeneralRecordingDir, &gopts.recording_dir),
Option(OptionID::kGeneralRewindInterval, &gopts.rewind_interval, 0,
Option(OptionID::kGenAutoLoadLastState, &gopts.autoload_state),
Option(OptionID::kGenBatteryDir, &gopts.battery_dir),
Option(OptionID::kGenFreezeRecent, &gopts.recent_freeze),
Option(OptionID::kGenRecordingDir, &gopts.recording_dir),
Option(OptionID::kGenRewindInterval, &gopts.rewind_interval, 0,
600),
Option(OptionID::kGeneralScreenshotDir, &gopts.scrshot_dir),
Option(OptionID::kGeneralStateDir, &gopts.state_dir),
Option(OptionID::kGeneralStatusBar, &gopts.statusbar, 0, 1),
Option(OptionID::kGenScreenshotDir, &gopts.scrshot_dir),
Option(OptionID::kGenStateDir, &gopts.state_dir),
Option(OptionID::kGenStatusBar, &gopts.statusbar, 0, 1),
/// Joypad
Option(OptionID::kJoypad),
Option(OptionID::kJoypadAutofireThrottle, &gopts.autofire_rate, 1,
Option(OptionID::kJoy),
Option(OptionID::kJoyAutofireThrottle, &gopts.autofire_rate, 1,
1000),
Option(OptionID::kJoypadDefault, &gopts.default_stick, 1, 4),
Option(OptionID::kJoyDefault, &gopts.default_stick, 1, 4),
/// Keyboard
Option(OptionID::kKeyboard),
// Core
Option(OptionID::kpreferencesagbPrint, &agbPrint, 0, 1),
Option(OptionID::kpreferencesautoFrameSkip, &autoFrameSkip, 0, 1),
Option(OptionID::kpreferencesautoPatch, &autoPatch, 0, 1),
Option(OptionID::kpreferencesautoSaveLoadCheatList,
Option(OptionID::kPrefAgbPrint, &agbPrint, 0, 1),
Option(OptionID::kPrefAutoFrameSkip, &autoFrameSkip, 0, 1),
Option(OptionID::kPrefAutoPatch, &autoPatch, 0, 1),
Option(OptionID::kPrefAutoSaveLoadCheatList,
&gopts.autoload_cheats),
Option(OptionID::kpreferencesborderAutomatic, &gbBorderAutomatic, 0, 1),
Option(OptionID::kpreferencesborderOn, &gbBorderOn, 0, 1),
Option(OptionID::kpreferencescaptureFormat, &captureFormat, 0, 1),
Option(OptionID::kpreferencescheatsEnabled, &cheatsEnabled, 0, 1),
Option(OptionID::kPrefBorderAutomatic, &gbBorderAutomatic, 0, 1),
Option(OptionID::kPrefBorderOn, &gbBorderOn, 0, 1),
Option(OptionID::kPrefCaptureFormat, &captureFormat, 0, 1),
Option(OptionID::kPrefCheatsEnabled, &cheatsEnabled, 0, 1),
#ifdef MMX
Option(OptionID::kpreferencesenableMMX, &enableMMX, 0, 1),
Option(OptionID::kPrefEnableMMX, &enableMMX, 0, 1),
#endif
Option(OptionID::kpreferencesdisableStatus, &disableStatusMessages, 0,
Option(OptionID::kPrefDisableStatus, &disableStatusMessages, 0,
1),
Option(OptionID::kpreferencesemulatorType, &gbEmulatorType, 0, 5),
Option(OptionID::kpreferencesflashSize, &optFlashSize, 0, 1),
Option(OptionID::kpreferencesframeSkip, &frameSkip, -1, 9),
Option(OptionID::kpreferencesfsColorDepth, &fsColorDepth, 0, 999),
Option(OptionID::kpreferencesfsFrequency, &fsFrequency, 0, 999),
Option(OptionID::kpreferencesfsHeight, &fsHeight, 0, 99999),
Option(OptionID::kpreferencesfsWidth, &fsWidth, 0, 99999),
Option(OptionID::kpreferencesgbPaletteOption, &gbPaletteOption, 0, 2),
Option(OptionID::kpreferencesgbPrinter, &winGbPrinterEnabled, 0, 1),
Option(OptionID::kpreferencesgdbBreakOnLoad, &gdbBreakOnLoad, 0, 1),
Option(OptionID::kpreferencesgdbPort, &gdbPort, 0, 65535),
Option(OptionID::kPrefEmulatorType, &gbEmulatorType, 0, 5),
Option(OptionID::kPrefFlashSize, &optFlashSize, 0, 1),
Option(OptionID::kPrefFrameSkip, &frameSkip, -1, 9),
Option(OptionID::kPrefFsColorDepth, &fsColorDepth, 0, 999),
Option(OptionID::kPrefFsFrequency, &fsFrequency, 0, 999),
Option(OptionID::kPrefFsHeight, &fsHeight, 0, 99999),
Option(OptionID::kPrefFsWidth, &fsWidth, 0, 99999),
Option(OptionID::kPrefGBPaletteOption, &gbPaletteOption, 0, 2),
Option(OptionID::kPrefGBPrinter, &winGbPrinterEnabled, 0, 1),
Option(OptionID::kPrefGDBBreakOnLoad, &gdbBreakOnLoad, 0, 1),
Option(OptionID::kPrefGDBPort, &gdbPort, 0, 65535),
#ifndef NO_LINK
Option(OptionID::kpreferencesLinkNumPlayers, &linkNumPlayers, 2, 4),
Option(OptionID::kPrefLinkNumPlayers, &linkNumPlayers, 2, 4),
#endif
Option(OptionID::kpreferencesmaxScale, &maxScale, 0, 100),
Option(OptionID::kpreferencespauseWhenInactive, &pauseWhenInactive, 0,
Option(OptionID::kPrefMaxScale, &maxScale, 0, 100),
Option(OptionID::kPrefPauseWhenInactive, &pauseWhenInactive, 0,
1),
Option(OptionID::kpreferencesrtcEnabled, &rtcEnabled, 0, 1),
Option(OptionID::kpreferencessaveType, &cpuSaveType, 0, 5),
Option(OptionID::kpreferencesshowSpeed, &showSpeed, 0, 2),
Option(OptionID::kpreferencesshowSpeedTransparent,
Option(OptionID::kPrefRTCEnabled, &rtcEnabled, 0, 1),
Option(OptionID::kPrefSaveType, &cpuSaveType, 0, 5),
Option(OptionID::kPrefShowSpeed, &showSpeed, 0, 2),
Option(OptionID::kPrefShowSpeedTransparent,
&showSpeedTransparent, 0, 1),
Option(OptionID::kpreferencesskipBios, &skipBios, 0, 1),
Option(OptionID::kpreferencesskipSaveGameCheats, &skipSaveGameCheats, 0,
Option(OptionID::kPrefSkipBios, &skipBios, 0, 1),
Option(OptionID::kPrefSkipSaveGameCheats, &skipSaveGameCheats, 0,
1),
Option(OptionID::kpreferencesskipSaveGameBattery, &skipSaveGameBattery,
Option(OptionID::kPrefSkipSaveGameBattery, &skipSaveGameBattery,
0, 1),
Option(OptionID::kpreferencesthrottle, &throttle, 0, 450),
Option(OptionID::kpreferencesspeedupThrottle, &speedup_throttle, 0,
Option(OptionID::kPrefThrottle, &throttle, 0, 450),
Option(OptionID::kPrefSpeedupThrottle, &speedup_throttle, 0,
3000),
Option(OptionID::kpreferencesspeedupFrameSkip, &speedup_frame_skip, 0,
Option(OptionID::kPrefSpeedupFrameSkip, &speedup_frame_skip, 0,
300),
Option(OptionID::kpreferencesspeedupThrottleFrameSkip,
Option(OptionID::kPrefSpeedupThrottleFrameSkip,
&speedup_throttle_frame_skip),
Option(OptionID::kpreferencesuseBiosGB, &useBiosFileGB, 0, 1),
Option(OptionID::kpreferencesuseBiosGBA, &useBiosFileGBA, 0, 1),
Option(OptionID::kpreferencesuseBiosGBC, &useBiosFileGBC, 0, 1),
Option(OptionID::kpreferencesvsync, &vsync, 0, 1),
Option(OptionID::kPrefUseBiosGB, &useBiosFileGB, 0, 1),
Option(OptionID::kPrefUseBiosGBA, &useBiosFileGBA, 0, 1),
Option(OptionID::kPrefUseBiosGBC, &useBiosFileGBC, 0, 1),
Option(OptionID::kPrefVsync, &vsync, 0, 1),
/// Geometry
Option(OptionID::kgeometryfullScreen, &fullScreen, 0, 1),
Option(OptionID::kgeometryisMaximized, &windowMaximized, 0, 1),
Option(OptionID::kgeometrywindowHeight, &windowHeight, 0, 99999),
Option(OptionID::kgeometrywindowWidth, &windowWidth, 0, 99999),
Option(OptionID::kgeometrywindowX, &windowPositionX, -1, 99999),
Option(OptionID::kgeometrywindowY, &windowPositionY, -1, 99999),
Option(OptionID::kGeomFullScreen, &fullScreen, 0, 1),
Option(OptionID::kGeomIsMaximized, &windowMaximized, 0, 1),
Option(OptionID::kGeomWindowHeight, &windowHeight, 0, 99999),
Option(OptionID::kGeomWindowWidth, &windowWidth, 0, 99999),
Option(OptionID::kGeomWindowX, &windowPositionX, -1, 99999),
Option(OptionID::kGeomWindowY, &windowPositionY, -1, 99999),
/// UI
Option(OptionID::kuiallowKeyboardBackgroundInput,
Option(OptionID::kUIAllowKeyboardBackgroundInput,
&allowKeyboardBackgroundInput),
Option(OptionID::kuiallowJoystickBackgroundInput,
Option(OptionID::kUIAllowJoystickBackgroundInput,
&allowJoystickBackgroundInput),
Option(OptionID::kuihideMenuBar, &gopts.hide_menu_bar),
Option(OptionID::kUIHideMenuBar, &gopts.hide_menu_bar),
/// Sound
Option(OptionID::kSoundAudioAPI, &gopts.audio_api),

146
src/wx/config/option-id.h Normal file
View File

@ -0,0 +1,146 @@
#ifndef VBAM_WX_CONFIG_OPTION_ID_H_
#define VBAM_WX_CONFIG_OPTION_ID_H_
namespace config {
enum class OptionID {
// Display
kDispBilinear = 0,
kDispFilter,
kDispFilterPlugin,
kDispIFB,
kDispKeepOnTop,
kDispMaxThreads,
kDispRenderMethod,
kDispScale,
kDispStretch,
/// GB
kGBBiosFile,
kGBColorOption,
kGBColorizerHack,
kGBLCDFilter,
kGBGBCBiosFile,
kGBPalette0,
kGBPalette1,
kGBPalette2,
kGBPrintAutoPage,
kGBPrintScreenCap,
kGBROMDir,
kGBGBCROMDir,
/// GBA
kGBABiosFile,
kGBALCDFilter,
#ifndef NO_LINK
kGBALinkAuto,
kGBALinkFast,
kGBALinkHost,
kGBAServerIP,
kGBALinkPort,
kGBALinkProto,
kGBALinkTimeout,
kGBALinkType,
#endif
kGBAROMDir,
/// General
kGenAutoLoadLastState,
kGenBatteryDir,
kGenFreezeRecent,
kGenRecordingDir,
kGenRewindInterval,
kGenScreenshotDir,
kGenStateDir,
kGenStatusBar,
/// Joypad
kJoy,
kJoyAutofireThrottle,
kJoyDefault,
/// Keyboard
kKeyboard,
// Core
kPrefAgbPrint,
kPrefAutoFrameSkip,
kPrefAutoPatch,
kPrefAutoSaveLoadCheatList,
kPrefBorderAutomatic,
kPrefBorderOn,
kPrefCaptureFormat,
kPrefCheatsEnabled,
#ifdef MMX
kPrefEnableMMX,
#endif
kPrefDisableStatus,
kPrefEmulatorType,
kPrefFlashSize,
kPrefFrameSkip,
kPrefFsColorDepth,
kPrefFsFrequency,
kPrefFsHeight,
kPrefFsWidth,
kPrefGBPaletteOption,
kPrefGBPrinter,
kPrefGDBBreakOnLoad,
kPrefGDBPort,
#ifndef NO_LINK
kPrefLinkNumPlayers,
#endif
kPrefMaxScale,
kPrefPauseWhenInactive,
kPrefRTCEnabled,
kPrefSaveType,
kPrefShowSpeed,
kPrefShowSpeedTransparent,
kPrefSkipBios,
kPrefSkipSaveGameCheats,
kPrefSkipSaveGameBattery,
kPrefThrottle,
kPrefSpeedupThrottle,
kPrefSpeedupFrameSkip,
kPrefSpeedupThrottleFrameSkip,
kPrefUseBiosGB,
kPrefUseBiosGBA,
kPrefUseBiosGBC,
kPrefVsync,
/// Geometry
kGeomFullScreen,
kGeomIsMaximized,
kGeomWindowHeight,
kGeomWindowWidth,
kGeomWindowX,
kGeomWindowY,
/// UI
kUIAllowKeyboardBackgroundInput,
kUIAllowJoystickBackgroundInput,
kUIHideMenuBar,
/// Sound
kSoundAudioAPI,
kSoundAudioDevice,
kSoundBuffers,
kSoundEnable,
kSoundGBAFiltering,
kSoundGBAInterpolation,
kSoundGBDeclicking,
kSoundGBEcho,
kSoundGBEnableEffects,
kSoundGBStereo,
kSoundGBSurround,
kSoundQuality,
kSoundVolume,
// Do not add anything under here.
Last,
};
static constexpr size_t kNbOptions = static_cast<size_t>(OptionID::Last);
} // namespace config
#endif // VBAM_WX_CONFIG_OPTION_ID_H_

View File

@ -0,0 +1,39 @@
#include "config/option-observer.h"
#include "config/option.h"
namespace config {
// An Option::Observer that calls a callback when an option has changed.
class OptionsObserver::CallbackOptionObserver : public Option::Observer {
public:
CallbackOptionObserver(const OptionID& option_id,
std::function<void(Option*)> callback)
: Option::Observer(option_id), callback_(std::move(callback)) {
assert(callback_);
}
~CallbackOptionObserver() override = default;
private:
// Option::Observer implementation.
void OnValueChanged() override { callback_(option()); }
std::function<void(Option*)> callback_;
};
OptionsObserver::OptionsObserver(const OptionID& option_id,
std::function<void(Option*)> callback)
: OptionsObserver(std::vector<OptionID>({option_id}), callback) {}
OptionsObserver::OptionsObserver(const std::vector<OptionID>& option_ids,
std::function<void(Option*)> callback) {
observers_.reserve(option_ids.size());
for (const OptionID& option_id : option_ids) {
observers_.emplace(
std::make_unique<CallbackOptionObserver>(option_id, callback));
}
}
OptionsObserver::~OptionsObserver() = default;
} // namespace config

View File

@ -0,0 +1,33 @@
#ifndef VBAM_WX_CONFIG_OPTION_OBSERVER_H_
#define VBAM_WX_CONFIG_OPTION_OBSERVER_H_
#include <functional>
#include <memory>
#include <unordered_set>
#include <vector>
#include "config/option-id.h"
namespace config {
// Forward declarations.
class Option;
// An observer for one or multiple options. Will call `callback` every time any
// of the options is modified.
class OptionsObserver {
public:
OptionsObserver(const OptionID& option_id,
std::function<void(Option*)> callback);
OptionsObserver(const std::vector<OptionID>& option_ids,
std::function<void(Option*)> callback);
~OptionsObserver();
private:
class CallbackOptionObserver;
std::unordered_set<std::unique_ptr<CallbackOptionObserver>> observers_;
};
} // namespace config
#endif // VBAM_WX_CONFIG_OPTION_OBSERVER_H_

View File

@ -27,21 +27,6 @@ Option* Option::ByID(OptionID id) {
return &All()[static_cast<size_t>(id)];
}
// static
Filter Option::GetFilterValue() {
return Option::ByID(OptionID::kDisplayFilter)->GetFilter();
}
// static
Interframe Option::GetInterframeValue() {
return Option::ByID(OptionID::kDisplayIFB)->GetInterframe();
}
// static
RenderMethod Option::GetRenderMethodValue() {
return Option::ByID(OptionID::kDisplayRenderMethod)->GetRenderMethod();
}
Option::~Option() = default;
Option::Observer::Observer(OptionID option_id)
@ -498,14 +483,11 @@ bool Option::SetGbPalette(const wxString& value) {
return true;
}
void Option::NextFilter(bool skip_filter_plugin) {
void Option::NextFilter() {
assert(is_filter());
const int old_value = static_cast<int>(GetFilter());
Filter new_filter = static_cast<Filter>((old_value + 1) % kNbFilters);
if (skip_filter_plugin && new_filter == Filter::kPlugin) {
new_filter = Filter::kNone;
}
SetFilter(new_filter);
const int new_value = (old_value + 1) % kNbFilters;
SetFilter(static_cast<Filter>(new_value));
}
void Option::NextInterframe() {
@ -577,17 +559,4 @@ void Option::CallObservers() {
calling_observers_ = false;
}
BasicOptionObserver::BasicOptionObserver(
config::OptionID option_id,
std::function<void(config::Option*)> callback)
: Option::Observer(option_id), callback_(std::move(callback)) {
assert(callback_);
}
BasicOptionObserver::~BasicOptionObserver() = default;
void BasicOptionObserver::OnValueChanged() {
callback_(option());
}
} // namespace config

View File

@ -9,147 +9,11 @@
#include <wx/string.h>
#include "config/option-id.h"
namespace config {
enum class OptionID {
// Display
kDisplayBilinear = 0,
kDisplayFilter,
kDisplayFilterPlugin,
kDisplayIFB,
kDisplayKeepOnTop,
kDisplayMaxThreads,
kDisplayRenderMethod,
kDisplayScale,
kDisplayStretch,
/// GB
kGBBiosFile,
kGBColorOption,
kGBColorizerHack,
kGBLCDFilter,
kGBGBCBiosFile,
kGBPalette0,
kGBPalette1,
kGBPalette2,
kGBPrintAutoPage,
kGBPrintScreenCap,
kGBROMDir,
kGBGBCROMDir,
/// GBA
kGBABiosFile,
kGBALCDFilter,
#ifndef NO_LINK
kGBALinkAuto,
kGBALinkFast,
kGBALinkHost,
kGBAServerIP,
kGBALinkPort,
kGBALinkProto,
kGBALinkTimeout,
kGBALinkType,
#endif
kGBAROMDir,
/// General
kGeneralAutoLoadLastState,
kGeneralBatteryDir,
kGeneralFreezeRecent,
kGeneralRecordingDir,
kGeneralRewindInterval,
kGeneralScreenshotDir,
kGeneralStateDir,
kGeneralStatusBar,
/// Joypad
kJoypad,
kJoypadAutofireThrottle,
kJoypadDefault,
/// Keyboard
kKeyboard,
// Core
kpreferencesagbPrint,
kpreferencesautoFrameSkip,
kpreferencesautoPatch,
kpreferencesautoSaveLoadCheatList,
kpreferencesborderAutomatic,
kpreferencesborderOn,
kpreferencescaptureFormat,
kpreferencescheatsEnabled,
#ifdef MMX
kpreferencesenableMMX,
#endif
kpreferencesdisableStatus,
kpreferencesemulatorType,
kpreferencesflashSize,
kpreferencesframeSkip,
kpreferencesfsColorDepth,
kpreferencesfsFrequency,
kpreferencesfsHeight,
kpreferencesfsWidth,
kpreferencesgbPaletteOption,
kpreferencesgbPrinter,
kpreferencesgdbBreakOnLoad,
kpreferencesgdbPort,
#ifndef NO_LINK
kpreferencesLinkNumPlayers,
#endif
kpreferencesmaxScale,
kpreferencespauseWhenInactive,
kpreferencesrtcEnabled,
kpreferencessaveType,
kpreferencesshowSpeed,
kpreferencesshowSpeedTransparent,
kpreferencesskipBios,
kpreferencesskipSaveGameCheats,
kpreferencesskipSaveGameBattery,
kpreferencesthrottle,
kpreferencesspeedupThrottle,
kpreferencesspeedupFrameSkip,
kpreferencesspeedupThrottleFrameSkip,
kpreferencesuseBiosGB,
kpreferencesuseBiosGBA,
kpreferencesuseBiosGBC,
kpreferencesvsync,
/// Geometry
kgeometryfullScreen,
kgeometryisMaximized,
kgeometrywindowHeight,
kgeometrywindowWidth,
kgeometrywindowX,
kgeometrywindowY,
/// UI
kuiallowKeyboardBackgroundInput,
kuiallowJoystickBackgroundInput,
kuihideMenuBar,
/// Sound
kSoundAudioAPI,
kSoundAudioDevice,
kSoundBuffers,
kSoundEnable,
kSoundGBAFiltering,
kSoundGBAInterpolation,
kSoundGBDeclicking,
kSoundGBEcho,
kSoundGBEnableEffects,
kSoundGBStereo,
kSoundGBSurround,
kSoundQuality,
kSoundVolume,
// Do not add anything under here.
Last,
};
static constexpr size_t kNbOptions = static_cast<size_t>(OptionID::Last);
// Values for kDisplayFilter.
// Values for kDispFilter.
enum class Filter {
kNone,
k2xsai,
@ -180,7 +44,7 @@ enum class Filter {
};
static constexpr size_t kNbFilters = static_cast<size_t>(Filter::kLast);
// Values for kDisplayIFB.
// Values for kDispIFB.
enum class Interframe {
kNone = 0,
kSmart,
@ -191,7 +55,7 @@ enum class Interframe {
};
static constexpr size_t kNbInterframes = static_cast<size_t>(Interframe::kLast);
// Values for kDisplayRenderMethod.
// Values for kDispRenderMethod.
enum class RenderMethod {
kSimple = 0,
kOpenGL,
@ -268,11 +132,6 @@ public:
// O(1)
static Option* ByID(OptionID id);
// Convenience direct accessors for some enum options.
static Filter GetFilterValue();
static Interframe GetInterframeValue();
static RenderMethod GetRenderMethodValue();
~Option();
// Accessors.
@ -326,7 +185,7 @@ public:
bool SetGbPalette(const wxString& value);
// Special convenience modifiers.
void NextFilter(bool skip_filter_plugin);
void NextFilter();
void NextInterframe();
// Command-line helper string.
@ -386,19 +245,41 @@ private:
const nonstd::variant<nonstd::monostate, double, int32_t, uint32_t> max_;
};
// A simple Option::Observer that calls a callback when the value has changed.
class BasicOptionObserver : public Option::Observer {
public:
BasicOptionObserver(config::OptionID option_id,
std::function<void(config::Option*)> callback);
~BasicOptionObserver() override;
private:
// Option::Observer implementation.
void OnValueChanged() override;
std::function<void(config::Option*)> callback_;
};
// Convenience direct accessors. These are used to make direct access to
// individual options less verbose.
inline Option* OptDispFilter() {
return Option::ByID(OptionID::kDispFilter);
}
inline Option* OptDispIFB() {
return Option::ByID(OptionID::kDispIFB);
}
inline Option* OptDispFilterPlugin() {
return Option::ByID(OptionID::kDispFilterPlugin);
}
inline Option* OptDispRenderMethod() {
return Option::ByID(OptionID::kDispRenderMethod);
}
inline Option* OptDispScale() {
return Option::ByID(OptionID::kDispScale);
}
inline Option* OptGeomFullScreen() {
return Option::ByID(OptionID::kGeomFullScreen);
}
inline Option* OptGeomIsMaximized() {
return Option::ByID(OptionID::kGeomIsMaximized);
}
inline Option* OptGeomWindowHeight() {
return Option::ByID(OptionID::kGeomWindowHeight);
}
inline Option* OptGeomWindowWidth() {
return Option::ByID(OptionID::kGeomWindowWidth);
}
inline Option* OptGeomWindowX() {
return Option::ByID(OptionID::kGeomWindowX);
}
inline Option* OptGeomWindowY() {
return Option::ByID(OptionID::kGeomWindowY);
}
} // namespace config

View File

@ -28,8 +28,7 @@ namespace {
// Validator for a wxTextCtrl with a double value.
class ScaleValidator : public widgets::OptionValidator {
public:
ScaleValidator()
: widgets::OptionValidator(config::OptionID::kDisplayScale) {}
ScaleValidator() : widgets::OptionValidator(config::OptionID::kDispScale) {}
~ScaleValidator() override = default;
private:
@ -68,7 +67,7 @@ private:
// Validator for a wxChoice with a Filter value.
class FilterValidator : public widgets::OptionValidator {
public:
FilterValidator() : OptionValidator(config::OptionID::kDisplayFilter) {
FilterValidator() : OptionValidator(config::OptionID::kDispFilter) {
Bind(wxEVT_CHOICE, &FilterValidator::OnChoice, this);
}
~FilterValidator() override = default;
@ -106,7 +105,7 @@ private:
// Validator for a wxChoice with an Interframe value.
class InterframeValidator : public widgets::OptionValidator {
public:
InterframeValidator() : OptionValidator(config::OptionID::kDisplayIFB) {
InterframeValidator() : OptionValidator(config::OptionID::kDispIFB) {
Bind(wxEVT_CHOICE, &InterframeValidator::OnChoice, this);
}
~InterframeValidator() override = default;
@ -146,7 +145,7 @@ private:
class RenderValidator : public widgets::OptionValidator {
public:
explicit RenderValidator(config::RenderMethod render_method)
: OptionValidator(config::OptionID::kDisplayRenderMethod),
: OptionValidator(config::OptionID::kDispRenderMethod),
render_method_(render_method) {
assert(render_method != config::RenderMethod::kLast);
Bind(wxEVT_RADIOBUTTON, &RenderValidator::OnRadioButton, this);
@ -184,7 +183,7 @@ private:
class PluginSelectorValidator : public widgets::OptionValidator {
public:
PluginSelectorValidator()
: widgets::OptionValidator(config::OptionID::kDisplayFilterPlugin) {}
: widgets::OptionValidator(config::OptionID::kDispFilterPlugin) {}
~PluginSelectorValidator() override = default;
private:
@ -246,11 +245,11 @@ DisplayConfig* DisplayConfig::NewInstance(wxWindow* parent) {
DisplayConfig::DisplayConfig(wxWindow* parent)
: wxDialog(),
filter_observer_(config::OptionID::kDisplayFilter,
filter_observer_(config::OptionID::kDispFilter,
std::bind(&DisplayConfig::OnFilterChanged,
this,
std::placeholders::_1)),
interframe_observer_(config::OptionID::kDisplayIFB,
interframe_observer_(config::OptionID::kDispIFB,
std::bind(&DisplayConfig::OnInterframeChanged,
this,
std::placeholders::_1)) {
@ -338,9 +337,8 @@ void DisplayConfig::OnDialogShown(wxShowEvent&) {
plugin_selector_->Clear();
plugin_selector_->Append(_("None"), new wxStringClientData());
const wxString selected_plugin =
config::Option::ByID(config::OptionID::kDisplayFilterPlugin)
->GetString();
const wxString& selected_plugin =
config::OptDispFilterPlugin()->GetString();
bool is_plugin_selected = false;
for (const wxString& plugin : plugins) {
@ -375,8 +373,7 @@ void DisplayConfig::OnDialogShown(wxShowEvent&) {
}
if (!is_plugin_selected) {
config::Option::ByID(config::OptionID::kDisplayFilterPlugin)
->SetString(wxEmptyString);
config::OptDispFilterPlugin()->SetString(wxEmptyString);
}
plugin_selector_->SetValidator(PluginSelectorValidator());
@ -393,13 +390,22 @@ void DisplayConfig::OnDialogClosed(wxCloseEvent&) {
void DisplayConfig::OnFilterChanged(config::Option* option) {
const config::Filter option_filter = option->GetFilter();
const bool show_plugin = option_filter == config::Filter::kPlugin;
plugin_label_->Enable(show_plugin);
plugin_selector_->Enable(show_plugin);
const bool is_plugin = (option_filter == config::Filter::kPlugin);
plugin_label_->Enable(is_plugin);
plugin_selector_->Enable(is_plugin);
systemScreenMessage(wxString::Format(
_("Using pixel filter: %s"),
filter_selector_->GetString(static_cast<size_t>(option_filter))));
// Plugin needs to be handled separately, in case it was removed. The panel
// will eventually reset if it can't actually use the plugin.
wxString filter_name;
if (is_plugin) {
filter_name = _("Plugin");
} else {
filter_name =
filter_selector_->GetString(static_cast<size_t>(option_filter));
}
systemScreenMessage(
wxString::Format(_("Using pixel filter: %s"), filter_name));
}
void DisplayConfig::OnInterframeChanged(config::Option* option) {
@ -418,16 +424,14 @@ void DisplayConfig::HidePluginOptions() {
if (filter_selector_->GetCount() == config::kNbFilters) {
// Make sure we have not selected the plugin option. The validator
// will take care of updating the selector value.
if (config::Option::GetFilterValue() == config::Filter::kPlugin) {
config::Option::ByID(config::OptionID::kDisplayFilter)
->SetFilter(config::Filter::kNone);
if (config::OptDispFilter()->GetFilter() == config::Filter::kPlugin) {
config::OptDispFilter()->SetFilter(config::Filter::kNone);
}
filter_selector_->Delete(config::kNbFilters - 1);
}
// Also erase the Plugin value to avoid issues down the line.
config::Option::ByID(config::OptionID::kDisplayFilterPlugin)
->SetString(wxEmptyString);
config::OptDispFilterPlugin()->SetString(wxEmptyString);
}
void DisplayConfig::ShowPluginOptions() {

View File

@ -4,13 +4,17 @@
#include <wx/dialog.h>
#include <wx/event.h>
#include "config/option.h"
#include "config/option-observer.h"
// Forward declarations.
class wxChoice;
class wxControl;
class wxWindow;
namespace config {
class Option;
}
namespace dialogs {
// Manages the display configuration dialog.
@ -28,13 +32,13 @@ private:
// Populates the plugin options.
void OnDialogShown(wxShowEvent&);
//
// Stops handling the plugin options.
void OnDialogClosed(wxCloseEvent&);
// Callback called when the render method changes.
// Displays the new filter name on the screen.
void OnFilterChanged(config::Option* option);
// Callback called when the interframe method changes.
// Displays the new interframe name on the screen.
void OnInterframeChanged(config::Option* option);
// Hides/Shows the plugin-related filter options.
@ -45,8 +49,8 @@ private:
wxChoice* plugin_selector_;
wxChoice* filter_selector_;
wxChoice* interframe_selector_;
config::BasicOptionObserver filter_observer_;
config::BasicOptionObserver interframe_observer_;
config::OptionsObserver filter_observer_;
config::OptionsObserver interframe_observer_;
};
} // namespace dialogs

View File

@ -7,9 +7,10 @@
#include <wx/log.h>
#include <wx/display.h>
#include "config/option-observer.h"
#include "config/option.h"
#include "wxvbam.h"
#include "strutils.h"
#include "wxvbam.h"
/*
disableSfx(F) -> cpuDisableSfx
@ -61,11 +62,11 @@ void SaveOption(config::Option* option) {
// Intitialize global observers to overwrite the configuration option when the
// option has been modified.
void InitializeOptionObservers() {
static std::unordered_set<std::unique_ptr<config::BasicOptionObserver>>
static std::unordered_set<std::unique_ptr<config::OptionsObserver>>
g_observers;
g_observers.reserve(config::kNbOptions);
for (config::Option& option : config::Option::All()) {
g_observers.emplace(std::make_unique<config::BasicOptionObserver>(
g_observers.emplace(std::make_unique<config::OptionsObserver>(
option.id(), &SaveOption));
}
}

View File

@ -46,7 +46,7 @@
namespace {
double GetFilterScale() {
switch (config::Option::GetFilterValue()) {
switch (config::OptDispFilter()->GetFilter()) {
case config::Filter::kNone:
return 1.0;
case config::Filter::k2xsai:
@ -108,17 +108,12 @@ GameArea::GameArea()
paused(false),
pointer_blanked(false),
mouse_active_time(0),
filter_observer_(config::OptionID::kDisplayFilter,
std::bind(&GameArea::OnRenderingChanged,
this,
std::placeholders::_1)),
interframe_observer_(config::OptionID::kDisplayIFB,
std::bind(&GameArea::OnRenderingChanged,
this,
std::placeholders::_1)),
scale_observer_(
config::OptionID::kDisplayScale,
std::bind(&GameArea::OnScaleChanged, this, std::placeholders::_1)) {
render_observer_(
{config::OptionID::kDispRenderMethod, config::OptionID::kDispFilter,
config::OptionID::kDispIFB},
std::bind(&GameArea::ResetPanel, this)),
scale_observer_(config::OptionID::kDispScale,
std::bind(&GameArea::AdjustSize, this, true)) {
SetSizer(new wxBoxSizer(wxVERTICAL));
// all renderers prefer 32-bit
// well, "simple" prefers 24-bit, but that's not available for filters
@ -391,7 +386,7 @@ void GameArea::LoadGame(const wxString& name)
emusys = &GBASystem;
}
if (config::Option::ByID(config::OptionID::kgeometryfullScreen)->GetInt()) {
if (config::OptGeomFullScreen()->GetInt()) {
GameArea::ShowFullScreen(true);
}
@ -639,10 +634,7 @@ void GameArea::UnloadGame(bool destruct)
// in destructor, panel should be auto-deleted by wx since all panels
// are derived from a window attached as child to GameArea
if (panel) {
panel->Destroy();
panel = nullptr;
}
ResetPanel();
// close any game-related viewer windows
// in destructor, viewer windows are in process of being deleted anyway
@ -778,11 +770,7 @@ void GameArea::AddBorder()
AdjustSize(false);
wxGetApp().frame->Fit();
GetSizer()->Detach(panel->GetWindow());
if (panel) {
panel->Destroy();
panel = nullptr;
}
ResetPanel();
}
void GameArea::DelBorder()
@ -797,19 +785,14 @@ void GameArea::DelBorder()
AdjustSize(false);
wxGetApp().frame->Fit();
GetSizer()->Detach(panel->GetWindow());
if (panel) {
panel->Destroy();
panel = nullptr;
}
ResetPanel();
}
void GameArea::AdjustMinSize()
{
wxWindow* frame = wxGetApp().frame;
double dpi_scale_factor = widgets::DPIScaleFactorForWindow(this);
double display_scale =
config::Option::ByID(config::OptionID::kDisplayScale)->GetDouble();
double display_scale = config::OptDispScale()->GetDouble();
// note: could safely set min size to 1x or less regardless of video_scale
// but setting it to scaled size makes resizing to default easier
@ -845,8 +828,7 @@ void GameArea::AdjustSize(bool force)
return;
double dpi_scale_factor = widgets::DPIScaleFactorForWindow(this);
double display_scale =
config::Option::ByID(config::OptionID::kDisplayScale)->GetDouble();
double display_scale = config::OptDispScale()->GetDouble();
const wxSize newsz(
(std::ceil(basic_width * display_scale) * dpi_scale_factor),
@ -864,6 +846,13 @@ void GameArea::AdjustSize(bool force)
wxGetApp().frame->Fit();
}
void GameArea::ResetPanel() {
if (panel) {
panel->Destroy();
panel = nullptr;
}
}
void GameArea::ShowFullScreen(bool full)
{
if (full == fullscreen) {
@ -883,10 +872,7 @@ void GameArea::ShowFullScreen(bool full)
// just in case screen mode is going to change, go ahead and preemptively
// delete panel to be recreated immediately after resize
if (panel) {
panel->Destroy();
panel = nullptr;
}
ResetPanel();
// Windows does not restore old window size/pos
// at least under Wine
@ -1108,7 +1094,7 @@ void GameArea::OnIdle(wxIdleEvent& event)
return;
if (!panel) {
switch (config::Option::GetRenderMethodValue()) {
switch (config::OptDispRenderMethod()->GetRenderMethod()) {
case config::RenderMethod::kSimple:
panel = new BasicDrawingPanel(this, basic_width, basic_height);
break;
@ -1422,10 +1408,9 @@ DrawingPanelBase::DrawingPanelBase(int _width, int _height)
rpi_(nullptr) {
memset(delta, 0xff, sizeof(delta));
if (config::Option::GetFilterValue() == config::Filter::kPlugin) {
if (config::OptDispFilter()->GetFilter() == config::Filter::kPlugin) {
rpi_ = widgets::MaybeLoadFilterPlugin(
config::Option::ByID(config::OptionID::kDisplayFilterPlugin)
->GetString(), &filter_plugin_);
config::OptDispFilterPlugin()->GetString(), &filter_plugin_);
if (rpi_) {
rpi_->Flags &= ~RPI_565_SUPP;
@ -1445,15 +1430,13 @@ DrawingPanelBase::DrawingPanelBase(int _width, int _height)
scale *= (rpi_->Flags & RPI_OUT_SCLMSK) >> RPI_OUT_SCLSH;
} else {
// This is going to delete the object. Do nothing more here.
config::Option::ByID(config::OptionID::kDisplayFilterPlugin)
->SetString(wxEmptyString);
config::Option::ByID(config::OptionID::kDisplayFilter)
->SetFilter(config::Filter::kNone);
config::OptDispFilterPlugin()->SetString(wxEmptyString);
config::OptDispFilter()->SetFilter(config::Filter::kNone);
return;
}
}
if (config::Option::GetFilterValue() != config::Filter::kPlugin) {
if (config::OptDispFilter()->GetFilter() != config::Filter::kPlugin) {
scale *= GetFilterScale();
systemColorDepth = 32;
}
@ -1572,7 +1555,7 @@ public:
delta_ += instride * procy;
// FIXME: fugly hack
if (config::Option::GetRenderMethodValue() ==
if (config::OptDispRenderMethod()->GetRenderMethod() ==
config::RenderMethod::kOpenGL) {
dst_ += (int)std::ceil(outstride * (procy + 1) * scale_);
} else {
@ -1592,7 +1575,7 @@ public:
// added procy param to provide offset into accum buffers
ApplyInterframe(instride, procy);
if (config::Option::GetFilterValue() == config::Filter::kNone) {
if (config::OptDispFilter()->GetFilter() == config::Filter::kNone) {
if (nthreads_ == 1)
return 0;
@ -1621,8 +1604,7 @@ private:
// definitely not thread safe by default
// added procy param to provide offset into accum buffers
void ApplyInterframe(int instride, int procy) {
switch (config::Option::ByID(config::OptionID::kDisplayIFB)
->GetInterframe()) {
switch (config::OptDispIFB()->GetInterframe()) {
case config::Interframe::kNone:
break;
@ -1650,7 +1632,7 @@ private:
// naturally, any of these with accumulation buffers like those
// of the IFB filters will screw up royally as well
void ApplyFilter(int instride, int outstride) {
switch (config::Option::GetFilterValue()) {
switch (config::OptDispFilter()->GetFilter()) {
case config::Filter::k2xsai:
_2xSaI32(src_, instride, delta_, dst_, outstride, width_,
height_);
@ -1812,7 +1794,7 @@ void DrawingPanelBase::DrawArea(uint8_t** data)
pixbuf2 = (uint8_t*)calloc(allocstride, std::ceil((alloch + 2) * scale));
}
if (config::Option::GetFilterValue() == config::Filter::kNone) {
if (config::OptDispFilter()->GetFilter() == config::Filter::kNone) {
todraw = *data;
// *data is assigned below, after old buf has been processed
pixbuf1 = pixbuf2;
@ -1825,8 +1807,8 @@ void DrawingPanelBase::DrawArea(uint8_t** data)
// First, apply filters, if applicable, in parallel, if enabled
// FIXME: && (gopts.ifb != FF_MOTION_BLUR || !renderer_can_motion_blur)
if (config::Option::GetFilterValue() != config::Filter::kNone ||
config::Option::GetInterframeValue() != config::Interframe::kNone) {
if (config::OptDispFilter()->GetFilter() != config::Filter::kNone ||
config::OptDispIFB()->GetInterframe() != config::Interframe::kNone) {
if (nthreads != gopts.max_threads) {
if (nthreads) {
if (nthreads > 1)
@ -1898,7 +1880,7 @@ void DrawingPanelBase::DrawArea(uint8_t** data)
}
// swap buffers now that src has been processed
if (config::Option::GetFilterValue() == config::Filter::kNone) {
if (config::OptDispFilter()->GetFilter() == config::Filter::kNone) {
*data = pixbuf1;
}
@ -2084,8 +2066,8 @@ BasicDrawingPanel::BasicDrawingPanel(wxWindow* parent, int _width, int _height)
{
// wxImage is 24-bit RGB, so 24-bit is preferred. Filters require
// 16 or 32, though
if (config::Option::GetFilterValue() == config::Filter::kNone &&
config::Option::GetInterframeValue() == config::Interframe::kNone) {
if (config::OptDispFilter()->GetFilter() == config::Filter::kNone &&
config::OptDispIFB()->GetInterframe() == config::Interframe::kNone) {
// changing from 32 to 24 does not require regenerating color tables
systemColorDepth = 32;
}
@ -2116,7 +2098,7 @@ void BasicDrawingPanel::DrawArea(wxWindowDC& dc)
src += 2; // skip rhs border
}
} else if (config::Option::GetFilterValue() != config::Filter::kNone) {
} else if (config::OptDispFilter()->GetFilter() != config::Filter::kNone) {
// scaled by filters, top/right borders, transform to 24-bit
im = new wxImage(std::ceil(width * scale), std::ceil(height * scale), false);
uint32_t* src = (uint32_t*)todraw + (int)std::ceil(width * scale) + 1; // skip top border
@ -2642,14 +2624,3 @@ void GameArea::ShowMenuBar()
menu_bar_hidden = false;
#endif
}
void GameArea::OnRenderingChanged(config::Option*) {
if (panel) {
panel->Destroy();
panel = nullptr;
}
}
void GameArea::OnScaleChanged(config::Option*) {
AdjustSize(true);
}

View File

@ -361,8 +361,8 @@ bool wxvbamApp::OnInit() {
// wxGLCanvas segfaults under wayland before wx 3.2
#if defined(__WXGTK__) && !wxCHECK_VERSION(3, 2, 0)
if (UsingWayland()) {
config::Option::ByID(config::OptionID::kDisplayRenderMethod)
->SetRenderMethod(config::RenderMethod::kSimple);
config::OptDispRenderMethod()->SetRenderMethod(
config::RenderMethod::kSimple);
}
#endif
@ -471,16 +471,12 @@ bool wxvbamApp::OnInit() {
config::GameControlState::Instance().OnGameBindingsChanged();
// create the main window
int x = config::Option::ByID(config::OptionID::kgeometrywindowX)->GetInt();
int y = config::Option::ByID(config::OptionID::kgeometrywindowY)->GetInt();
int width = config::Option::ByID(config::OptionID::kgeometrywindowWidth)
->GetUnsigned();
int height = config::Option::ByID(config::OptionID::kgeometrywindowHeight)
->GetUnsigned();
bool isFullscreen =
config::Option::ByID(config::OptionID::kgeometryfullScreen)->GetInt();
bool isMaximized =
config::Option::ByID(config::OptionID::kgeometryisMaximized)->GetInt();
int x = config::OptGeomWindowX()->GetInt();
int y = config::OptGeomWindowY()->GetInt();
int width = config::OptGeomWindowWidth()->GetUnsigned();
int height = config::OptGeomWindowHeight()->GetUnsigned();
bool isFullscreen = config::OptGeomFullScreen()->GetInt();
bool isMaximized = config::OptGeomIsMaximized()->GetInt();
frame = wxDynamicCast(xr->LoadFrame(nullptr, "MainFrame"), MainFrame);
if (!frame) {
@ -844,10 +840,8 @@ void MainFrame::OnMove(wxMoveEvent&) {
if (!IsFullScreen() && !IsMaximized()) {
if (window_pos.x >= 0 && window_pos.y >= 0) {
config::Option::ByID(config::OptionID::kgeometrywindowX)
->SetInt(window_pos.x);
config::Option::ByID(config::OptionID::kgeometrywindowY)
->SetInt(window_pos.y);
config::OptGeomWindowX()->SetInt(window_pos.x);
config::OptGeomWindowY()->SetInt(window_pos.y);
}
}
}
@ -857,17 +851,13 @@ void MainFrame::OnSize(wxSizeEvent& event)
wxFrame::OnSize(event);
wxRect window_rect = GetRect();
wxPoint window_pos = GetScreenPosition();
config::Option* window_x =
config::Option::ByID(config::OptionID::kgeometrywindowX);
config::Option* window_y =
config::Option::ByID(config::OptionID::kgeometrywindowY);
config::Option* window_x = config::OptGeomWindowX();
config::Option* window_y = config::OptGeomWindowY();
if (!IsFullScreen() && !IsMaximized()) {
if (window_rect.GetHeight() > 0 && window_rect.GetWidth() > 0) {
config::Option::ByID(config::OptionID::kgeometrywindowHeight)
->SetUnsigned(window_rect.GetHeight());
config::Option::ByID(config::OptionID::kgeometrywindowWidth)
->SetUnsigned(window_rect.GetWidth());
config::OptGeomWindowHeight()->SetUnsigned(window_rect.GetHeight());
config::OptGeomWindowWidth()->SetUnsigned(window_rect.GetWidth());
}
if (window_pos.x >= 0 && window_pos.y >= 0) {
window_x->SetInt(window_pos.x);
@ -875,10 +865,8 @@ void MainFrame::OnSize(wxSizeEvent& event)
}
}
config::Option::ByID(config::OptionID::kgeometryisMaximized)
->SetInt(IsMaximized());
config::Option::ByID(config::OptionID::kgeometryfullScreen)
->SetInt(IsFullScreen());
config::OptGeomIsMaximized()->SetInt(IsMaximized());
config::OptGeomFullScreen()->SetInt(IsFullScreen());
}
int MainFrame::FilterEvent(wxEvent& event)

View File

@ -11,7 +11,7 @@
#include <wx/propdlg.h>
#include <wx/datetime.h>
#include "config/option.h"
#include "config/option-observer.h"
#include "widgets/dpi-support.h"
#include "wx/joyedit.h"
#include "wx/keyedit.h"
@ -542,7 +542,9 @@ public:
// FIXME: size this properly
#define NUM_REWINDS 8
#define REWIND_SIZE 1024 * 512 * NUM_REWINDS
// FIXME: make this a config option
// Resets the panel, it will be re-created on the next frame.
void ResetPanel();
void ShowFullScreen(bool full);
bool IsFullScreen()
@ -614,15 +616,8 @@ protected:
DECLARE_EVENT_TABLE()
private:
// Callback for Render and Interframe changed events.
void OnRenderingChanged(config::Option*);
// Callback for VideoScale changed events.
void OnScaleChanged(config::Option*);
config::BasicOptionObserver filter_observer_;
config::BasicOptionObserver interframe_observer_;
config::BasicOptionObserver scale_observer_;
config::OptionsObserver render_observer_;
config::OptionsObserver scale_observer_;
};
// wxString version of OSD message