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.