Commit Graph

2913 Commits

Author SHA1 Message Date
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 da686a4827
Reinit panel on vsync toggle.
Destroy the DrawingPanel on vsync checkbox toggle so that it is
re-created with the vsync option in effect.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-10-21 21:43:13 +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
Rafael Kitover c27d384a53
Enable GL on Wayland for wx 3.2+, no vsync.
wxWidgets 3.2+ has experimental `wxGLCanvas` support for Wayland EGL,
enable it for those versions.

The `glXQueryExtensionsString()` method for enabling or disabling vsync
does not work on Wayland currently, so it's disabled.

TODO: Enable/disable vsync on Wayland EGL.

Fix #1028.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-10-21 17:24:46 +00:00
Rafael Kitover 75e46b7117
build: update macOS third_party_libs_tool from git
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-10-19 00:00:59 +00:00
Rafael Kitover c249115b7a
build: set -mtune=generic
Nach explained that this is the safest and best option.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-10-16 18:37:03 +00:00
Rafael Kitover d23b374fbf
ci: add basic macos-latest runner
Add basic macos-latest build to have one macOS runner.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-10-16 18:22:37 +00:00
Rafael Kitover 2985b46926
ci: add ubuntu-latest workflow
Add basic build on ubuntu-latest to have at least one ci build on Linux.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-10-16 14:18:13 +00:00
Adam Sampson 54b8192d30 Fix prototype for main.
A typo in 297d7c06c4 meant main had the
wrong prototype on non-Windows systems, breaking the build.
2022-10-16 13:08:25 +00:00
Rafael Kitover 927ccf0bc8
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-10-16 02:02:40 +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 297d7c06c4 [hidpi] Use wxWidgets 3.2 on Windows
* Remove the custom handling for pre-3.1.4 builds on Windows since
  both the mingw and msvc builds now use 3.2.
* Remove wxDPIChangedEvent handling, since this triggers a resize,
  which has the same effect.
* Implement main/WinMain ourselves, rather than relying on wxWidgets
  macros. This allows us to initialize the console earlier in the
  process.
* Add an explicit dependency on the manifest file to trigger a link
  when it is modified.
2022-10-15 22:25:54 +00:00
Fabrice de Gans 0d86432a31 [hidpi] Implement full HiDPI support
This converts the HiDPIAware into a series of helper functions, using
wxWidgets native support starting with wxWidgets 3.1.4. Custom
implementations are provided for Mac and Windows.

In addition, this fixes a few issues with the Windows build:
* Use the same defines variables in the MSVC and MinGW builds, with
  g++ and Clang.
* Add a custom manifest for the application, indicating full DPI
  support and support for recent Windows versions so the application
  will no longer run in compatibility mode by default.
* Manually spawn a console in debug builds if none is attached and
  always use the parent console if it is available otherwise, even in
  release builds. This also removes the /subsystem:console linker
  argument.
2022-10-15 22:25:54 +00:00
Fabrice de Gans 95337da558 [build] Add basic clang-cl support
XAudio2 is disabled because the included header needs to be updated to
be parseable by clang.
2022-10-15 22:25:34 +00:00
Rafael Kitover d6331ff92e
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-10-14 02:02:29 +00:00
Rafael Kitover 69a4061ab9
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-10-13 02:02:23 +00:00
Rafael Kitover 8f27869715
build: fix finding static vcpkg SDL2
The static lib is now called `SDL2-static.lib` and the debug version is
called `SDL2-staticd.lib`.

Adjust our `cmake/FindSDL2.cmake` for the new vcpkg naming convention.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-10-09 04:00:26 +00:00
Rafael Kitover eed171aac0
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-10-02 02:02:17 +00:00
Rafael Kitover 603d6a3872
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-10-01 02:02:18 +00:00
Fabrice de Gans f8974d8870
Merge pull request #1012 from Ds886/fix-missing-header
* adds missing header to memgzio ("stdint")
2022-09-30 13:11:50 -07:00
Ds886 6be626d4c7 * adds missing header("stdint") 2022-09-30 22:56:58 +03:00
Rafael Kitover 8771172d19
build: silence cmake warning on macOS for Sparkle
Silence cmake policy set warning for FetchContent
DOWNLOAD_EXTRACT_TIMESTAMP by setting it to TRUE.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-09-29 23:04:27 +00:00
Rafael Kitover 85a95dcde0
build: macOS C++ compatibility fixes
Remove constexpr in user-input.h as LLVM 13 complains that it is
illegal.

Use variant-lite as nonstd::variant and related types as some variant
functions are macOS 10.14 Mojave only.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-09-29 22:34:59 +00:00
Rafael Kitover 343eafc477
build: add variant-lite as nonstd::variant
From:

