Commit Graph

2146 Commits

Author SHA1 Message Date
Rafael Kitover 6ed20a51cc
build: unpack XAudio2_7.dll at init
Use a Windows resource for the XAudio2_7.dll which may not be installed
by the user.

Unpack it at initialization of the XAudio2 driver into a temp directory
and load it.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-10-06 21:31:56 +00:00
Squall Leonhart 709a322337
cherry pick d5d01a8b68 2024-10-07 00:26:31 +11:00
Rafael Kitover cdfd37fc4e
build: rename dependencies submodule -> win32-deps
Rename the Git submodule `dependencies` used for some dependent files
for Win32 builds to `win32-deps` and make the necessary adjustments to
the CMake code.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-10-04 20:05:52 +00:00
Fabrice de Gans b22e9fb709
Ignore illegal opcodes used by Wii U VC (#1351)
The Wii U VC emulator incorrectly allows for armv6 thumb instructions
(like LSRS). These cause an undefined instruction error on real hardware
but the Wii U VC emulator just ignores them. This change mimicks the Wii
U VC emulator behavior.
2024-09-29 23:13:11 -07:00
Rafael Kitover 4e2799b582
build: don't hardcode Windows certificate password
Use a file for the Windows code-signing certificate instead of
hardcoding it into the CMake code.

Update the developer manual with instructions on where to put the
Windows code-signing certificate and the file containing the password
for it.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-09-29 20:59:40 +00:00
Fabrice de Gans 7fa90531e6
Disable open menu tracking outside of Windows (#1350)
Tracking whether or not the menus are opened is necessary on Windows since menus stop
the main loop. This is not necessary on other platforms. In particular, on Mac, we do
not get a `wxEVT_MENU_CLOSE` event when opening a dialog from a shortcut, resulting in
the menu status tracking being incorrect.

Fixes #1348
2024-09-29 13:59:19 -07:00
Fabrice de Gans e1c2ecc584
[dialogs] Display all controls in AccelConfig on Mac (#1349)
Calling `ExpandAll()` on the `wxTreeCtrl` would cause it to display outside of its
intended view, hiding other controls. Instead, this sets a minimum size for the tree
control, so the default window size is reasonable.

Fixes #1348
2024-09-28 10:38:28 -07:00
Rafael Kitover 4c450ab360
build: fix linking FAudio statically on MINGW
Link `FAudio.a` explicitly on MINGW toolchains, for some reason linking
`FAudio` with static preference no longer works.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-09-19 09:22:38 +00:00
Fabrice de Gans d5e1a1f36b [GB] Properly set OPRI on startup
Previously, the OPRI register was always set to be in CGB mode when not
using the CGB BIOS, resulting in graphics corruption when running DMG
software in CGB mode without using the CGB BIOS. This fixes the issue by
properly setting bit 1 of the OPRI register as expected.

This was broken in #1119.
2024-09-17 18:52:35 -07:00
Rafael Kitover 821b9176bd
build: do not use debug libs for RelWithDebInfo
Stop trying to use debug libs for `CMAKE_BUILD_TYPE=RelWithDebInfo`,
this also fixes the current link error with SFML.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-09-17 18:35:39 +00:00
Rafael Kitover 9031103c9a
build: fix linking non-debug pcre for debug wx
Remove the cmake code that adds the pcre library because the wxWidgets
cmake code correctly includes it now, on both vcpkg and MSYS2.

Also fix up `wxWidgets_ROOT_DIR` and `wxWidgets_LIB_DIR` for debug
builds.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-09-15 19:53:27 +00:00
Rafael Kitover b3952d74a8
build: fix ENABLE_LIRC=ON
Fix the `ENABLE_LIRC` cmake option, pass an interface specifier to
`target_compile_definitions()`.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-09-13 15:29:16 +00:00
Fabrice de Gans be09125d52 Use relative paths for installation
The CMake documentation [1] advises against using `CMAKE_INSTALL_FULL_*`
in `install()` commands.

[1] https://cmake.org/cmake/help/v3.30/module/GNUInstallDirs.html#result-variables
2024-09-13 01:05:38 +00:00
Rafael Kitover f264e7f807
Fix Help -> Translations URL
Fix the URL a browser is launched with when the `Help -> Translations`
menu item is selected to point to the project page on Transifex.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-09-12 17:35:40 +00:00
Fabrice de Gans 61f427dec1
Write shortcuts in the proper section (#1335)
Shortcuts were mistakenly written in `Keyboard/Keyboard` rather than in
the `Keyboard` section.
In addition, this properly fixes toggling checkable menu item options
via a shortcut.

Fixes #1334
2024-09-11 22:48:06 -07:00
Rafael Kitover 26207038c9
Update WinSparkle to 0.8.1 and add ARM64
Update the included WinSparkle dll to 0.8.1 and add support for using
the ARM64 WinSparkle dll as well.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-09-09 11:07:19 +00:00
Fabrice de Gans 2b8f9f71ff Copy string options rather than referencing them
This can lead to dandling references, though this is very unlikely. This
commit also removes a useless check.
2024-09-09 02:29:11 +00:00
Fabrice de Gans e76cef79d2 Remove cast for UTF-16 -> UTF-8 conversion
Add convenience functions to call `config::utf16_to_utf8()` without a
cast.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-09-09 02:29:11 +00:00
Fabrice de Gans 7f06428df8
Disable dialog position save/restore on wxGTK (#1331)
This is currently broken on Wayland, resulting in dialogs showing up in
random locations.
2024-09-08 16:56:30 -07:00
Fabrice de Gans aa6ed14b2a
[FAudio] Always convert UTF-16 names (#1328)
On Windows, wchar_t is 16 bits and represents UTF-16 code units.
However, on other platforms, wchar_t is typically implemented as 32 bits
to represent UTF-32 code units. In order to work around this problem, we
always convert the string we get from FAudio, which is represented as
UTF-16 code units, into UTF-8 and let wxString handle the conversion to
its native type internally.
2024-08-17 21:02:01 -07:00
Fabrice de Gans e4ef4aa625
Propagate key events (#1323)
Previously, `wxEVT_KEY_DOWN` and `wxEVT_KEY_UP` were transformed into
`VBAM_EVT_USER_INPUT` and marked as processed early. This broke a number
of controls that rely on the traditional widgets events.

To fix this, we now filter the `wxEVT_KEY_*` and `wxEVT_CHAR` events in
the only widget we use that cares about them, `UserInputCtrl` instead of
filtering them at the application level.
2024-07-28 15:19:19 -07:00
Rafael Kitover e2cf6ecba6 Add option to mute sound during speedup
Add core option to mute sound during speedup, implemented in the gba
core. Link the option to the SDL port as well.

Add the new Mute Sound option as a checkbox to the xrc for the
Speedup/Turbo dialog and improve the dialog appearance.

Fix the max values for the options speedup_throttle and
speedup_frame_skip.

Add base class for numeric OptionProxy types implementing the +=, -=
operators, increment/decrement operators and operator T(). Add tests for
these operators on numeric types.

Move Speedup/Turbo dialog code from guiinit.cpp to a dialog class and
rewrite it using validators.

Remove the "GL VIEWPORT" debug prints from panel.cpp.

Fix #865

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-07-05 12:14:58 -07:00
Rafael Kitover d516683a77
build: fix for wx using GTK2
Use the __WXGTK3__ macro to check for GTK3 when setting the gdk backend
to X11 when Wayland EGL is not available, GTK2 does not have this
function and always uses X11 anyway.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-06-14 11:10:00 +00:00
Fabrice de Gans 4f1a5dd726 [Test] Add tests for widgets code
This creates a vbam-wx-widgets target for the custom widgets code and
adds tests for them.
2024-05-29 19:30:35 -07:00
Fabrice de Gans f646c3848c [Test] Change assert to custom CHECK macros
This changes the way we handle asserts to use a set of custom macros.
This greatly speeds up crashing, especially on Windows, and provides
assertions in release mode too.
2024-05-21 18:47:50 +00:00
Fabrice de Gans 05c09ff506 [Build] Add devkitpro-based libretro targets to CI 2024-05-10 13:36:05 -07:00
Fabrice de Gans 5b8b6a0b47 [Test] Add tests for the EmulatedGamepad class 2024-05-09 17:48:48 -07:00
Fabrice de Gans 8809ce26b3 [Test] Add tests for the Bindings class
In addition to fixing a couple of minor bugs, this also creates some
utility functions to access the cmdtab data.

Finally, this disables tests on MSYS2 as they can be flaky.
2024-05-09 13:15:16 -07:00
Fabrice de Gans a48625855b [Build] Share wx-related targets configuration
Breaking the main wx target down to multiple libraries had the side
effect that many build options were not properly applied to libraries.
This fixes the issue by having a common configuration function in CMake
to share most of the configuration between all of the wx-related
targets.
2024-05-09 12:28:05 -07:00
Rafael Kitover 55c1477d69
build: disable FAudio for 32 bit Windows builds
Disable FAudio for 32 bit Windows builds because it uses libraries that
Windows XP does not have.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-05-09 02:34:25 +00:00
Rafael Kitover 2d7a1ea25b
build: fix faudio linkage regression on MSVC+vcpkg
Followup on 244149c0 (build: fix faudio static linkage, 2024-05-09)
which broke linking faudio on MSVC+vcpkg, go back to using the
FAudio::FAudio cmake target for MSVC.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-05-09 01:38:44 +00:00
Rafael Kitover 244149c00e
build: fix faudio static linkage
Use "faudio" and dependent dlls on Windows instead of the FAudio::FAudio
cmake target, because the cmake target always links the faudio dll.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-05-09 01:25:05 +00:00
Fabrice de Gans c0bcf3bfdf [Test] Add tests for many config classes
This also fixes a coupld of minor issues that were found while adding
tests.
2024-05-08 13:08:07 -07:00
Fabrice de Gans 13756bcbf9 [Test] Replace doctest with googletest
* Convert the only existing test (strutils) to googletest.
* Create a test target for vbam-wx-config.
* Add necessary fakes for the test binary.
* Add tests to CI.
2024-05-08 13:00:56 -07:00
Rafael Kitover df89beb256
build: disable gpg signatures by default
Add the GPG_SIGNATURES cmake option to control creating gpg clearsign
signatures for the translations and exe zips for UPSTREAM_RELEASE,
defaulting to OFF.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-05-07 02:59:17 +00:00
Fabrice de Gans c9668d9a88 [config] Create the vbam-wx-config target
Circular dependencies between the config sub-module and the rest of the
wx frontend have been removed. This change separates the config code to
its own submodule.

This is a preliminary change to improve testing coverage.
2024-05-05 22:57:47 -07:00
Fabrice de Gans 90a56c6937 [config] Move strutils to src/config/
This removes circular dependencies between the main wx target and the
config/ sub-directory.
2024-05-05 21:38:14 -07:00
Fabrice de Gans d543784a3d [UserInput] Filter key events globally
This changes key events to be filtered globally by the application,
preventing any widget from accessing them. Widgets should instead use
the new VBAM_USER_INPUT_EVENT event.

In addition, this explicitly removes accelerator handling from wxWidgets
main menu, allowing us to populate joystick options in the menu without
firing wxWidgets assertions.
2024-05-04 16:07:25 -07:00
Fabrice de Gans 902c6c8e4b [UserInput] Only process shortcut commands once
This modifies the UserInputEvent class to fire a vector of events at
once, rather than individual down/up events for each UserInput. This
simplifies handling of the global event filter and prevents the firing
of spurious events.

This also fixes a bug when pressing "Ctrl+1" would trigger the command
for both the command assigned to "Ctrl+1" and to "1". Now, only the
"Ctrl+1" command will fire.
2024-05-04 13:38:43 -07:00
Fabrice de Gans d32be9ddbe Move cmdtab and command enable flags to config/
* Moves cmdtab to config/. This removes the dependency on the wxvbam.h
  header from the config/ directory.
* Fixes a number of issues in the shortcuts configuration window:
  * The "Remove" command was not working properly due to an incorrect
    refactor.
  * The window is now fully expandable.
2024-05-04 10:44:06 -07:00
Fabrice de Gans b776509287 [bindings] Set default shortcut for recent file 3
This was lost in translation between 2 refactors.
2024-05-03 17:30:51 -07:00
Rafael Kitover 3e30f54d5f
translations: fix strings starting with lowercase
Fix translated strings that start with lowercase to start with
uppercase.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-04-28 19:16:26 +00:00
Fabrice de Gans 18a0067ca7 [Input] Unify command handling
This unifies command handling between game and shortcut commands. Both
types of commands are now handled in a common manner and the binding
configuration is shared. In particular, this prevents assigning the same
user input (joypad or keyboard) to a game command or a shortcut command.

Bug: #745
2024-04-23 18:02:25 -07:00
Fabrice de Gans cfdbdc4ec2 [Input] Move input configuration objects to app
Previously, some input-related configuration objects were either owned
by `gopts` or global values. This moves these objects to be owned by the
app object instead.

Rather than directly accessing the app object, other objects (like
dialogs) that need to access the input-related configuration objects are
passed a `ConfigurationObjectProvider` function. This will make it
easier to test these objects independently down the line.

Bug: #745
2024-04-23 15:38:39 -07:00
Fabrice de Gans 62294702e4 [Input] Remove transitional key, mod, joy triplet
Originally, UserInput was built around the key, mod, joy triplet values
to maintain compatibility with other parts of the code base that made
use of these values. Since the UserInput class was introduced, all use
cases have been transitioned off these values in favor of treating the
UserInput as an abstract input.

UserInput is now a simple wrapper around either a KeyboardInput or a
JoyInput structure that only contain data pertinent to their input type.

This concludes the transition to the UserInput type.

Bug: #745
2024-04-23 14:26:59 -07:00
Fabrice de Gans 1e1a369c8d [Input] Unify UserInput event handling
This adds a custom UserInputEvent for handling joypad and keyboard input
for both accelerators and emulator control configuration.

These changes fix a number of issues with the wxWidgets implementation
of key down / up event handling. In particular, every "down" event now
has a corresponding "up" event. All of the special handling that was
done in multiple places to handle shortcuts is now done in a new class,
`UserInputEventSender`, simplifying multiple call sites.

This is another step towards complete unification of UserInput handling,
which will prevent double assignment between shortcuts and emulator
controls.

Bug: #745
2024-04-23 11:30:20 -07:00
Fabrice de Gans 32627f6b85 [Dialogs] Save and restore dialog positions
This changes most dialogs in the wx frontend to use a common base
abstraction, `dialogs::BaseDialog`. This base class sets up common
style options for every dialog and automatically saves and restores the
dialog position.

In addition, this moves the first time show position of the dialog to be
slightly to the bottom and right of the main window, even if the main
window is on a screen other than the main screen.
2024-04-18 09:02:08 +00:00
Rafael Kitover 8d08223dbc
build: fix compatibility with older ffmpeg
Check LIBAVCODEC_VERSION_MAJOR and use the older channel_layout API if
it's below 60.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-04-16 16:19:12 +00:00
Rafael Kitover 6766b9ca54
build: fix ffmpeg 7.x compat
Update from the channels/channel_layout API to the new ch_layout API,
assume two channel stereo always.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-04-15 23:28:56 +00:00
Ruben 647be137f6
gba: set cpsr=spsr when switching to FIQ mode
The CPSR register needs to be restored from SPSR when switching modes.
This is currently being done for all mode switches /except/ for FIQ,
which is very likely just an oversight rather than intended behaviour.

This fixes the random crashing in OpenLara, as well as fixing random
glitching of my own project that uses FIQ mode switches. The issue
happens "at random" because it requires an interrupt to occur while in
FIQ mode, and it must also fire inside a section of code that relies on
the status flags (or the CPSR register in general): When exiting the
interrupt exception, the CPSR register is supposed to be restored from
SPSR, but this isn't being done when switching from IRQ mode back to FIQ
mode, which results in CPSR (and thus the status flags) being corrupted.
For example, SUBS r0, #1; [interrupt]; BNE 1b would trigger the bug, but
[interrupt]; SUBS r0, #1; BNE 1b wouldn't, and neither would
SUBS r0,#1; BNE 1b; [interrupt].
2024-04-12 15:49:45 +00:00