Commit Graph

65 Commits

Author SHA1 Message Date
Fabrice de Gans 9889ef4fa8 Move GameBoyConfig dialog to its own class
This changes all of the options handled by the GameBoyConfig dialog to
use the new Option type. This also fixes a number of small issues
related to palette handling and GB emulation:
* Modifying the custom GB palette no longer incorrectly applies to GBC
  and SGB modes.
* Loading a GB save state (not GBC or SGB) properly applies the
  user-defined palettte and not the one in the save state.
* The GBC core now accepts .gbc BIOS files.

Finally, this modifies and renames wxFarRadio to widgets::GroupCheckBox.
In addition GroupCheckBoxes can now be loaded and fully configured from
the XRC file rather than having to be manually configured on dialog
initialization.
2023-03-15 00:45:22 +00:00
Stanley Kid d756f6716f
translations: fix some source strings
Fix some more strings marked for translation in the source code to be
more correct and easier to localize.

References #1071 #1029

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-02-10 05:50:20 +00:00
Fabrice de Gans 91873254d3 Add INI file versioning
This introduces a new INI config option called "IniVersion". Whenever
default values change or options are renmaed, the latest version number is
incremented and an update path is run.
This change also rewrites part of the initialization routine by adding
more safety checks before creating or reading the configuration file.
2023-02-08 01:31:40 +00:00
Fabrice de Gans 2b950e282f [Option] Add Proxy template class for Option
This removes the global accessors for individual options in favor of a
proxy template class with a simpler per-type API. This adds compile-time
checks to validate that the right option is used with the right type
when accessing it directly.
2023-02-06 03:25:37 +00:00
Stanley Kid 64921c6535
translations: fix some source strings
Fix some source strings in the source code that are marked for
translation to be more formally/grammatically correct and easier to
localize.

