Commit Graph

2054 Commits

Author SHA1 Message Date
Zach Bacon 23ef8ef0f9
Dialog appearance improvements + link warning
In SoundConfig.xrc and DisplayConfig.xrc use the 'option' property
to fully expand the contents.

In NetLink.xrc add a label at the top of the dialog explaining that Link
will likely not work over the internet or over LAN.

Signed-off-by: Zach Bacon <zachbacon@vba-m.com>
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-01-15 16:19:52 -08:00
Stanley Kid e70e57a5c0
translations: remove strings to not translate
Mark some strings that don't need to be translated as such to remove
them from the catalog.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-12-29 14:23:16 +00:00
Rafael Kitover a045270164
build: don't fseeko64()/ftello64() on musl libc
Check for musl libc in Patch.cpp and use fseeko()/ftello() in that case
instead of fseeko64()/ftello64() as well, as the 64 variants are glibc
extensions.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-12-23 10:23:25 +00:00
Zach Bacon 9e9fe812d2 visualboyadvance-m.metainfo.xml: add screenshots to the metainfo
Useful for app stores like KDE's discover and gnome software
Also updated to current specifications of appstream
Signed-off-by: Zach Bacon <zachbacon@vba-m.com>
2023-12-20 22:06:21 -05:00
Fabrice de Gans beab088139 Store the PC register at the appropriate offset
In ARM mode, the GBA CPU stores the PC (r15) register with an offset of
4. This was not handled correctly by the core emulator.

Fixes #1200
2023-11-10 15:55:41 -08:00
Rafael Kitover 215e9b1ac2
build: fix vcpkg support for Linux
Fix the Linux-specific date command in the cmake code, and skip the ABI
check for vcpkg, because it is failing for some reason on Linux+vcpkg.

The resulting executable works perfectly.

This should also help on mac, I will test this later.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-11-10 09:50:50 +00:00
Fabrice de Gans bf2452aab9 Resize GameArea after MainFrame initialization
The GameArea was setting incorrect minimum size during initialization
due to the MainFrame not being entirely loaded, this caused the
MainFrame to not be resized properly on initialization. Resetting the
MainFrame minimum size after everything has been loaded fixes the issue.

This also changes MainFrame to ignore events sent before initialization
is complete, which should speed up startup a bit.

Fixes #1186
2023-10-24 12:49:34 -07:00
Fabrice de Gans 71ca0fb270
Properly hide the status bar at startup
Previously, the status bar was always shown at startup, even if the
status bar had been previously disabled. This fixes the issue by hiding
the status bar when it is first set up, if needed.
2023-10-24 17:51:02 +00:00
Rafael Kitover 7e1afcd37c
Fix reading joystick hat config values
Use the wxString-returning form of wxRegex.GetMatch() because the bool
form always returns true if the initial match succeeded, causing every
hat direction in the config to be interpreted as north, the first
condition in the if statement.

Fix #1192

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-10-20 17:45:54 +00:00
nuive 32581966ae Link: Fix menu not refreshing correctly
Start Network Link is not allowed while Local mode is selected, but
state change of Local mode was ignored until an option which triggers
EnableNetworkMenu() was selected.

Removed EnableNetworkMenu() from the Configuration option because it
doesn't change anything related to Link menu state.
2023-10-15 03:36:38 +00:00
Rafael Kitover e17d2cbaf5
build: fixes for nix on macOS
Add references to frameworks being linked to `buildInputs` in
`default.nix`.  Remove `-framework System` from `wxWidgets_LIBRARIES` in
the cmake code as it's not necessary and nix does it have it in
`darwin.apple_sdk.frameworks`.

TODO:

Debug build currently builds and runs. Release build builds but does not
run because of a problem with the dylib bundling.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-10-04 13:19:44 -07:00
Rafael Kitover aca206a721 Launch on xwayland under Wayland if no EGL
On initialization, if wxWidgets was compiled without EGL support, check
in environment variables if running under Wayland and if so tell GDK to
prefer using an X11 backend, causing the program to launch under
xwayland.

Fix #1028

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-09-10 21:14:45 -07:00
Rafael Kitover 93a24bee3c Disable mirroring for ROMs > 32MB
In doMirroring() do nothing if the ROM size is greater than 32MB. This
fixes these ROMs automatically working without disabling mirroring in
settings.

