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>
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>
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.
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>
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
* 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.
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.
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>
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.
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.
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.
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.
* 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.