References #1029

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-02-05 19:55:06 +00:00
Rafael Kitover 61046c76bf
translations: rebuild source .pot
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-02-05 17:29:14 +00:00
Fabrice de Gans 2cec46f825
Clean-up ConfigManager options (#1067)
* Clean-up ConfigManager options

Many of the options in ConfigManager were not actually used.
* Some options are only used by wx, they have been moved to gopts. In
  addition, the type of the option has been changed to "bool" when
  applicable.
* Some options are only used by SDL and do not have a corresponding
  configuration option, they have been moved to the SDL implementation.
* Some options are not used at all, they have been removed.
2023-02-04 21:39:13 -08:00
Rafael Kitover 87bdc93e15
Revert "translations: use %% instead of percent"
This reverts commit 1ac7ac999b.

The %% sequence turned out to not be dealt with specially by gettext
tools.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-12-28 18:51:37 +00:00
Rafael Kitover 1ac7ac999b
translations: use %% instead of percent
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-12-04 15:55:42 +00:00
Rafael Kitover ea10306daa
translations: minor additions/adjustments
Add a few translation markers for strings that are translated in the
wxWidgets catalogs, which we do not pull yet.

Also change the string "% of normal:" to "percent of normal:" because
the percent sign was causing an error in poedit.

Fix #1029.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-12-02 22:21:13 +00:00
Fabrice de Gans 080be1a325 [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.
2022-10-26 12:28:14 +00:00
Fabrice de Gans af4951511e [config] Add Observers for Options
This adds a generic Observer interface to config::Option. To
demonstrate its intended usage, the Display Configuration dialog and
the options it controls have been updated to be entirely handled via
the config::Option class.

Implementations for wxValidator are used to validate the flow between
the UI and the underlying Option. In turn, modifying the Option value
triggers all of its observers that should then do what they need to
do.

Rather than explicitly calling all of the needed methods after
modifying a global option value, the UI elements that need to be
notified when an Option value is modified will be notified via their
observers. Runtime assert checks are put in place to prevent infinite
recursion if an observer attempts to modify an Option while handling
the observer callback.

Once all uses of Options have been updated, we should get into a state
where the following will be true:
* cmdevents.cpp will no longer rely on the application state.
* All dialogs will have been moved to specific implementations,
  reducing the size of guiinit.cpp
* update_opts() will no longer need to be called and will be removed.

This will then make it easier to update accelerator handling to be
done with config::UserInput.

Bug: #745
2022-10-22 01:47:39 +00:00
Rafael Kitover ec27885c36
Support EGL VSync on Wayland.
Add support for `eglSwapInterval()` to enable or disable VSync on
Wayland.

Also add status messages for enabling or disabling VSync, for both EGL
and GLX.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-10-21 19:19:28 +00:00
Fabrice de Gans 8c1bd84f40 [config] Move VbamOption and wxGameControl to config namespace 2022-10-15 23:11:41 +00:00
Fabrice de Gans c4d46a713f [options] Refactor INI options
This change introduces a new class to handle all of the INI options
data, VbamOption. A VbamOption represents a single option in the INI
file. It is not constructible outside of its implementation, which
prevents the initialization of incorrectly formatted options.

Internally, a VbamOption points to a global variable in memory, which
holds the value used at runtime. This is because various parts of the
codebase edit the global variable rather than going through a central
registry. This also means we need to separately update the INI values.

In the future, we may be able to convert all existing reads and writes
to the global variable to go through VbamOption. Individual UX elements
could link directly to getters/setters for a specific VbamOption rather
than have duplicate data.

VbamOption replaces the opt_desc struct and the global opts array. All
users of opt_desc and the global opts array have been updated.

This is a necessary preliminary change to better support a refactor of
accelerators, through wxUserInput.

Issue: #745, #158
2022-09-25 05:47:34 +00:00
Rafael Kitover a57d81e1af
Show name of interframe blender not num in OSD
When changing the interframe blending algorithm via:

`Options -> Video -> Change interframe blending`

, show the short name of the algorithm instead of the list number in the
OSD.

Store a pointer to the wxChoice of interframe algorithms read from the
XRC for easy access.

Shorten the names of the algorithms in the XRC selection list.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-09-23 23:44:36 +00:00
Rafael Kitover 2d5fdf8e79
translations: rebuild source .pot
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-08-18 14:46:00 +00:00
laqieer d2fee771fd
Add VBA Movie Version 2
Add new format for recording VBA Movies that records inputs since the
time of the last input instead of the beginning of the movie.

Keep the extension `.vmv` the same, the format is determined from the
header of the file.

Make this the new default format for recording VBA Movies.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-08-08 04:01:45 +00:00
Fabrice de Gans 51473a7c53 Refactor game controls bindings
This introduces abstractions for a game key (`wxGameKey`), a game
control (`wxGameControl`) and a common global handler for in-game
user input processing (`wxGameControlState`).
User configuration is changed from a vector to a map of `wxGameControl`
to a set of `wxUserInput`, which simplifies input configuration updates.

User input processing for in-game controls is now unified between
keyboard and joypad input, and is much faster in general since access
to game control state is now always logarithmic rather than linear.
This comes at the expense of slightly slower user input configuration
updates. However, in the worst case scenario, this is still done in
O(log(n)).

This removes all uses of `wxJoyKeyBinding`. However, some uses of the
key, mod, joy triplets remain and will be cleaned up in follow-up PRs.

Issue: #745
2022-08-06 12:18:35 +03:00
Squall Leonhart 972f151310
Enable GB colorization hack support in GUI.
This is used by some hacked ROMs like Metroid II DX.

Add a config variable to enable the already existent core support for
this.

This conflicts with using a GB BIOS file, add checks and error dialogs
for this.

Also move including "ConfigManager.h" into "wxvbam.h".

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2021-11-24 21:30:37 +00:00
Rafael Kitover bb903e5e08
Transifex push/pull.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-12-17 05:14:46 +00:00
Fabrice de Gans-Riberi edc34942a8 Refactor wxSDLJoy
This is a major refactor of the wxSDLJoy class.
* Move handling of SDL objects creation and destruction to its own
  class. This simplifies the lifespan of SDL-related objects.
* Re-add handling of HATs. This is necessary for DirectInput
  controllers.
* Rename the public API for wxSDLJoy to be clearer.
* Add documentation for every class related to wxSDLJoy.
2020-10-19 08:11:38 +00:00
Rafael Kitover 87fac44fdb
Transifex push/pull.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-09-05 19:39:52 +00:00
Rafael Kitover 891b1c35e4 Update gettext source.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-08-29 20:53:49 +00:00
Fabrice de Gans-Riberi 4074158061
Add GUI cmd line option for config file. (#724)
This adds the command-line option `-c` or `--config` to specify a custom
configuration file.

Co-authored-by: Fabrice de Gans-Riberi <steelskin+github@gmail.com>
2020-08-28 22:26:07 +00:00
Rafael Kitover dfec0b3d99
Transifex push/pull.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-08-17 18:37:36 +00:00
Rafael Kitover 121013c534
Transifex push + fix for a couple of strings.
Fix a couple of strings noted by @Ds886.

Generate new pot and push to transifex.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-06-21 19:42:52 +00:00
Rafael Kitover 1347026d40 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>
2020-05-15 02:01:57 +00:00
Rafael Kitover 09e8da43db Joystick refactor pt. Deux: Support Joysticks.
Add support for non-GameController SDL Joysticks.

Add proxy class wxSDLJoyDev to support using either SDL_GameController*
or SDL_Joystick* values in joystate.dev.

Add pretty much identical SDL code to support SDL_Joystick* when the
device cannot be opened as an SDL_GameController*, without changing the
API. SDL_Joystick* devices operate almost identically to SDL_Controller*
devices with their own default mappings, for both events and polling.

Filter axis motion events in the bindings editor widget for subsequent
events within 300ms. This gets rid of the double binding for +1/-1 when
the stick is moved to a direction.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-05-05 08:47:52 +00:00
Rafael Kitover 504ca08b6b Hide menubar + minor UI refactor.
Add ui/hideMenuBar boolean option, defaulting to on, which hides the
main menubar when the mouse is idle or outside the frame.

This is disabled on mac, because on macs the main menubar is not part of
the application window.

Fix pointer hiding/unhiding by connecting panel events to the gamearea
mouse event handler.

Clean up the pausing when menus are opened code, make it actually work
on Windows.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-05-02 13:14:46 +00:00
Rafael Kitover 9e03af83c4
Transifex push.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-04-12 00:21:04 +00:00
Rafael Kitover 8e3978b314 Speedup/Turbo/Throttle fixes.
Fix throttle=0 (unlimited speed) settings for both the Speedup/Turbo
config panel and the general throttle setting and make 100 the default.

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

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

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

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

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-04-10 10:19:03 +00:00
Rafael Kitover 8ede756fb0
Gettext pot regen and transifex push.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-03-13 14:41:14 +00:00
Rafael Kitover f1099a213a
Check return value of soundInit().
soundInit() returns a bool to indicate success, and failure inevitably
leads to crashes as the emulator tries to use a NULL soundDriver.

On false, popup an error dialog saying that the sound driver failed to
initialize, this is at least better than crashes, which will also need
to be fixed.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-03-07 13:30:28 +00:00
Rafael Kitover 32e7c69726
Gettext pot update improvements.
Extract strings from all wx sources, not just the enabled ones.

Ignore comments in the generated pot when checking if it was updated, we
don't care about just changes in line numbers.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-24 21:06:23 +00:00
Rafael Kitover 2f0653824e
Enable XAudio2 for Windows vcpkg build.
Add necessary headers to the dependencies submodule and default the
cmake option to on.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-24 20:49:01 +00:00
Rafael Kitover 4b4b770495
Transifex push/pull.
pot made using new cmake code from d93f6350.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-17 09:13:08 +00:00
s520 a320377040
Fix: a issue with loading e-Reader dot code (#608)
Fix issues with {sav,load}ing e-Reader `Dot Code`.

If `Dot Code` file is not specified, it tries to continually read it and does not accept input.

In Japanese (very likely other languages as well), the path of `Dot Code` file is garbled
internally due to failing conversion to UTF-8.
2020-02-15 14:02:53 -03:00
Rafael Kitover 02520fb63e Joystick handling refactor.
Use the SDL GameController API with SDL events instead of polling
manually. Run SDL_PollEvent() in the panel OnIdle().

The API to the GUI remains the same, the sending of wxSDLJoyEvent
events. Except there are no more hat events, we just use the
GameController buttons. Also the GUI now has to make arrangements for
wxSDLJoy::Poll() to be called periodically, for the config dialog this
is done with a timer.

All Xbox 360 controller buttons and axes are now in the defaults, and
the SDL GameController API will map them to the appropriate keys on
other controllers.

As a consequence of using SDL events, controller attach/detach from the
system is now also handled correctly. It is no longer necessary to have
the controller attached and turned on when the program launches.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-11-27 23:09:35 +00:00
Edênis Freindorfer Azevedo cc51622928 transifex push/pull
Signed-off-by: Edênis Freindorfer Azevedo <edenisfa@gmail.com>
2019-09-10 07:59:56 +00:00
Rafael Kitover 1949cdb37a
transifex push/pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-08-20 23:24:36 +00:00
Rafael Kitover 3923b28fc3
transifex pull/push
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-08-18 19:01:10 +00:00
Rafael Kitover bcc8b54096
transifex sync
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-07-04 04:50:39 +00:00
Rafael Kitover 6462ce59b5 pull transifex updates 2019-01-02 17:25:10 -08:00
Rafael Kitover 0e33861754 update translations, add new langs from transifex
Update the po files with the transifex client and do a msgmerge.

Replace cmake/FindGettext.cmake with the current version, and fix a bug
in it that would not allow files with multiple periods such as
zh_TW.Big5.po. Also disable msgmerge in GETTEXT_CREATE_TRANSLATIONS
otherwise it would create too many very spammy commits.

Replace language list in po/wxvbam/CMakeLists.txt (where the .pot and
.po files are) with a list made with file(GLOB ...), so that all the new
languages are pulled in.
2018-08-11 16:18:15 -07:00
Rafael Kitover d118c457b1 regenerate translation files
Run po/update_pot.sh and rebuild all .po files.
2017-08-03 23:33:30 -07:00
Zach Bacon ebfc8fdb12
Updated translation pot file 2017-06-03 12:11:53 -04:00
skidau 8e57e850a4 Added an option to show/hide the status bar. 2015-06-10 03:11:34 +00:00
skidau e973e59666 Added an auto-update option (Windows only) 2015-06-08 06:25:19 +00:00
skidau 1dc399839c Added a "Check for updates" option to the Help menu. 2015-06-05 13:48:37 +00:00