We offer a way to control the color saturation for GBA games such as
Fire Emblem Tactics Advance.
It will be enabled by default for GBA games and disabled for GB.
The user will be able to toggle both of them and these options
will be persistent by saving to `vbam.ini`.
- Fix#131.
Add a ZIP_SUFFIX option defaulting to "" that is added to the generated
.zip file with UPSTREAM_RELEASE before the .zip extension.
For example, for an experimental feature you could pass
-DZIP_SUFFIX=-timer_loop and the resulting .zip file would be
visualboyadvance-m-Win-64bit-timer_loop.zip or
visualboyadvance-m-Win-64bit-debug-timer_loop.zip for a debug build.
Also add a modeline to this cmake file because vim-sleuth always gets
the settings wrong. Or it could be the cmake filetype plugins.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
For the netlink dialog, leave the server IP text field enabled when the
server radio button is selected and bind it to the new option
gopts.server_ip which defaults to "*" for binding on all addresses,
which was the previous behavior.
Copy this value to the new GBALink global IP_LINK_BIND_ADDRESS and use
it when creating a listening socket.
SFML supports creating sf:IpAddress values from hostnames, consequently
no additional code is needed to support hostnames in the netlink dialog.
Change GetLinkServerHost to return the primary local address when the
value is "*", which was the previous behavior, and the set value
otherwise.
Remove the min/max macros from GBALink as they are unnecessary and
conflict with std headers.
Require at least SFML 2.4 instead of 2.x for the IP binding
functionality in cmake.
- Fix#632
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
For the zip file containing the executable (and symbols for debug builds
on msvc) add the -debug suffix to the basename of the zip file for debug
builds.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
When UPSTREAM_RELEASE is set, only use gpg to make detached signatures
if the output of gpg -k is not blank. If it is not, the user has likely
installed a private key to sign with.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Quote variables containing the HOME or USERPROFILE, as they may have
spaces.
Check for both osslsigncode and signtool regardless of platform, and
prefer osslsigncode.
The reason for this being that osslsigncode is more reliable and does
not depend on system configuration in any way, while signtool can fail
under more conditions.
The other reason being that you can use either program on both windows
and linux. E.g. the mingw version of osslsigncode or the signtool from
mono distributions on linux.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
When we have a notebook with intel+nvidia, OpenGL sets both
`glXSwapIntervalSGI` (nvidia) and `glXSwapIntervalMESA` (intel) for
usage. That means that if the display is controlled by one, we may
disable vsync for the other card, therefore having no actual effect
on gameplay. With this, we check for all available functions and try
them all.
This may lead to some false warnings, but useful for debugging
purposes.
The vsync has to be {dis,en}abled before a ROM is loaded or we need to
restart the output module to apply it.
We also support MESA based installations (Intel HD Graphics, AMD/ATI and
Nouveau) on Linux.
Include the visualboyadvance-m.pdb file alongside the .exe for Visual
Studio debug builds.
Visual Studio generates this file with the debug symbols for debug
builds. The file is not generated for release builds. It is also
generated for RelWithDebInfo builds.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
soundInit() returns a bool to indicate success, and failure inevitably
leads to crashes as the emulator tries to use a NULL soundDriver.
On false, popup an error dialog saying that the sound driver failed to
initialize, this is at least better than crashes, which will also need
to be fixed.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Limit the utilLoad() function in src/Util.cpp to 32 MiB.
This function loads a file from disk and returns a memory image of it.
This is only used to load ROMs currently.
Followup on 513af13d which replaces the use of libpng with the stb_image
headers.
- Remove the use of libpng in cmake.
- Remove libpng from list of vcpkg dependencies.
- Add libpng to list of wxwidgets link libraries when using vcpkg, since
it is no longer linked directly. This is necessary for static builds.
- Remove libpng from all package lists in installdeps.
- Remove libpng-dev from the debian control file.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Extract strings from all wx sources, not just the enabled ones.
Ignore comments in the generated pot when checking if it was updated, we
don't care about just changes in line numbers.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
gcc (mingw) does not allow converting a const char*[] to a char**
without -fpermissive. Make some adjustments to the string handling to
execute the cmd.exe command to delete the temp file.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Trying to delete the temp file for the winsparkle dll after unloading
the dll would still produce an access denied error, presumably because
for whatever reason not all resources used by the dll were freed.
Instead of trying to immediately delete the file, start an asynchronous
cmd.exe process to sleep for 2 seconds and delete the file. This gives
the app time to exit, after which the file can be deleted.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
When the feature was added in d93f6350, I did not adequately test for
the normal case when the pot is not updated.
This does not work because the pot has a timestamp in the
POT-Creation-Date: field.
Fix check-pot-update.cmake to ignore the pot timestamp and not report
the pot as changed when it has not been.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Remove po/update_pot.sh and generate the gettext .pot source
automatically in cmake on every build instead.
If the .pot is actually updated, print a loud message at the end of the
build to commit the result and push to transifex.
Fix the gettext tools and package loading block to only run when
ENABLE_NLS is enabled and find the xgettext and msginit binaries in the
Windows case as well. xgettext is used to generate the .pot.
Refactor the SRC_WX/HDR_WX/RES_WX/XRC_SOURCES handling to use only
relative paths and move all generated files into RES_WX. This was
necessary to generate the .pot from cmake.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Fix issues with {sav,load}ing e-Reader `Dot Code`.
If `Dot Code` file is not specified, it tries to continually read it and does not accept input.
In Japanese (very likely other languages as well), the path of `Dot Code` file is garbled
internally due to failing conversion to UTF-8.
Default to ON on Windows for x64 or x86.
Set new appcast URL, this will be in the github pages repo.
We will need to get everything ready for the next release.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Default the linkTimeout ConfigManager variable to 500 (milliseconds.)
Detect if the previous default is set, which 1, and set to 500, to
repair existing configurations.
This may reduce the amount of reports about link being broken, as some
people have certainly not checked this setting, and the default should
not be so wrong.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Add field for the network port to the start link dialog, default is 5738
as before.
The port is stored in the user's options config.
Add TextCtrl support to UIntValidator for this.
Related: #594.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This doesn't work to pick up changes from changed translations files
though, because git does not store file timestamps.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
We need to use proper documented behaviour when coding the
core, therefore this should be reverted until a proper
solution is done.
This reverts commit ca3b63d64c.
The current code is very messy as far as GFX goes. There are more
elegant ways of tackling this issue, but they are very difficult with
our current code.
The idea behind this issue is that the backgrounds are not switching
properly for the lcd. So we enable the layers accordingly to
`layerSettings & DISPCNT` on every `CPUUpdateRenderBuffers`.
The bits of `layerSettings` enconde each layer and objs.
We actually only need 2 of these, but I can't do much more here
unsupervised.
- Fix#376.
Use the 3.x wxwidgets mingw package in installdeps.
Add the win64 alias to installdeps for 64 bit mingw builds, like the
win32 alias for 32 bit mingw builds.
Check CROSS_ARCH in Architecture.cmake, set by our mingw toolchains.
Disable LTO by default for all mingw builds, not just amd64, because it
is unfortunately broken on i686 as well now.
Search for heuristically the most appropriate wx-config and set
wxWidgets_CONFIG_EXECUTABLE accordingly in the mingw toolchains.
Refactor the mingw toolchains somewhat, put common code into a common
file, add static toolchains.
For static toolchains, also search for a static zlib and set ZLIB_ROOT.
Change installdeps instructions to use ninja instead of make. Add ninja
to all target dependencies where it was missing, this may be incorrect
in a couple of the rarely used targets, if this is the case the affected
users are free to open an issue.
Also start using ninja on travis instead of make, except for libretro
which uses a GNU Makefile.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Although a length check is being performed on the imported GSA Codes file, `len` is both a signed int and attacker controlled.
With a specially crafted GSA Codes file, an attacker could specify a value for `len` that overflows the `int` type, rolling over into a negative number. By doing so, the attacker can bypass the conditional mentioned above.
The `fseek` length parameter is of type `size_t` which is an unsigned int, this will result in `len` being interpreted as a large unsigned int, allowing for a stack based buffed overflow in the desc char array.
By making `len` an unsigned integer, it will prevent the overflow. It ensures that the bounds check works as intended.
Use GetIcons() to get the IconBundle and call GetIcon() on it to get a
32x32 icon with fallback.
For whatever reason this works while just GetIcon() does not.
Source:
https://forums.wxwidgets.org/viewtopic.php?t=44818
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Followup on f306cc63.
The icon name was changed from "vbam" to "visualboyadvance-m", so also
change the Icon field in the .desktop file.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Followup on e98d8931.
Set the BITS variable in Architecture.cmake even if
CMAKE_SYSTEM_PROCESSOR is not set, and it often isn't. This allows for
generating the right release zip for 32 bit MinGW builds.
When invoking zip to make the translations.zip, use `.` instead of `*`
as the argument, with the correct WORKING_DIRECTORY, so as not to rely
on shell globbing of any sort. This broke for the 32 bit MinGW cross
build.
Fix the keychain unlock command on mac, the keychain must be unlocked to
use the codesigning certificate.
Fix the translations.zip.asc signature overwrite prompt on Windows.
For the mac builder, automatically use Xcode 9 for 32 bit builds if
installed, this is necessary on 10.14 (Mojave) and later.
Add interactive-pause.cmake script to wait for the user to press enter
before continuing, invoke it before gpg commands so that waiting for the
passphrase does not time out. It will not run if ENV{CI} is set or
ENV{VBAM_NO_PAUSE} is set, this is so that later we can set up automated
builds.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Call mainframe->PollJoysticks() on every pass through OnIdle, not just
when game is not paused.
Fix#582.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Use ENV{MSYSTEM_PREFIX} instead of ENV{MSYSTEM} to check for msys2 as
that is more reliable.
Generate the translations.zip when building for Windows from the
generated .gmo files.
Add the UPSTREAM_RELEASE option to perform some additional release
automation steps:
- Codesign for Windows with either the Visual Studio signtool or
osslsigncode when using MinGW.
- On Windows zip up the .exe into the appropriate zip file for release.
- Generate the gpg signature .asc files for the translations zip and the
.exe zip on Windows.
- On Mac codesign the app, zip it and sign the zip.
- On all platforms try to strip the binary.
Remove the release automation steps from the builder script as they are
now in cmake.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Followup on 0577f8af.
When looping through configured joysticks, ignore ones that do not have
a valid open device pointer.
Also remove the use of std::get for the joystate map tuple and use
.first instead.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Combine SDL events with polling the axes and buttons of controllers
every 10 milliseconds, this is necessary because of this bug in SDL:
https://bugzilla.libsdl.org/show_bug.cgi?id=4886
which causes SDL to not generation button and axes events after a
joystick is disconnected and then reconnected to the system.
Change the axes state from a unordered_map to an std::array because the
number of axes is fixed, add analogous buttons array.
Keep controller state synchronized between the event receiving code and
the polling code.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Rename all icon basenames and references to them from "vbam" to
"visualboyadvance-m".
Change app name in desktop file from "VBA-M" to "visualboyadvance-m" as
well.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Fix the vcpkg root setting, which was trying to use CMAKE_PROJECT_DIR
before a project is defined by switching back to CMAKE_SOURCE_DIR. Also
check if the user has \vcpkg or c:\vcpkg and use those if found. Use
\vcpkg if ENV{CI} is set, e.g. on Appveyor.
Enable nasm for visual studio builds by using the nuget nasm2 package.
In Architecture.cmake check that the vcpkg arch matches the compiler
arch, and throw a fatal error otherwise.
When using GLOB to find the nuget package directory, use the package
name as the prefix, this is quite necessary when using multiple nuget
packages.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Default to ENABLE_NLS=ON for vcpkg builds too.
Check for libintl under both the names "intl" and "libintl", likewise
for libiconv. The vcpkg versions have the "lib" prefix.
Use the Gettext.Tools package from NuGet for the tools to build the
translation files. vcpkg does not yet have gettext-tools.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
sdlReadDesktopVideoMode() was apparently being called when the window
pointer is NULL.
Wrap the code in an `if (window) { ... }`.
SDL binary now launches correctly.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Add support for vcpkg ffmpeg, this requires using someone's
FindFFmpeg.cmake instead of relying on pkg-config, since vcpkg does not
have pkg-config.
Do not use the ffmpeg from vcpkg on appveyor however, because that
pushes the build cache generation over the time limit for jobs.
Add secur32 and bcrypt to the list of ffmpeg libs on windows, these are
standard windows libraries.
Change some code in ffmpeg.cpp to remove C-style casts of struct
initializers, which are illegal in MSVC.
Add the INT64_C and UINT64_C macros missing in MSVC's stdint.h (if not
defined) to ffmpeg.h before the ffmpeg headers are included, because
they rely on them.
Rewrite the wxWidgets finding code for the vcpkg wxWidgets to be nicer
and work correctly for debug and static builds.
Remove all /W* and /w* warnings options from cmake compiler flags, and
replace them with /W4 for debug builds, and /w (no warnings) for release
modes.
When building a static binary, remove all /MD* flags from cmake compiler
flags, and use /MT for static release builds and /MTd for static debug
builds.
Improve the vcpkg toolchain wrapper to only rebuild the vcpkg binary if
there were git updates.
Redo the handling of SDL2 and SDL_main. Only link SDL2Main to the SDL
binary and don't use the definitions.
Update CMakeSettings.json to use Ninja and include static
configurations.
Use CMAKE_PROJECT_DIR instead of CMAKE_SOURCE_DIR to determine the vcpkg
root, as CMAKE_SOURCE_DIR is sometimes set incorrectly in the 2017 GUI.
Add /nodefaultlib:libcmt to the debug build link flags, as in debug
builds libcmtd is used and libcmt should not be.
Add /subsystem:console to debug build link flags to produce a windows
console app for debug builds, like we do for mingw builds. To do this,
define a WIN32_CONSOLE_APP macro and if set, define a main() that calls
WinMain().
Call wxMesdsageOutput::Set() in OnInit with an instance of
wxMessageOutputStderr for windows debug builds to make sure the --help
text etc. goes to the console instead of a popup box.
Update the Visual Studio related text in README.md.
Fix dynamic debug builds by linking to the debug version of SDL2 and
copying the debug version of the dll to the build dir.
Fix issue in MainFrame::BindAppIcon with the function we are using not
being found in a Windows DLL in debug builds by using
wxDynamicLibrary::GetSymboolAorW() instead of GetSymbol().
Enable LTO for MSVC in Release modes, if the option is set.
Change appveyor config to use an 8 item build matrix of
x64/x86 / Release/Debug / Static/Dynamic. And test the binary in debug
modes by running --help.
When copying the wxrc.exe out of the build tree, copy both the release
and debug versions, this is so that appveyor caching of vcpkg works,
since the build trees are not cached.
Add some necessary win32 libraries to the SDL binary. And enable
building it on appveyor.
Fix#465.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Followup on 02520fb6.
Add ConnectController() and DisconnectController() protected methods in
wxSDLJoy, use them to open or close and clear the device pointer
properly.
For controller add/remap events, call DisconnectController() first
before ConnectController() to make sure the right device is associated.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Followup on 02520fb6.
Versions of wxWidgets after 3.0 change the windows event loop in such a
way that using QueueEvent for joystick events no longer works, use
ProcessEvent instead. This has no effect on latency since the joystick
events only cause the emulator controller state to be updated.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
A followup on 02520fb6.
In wxSDLJoy::Remove(n), which is the only API that needs to release a
game controller device from the application, actually call
SDL_GameControllerClose(dev) when a device is released.
This is used when the input config dialog is launched. First all sticks
are closed, and then all available sticks are added for the duration of
the dialog. Then they are closed again, and only the configured sticks
are open for the game, which is what happens generally.
The device ordering is determined by the OS.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Use the SDL GameController API with SDL events instead of polling
manually. Run SDL_PollEvent() in the panel OnIdle().
The API to the GUI remains the same, the sending of wxSDLJoyEvent
events. Except there are no more hat events, we just use the
GameController buttons. Also the GUI now has to make arrangements for
wxSDLJoy::Poll() to be called periodically, for the config dialog this
is done with a timer.
All Xbox 360 controller buttons and axes are now in the defaults, and
the SDL GameController API will map them to the appropriate keys on
other controllers.
As a consequence of using SDL events, controller attach/detach from the
system is now also handled correctly. It is no longer necessary to have
the controller attached and turned on when the program launches.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Accumulate link libraries for wxvbam in the VBAM_LIBS list variable
instead of listing every possible library variable in the
target_link_libraries() call.
This fixes the issue with trying to use OPENAL_LIBRARIES when it's set
to NOTFOUND which generates a cmake error.
Fix#563.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
- Make WinSparkleDllWrapper a real singleton.
Make the constructor private and add a static `GetInstance()` method
that constructs the single instance and/or returns it.
Make it encapsulate the function pointers and the wxDynamicLibrary
instance, with the API as friend functions.
- Make winsparkle API completely self-contained.
Make the instance of the WinSparkleDllWrapper a factory function local
static.
This way the calling program does not have to manage the life-cycle, the
singleton is initialized when the API is first invoked, and destroyed
during global destruction.
The destructor is now also private, because the singleton object is
destroyed during global destruction.
Found the solution here:
https://stackoverflow.com/a/46139631/262458
- Cmake improvements.
Only enable the ENABLE_ONLINEUPDATES option by default if we are going
to use winsparkle on 32 or 64 bit intel windows.
Do not inlclude winsparkle if the option is off.
- Disable for now.
Currently ENABLE_ONLINEUPDATES defaults to OFF even on intel/windows,
until we do more work on this feature.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Remove traces of previous update checker.
We use version 0.6.0 available here:
https://github.com/vslavik/winsparkle/releases
We only support on Windows at the moment using `winspakrle`. So remove
this item for other platforms or when disabled in compilation.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Add cmake glue and necessary code to load WinSparkle.dll as a binary
resource that gets written out to a temp file and loaded with
wxDynamicLibrary.
Object lifetime of the dll wrapper is handled by the app.
The API is the same as the winsparkle API, the only change required is
changing:
`#include <winsparkle.h>`
to:
`#include "winsparkle-wrapper.h"`
and handle the lifetime of a WinSparkleDllWrapper object.
On destruction the temp file is removed.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Do not copy the `wxrc.exe` from the vcpkg build tree if it has already
been copied, as in the case of the appveyor vcpkg installed cache.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
==15788== Conditional jump or move depends on uninitialised value(s)
==15788== at 0x5143A2: wxvbamApp::~wxvbamApp() (wxvbam.cpp:682)
==15788== by 0x5144BB: wxvbamApp::~wxvbamApp() (wxvbam.cpp:676)
==15788== by 0x739CD22: wxEntryCleanup() (in /usr/lib64/libwx_baseu-3.0.so.0.4.0)
==15788== by 0x739D02B: wxUninitialize() (in /usr/lib64/libwx_baseu-3.0.so.0.4.0)
==15788== by 0x739CE39: wxEntry(int&, wchar_t**) (in /usr/lib64/libwx_baseu-3.0.so.0.4.0)
==15788== by 0x50BD42: main (wxvbam.cpp:32)
v2: Initialize overrides as a nullptr.
The Clone function seem unused, the AcceptsFocus and HasFocus
functions are marked as const and Show is renamed to ShowAddr
to not conflict with unrelated functions.
[187/196] Building CXX object src/wx/CMakeFiles/visualboyadvance-m.dir/viewsupt.cpp.o
In file included from ../src/wx/viewsupt.cpp:1:
../src/wx/viewsupt.h:197:10: warning: 'Viewers::MemView::Show' hides overloaded virtual function [-Woverloaded-virtual]
void Show(uint32_t addr, bool force_update = false);
^
/usr/include/wx-3.0/wx/gtk/window.h:64:18: note: hidden overloaded virtual function 'wxWindow::Show' declared here: different number of parameters (1 vs 2)
virtual bool Show( bool show = true );
^
In file included from ../src/wx/viewsupt.cpp:1:
../src/wx/viewsupt.h:410:10: warning: 'Viewers::DispCheckBox::AcceptsFocus' hides overloaded virtual function [-Woverloaded-virtual]
bool AcceptsFocus()
^
/usr/include/wx-3.0/wx/window.h:724:18: note: hidden overloaded virtual function 'wxWindowBase::AcceptsFocus' declared here: different qualifiers ('const' vs unqualified)
virtual bool AcceptsFocus() const { return true; }
^
In file included from ../src/wx/viewsupt.cpp:3:
In file included from ../src/wx/wxvbam.h:14:
In file included from ../src/wx/widgets/wx/joyedit.h:9:
../src/wx/widgets/wx/sdljoy.h:115:14: warning: 'wxSDLJoyEvent::Clone' hides overloaded virtual function [-Woverloaded-virtual]
wxEvent* Clone();
^
/usr/include/wx-3.0/wx/event.h:1569:22: note: hidden overloaded virtual function 'wxCommandEvent::Clone' declared here: different qualifiers ('const' vs unqualified)
virtual wxEvent *Clone() const { return new wxCommandEvent(*this); }
^
In file included from ../src/wx/viewsupt.cpp:3:
../src/wx/wxvbam.h:286:10: warning: 'MainFrame::HasFocus' hides overloaded virtual function [-Woverloaded-virtual]
bool HasFocus()
^
/usr/include/wx-3.0/wx/window.h:715:18: note: hidden overloaded virtual function 'wxWindowBase::HasFocus' declared here: different qualifiers ('const' vs unqualified)
virtual bool HasFocus() const;
^
4 warnings generated.
Call `rtcEnableRumble(true);` always regardless of the `rtcEnabled`
option, because @negativeExponent points out that they are unrelated.
Check for at least SDL version `2.0.9` before using the
`SDL_JoystickRumble()` API, since it is not present in earlier versions.
Increase rumble duration to twice the poll time to keep the motors
running, subsequent poll events will cancel the rumble as necessary.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Call `rtcEnableRumble()` in the core if the rtc is enabled during ROM
loading.
On `systemCartridgeRumble(bool)` events from the core, set the state in
`wxSDLJoy` accordingly, to either rumbling or not rumbling based on the
boolean parameter.
On the `50ms` joystick poll events, use `SDL_JoystickRumble()` to enable
rumble on both the low and high frequencies at maximum for the poll time
of `50ms`, to be set or reset again on the next poll event.
Tested in Drill Dozer, rumbling is being activated. Will need testing
from users as well to see if this is implemented correctly.
Fix#522.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
All keys were being captured before being processed by any window of the
app to check for accelerators. This meant being impossible to use any
keys for input if they were saved for an accel.
- Fix#516.
The change to use an extern version variable in 24d83a12 produces a
linker error with Visual Studio due to the `version.c` source file being
compiled as C instead of C++.
Rename:
`version.c` -> `version.cpp`
`version_c.h` -> `version_cpp.h`
And update all references accordingly.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Make a `version.c` with `const char*` variables to store the version
strings used by other files, to make recompiles slightly faster when the
git state changes.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
When using the command line options, we had a circular issue:
- using `LoadConfig()` before `ReadOpts()` would mean the `--config` is
ignored.
- using `ReadOpts()` before `LoadConfig()` would mean the command line
options were ignored in favor of the default ones.
If we want to use a custom `vbam.ini`, we need to load it with
`--config`. Now we only consider params order on command line.
All this code protected by `#if 0` is implemented already one way or
another. Hence the decision to remove it, instead of commenting.
This also removes the need of the branch `arthur/sdl2`.
It happens due to our wxRadioButtons having 3 options (indexed by 0, 1
and 2) but we trying to get the index 7 (due to want to check every 7
days).
We should still implement something like WinSparkle for Windows.
- Fix#499.
We assign the `NOOP` id for every command disabled by the user, but not
the command name (just `NOOP`). When updating the configuration file,
any command with `NOOP` id is valid, even if the label does not match
`NOOP`. Hence this weird issue.
- Fix#502.
Check for the APPDATA environment variable if there is no LOCALAPPDATA
environment variable for things like reading the config file.
Fix#407.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
wxWidgets fails to translate some internal strings due to locale issues.
It is not clear how the current locale is detected, but it fails for
cases when the system is different from the set by the user. Eg: the
system is using `en_US`, but the user sets `LANG=pt_BR.utf8` for an
application. Some internal strings are translated because of `LANG`,
while others remain the same because `en_US`.
We could not use key shortcuts for this, since it was only checking if
the option was activated on menu. This only happens if you open the
menu and click it, so the key shortcut does not work.
We protect all code relevant to disabling this property with either
`BKPT_SUPPORT` or `NO_DEBUGGER`. This is mostly debugging options or
prints scattered around the code.
We also adjust cmake to ignore the specific files surround it, but
allowing the rest of the GUI to work.
- Fix#431.
For cmake, the dependency on `bin2c` when using `HostCompile.cmake` does
not work if it's set to `bin2c.exe`, for whatever reason, so remove the
suffix.
Add `-DCURL_STATICLIB` to `CPPFLAGS` etc. to link to `libcurl`
correctly, needed for `osslsigncode`.
Add `--without-brotli` to curl configure args, because it can try to
link to some existing version and fail.
Add a `gmake` symlink to the system `make` into the `PATH` because some
things like Strawberry Perl install their own copy of `gmake` into the
`PATH`.
Add `pass` to list of msys2 deps, needed to store the windows
codesigning cert password.
Use `$CMAKE_ARGS` instead of `$CMAKE_BASE_ARGS` for building vbam,
adding `-DCMAKE_INSTALL_PREFIX=/usr`, this is necessary for extracting
the locales correctly.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Fix the cmake ffmpeg detection and make it not print the detection
messages twice.
Add `-D__STDC_FORMAT_MACROS` to compiler flags, some versions of ffmpeg
require this.
Redefine `static_assert(x)` to the `static_assert(x, msg)` form in
`xbrz.cpp`. This is a C++17 feature and some versions of gcc wrongly set
`__cpp_static_assert` even though they do not support it.
Also we want to stick to C++11 for the time being, until there is
consensus to support a newer a version.
For that reason, change the MSVC flag `/std:c++latest` to `/std:c++11`
as well.
Remove `-DENABLE_OPENAL=ON` and `-DENABLE_LINK=ON` from travis config,
as these are now automatic.
In `installdeps` remove the hacks for supporting the `https://` apt url
for mxe and use an `http://` url instead. This works perfectly on Ubuntu
14 (trusty).
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Use `/std:c++latest` for Visual Studio because the XBRZ 1.7 code
requires at least C++17.
Replace the use of `bool++` in `GBALink.cpp` which is now apparently an
error with `bool = !bool` to flip the value.
Use `/W4` to enable a good amount of warnings in Debug mode, and `/W0`
to disable warnings entirely in release modes.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Get files from here `https://sourceforge.net/projects/xbrz/files/xBRZ/`.
Then, update the src to handle pitch params. For our case, the pitch
is necessary because we deal with borders (top and right) of our source
image. Normally, we would want to scale without it, and therefore we
need to adjust the pointers to skip the borders.
If we have a `width + 1 pixel border` per line, the we need to scale
a image with `width` line size, but advancing the pointer for each new
line processed including the border on the count.
Also, since our output pointer also allocates for the border, we need
to adjust the output moving pointer for each line in a custom way.
(output border in this case)
- Fix#164.
From my very superficial understanding, the `rom[]` resize happens
only when `rom_size` is greater than 0x2000000.
We should probably study this better for an actual explanation.
- Fix#487.
In cmake detect if the dependencies for link (sfml), recording (ffmpeg)
and openal are installed and default the features to `ON` if they are,
otherwise to `OFF`.
This simplifies the cmake usage.
Update the default column in the `README.md` table to `AUTO` as well.
Remove the cmake options from `installdeps` instructions, since they are
auto-detected.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
See #465
To compile the build tool `bin2c`, add a target with `add_executable()`
on visual studio instead of using `HostCompile.cmake` because running
`cl.exe` fails in the appveyor visual studio environment, see:
https://developercommunity.visualstudio.com/content/problem/325122/c1356-unable-to-find-mspdbcoredll.html
Also update the dependencies module to latest.
appveyor build now tested to work.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
We fix the wxWidgets error message when trying to open the dialog
via menu.
The scrollbar behaviour has been enhanced to adjust itself between
200 and 300 rows from GUI (0x6c0 memory to 0xf9ff - GB example).
Clicking on top or bottom line of the memory values now moves 1 row
position backwards and forward, respectively.
Arrow keys also functional for navigation.
* Remove clicking on top/bottom behaviour.
- As discussed at #cheats on discord, using the search engine will cause RetroArch to crash as
soon as you click on Start or Restart Cheat Search.
- This PR adds the missing break lines for the switch statements that is causing the core to crash
We do not allow to skip frames while recording. The resulting length
will be extended compared to using turbo/speedup modes, because the
recording will be normal time (as in running without turbo/speedup).
We create a namespace to deal with most of our recording solution.
Besides that, we also add some functions to remove the need of
including libavutil headers on other part of the code. This is meant to
isolate most of recording solution components on the proper files.
We will start with a limited number of codecs supported; slowly we
should add them as they are tested (the previous one did not work for
most codecs listed).
This should support `ffmpeg 4.1` and further, including removing
all compilation warnings related to versions discrepancy.
changes includes:
- append "options_" to core-related variables
- remove some unnecessary function calls
- change some float data types to double
- set max geometry width/height depending on max values for the system being emulated
- create advanced core options to minimize the number of options shown
- style nits
- Add core option to allow RTC to be enabled regardless of rom. This usuable for rom patches that requires the RTC to be enabled yet the RTC flag is not enabled. (aka Pokemon patches)
- minor n0n-functional changes
- cleanup gb built-in palette struct
- update retro_get_memory_data/size to directly use related variables for RAM and VRAM
and fix sizes (GB vs GBC pointers and pointer size) for proper cheat search support.
You can now access full 32K ram of GBC for example.
We set using the QWERT keyboard as a reference. These keys should
be located at fixed positions on most QWERT keyboards.
KEY | KEYBOARD
-------|----------
UP | W
DOWN | S
LEFT | A
RIGHT | D
A | L
B | K
R | O
L | I
SELECT | Backspace
START | Enter
- Fix#463.
Add option to remove all configuration related to checking for updates
online. Although it is not implemented at the moment, these options
appeared on our menu `Options` > `General ...`.
- Fix need of patch on #140.
It is not possible to pre-select a file with `wxFilePickerCtrl`. Hence,
we add a label to show the current gopts.{gba_bios,gb_bios,gbc_bios} is
being used, if any.
- Fix remaining of #196.
Several toggle options from the main menu could not be handled by the
key shortcuts. This was mainly because the code was only checking if
they were ticked or not.
When a key shortcut was pressed, the key itself did not trigger the
tick of the box from the menu, hence nothing was being done.
We are not setting the debug ones because they are not being missed
by the users (yet).
- Fix remaining of #88.
We use the following key input if the config `vbam.ini` does not exist:
input | keyboard
A | A
B | S
L | Q
R | W
SELECT | Z
START | X
We also set a joystick default, using the XBOX 360 controller as a
base.
- Fix#463.
The idea of these was to show them available in `Options` >
`Key shortcuts` and allow the user to rebind them. We want the users to
use the keys rather than trying to change the volume via menu actions.
Similar update to GBA which does the following:
- reduces input lag by 1 frame by reading user input at beginning of cpu loop
- audio and video timing update, which sends audio and video at every frame possible
- add missing sound state variable, soundTicks for gb and gba
Map initial state of axis to 0. This is sufficient for the time being
for the 360 triggers to work better.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
SDL APIs like `SDL_JoystickNumAxes(dev)` can return a negative error
code. Handle this case better.
This should fix the fatal exception from trying to allocate an array
with an illegal size (negative, due to the error.)
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
If the user pauses with the keybinding or the menu `Emulation` > `Pause`
while `Pause when inactive` is enabled, the game should not unpause when
the window receives focus again. It should wait for the user to trigger
the manual unpause.
- Fix#460.
Replace the vcpkg code with a newer and better version. In this version
the `vcpkg` directory is on the same level as the source directory, so
that IntelliSense does not get confused scanning for files.
The cmake variable `VCPKG_TARGET_TRIPLET` is required to activate vcpkg
support, it must be set to e.g. `x64-windows` or `x86-windows`.
Update `CMakeSettings.json` for the new code for the GUI.
Fix a problem copying the `SDL2.dll` file to the binary directory.
Update `README.md` with commandline instructions.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
It looks like that when we use the `Simple` output module, we get
weird errors when trying to load state for any game, most likely due to
memory corruption. AFAIK, it seems the frame buffer is not large enough
to render all components.
This issues does not appear when using OpenGL, or using the Simple with
any display filter available.
Add missing gettext calls for the game controls code.
Seems to work correctly in the Russian locale with special keys.
Also add CLion files to `.gitignore`.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
We use the same event for both keybinding and `Emulation` > `Pause`
actions. The issue here is that the menu item is checkable, meaning
that you toggle its value and then run the handler.
The handler checks the value of the menu item `Emulation` > `Pause`,
and toggle the game pause accordingly. Such thing does not happen when
using the keybinding. Hence, it did not toggle the pause as expected.
- Related to #454.
* Fix key shortcuts for save/load states.
We show the wrong description for these shortcuts, although it works
correctly for the keybinding.
* Use the proper labels for save/load states.
Check that SDL reports any available controls for a joystick, otherwise
mark it invalid and close it.
When processing events for joysticks, check that each one is valid.
Set initial value of controls to zero initially not after getting the
initial state, previously we were getting the initial state and
overwriting it with zeroes, defeating the purpose.
Fix memory leak, `curval` array of controls not being cleared.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Fix `homeDir` `ConfigManager` global pointing to freed memory.
Thanks to @FredericHamel for catching this.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Correct set WXK_NUMPAD_{ADD,SUBTRACT} for default volume controls and
enable users to change it via menu "Options > Key Shortcuts".
Also allow users to use both these buttons for other input.
Some keybindings were not handled by the frame. That includes some
wxAcceleratorEntry keys. On Linux, if you set a key shortcut using a key
with no modifier ("U" for "Input > Configure"), pressing the key would
not lead to anything.
This is very likely related to wxGTK, although it is not possible to
confirm this at the moment.
Whenever users try to remove the system keys shortcuts, the
configuration file is overwritten and only records the last erase.
For example, if we wish to remove all the auto{A,B,L,R} keys at once,
we get the following writes on the configuration file:
NOOP=ALT+1,ALT+2,ALT+3,ALT+4
NOOP=ALT+2,ALT+3,ALT+4
NOOP=ALT+3,ALT+4
NOOP=ALT+4
Only `NOOP=ALT+4` stays for the following execution.
Whenever there is a link connection for GBA, we check if "GBA/LinkHost"
is an empty string. If it is, we send this warning. This is unnecessary
because most connections are assumed to be for localhost, otherwise the
user would set a server ip address and not see this warning.
Currently, if we maximize the window, our windowPosition{X,Y} become 0.
When reopening the app, we have a window with the same size of a
maximized, but without this property toggled on. This is not intuitive
for users, since it is expected to have the last non-maximized size
to be restored.
If the status bar option is enabled or disabled, there is a trigger that
resizes the current window geometry to its zoom configuration. What
should happen instead is the size remain the same.
In the `OnKeyDown` event handler, check if the key is actually pressed
using `wxGetKeyState()`, because for some reason on Ubuntu 18
spurious events are generated when the key is not actually pressed.
Also, if a game is paused by the frontend while a key is being pressed,
the key will remain active for the game when unpaused. This is an
issue because the key will likely be released outside of the game zone;
therefore, we would not process the key release for the game itself.
The same bug happens if clicking outside of the game zone while
holding a key.
For the case of a directional key, this means a continuous movement
in the direction of the key pressed before the pause until the key
is pressed and released.
Joysticks have their own set of {KEY,MOD,JOY}, what means that setting
everything for MOD=0 is a mistake. We need to deal only with keyboard
mappings here.
as a mapping key (#142).
When holding a key(W,A,S,D) and then pressing a modifier(SHIFT,CTRL,ALT),
we get two sets {MOD,MOD,0} and {KEY,MOD,0} with MOD > 0 after a
{KEY,0,0}. When releasing the initial key while holding the modifier,
we search for {KEY,MOD,0} instead of {KEY,0,0} to be removed.
Finally, when releasing the modifier, we remove {MOD,MOD,0} from our
stack. This means the {KEY,0,0} stays "pressed", although no input
is being taken from the keyboard.
Full example using WASD as movement keys and L_SHIFT as our B button.
1. Press and hold "A" --> add {A,0,0} to stack;
2. Press "L_SHIFT" --> add {L_SHIFT,4,0} and {A,4,0} to stack;
3. Release "A" --> remove {A,4,0} from stack (no effect);
4. Release "L_SHIFT" --> remove {L_SHIFT,4,0} from stack;
5. {A,0,0} still on stack.
No keyboard button is being pressed anymore, but there is a continuous
movement towards the direction mapped by "A" {A,0,0}. It is only fixed
when "A" is pressed two times in succession, because we don't add
duplicate sets to our stack, but try to remove them anyway.
Before trying to rename `vbam.conf` to `vbam.ini`, as we decided during
the XDG support work, first check if `vbam.ini` does not already exist.
If it already exists, use `vbam.ini` and do nothing with the
`vbam.conf`.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Make some changes to support out-of-the-box builds on FreeBSD:
- set cmake OpenGL type to `LEGACY`, the new `GLVND` type produces
unusable binaries on FreeBSD
- on FreeBSD add -I/usr/local/include to compiler flags, why this is
necessary I don't know
- look for llvm tools such as `llvm-ar` in `/usr/local/llvm-devel/bin`,
LTO works
- improve the `find_wx_util()` cmake function to handle `wx-config`
scripts named in the form e.g. `wxgtk3u-3.1-config`
- add FreeBSD support to `installdeps`
- make some minor changes to included headers based on macros such as
`__FreeBSD__` to compile on FreeBSD, including adding a `BSD.h` header
with some defines for e.g. `fseeko64`
- move the cmake X11 detection to before the wx compile tests, because
otherwise the extra compile flags for the wx tests make the X11 tests
fail
- make some minor changes to fix wx 2.8 compatibilty again, we don't
actually use 2.8 for FreeBSD but I was testing it
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Previously when working on Visual Studio support I noticed an XRC error
dialog when adding the game area to the BoxSizer.
I tried removing the wxEXPAND flag with insufficient testing, the flag
is actually necessary.
The error is actually an incorrect debug assertion that is present in
3.1.2 and later fixed in master. The assertion is not triggered when
the project is built in release mode.
Remove the windows conditional code that removes the wxEXPAND flag.
TODO: silence assertion in debug mode or patch the wxWidgets vcpkg port.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Fix the cmake code that sets up wxWidgets when using vcpkg with Visual
Studio so that the Release configuration also works. Use variables
instead of an if statement.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
To make the version string consistent with other cores, make it of the
form "<VER> <SHORT-SHA>" with a space in-between.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
To make the libretro core consistent with other cores, remove the "-"
between the version and the git short sha for git builds.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Fix display when loading ROMs with custom geometry.
This issue was a combination of `wxSHAPED` and its effect on the custom
geometry. It is necessary to force a dummy resize so the display adjusts
itself.
Align game frame on center, both horizontal and vertical.
In 2097b5aa I added a function that is used both in the non-vcpkg block
and outside of it, but the function was defined in the non-vcpkg block,
and this broke the visual studio build.
Move functions and macros into an include file so that they are globally
available.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Clear the `find_program()` cache variable before each use.
On win32 prefer unqualified utility executables.
Add special handling for msys2, where wx-config is a shell script that
cannot be directly run from native cmake.
This is a followup on 2097b5aa.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Instead of ignoring the initial state of axes, which I did to make
triggers work on the 360 controller, set the initial previous value to
the initial state instead.
This fixes the original problem without breaking analog stick movement.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
The `wxEXPAND` flag is necessary for the game area in wxWidgets 3.0 and
earlier, it may be necessary in 3.1.2 as well, but it throws an xrc
error, so we check for windows and at least 3.1.2 to test for the visual
studio and vcpkg environment to avoid the xrc error.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
@denisfa found this due to a warning, this should improve the
functionality of the SDL sound driver.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Add support for RHEL/centos to installdeps. There is no SFML package.
Add some string compatibility stuff so that everything builds on wx 2.8
unicode builds.
TODO: add travis slaves for 2.8, with and without unicode
Disable the game frame spacer code on 2.8 because it does not work (the
frame does not expand.)
cmake improvements:
- set ENABLE_LTO=OFF for Debug builds by default
- set ENABLE_LINK=OFF if SFML cannot be found and continue
- use better logic for finding wx utilities wx-config and wxrc
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Closes#395Closes#297
Do some reformatting towards the more modern cmake style.
Clean up some code.
Support linking to gcc compiled wxWidgets by setting
`-D__GXX_ABI_VERSION=` appropriately for clang.
Use the new method of calling `FindwxWidgets.cmake`, the old method
causes some problems now.
Set all necessary policies in both cmake files.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Check `if(POLICY CMP0077)` before trying to set it, because setting a
policy a version of cmake does not know about is an error.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Ninja requires `-fdiagnostics-color=always` instead of
`-fdiagnostics-color=auto` with gcc because it pipes output from the
compiler unlike regular makes.
Use `-fcolor-diagnostics` for clang, which also works correctly with
ninja to show colors.
Information for this taken from here:
https://medium.com/@alasher/colored-c-compiler-output-with-ninja-clang-gcc-10bfe7f2b949
Set all cmake policies in both the root `CMakeLists.txt` and
`src/wx/CMakeLists.txt` to silence warnings about unset policies from
cmake.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Use the libXss Xorg screensaver extension library to call
`XResetScreenSaver()` on joystick events to inhibit screen blanking when
for whatever reason the joystick driver or DE (xboxdrv and KDE in this
case) does not do this.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
On wxWidgets 3.1.2, which is what vcpkg uses (and we use vcpkg for
Visual Studio) the wxEXPAND flag for the game area in the sizer throws
an XRC error dialog, removing the flag works correctly on Windows, but
not on wxGTK.
As a workaround, do not use the wxEXPAND flag on Windows.
TODO: with max zoom set, the game area is not centered vertically in
wxGTK.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Use vcpkg to build deps when Visual Studio on Windows is detected, this
only happens on first build, but does take a while because things like
wxWidgets need to be built. Building from the developer command line is
also supported.
I considered making a pre-built tarball available, but the resulting
files are just too big for this to be practical.
Make the necessary cmake code changes for this to work and to use the
vcpkg packages, which work just like on linux or have other cmake glue
code available.
To do this, we make vcpkg a submodule, use git to checkout all
submodules, then just build and use the `vcpkg.exe`. Then we set the
CMAKE_TOOLCHAIN_FILE to the vcpkg toolchain and also include it
directly, why this is necessary I don't know, without it it doesn't work
in the IDE but does on the command line.
All of this requires no vcpkg integration with either the user or the
project. A user-wide `ENV{VCPKG_ROOT}` is also supported.
Fix the dynamic arrays in the GBA core, MSVC follows the C++ standard on
this and gcc does not.
TODO: add the necessary gcc flags to make this an error in cmake.
Use `wxArrayString` instead of `std::vector<wxString>` in
`src/wx/strutils.cpp` which is used in options parsing. This was
necessary because of a bizarre linker error with wxWidgets when using
Visual Studio:
https://trac.wxwidgets.org/ticket/10884#comment:46
In `src/wx/panel.cpp` make sure the unimplemented D3D renderer code does
not get compiled if it's actually `OFF`.
Also fix the new spacer code for the drawing panel to not combine
`wxEXPAND` with `wxALIGN_CENTER`, which is an error on wxWidgets 3.1.2,
which is what vcpkg uses. The drawing panel seems to be automatically
stretched to the max size automatically anyway.
TODO: if all of this works, we'll need an Appveyor set up for visual
studio.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
* Apply save order for save states and batteries.
The order for save state/battery:
1. StateDir / BatteryDir;
2. The path of the current loaded game;
3. XDG Base Dir fallback.
* Use XDG Base Dir fallback to save screenshots and recordings.
* Apply search order for all dirs except recording (not implemented yet) of SDL port.
The order for battery/save state/screenshot is:
1. StateDir/BatteryDir/ScreenshotDir;
2. The path of the current loaded game;
3. XDG Base Dir (or equivalent) fallback.
* Refactor code.
* Fix freeing and setting pointer to NULL of SDL port.
* Add support to save/load geometry options for GUI window.
* Refactor code to use wxWidgets functions to get window geometry.
* Call update_opts() from ::OnSize and ::OnMove functions.
Store the full relative path to found `.rpi` plugins, relative to the
standard Plugins directory, as specified by wxWidgets.
This fixes the problem of plugins being in a subdirectory while only the
basename was stored, making the plugins unusable.
This is done by using `wxFileName::GetFullPath()` instead of
`wxFileName::GetFullName()` with a relative filename instance.
Make a `GetPluginsDir()` method on the app class to simplify getting
this directory, and for possible future overrides.
Also make some minor, functionally equivalent changes to
`get_config_path()` in `wxvbam.cpp`:
- use the new `GetPluginsDir()` method for the plugins directory when
building the config file search path
- print the XdgConfigDir on all platforms, since the function works on
all platforms
- make a `add_nonstandard_path` macro which duplicates the `add_path`
macro for wxWidgets standard paths but for any arbitrary string path
- use `wxFileName` methods to make the XDG config directory path instead
of string concatenation
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
* Add XDG Base Dir Spec for other Unix alike platform.
* Add XDG Base Dir support for the fallback on SDL port.
* Add migration for Unix configuration file.
We migrate from 'vbam.conf' to 'vbam.ini' automatically.
* Refactor code for portability of dir creation functions.
* Fix for MacOS compilation directive.
Remove the "wrote battery" system message that is painted on the panel,
because it annoys people, and show errors writing the battery with
`wxLogError()`.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
We check if `$HOME/.vbam` exists; if it does, then we use
`$HOME/.vbam/vbam.conf`; otherwise, use
`${XDG_CONFIG_HOME:-$HOME/.config}/visualboyadvance-m/vbam.conf`.
The MBC3 and TAMA5 battery formats save the RTC data including a
`time_t` field which is the last field.
Since `time_t` is 32 bits for 32 bit builds and 64 bits for 64 bit
builds, pad it in the two battery structs with a `uint64_t` and detect
the 4 byte shorter saves made by older 32 bit builds.
Also remove some pointless code in save state reading that also uses
`sizeof(time_t)`.
Add two new constants for RTC data size in gbMemory.h and use them.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Add a "Factory Reset" item to the Options menu, which calls
`DeleteAll()` on the config object, which actually deletes the config
file. After this the application is relaunched asynchronously without
parameters and the current instance is closed.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Conditionally compile out the code for the feature implemented in
16dd5d40 (which is the throttle and frame skip configuration for the
speedup button) for libretro, and use the old behavior of skipping 9
frames.
Affects GBA.cpp and GB.cpp .
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Add Speedup / Turbo configuration panel which allows setting the
throttle or number of frames to skip for when the speed key is pressed
or turbo is enabled (which just presses the speed key.)
Throttle and frame-skip are mutually exclusive, throttle must be 0 (no
throttle) when number of frames to skip is non-zero. The dialog controls
handle this.
This is implemented in the core in GBA.cpp, GB.cpp and ConfigManager.
Two new options are added both in ConfigManager and in the wx options,
speedup_throttle and speedup_frame_skip, the defaults are:
```
speedup_throttle = 0 (no throttle)
speedup_frame_skip = 9
```
this was the original behavior.
Add support for unsigned ints to wx/opts.cpp for these and for throttle,
this requires a new validator wxUIntValidator to use them in spin
controls.
Clean up appearance of the throttle spin control in the General dialog.
Maximum throttle and speedup_throttle is 600, values much over 500 will
not behave differently from 0 on modern hardware.
Maximum frame skip is 30 at the moment.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Add wxEXPAND spacers to frame wxBoxSizer on the top and bottom around
the drawing panel so that panel is correctly centered if maximum zoom is
set.
Set proportion to 1 on the spacers and 0 on the panel so that both
centering with maximum zoom and full expansion work correctly.
Refactor frame OnSize event: pass a dummy userdata pointer to
distinguish resizing the frame from resizing the panel, and call
Layout() when the frame is resized.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
1. EEPROM: move eepromInUse and eepromSize from EepromReset() to eepromInit()
to avoid re-initializing during a reset (makes item below redundant)
2. Remove gbaSaveType variable - this is now redundant due to change above
which probably was added for this reason since games using eeprom fails with
gamepak error after a reset.
3. Add labels to identify cpuSaveTypes
4. libretro: remove workaround for eeprom reset issue (#1), do not apply
custom gbPalettes if not running in GB, change vram size to 0x18000 in
memory map
Write `gopts.audio_dev` to the option `Sound/AudioDevice`.
Clear `gopts.audio_dev` when resetting the driver, because we cannot
assume anything about device enumeration order across sound drivers.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
- Uses analog stick to simulate tilt and gyro hw. By default, tilt uses
the right analog stick while gyro uses the left. The analog stick can be
swapped using a core option provided and with separate sensitivity level
for both sensors. WIP and will be fine tuned later (Kirby was fun to
play at least)
- Minor retro_run() cleanup and some minor stuff i forgot.
- Updates descriptors for 4-player SGB
- Remove alternate gamepad layouts for GBA
- Prevent crash when SGB border option executes at startup when GB is not
initialized yet
- Update input turbo function for 4-player support
- Minor cleanups (texts, style nits, etc)...
Check for __LIBRETRO__ before including getopt.h in ConfigManager.h,
because windows does not come with this header or function, and libretro
does not need it.
Allow serial emulation without having the need to run link-related
communication stuff (NO_LINK define). Some games need this e.g. RC Pro-AM
racing. Dummy funcs/vars are added as placeholders.
Currently work-in-progress and might need to disable some more NO_LINK
sections.
Remove esc to quit key bind #298.
Remove ctrl+x (cmd+x on mac) to quit key bind #334.
Remove FilterEvent app method, it is no longer being used anyway as key binds
work correctly.
The config option name enum needs to match the actual enum, since the
value is an integer. Unavailable APIs are not shown using #ifdefs in
guiinit.cpp.
Also reorder the radio button xrcs to be in the order of the enum.
One bug noted in the #88 discussion is that when a joystick button is
held down, keyboard shortcuts do not work.
Rewrite the logic for process_key_press() to only block further
wxWidgets event propagation if the actual key pressed is a game key, not
if any game keys are being held down.
This takes care of all the issues in #88.
TODO:
- investigate other joystick issues
On joystick event notification, filter out axis values that are equal to
their initial state.
The reason for doing this is explained in 539027ca. Triggers on e.g. the
360 controller are an axis that are the max negative value in the
depressed state, and for some reason a constant stream of events are
generated for them, that's another issue that needs to be addressed.
For the time being, this fixes the other half of the main issue in #88:
users with an old config with the default special key bindings will now
be able to use keyboard hotkeys as these spurious joystick events will
be filtered out and will not block keyboard events.
TODO:
- stop generating events for depressed triggers in the first place
- fix joystick events completely blocking keyboard events
Move the new faudio driver constant AUD_FAUDIO to the end of the sound
driver enum, otherwise the wrong is used.
Also check for NO_OAL before instantiating an openal driver.
Add cmake code to find and link faudio if enabled.
Fix typo for get devices faudio method in wxvbam.h
Selecting the faudio driver now works, but the driver not does
unfortunately.
Fix name of FAudio option XRC control: "FAudio" and not "Faudio".
Create list of valid sound driver options by using macros for the ones
that are compiled in (with windows being a special case.)
The default keyboard/joystick bindings for the "special" keys have
assumptions about axis numbers that do not hold with modern game pads.
For reference, the 360 controller has the following mappings:
Axis 0/1: left stick
Axis 3/4: right stick
Axis 2: left trigger
Axis 5: right trigger
This triggers another bug causing the depressed state of a trigger axis
to fire continuously. In this case, this is the left trigger on a 360
controller which is axis 2.
This triggers yet another bug where a stream of joystick events blocks
keyboard events from registering, resulting in hotkeys like ctrl+p to
pause not working.
Replace all joystick binds for special keys with null values.
With this change, a default installation of vbam will not trigger the
hotkeys not working bug when a joystick is plugged in.
The other bugs here mentioned also need to be fixed.
When trying to do the necessary edits to linklibs.rsp or link.txt for
static linking, first check if the files were created by cmake,
otherwise a fatal error is generated.
When connecting the debugger the debugger variable was
being set to true before setting up the dbgMain and other related
function pointers. This caused the idle loop to attempt to call dbgMain
which was still NULL. This change makes sure that debugger isn't
set to true until all function pointers are set and that when disconnecting
the remotePort variable is reset back to 0 so we can reconnect properly.
The latest version of gdb from devkitpro expects slightly
different response to some of the remote queries. For instance
when sending back the current thread id there should be no
space or dash between 'm' and the thread id. Additionally a
handful of other common remote gdb query params were
added to better support current versions of gdb
https://github.com/llvm-mirror/lldb/blob/master/docs/lldb-gdb-remote.txt
The qHostInfo command is listed as a high priority to implement for gdb
stubs that lldb can connect to. Adding support for this command allows
lldb to properly connect with it's `gdb-remote 55555` command and
correctly determine the target and allow debugging.
When doing a remote memory read the debugger can ask for any size.
The buffer being allocated however was only 1024 bytes long and the
code in remoteMemoryRead also attempts to write a zero byte at the
end of the array. This code will now take the count of bytes the debugger
is trying to read and allocates a buffer that is count * 2 + 1 large. This is large
enough to hold the $02x formatted hex byte for each byte as well as the zero
byte written at the end.
If the packet passed into remotePutPacket was 1024 bytes or
larger then the buffer array would not be large enough to hold
the $, checksum and zero byte written. This now allocates a buffer
of size count + 5 to accommodate these extra characters.
Use the IsWindowsVistaOrGreater() function from VersionHelpers.h, which
fortunately is part of mingw, to check for the availability of the
comctl32 LoadIconWithScaleDown API, which we use to fix issues with the
app icon, like the icon being too big in the volume mixer.
Rename cmake script to copy .gmo files into the .app introduced in
bf4606fc from mac-localizations.cmake to mac-translations.cmake since
these are really translations and not localizations.
Add a POST_BUILD hook to run a cmake script to install translations into
the .app.
Tested to work correctly, when system language is different a
translation is loaded.
Remove -fpermissive from the list of flags passed to gcc and clang.
Remove -fpermissive from the cxxflags from wxWidgets config as well.
When checking wxWidgets ABI compatibility version, temporarily add
-fpermissive to compiler flags on Win32 because minhook requires it.
- Add the cross root from the mingw-w64 mac brew to the cmake toolchain
files.
- Remove strerror_r/strerror_s from ConfigManager.cpp because the
mingw-w64 brew does not support strerror_s for some reason.
- Strip the vbam executable from the builder script in the build_project
phase.
- Change the bzip2 URL to the github mirror because the bzip.org domain
expired.
- Add libuuid as it's required by the new fontconfig, use the mingw
version for mingw builds, for mingw also set UUID_LIBS to
'-luuid_mingw -luuid' in mingw.sh for fontconfig, the mingw version
is called uuid_mingw because uuid is a core win32 library.
- Lower glib version to 2.57.2 stable.
- Update wxwidgets version to current master sha.
- Fix a bug in flex-2.5.3 post_build where it tries to build flex
current but flex has been removed, and it was just rebuilding 2.5.3.
- Fix "aggressive" relocation and the relocation of .l[ao] and .pc files
in install_dist to ignore /usr/local, and only match /usr.
- Add a "project" pre_build and post_build hooks.
- Add getopt to host-only dists in mingw-cross.sh.
- Use perl instead of readlink -f to get the absolute path of the cmake
toolchain files in mingw-cross.sh, as readlink -f is linux-only.
- In mingw-cross.sh, replace the glib post_build to rebuild
gettext-target instead of gettext --without-included-glib.
- Add overridable functions set_host_env_hook and unset_host_env_hook in
mingw.sh to override in other scripts, in this case mac-cross-builder.
- Update mingw glib patches to current fedora versions.
- Add tools/win/mac-cross-builder script to build mingw windows binaries
on mac, it borrows some necessary parts from the mac native builder
for host dists, and inherits from mingw-cross.sh.
TODO: currently the resulting mac-built binary segfaults due to gcc
8.2.0, just as the msys2-built binary does, this is a separate issue.
Use find_program() to check for the existance of wx-config-gtk4, then
wx-config-gtk3 and finally wx-config, instead of calling find_package()
for each separately, FindwxWidgets module does not like being called
multiple times, it screws up some cache variables.