Fix #1046

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-09-06 18:52:35 +00:00
Fabrice de Gans 0f4ec57557 [Build] Fix the NO_LINK build
The NO_LINK build had bitrot and was no longer building. This fixes the
issue by properly disabling Link-related code, including unreachable
functions when the project is built with ENABLE_LINK=FALSE
2023-09-04 13:46:29 -07:00
Fabrice de Gans 803ab35269 [GB] Save MBC7 EEPROM data to `gbRam`
Previously, MBC7 EEPROM was saved at address 0xa000 in memory, rather
than inside the `gbRam` data buffer. This was inconsistent with other
mappers, resulting in issues like the EEPROM data being cleared on
`gbReset`.

Fixes #1173
2023-08-27 17:08:09 -07:00
Fabrice de Gans 24b6ac5a28 [GBA] Implement missing Thumb instruction
The CMP Thumb instruction was missing one variant. This is used in the
Chinese fan translation of Mega Man Battle Network 2.

Fixes #889
2023-08-27 16:52:36 -07:00
saulfabreg Wii VC Project 76cb71464d Fix GameCube builds for VBA-M Libretro too
The GameCube, like the Wii and Wii U, is also big-endian, so let's fix VBA-M for GCN too.
2023-08-19 15:26:08 +00:00
saulfabreg Wii VC Project 3745eea419 Fix Wii & Wii U builds of VBA-M for Libretro (Ploggy)
Since Wii and Wii U are both big-endian systems, we need to call in the Makefile for Libretro cores that these must use big endian code for be able to work, otherwise the emulation will just give a white screen.
Fix by Ploggy, many thanks to him.
2023-08-19 15:26:08 +00:00
Fabrice de Gans 14a4b6f820 [dialogs] Move JoypadConfig to its own class. 2023-08-13 16:07:31 -07:00
Rafael Kitover 32d273ad78
build: notarize mac release binary
Notarize the mac release binary from cmake as described here:

https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution/customizing_the_notarization_workflow?language=objc

. This involves adding `--options runtime` when codesigning to enable
the hardened build.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-07-22 20:51:48 +00:00
Rafael Kitover 774fbab7cc
build: write version to macOS plist
Separate writing the version into the Info.plist on macOS into a
separate action from the online updates Sparkle framework into a
separate POST_BUILD action because we are not using Sparkle for macOS
builds right now due to codesigning issues.

Also sort tags by reverse tag name in the cmake git version extractor
because a tag was rewritten.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-07-12 06:24:20 +00:00
Rafael Kitover bde372bc72
build: fix codesigning arm64 release binaries
CMAKE_CROSSCOMPILING is true when building arm64 on an x64 host, so
ignore this on MSVC.

Eventually we want to run osslsigncode through wine when cross compiling
for win32 on other platforms, or use the native signtool.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-07-10 01:37:55 +00:00
Squall-Leonhart 7561ca97c1
Fix Discord streaming for OpenGL
Check if the OpenGL context is valid on every operation, and if not
re-initialize it. Also rebind the textures every time the frame is
drawn.

Also rename the SetCurrent method to SetContext, which is clearer.

Fix #643
Fix #767
Fix #840
Fix #843

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-07-06 20:40:54 +00:00
Rafael Kitover 882957a2d3
Override SetCurrent() in GLDrawingPanel
Make a bool SetCurrent() wrapper over checking the wxGL_IMPLICIT_CONTEXT
define and executing the appropriate behavior to set the OpenGL context.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-06-28 21:12:01 +00:00
Rafael Kitover 5b65066bf8
build: on mac install trans into debug builds too
Change the cmake code to install the translations gettext .mo files into
the .app bundle for non-release builds too.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-06-27 22:14:37 +00:00
Fabrice de Gans 6f68bfcf71 Create the config directory at first launch
First launch would fail because wx does not create the configuration
directory by itself if it does not exist.
This also fixes an incorrect menu option.
2023-06-01 18:28:14 +00:00
Fabrice de Gans e26f807355 [bios] Fix lz77 and add BIOS_SndDriverVsyncOn
The lz77 uncompresssion software BIOS implementation was exiting early
when uncompressing data, if the overall length was larger than
advertised in the function parameter. However, real GBA BIOS does read
further than the advertised length, so we do here too. This fixes
Advance Wars title screen.

This also adds a SoundDriverVSyncOn implementation, silencing an error
for some Shrek games, though they still cannot properly boot with an
emulated BIOS.

