Commit Graph

2924 Commits

Author SHA1 Message Date
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
Rafael Kitover 0a104a9a9d
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-10-26 02:02:20 +00:00
Rafael Kitover 0bfb88d0e3
Fix regression in ea2a929f, check for Wayland
Fix regression in ea2a929f, which broke x11 support by not checking for
Wayland when making the Wayland EGL subsurface move call.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-10-25 19:17:40 +00:00
Rafael Kitover 873de5f667
build: update default.nix
Change dbus_libs to dbus, which is the new package name.

This is for `nix-shell` to build on NixOS.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-10-25 19:14:38 +00:00
Rafael Kitover 9bf6a25048
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-10-24 02:02:24 +00:00
Rafael Kitover ea2a929f5e Backport 800d6ed69b from wx to fix Wayland EGL pos
Backport 800d6ed69b from wxWidgets git to fix resizing the
`GLDrawingPanel` in Wayland using the EGL `wxGLCanvas`.

Also rename `IsItWayland()` to `IsWayland()`.

Fix #1028

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-10-23 13:14:03 -07:00
Fabrice de Gans 0ca5184dda [option] Convert all uses of geometry options to use config::Option
Moving and resizing the window no longer updates the entire option
set, reducing jank on move and resize.
2022-10-23 11:42:08 +00:00
Rafael Kitover d2d070b52f
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-10-23 02:03:18 +00:00
Rafael Kitover c40a141792
Write vsync toggle msg to debug log not OSD
Write vsync enable/disable messages to debug log and not the OSD, they
are kind of annoying.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-10-22 11:55:56 +00:00
Rafael Kitover 5d2dd01e85
Call Layout() after DrawingPanel OnSize event
When processing the `OnSize` event in the `GameArea` and calling the
embedded `DrawingPanel` `OnSize` event, call `Layout()` afterwards.

This seems to improve the resizing behavior of the EGL `wxGLCanvas`
`DrawingPanel` on Wayland.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-10-22 11:51:13 +00:00
Rafael Kitover 00344ca8f1
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-10-22 02:02:19 +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 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