Commit Graph

3071 Commits

Author SHA1 Message Date
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
Rafael Kitover 790618102d
builder: bump SDL2 2.24.0 -> 2.28.0
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-06-23 00:56:37 +00:00
Rafael Kitover 9331dbf9c8
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-06-04 02:01:00 +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
Rafael Kitover 7b8c4242fb
builder: macOS build updates
Update glib/gvdb to fix a compile error with newer clang compilers.

Add link flags for ffmpeg to link the static libraries and frameworks it
needs.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-05-31 13:38:44 +00:00
Rafael Kitover df84f2b005
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-05-31 02:01:00 +00:00
Rafael Kitover d08c9137c1
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-05-29 02:01:01 +00:00
Rafael Kitover 7aafce0665
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-05-28 02:01:01 +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
Rafael Kitover 4c8b54de89
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-05-26 03:28:10 +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
Rafael Kitover b9694e1900
build: fixes for mac Homebrew
Add some fixes for building on macOS Homebrew.

- Set ZLIB_ROOT because zlib is now keg-only. Unfortunately the cmake
  warning about policy CMP0074 cannot be suppressed because of some kind
  of cmake bug.

- Update FindFFmpeg.cmake from:
  https://github.com/snikulov/cmake-modules/blob/master/FindFFmpeg.cmake
  , this fixes a problem with FFmpeg not being found.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-05-07 23:41:51 +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 93fbb5618d
build: add arm64 VS build configs
Add arm64 configurations to CMakeSettings.json for Visual Studio.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-04-12 03:01:25 +00:00
Rafael Kitover 6a1be5d4ad
build: update VS build configs
Update the Visual Studio build configurations in CMakeSettings.json to
remove dynamic builds and add RelWithDebInfo.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-04-12 02:52:02 +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
Rafael Kitover 40711fa5c9
build: lowercase vcpkg package names
vcpkg now requires that package names be lowercase, change all package
names to lowercase.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-04-11 23:17:06 +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 88b07df394
build: add pkgconf to vcpkg deps
Add pkgconf to list of vcpkg deps. We are not using it right now for
vcpkg builds, but it may be good to have available.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-03-31 00:08:15 +00: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
Rafael Kitover df81959825
builder: update macOS build to 10.10, Wx 3.2.2.1
Bump the macOS target OS from 10.7 Lion to 10.10 Yosemite to use the
newest Wx, 3.2.2.1.

This also fixes dark mode support on macOS 13 Ventura.

Remove --enable-static from base CONFIGURE_ARGS because it breaks Wx,
and add it to DIST_ARGS where it's needed, libffi, libicu and libx264.

Make the necessary adjustments to build the new Wx and a couple of other
minor fixes.

Fix #1102

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-03-27 14:59:10 +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
Rafael Kitover 785af394f6
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-03-24 02:01:03 +00:00
Rafael Kitover f15b09f8e5
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-03-20 22:43:31 +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
Fabrice de Gans 9889ef4fa8 Move GameBoyConfig dialog to its own class
This changes all of the options handled by the GameBoyConfig dialog to
use the new Option type. This also fixes a number of small issues
related to palette handling and GB emulation:
* Modifying the custom GB palette no longer incorrectly applies to GBC
  and SGB modes.
* Loading a GB save state (not GBC or SGB) properly applies the
  user-defined palettte and not the one in the save state.
* The GBC core now accepts .gbc BIOS files.

Finally, this modifies and renames wxFarRadio to widgets::GroupCheckBox.
In addition GroupCheckBoxes can now be loaded and fully configured from
the XRC file rather than having to be manually configured on dialog
initialization.
2023-03-15 00:45:22 +00:00
Rafael Kitover 1d7e8ae4ed build: fix build with new OpenAL
Remove the AL_NO_PROTOTYPES #define, it breaks the build with new
versions of OpenAL.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-03-12 15:06:42 +00:00
Fabrice de Gans 892527e53b Move ConfigManager to SDL
This removes ConfigManager from common source and header files and moves
it to be only used by the SDL frontend.
2023-03-07 14:11:52 -08:00
Fabrice de Gans bd7eac6c4b Add options shared with sdl to wx g_owned_opts
This removed the dependency on ConfigManager from the wx frontend.
Next: Move ConfigManager to be only used by the SDL frontend.
2023-03-07 13:38:46 -08:00
Zach Bacon efffe7c333 Add the repology badge to the readme.
Signed-off-by: Zach Bacon <zachbacon@vba-m.com>
2023-02-27 21:07:25 -05:00
Squall Leonhart a529ddfe49 remove non-working override. 2023-02-27 20:31:02 +00:00
Squall Leonhart 9a8a077443 Lets fix Stuart Little 2 properly (maybe?)
This game cart may have a flashcontroller but no flashram onboard, the game automatically goes down the Flash Type path and hits a stackoverflow at cpuSaveGameFunc after cpuSramEnabled returns as false

I'm not sure of the specifics, but with this change it seems to avoid this condition.

I have tested a number of titles that create Sram, 512 and 1024Mbit flash and they all still seem to just fine.
2023-02-27 20:31:02 +00:00
Squall Leonhart a9284b3d66 workaround for Stuart Little 2 crashing when set to none
despite not having backup ram.
2023-02-27 17:17:28 +00:00