Fixes #789
2023-05-27 22:51:39 +00:00
Fabrice de Gans bad388e0aa Move the GB ROM Info dialog to its own class
* Move the Game Maker information to a separate helper method.
* Make the dialog strings more localizable.
2023-05-23 15:19:39 -07:00
Fabrice de Gans d1f6500098 Refactor accelerator / global shortcuts handling
* Removes wxAcceleratorEntryUnicode and assorted arrays in favor of a
  new class, `config::Shortcuts`, which handles UserInput assignment to
  commands and resolution at runtime. `config::Shortcuts` also handles the
  INI user configuration in a backwards-compatible way. Runtime
  resolution of UserInput to command is also now logarithmic rather than
  linear.
* The same shortcut can no longer be assigned to 2 different commands,
  which fixes #158.
* Moves the `AccelConfig` dialog to its own dedicated class.
2023-05-23 11:56:32 -07:00
Fabrice de Gans fda429fc64 [GBA] Do not draw BG tiles from outside of BG VRAM
This was fixed by endrift in mGBA in commit
4ce9b83362
2023-05-09 17:12:30 -07:00
Fabrice de Gans b139572424 Convert wxJoyKeyCtrl to UserInputControl
This replaces all uses of wxJoyKeyCtrl with a new custom widget,
UserInputControl. Internally, this class keeps track of UserInputs
associated with the current control, allowing direct access to the
UserInputs, rather than going through string conversions.

Acceleration handling is simplified by going through UserInput -
converted to the key, mod, joy triplet for now - rather than handling
string comparisons.
2023-05-08 01:42:39 +00:00
Fabrice de Gans 5aa3ea92b9 Properly initialize wxAcceleratorTable
The `wxAcceleratorTable` for the `GameArea` panel was initialized with an
array of `wxAcceleratorEntryUnicode`, while the API calls for an array
of `wxAcceleratorEntry`. This resulted in the array not being properly
interpreted by the `wxAcceleratorEntry`. This fixes the issue by using
`wxAcceleratorEntry` to instantiate the array.
2023-04-24 18:04:43 -07:00
Fabrice de Gans 7b5d4a82d7 Remove unused code and use explicit type coercions 2023-04-24 18:04:32 -07:00
Fabrice de Gans 1f57d5f797 Remove global variables for ROM data
These can be accessed via the global gbCartData object. In addition,
this cleans up gbMemory to remove dead code that was used as a
workaround for ROM hacks.
2023-04-24 13:52:12 -07:00
Fabrice de Gans 0e29be8735 Support multiple RAM sizes for MBC7
We rely on the rom size in the cartridge header as a proxy for the RAM
size. Only 3 cartridges exist that use MBC7, Korokoro Kirby / Kirby
Tilt'n'Rumble and Command Master. Both versions of Kirby use a 256 bytes
EEPROM while Command Master uses a 512 bytes EEPROM. There does not seem
to be any other way to reliably get the EEPROM size for MBC7 cartridges.
2023-04-17 17:07:18 -07:00
Fabrice de Gans 75b79d91f1 Change MBC7 reported RAM size to 512 bytes
Some MBC7 cartridges use 512 bytes EEPROM rather than 256 bytes. For
compatibility with older versions, we keep saving and loading 256 bytes
of EEPROM for every MBC7 cartridge. TODOs have been left to figure out
how to identify the EEPROM capacity properly.
2023-04-17 17:07:18 -07:00
Fabrice de Gans 52c05c7147 Simplify battery save / load
* Removes all of the per-mapper helper functions in favor of an
  iovec-like structure that is set on ROM load and ROM patch.
* Changes the MBC7 RAM size to 256 bytes, which is what the cart
  actually uses.
* Works around issues with homebrews by overriding some of the header
  data. For instance, battery is disabled if a cart specifies a battery
  but no RAM and no RTC.

Test: This was tested with every known RTC/RAM/Battery variations by
creating a battery file before these changes and checking that the
battery file is still loaded properly with these changes applied. The
reverse was also tested to ensure compatibility.
2023-04-17 17:07:18 -07:00
Fabrice de Gans d8d6991c4b Refactor the save/load state and battery code
* Simplifies most of the GB save/load state code and changes many
  of the global variable uses to go through gbCartData instead.
* Changes all battery reads to use gzFiles. This seems to have been an
  oversight in an earlier refactor of the code.
* Removes some unused variables and stops exporting internal-only
  functions in GB.cpp/gb.h.

