* 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.
* 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.
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>
Update the Visual Studio build configurations in CMakeSettings.json to
remove dynamic builds and add RelWithDebInfo.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
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>
* 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.
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.
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.
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>
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#788Fix#1077
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
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>
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>
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.
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.
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.
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.
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>
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.
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>
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.
This also removes limits on the main window position so it can now be
negative. This is necessary on Windows where multiple screens to the
left and top of the main screen have negative coordinates. A check at
startup ensures we always restore the window within the drawable area.
This introduces an OPTION macro, as well as assignment operators and
convenience conversion operators to make it easier to treat the
OptionProxy object (renamed from Proxy) as a variable.
This removes the global accessors for individual options in favor of a
proxy template class with a simpler per-type API. This adds compile-time
checks to validate that the right option is used with the right type
when accessing it directly.