Commit Graph

3055 Commits

Author SHA1 Message Date
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
Squall Leonhart 166299cda6 Implements Read/Writes for HUC3
Also seperates HUC1 from MBC1
2023-02-27 02:18:27 +00:00
Rafael Kitover 1a63a27c62
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-02-27 02:01:01 +00:00
libretroadmin 640ce45325 Change SOUND_CLOCK_TICKS to 280896 cycles - ~1074 samples per frame 2023-02-27 00:14:05 +01:00
Rafael Kitover 83d24828df
build: fix default debug build for vscode
Check if CMAKE_BUILD_TYPE is false and not just empty string, as it is
some kind of other empty value in the default vscode build and the check
fails.

If CMAKE_BUILD_TYPE is unset, default to Debug, which is what vscode and
most things expect as the default CMAKE_BUILD_TYPE.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-02-21 20:53:20 +00:00
Fabrice de Gans f1d3f631d2 Fix automatic dynamic frame skipping
The previously used algorithm was too aggressive. This fixes the issue
by using the last second data and using a more gentle adjustment curve
to prevent huge changes in frame skipping.
2023-02-15 13:52:16 +00:00
Fabrice de Gans d1733c4505 [ConfigManager] Move wx options to g_owned_opts
This is a preliminary change towards removing ConfigManager from the wx
build. Usage of these options has also been modified in the wx frontend.
2023-02-14 18:06:41 -08:00
Fabrice de Gans d37a3a32e1 Move remaining options used by core to CoreOptions 2023-02-14 16:33:03 -08:00
Rafael Kitover 3f507b6c6a
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-02-14 02:01:02 +00:00
Rafael Kitover e560efb08f
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-02-12 02:00:57 +00:00
Rafael Kitover ca841e9bae
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-02-11 02:00:59 +00:00
Rafael Kitover 4b605b4b1a
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-02-10 05:53:02 +00:00
Stanley Kid d756f6716f
translations: fix some source strings
Fix some more strings marked for translation in the source code to be
more correct and easier to localize.

References #1071 #1029

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-02-10 05:50:20 +00:00
Rafael Kitover 49140fe5dd
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-02-10 02:01:01 +00:00
Rafael Kitover 5d4f1bd0d9
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-02-09 16:18:49 +00:00
Fabrice de Gans 91873254d3 Add INI file versioning
This introduces a new INI config option called "IniVersion". Whenever
default values change or options are renmaed, the latest version number is
incremented and an update path is run.
This change also rewrites part of the initialization routine by adding
more safety checks before creating or reading the configuration file.
2023-02-08 01:31:40 +00:00
Rafael Kitover ae09ae7d59
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-02-07 02:01:00 +00:00