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>
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.
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.
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>
* 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.
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>
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>
* 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 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
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>
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
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>
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>
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
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>
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.
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>
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>
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>
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>
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>
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>
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>
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.
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>
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.