Breaking change: Cartridges with no mapper, but a save battery should
now properly save and load changes. However, this type of cartridge has
not been used in any commercially released software for Game Boy so the
exact intended behavior is speculative.
2023-04-17 17:07:18 -07:00
Rafael Kitover 36e88fafb6
Fix dsound looping when moving/resizing window
Add MOVE_START/MOVE_END events to detect when the window is moved or
resized and pause sound on Windows to prevent the DirectSound driver
from looping.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-04-13 13:47:17 +00:00
Rafael Kitover 23aa083cd4
build: support RelWithDebInfo for vcpkg
Make some tweaks to the cmake files to support
CMAKE_BUILD_TYPE=RelWithDebInfo, release with debug information for MSVC
vcpkg builds.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-04-12 02:43:13 +00:00
Fabrice de Gans 86bef62faf Move more options to g_owned_opts
* Moves most remaining options toggled by menu items to g_owned_opts and
  modifies associated usage.
* Adds more obervers to handle option changes.
2023-04-07 15:36:45 -07:00
Fabrice de Gans 928a61704f Move directory options to g_owned_opts
* Moves most directory settings to g_owned_opts.
* Converts the DirectoriesConfig dialog to the new structure.
* Various includes clean-ups.

Breaking change: Loading a GB/GBC/GBA ROM when the ROM directory setting
is unset for that platform will now populate the per-platform ROM
directory setting.
2023-04-06 00:49:55 -07:00
Fabrice de Gans 019fcda9c1
Sanitize and improve the GB header parsing (#1109)
Further testing showed some limitations with the current GB header
parsing. Many homebrew and some licensed cartridges do not follow the
expected format. In particular, the manufacturer code used in the "new
format" is not always used properly.

Some mapper flags seem to not actually exist in practice. These have
been documented as comments.

The header parsing code was creating string objects with '\0' bytes,
this is now properly sanitized.

The destination code flag was not being set properly. This has been
fixed.
2023-04-06 00:49:08 -07:00
Fabrice de Gans 7005b92840
Sanitize allocations in the Game Boy emulator (#1105)
This adds checks for every allocation failure in the core Game Boy
emulator. In addition, this replaces some magic values defined
constant expressions and removes an unused function.
This also removes asserts for failed allocations in GB.cpp, they now
report a failure to the caller.
2023-04-03 12:47:55 -07:00
Fabrice de Gans e91e4dcf17 Add nanosvg library dependency for vcpkg static builds
nanosvg is now a required dependency with recent wxWidgets builds.
2023-04-01 17:15:22 -07:00
Rafael Kitover 3cef52b72d
Fix pause/next-frame
Pause only sound on menu open on Windows, and resume on menu close if
emulator is not paused.

This is to avoid DirectSound looping on menu open.

Fix #788
Fix #1077

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-03-30 00:22:54 +00:00
multiSnow Liu d3f8cc1714
Option to suspend the X11 screensaver when running
On Linux, when not running under Wayland and the app was built with XSS
(X ScreenSaver) support, optionally suspend the X11 screensaver when a
ROM is loaded and not paused.

Add a "Suspend ScreenSaver" checkbox in UI Settings bound to an option
to enable this feature, visible only under X11.

Defaults to off, as there is already a call to suspend the screensaver
on joystick input, which may be sufficient for the user.

TODO: Add necessary support for other platforms.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-03-28 16:28:36 +00:00
Fabrice de Gans 0132c76100 Move GB/GBC header parsing to gbCartData
This adds a new class, gbCartData to do all of the GB/GBC header parsing
in a single location.

Breaking change: ROMs advertising a 2 KiB RAM size now properly only
have 2 KiB allocated for RAM, whereas it used to be 8 KiB. This was
tested with the one aftermarket ROM making use of this RAM size
(Quartet), with no issue. Save files and save state files should still
be compatible since the RAM was saved with the correct 2 KiB size.
2023-03-27 10:55:00 +00:00
Rafael Kitover e505236ec4
Merge remote-tracking branch 'libretro/master'
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-03-25 12:23:58 +00:00
Fabrice de Gans 1ab46f704f Update SIOCNT when the link driver is disconnected
Some software (like the EU version of Digimon Racing) relies on the
SIOCNT register being properly updated when no cable is connected.
Otherwise, they risk getting stuck in a loop waiting for an update on
the SIOCNT register.
2023-03-19 22:22:43 +00:00