https://github.com/martinmoene/variant-lite

. Needed for macOS build.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-09-29 22:34:59 +00:00
Rafael Kitover 1425248072
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-09-29 02:02:19 +00:00
Rafael Kitover 4bdd3798f1
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-09-28 02:02:21 +00:00
Fabrice de Gans 69d24fb53e [build][msvc] Fix debug information and set hidpi support
* Add /ZI compiler flag in Debug mode to get proper debug symbols.
* Specify hidpi support in the app manifest.
2022-09-27 01:25:20 +00:00
Fabrice de Gans b027e64753 [config] Move wxUserInput to the config namespace
* Remove the wx prefix and make UserInput a class in the config
  namespace.
* Make UserInput constexpr-constructible. This should reduce program
  startup time by having the compiler pre-allocate UserInput objects.
* Change initialization of UserInput objects to be made via
  constructor. A previous approach would have limited creation of
  UserInput objects to a few places but that proved unworkable in the
  long run.
2022-09-26 02:20:12 +00:00
Fabrice de Gans 1d4eb48a68 [build] Fix all warnings in src/gba/bios.cpp
This adds some helper methods to safely downcast integer types.

Bug: #1003
2022-09-26 02:17:26 +00:00
Fabrice de Gans 1e1451c57f [build] Fix warnings in src/common
Bug: #1003
2022-09-26 02:14:53 +00:00
Fabrice de Gans b2ec1544be [build] Regenerate lex and yacc files
The source grammar files were also updated. This fixes compiler
warnings for these files.

Bug: #1003
2022-09-26 02:13:12 +00:00
Fabrice de Gans 239b244640 [build] Fix warnings in memgzio.c
Bug: #1003
2022-09-26 02:11:52 +00:00
Rafael Kitover 9cc45c355b
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-09-26 02:02:20 +00:00
Fabrice de Gans 4a056c7720 [options] Remove duplicate string constants
* Changed the string to enum conversions to be built at runtime from
  the existing constant array rather than redefining the strings.
* Fixed an issue in the initialization of the `checkable_mi` array.
  A test had been mistakenly removed during the refactor.
* Fixed an issue where changing a bool or int option would cause an
  assertion error at runtime. Changed helper methods definitions to
  use a pointer to a variable rather than take a parameter by
  reference, clarifying the intent from the caller perspective.
* Fixed the `renderer` enum definition to properly exclude Direct3D or
  Quartz2D depending on the platform.
* Various comment fixes.
2022-09-25 05:47:34 +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 dd6071e5cb
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-09-25 02:02:21 +00:00
Rafael Kitover c10338a854
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-09-24 02:02:22 +00:00
Fabrice de Gans a92c448405
Merge pull request #1002 from visualboyadvance-m/interframe-blending-changer
Interframe blending changer OSD improvement
2022-09-23 16:55:41 -07:00
Rafael Kitover 90fc3e12e2
Default CTRL+I to change interframe blender
Add default menu accelerator `CTRL+I` to `ChangeIFB` which is the menu
item to change the interframe blending algorithm.

CMD+I on macOS.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-09-23 23:44:37 +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 97c24ec2d2
Minor refactor of strutils and add 3 new functions
Use namespace strutils:: instead of the `str_` prefix for the functions.

Remove `vec_find` as it's just an alias for `wxArrayString::Index(str)`
and is not a function on a string.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-09-23 23:43:31 +00:00
Rafael Kitover 2d3610b5c6
translations: remove Hebrew he locale, use he_IL
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-09-23 22:12:34 +00:00
Rafael Kitover adb9f62080
Copy Hebrew translation from he to he_IL locale
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-09-23 21:59:26 +00:00
Rafael Kitover bad9538ed4
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-09-12 02:02:22 +00:00
Rafael Kitover 8e83209121
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-09-06 02:02:22 +00:00
Rafael Kitover 13c558ac9f
Disable wireless link type
Always disable wireless link type as it has never worked.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-09-04 03:17:35 +00:00
Fabrice de Gans 3eb9fbdb7e [snap] Fix snapcraft build for core20 2022-09-03 19:01:17 -04:00
Rafael Kitover e140ba816c
installdeps: remove wxgtk2 for Arch on failure
The wxgtk2 package being installed may prevent the installation of the
newer wxwidgets-gtk3 package, remove it on pacman failure and try again.

See:

https://archlinux.org/news/wxwidgets-32-update-may-need-manual-intervention/

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-09-03 09:34:05 +00:00
Squall Leonhart 355c8efeb4 change invite code
resolves expired code error
2022-09-02 17:57:38 -04:00
Squall Leonhart 7d606f7065 fix it better 2022-09-02 17:47:42 -04:00