Commit Graph

2054 Commits

Author SHA1 Message Date
Edênis Freindorfer Azevedo 99b66e1326 Expose LCD filter for GBA and GB color saturation.
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.
2020-03-18 00:48:43 +00:00
Edênis Freindorfer Azevedo c789020e93 Fix `Save` button on OAM Viewer for GB and GBA.
No idea why this was not implemented yet...
2020-03-18 00:48:43 +00:00
Edênis Freindorfer Azevedo dcaa1b9abc Fix `Save` button on Tile Viewer for GB and GBA.
For some reason this was not implemented yet.
2020-03-18 00:48:43 +00:00
Edênis Freindorfer Azevedo d05e8fc141 Make AGBPrint output to our Logging.
We also output using `dbgOutput`, hence the behaviour will not change
for users relying on this.
2020-03-18 00:12:27 +00:00
Rafael Kitover 60f05cedc2
cmake: Add ZIP_SUFFIX option, for build configs.
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>
2020-03-17 03:24:43 +00:00
Rafael Kitover abb8234174
Allow binding specific server IP. (#633)
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>
2020-03-16 13:37:01 -03:00
Rafael Kitover a462904c58
Merge remote-tracking branch 'vbam-libretro/master'
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-03-16 11:48:19 +00:00
Rafael Kitover 7ab7bc3a9d
cmake: Add -debug suffix to windows debug zips.
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>
2020-03-15 20:44:22 +00:00
Rafael Kitover 571025da66
cmake: Do not use gpg if user has no keys.
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>
2020-03-14 13:28:36 +00:00
Rafael Kitover 6c64db0794
cmake: Windows codesigning refactor.
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>
2020-03-13 00:30:26 +00:00
Edênis Freindorfer Azevedo 4f1a351d4a Try to configure vsync for multiple options.
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.
2020-03-11 14:00:24 +00:00
Edênis Freindorfer Azevedo ed8a9af250 Use proper functions and checks for OpenGL VSYNC.
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.
2020-03-11 14:00:24 +00:00
negativeExponent 6092082e04
Fix Save Failed error for Super Monkey Ball Jr. 2020-03-11 06:47:25 +08:00
Rafael Kitover 2ba0d316cd
cmake: Include .pdb in zips of debug builds.
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>
2020-03-09 04:28:52 +00:00
Rafael Kitover f1099a213a
Check return value of soundInit().
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>
2020-03-07 13:30:28 +00:00
Mystro256 410ede543c
Check for null pointer in soundReset().
Check that soundDriver is defined.
2020-03-07 13:08:44 +00:00
negativeExponent 9d1d707c01
Limit ROM size to 32 MiB.
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.
2020-03-07 11:45:19 +00:00
negativeExponent fd319d2184
GB: Check header for a valid ROM file.
Check some magic numbers in the ROM header to detect Game Genie and Game
Shark ROMs, and check for the Nintendo logo in the header in normal
ROMs.
2020-03-07 11:43:00 +00:00
Rafael Kitover 05bd2a95cd
Remove libpng direct dependency.
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>
2020-03-01 13:56:29 +00:00
Edênis Freindorfer Azevedo 513af13ddc Replace `libpng` code for `stb_image` one.
It is a very straightforward replacement calls.
2020-03-01 09:54:43 +00:00
Edênis Freindorfer Azevedo 8f48c1f01d Fix weird `wxWidgets>=3.0` error message.
ASSERT INFO:
/usr/include/wx-3.0/wx/object.h(160): assert "wxDynamicCast(ptr, T)"
failed in wxCheckCast(): wxStaticCast() used incorrectly
2020-03-01 09:54:43 +00:00
Rafael Kitover 32e7c69726
Gettext pot update improvements.
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>
2020-02-24 21:06:23 +00:00
Rafael Kitover 2f0653824e
Enable XAudio2 for Windows vcpkg build.
Add necessary headers to the dependencies submodule and default the
cmake option to on.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-24 20:49:01 +00:00
Rafael Kitover ba14cadba1
Fix 0e8e46f0 for gcc.
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>
2020-02-24 19:46:50 +00:00
Rafael Kitover 0e8e46f0b7
Windows: Fix deleting tempfile for winsparkle dll.
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>
2020-02-24 13:17:32 +00:00
Rafael Kitover 89d378eb71
cmake: Fix gettext pot update check.
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>
2020-02-20 23:46:09 +00:00
Rafael Kitover d93f6350d0
cmake: Generate gettext pot automatically.
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>
2020-02-17 08:34:32 +00:00
s520 a320377040
Fix: a issue with loading e-Reader dot code (#608)
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.
2020-02-15 14:02:53 -03:00
Rafael Kitover 83614290be
Turn on winsparkle update checking support.
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>
2020-02-08 04:26:50 +00:00
Rafael Kitover 4aab08c47b Set link timeout default to 500ms, fix prev. dflt.
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>
2020-02-04 23:01:11 +00:00
Rafael Kitover 136c094f0c Add option to set link network port.
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>
2020-02-04 23:01:11 +00:00
Rafael Kitover 98f3948ea8
cmake: Add dep on catalogs for translations.zip.
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>
2020-02-03 18:10:29 +00:00
Edênis Freindorfer Azevedo 789cd2d0f0
Revert "Enable layers in non-tile modes."
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.
2020-02-03 07:38:26 -03:00
Edênis Freindorfer Azevedo ca3b63d64c
Enable layers in non-tile modes.
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.
2020-02-02 15:49:02 +00:00
Rafael Kitover 3edd9ba756
cmake: Fix fedora mingw build + misc improvements.
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>
2020-02-01 16:43:08 +00:00
Edênis Freindorfer Azevedo f69febfd71
Add `.wav` support for sound recording.
WAV is also set to be the default extension for audio recording.
2020-01-22 13:50:27 -03:00
Edênis Freindorfer Azevedo 588e82f03c
Cleanup from PR 586. 2020-01-21 13:57:42 -03:00
Zack 6a8a9e6244 Fix integer overflow in cheatsImportGSACodeFile length check.
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.
2020-01-17 16:39:58 -03:00
Rafael Kitover 920f5ac704
Merge remote-tracking branch 'vbam-libretro/master'
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-01-16 15:47:53 +00:00
twinaphex 7d88e045a2 (MSVC 2017) Buildfix 2020-01-07 17:57:00 +01:00
negativeExponent b50d48458f GBA: Fix crash when new size is larger than rom size after soft-patching 2020-01-04 04:46:49 +08:00
Ar't 9e1a63af0b support for patches in BPS format 2020-01-04 00:44:55 +08:00
Zach Bacon d58d4ee1d2
Move the snapcraft to root for snapcraft edgechannel setup 2019-12-28 22:04:03 -05:00
Zach Bacon 312b541625
Fix up the icon location in the desktop file
For regular desktop users they don't need this work around, it's mainly due to how snaps are mounted.
2019-12-28 22:01:53 -05:00
Rafael Kitover 065e700fc8
Fix icon in about dialog.
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>
2019-12-29 02:03:46 +00:00
Rafael Kitover f3e4b05fa8
Linux: fix icon name in .desktop file.
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>
2019-12-29 01:26:15 +00:00
ZachBacon f26480bb07
Move this snapcraft yaml to git releases and fix the icon location 2019-12-28 19:21:49 -05:00
Rafael Kitover d3397e6a1a
cmake: Release automation followup.
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>
2019-12-25 23:14:45 +00:00
Rafael Kitover fb068e55c4
Poll joysticks before emumain in OnIdle #582.
Call PollJoysticks() before entering the emulator in OnIdle for the
lowest input latency.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-24 21:53:41 +00:00
Rafael Kitover 7a8aeb9842
Poll joysticks even when emulator is paused.
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>
2019-12-24 13:54:53 +00:00
Rafael Kitover e98d89310e
cmake: Add some release automation steps.
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>
2019-12-24 06:32:01 +00:00
Rafael Kitover bbbe9fe73f
Only poll joysticks with a valid device.
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>
2019-12-22 17:59:57 +00:00
Rafael Kitover 54072f9711
Update icon xrc.
Followup on f306cc63.

Set the correct reference to icon .xpm file in MainIcon.xrc.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-22 17:34:50 +00:00
Rafael Kitover 0577f8afc2
Better joystick hotplug support.
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>
2019-12-22 03:17:33 +00:00
Rafael Kitover f306cc63b0 App name cleanup.
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>
2019-12-21 18:22:57 +00:00
Rafael Kitover 49ca52ba03
cmake: Visual Studio misc followup on cf9a88df.
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>
2019-12-15 19:34:18 +00:00
Rafael Kitover b3932e4e3d
cmake: Fix localization for Visual Studio.
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>
2019-12-12 19:01:58 +00:00
Rafael Kitover d0d087511f
MSVC: Fix SDL binary assertion failure on start.
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>
2019-12-10 23:41:40 +00:00
Rafael Kitover cf9a88dfc3
cmake: Visual Studio support improvements.
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>
2019-12-10 11:13:58 +00:00
Rafael Kitover 1ccc377978
Improve joystick connection/disconnection.
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>
2019-12-05 17:00:05 +00:00
Rafael Kitover 6c2850cd59
Merge remote-tracking branch 'vbam-libretro/master'
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-04 01:59:38 +00:00
Rafael Kitover 498e4e858d
Windows joystick events fix.
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>
2019-12-03 20:09:56 +00:00
hizzlekizzle 2622db116c
Merge pull request #82 from negativeExponent/fix_window
Allow game window to resize on-the-fly when enabling/disabling borders
2019-12-02 13:26:45 -06:00
negativeExponent 72d0725bac Allow game window to resize on-the-fly when enabling/disabling borders 2019-12-02 22:23:07 +08:00
Rafael Kitover 24f13ef00f
Merge remote-tracking branch 'vbam-libretro/master'
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-01 00:35:05 +00:00
Rafael Kitover e04efa76b3
Release game controller device correctly. #568
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>
2019-11-29 03:50:24 +00:00
Rafael Kitover 02520fb63e Joystick handling refactor.
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>
2019-11-27 23:09:35 +00:00
Rafael Kitover ae7349b06f
cmake: Use list var VBAM_LIBS for link libs.
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>
2019-11-13 02:56:06 +00:00
Rafael Kitover e35d46254b
WinSparkle wrapper improvements.
- 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>
2019-11-09 23:44:23 +00:00
Edênis Freindorfer Azevedo 76803caf5f
[Windows] Enable winsparkle update checker.
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>
2019-11-09 22:47:34 +00:00
ZachBacon 3f39bcd04f
Finally a working snapcraft yaml file with confinement enabled.
Tasks that need to be done
- Enable ffmpeg
- Fix icon location
- Enter testing phase before going onto the snap store.
2019-11-08 04:36:04 -05:00
Edênis Freindorfer Azevedo 225e4dc954 Remove top border black line when using filters.
We don't want to display the top border when using filters, since it
is a single line with black pixels.

- Fix #561.
2019-11-07 17:52:18 +00:00
Rafael Kitover 4352504385
Windows: load WinSparkle.dll as a resource
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>
2019-11-06 12:04:29 +00:00
Rafael Kitover d0d22b3068
cmake: copy wxrc from vcpkg build if not exists
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>
2019-10-21 14:19:56 +00:00
mudlord 0535d5c797 Optimize CRC32. 2019-10-21 13:25:19 +00:00
orbea 65c908141c wx: Fix conditional jump on uninitialized value with valgrind.
==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.
2019-10-10 02:47:43 -07:00
orbea 6adf5ea487 wx: Silence -Woverloaded-virtual warnings with debug builds.
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.
2019-10-09 10:32:51 -07:00
orbea 4e9882f24d cmake: Don't install visualboyadvance-m twice on WIN32. 2019-10-08 13:23:44 -07:00
orbea 518c147281 cmake: Use an install target for visualboyadvance-m. 2019-10-07 17:36:27 -07:00
orbea abff89e4fb cmake: Use add_executable when not cross-compiling. 2019-10-07 04:46:20 -07:00
Rafael Kitover 61520df789
Add @orbea to About -> Contributors.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-10-06 23:48:13 +00:00
Rafael Kitover 7ee3cbe120
Joystick rumble followup. #522
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>
2019-10-06 17:42:12 +00:00
Rafael Kitover 4bc9bb84b4
Implement joystick rumble. #522
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>
2019-10-06 11:06:08 +00:00
orbea 680af6d420 cmake: Silence cmake policy warning CMP0058.
See: cmake --help-policy CMP0058
2019-10-05 18:33:44 -07:00
Rafael Kitover 699d0c3724
Add denisfa to about -> contributors.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-10-05 19:35:15 +00:00
Edênis Freindorfer Azevedo 384f448757 Fix key accel overriding menus and dialogs.
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.
2019-10-05 12:30:49 -07:00
Rafael Kitover 3e22d17fb2
fix Visual Studio build
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>
2019-10-04 13:20:10 +00:00
Rafael Kitover 24d83a1262
make recompile for vers/git state change minimal
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>
2019-10-04 08:14:22 +00:00
Rafael Kitover af0de1c4b3
xbrz: fix inline asm check
Use correct cpp code to detect x86/amd64 architecture to use inline asm.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-10-04 07:35:49 +00:00
Ar't ced2676926
win: set correct version in rc
xvbam.rc: use version.h to generate version strings,
cmake: adding version in odd format required by rc
2019-10-04 07:13:20 +00:00
Edênis Freindorfer Azevedo 806dd7daa6 Fix circular `--config` for SDL port.
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.
2019-09-25 20:59:37 -01:00
Edênis Freindorfer Azevedo 1aa8afb4dc Drop dead code entirely.
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`.
2019-09-25 20:59:37 -01:00
Edênis Freindorfer Azevedo 531172c4be Fix displaying of link menu when `ENABLE_LINK=NO`.
We disable the items, but not the menu. So, there was an empty list
on `Options` > `Link` > `Type`.
2019-09-16 21:36:44 -01:00
Edênis Freindorfer Azevedo 07107096b8 [Windows] Fix crash when setting weekly updates.
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.
2019-09-16 21:36:44 -01:00
Edênis Freindorfer Azevedo efa09bdb07 Add faster sqrt code for xBRZ filters.
We use ASM code for Windows `x86` and Linux desktop. The others remains
the same.
2019-09-16 21:36:44 -01:00
Edênis Freindorfer Azevedo 10f5576ecf Fix config file when removing system accels.
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.
2019-09-16 21:36:44 -01:00
Edênis Freindorfer Azevedo 1c6b016853 [Windows] Fix remaining UTF-8 issues.
We were missing some `wxConvLibc` on the output code. This meant crappy
messages on windows.
2019-09-16 21:36:44 -01:00
Rafael Kitover 0f2c8cab08
win: check APPDATA if LOCALAPPDATA is not found
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>
2019-09-12 03:01:16 +00:00
Edênis Freindorfer Azevedo 528c37f9e0 Allow "Browse" to be translated.
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`.
2019-09-10 07:59:56 +00:00
Edênis Freindorfer Azevedo d8c981fb42 Fix toggles for video/audio layer options on menu.
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.
2019-09-10 07:59:56 +00:00
Edênis Freindorfer Azevedo c0f96425e6 Show all commands available on menu.
We move from `Other commands` to several places of our main menu. This
way we allow texts to be translated and easier view of them for users.
2019-09-10 07:59:56 +00:00
Edênis Freindorfer Azevedo 51fa150f1c Adjust MMX menu variable and position.
It should only appear on `x86`.
2019-09-10 07:59:56 +00:00
Edênis Freindorfer Azevedo 27b038b378 Show messages about operations of state slot. 2019-09-10 07:59:56 +00:00
Edênis Freindorfer Azevedo 2e24845711 Allow translation of the words `Open` and `Quit`. 2019-09-10 07:59:56 +00:00
Edênis Freindorfer Azevedo 54991c5b14 Add extra keys default input when using GUI.
We also set the extra keys for controller input when using `defaults`
option.
2019-09-10 07:59:56 +00:00
Rafael Kitover b358c051c9 Fix compilation issue when `ENABLE_DEBUGGER=Off`.
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.
2019-09-04 14:31:11 +00:00
Rafael Kitover 2a2be95397
builder: msys2 fixes
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>
2019-09-03 00:14:37 +00:00
Rafael Kitover d9e4a0874d
build fixes: ffmpeg, xbrz, travis, C++ version
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>
2019-08-31 22:58:59 +00:00
Rafael Kitover 381a7bfe78
/std:c++latest for MSVC, fix bool flip, warn opts
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>
2019-08-30 01:57:01 +00:00
Edênis Freindorfer Azevedo 234f1e9b1a Update to xBRZ `1.7`.
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.
2019-08-28 22:07:52 +00:00
Edênis Freindorfer Azevedo 06a9d786c2 Allow UPS patch for GBA games.
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.
2019-08-21 00:45:46 +00:00
Edênis Freindorfer Azevedo 03121c69c0 Add support for autohold buttons.
We implement this in the same way it is being done on `vba-rr`.

- Fix #414.
2019-08-20 23:00:48 +00:00
Edênis Freindorfer Azevedo e87213e369 Fix indentation. 2019-08-20 23:00:48 +00:00
Edênis Freindorfer Azevedo cf47942f09 Fix Autofire {L,R}.
We were using directionals (left and right) instead.
2019-08-20 23:00:48 +00:00
Rafael Kitover d9a7e0c964
cmake: auto-detect sfml, ffmpeg and openal
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>
2019-08-20 08:21:38 +00:00
Rafael Kitover 8ceef90fc4
fix appveyor visual studio build
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>
2019-08-20 06:55:07 +00:00
Edênis Freindorfer Azevedo fc2eb38fcd Fix behaviour of `Tools` > `Memory Viewer` (#486)
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.
2019-08-19 19:25:47 -01:00
Rafael Kitover 51f61a3afb
Merge remote-tracking branch 'vbam-libretro/master' 2019-08-18 18:46:55 +00:00
Aaron Kling a01a2d4dd0 libretro: allow mingw cross compile 2019-08-17 09:17:06 -05:00
Rafael Kitover dc8d36a08c
minor fix for stl wx builds
`XRCID()` expects a `const char *` not a `wxString`.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-08-16 06:08:47 +00:00
Rafael Kitover 51a4f74b94
Merge remote-tracking branch 'vbam-libretro/master' 2019-08-15 18:42:08 +00:00
negativeExponent 9ccdeac3aa Add missing break; lines for switch statements
- 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
2019-08-15 15:23:58 +08:00
Rob Loach a17eb47103
Merge branch 'master' of github.com:fpscan/vbam-libretro into intl 2019-08-14 10:00:20 -04:00
Rob Loach 9b043daadf
libretro: Update core options API 2019-08-14 09:56:39 -04:00
Edênis Freindorfer Azevedo 6b18c1f9b8 Fix warning about frames left in queue.
Example:
- [libmp3lame @ 0x55b9e7248300] 4 frames left in the queue on closing
2019-08-14 08:27:51 -01:00
Edênis Freindorfer Azevedo f5b19475c9 [IDEA] Fix recording when using `speedup/turbo`.
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).
2019-08-14 08:27:51 -01:00
Edênis Freindorfer Azevedo 738494a232 Support all sample rate available on GUI.
Before we could only use `44100`. Now we can use all available on GUI
for the supported codecs.
2019-08-14 08:27:51 -01:00
Edênis Freindorfer Azevedo aa3ecaf701 Add new output formats for recording audio/video.
We test each of these additions by trying to record gameplay with them.
Then we play it and check the results. Pretty straightforward.
2019-08-14 08:27:51 -01:00
Edênis Freindorfer Azevedo 5848feaea2 Fix video/audio recording.
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.
2019-08-14 08:27:51 -01:00
Ömercan Kömür 9e3c26152e Update libretro_core_options.h
option_defs_tr
2019-08-13 11:23:36 +03:00
Ömercan Kömür 6c60ac334b Turkish Language option 2019-08-13 08:50:56 +03:00
retro-wertz ad43b32bdd Fix "index out of bounds" runtime error 2019-08-12 21:56:10 +08:00
retro-wertz 82e723a528 MBC3: Update mapper to check if RTC is present before running RTC functions 2019-08-10 19:01:10 +08:00
retro-wertz 03184dd513 libretro: Use GB RTC data when available
- Save GB RTC data using retro_get_memory/size and only init using localtime when its unavailable (check is done in retro_run)
2019-08-10 18:24:32 +08:00
retro-wertz b3744b3bd5 Simplify GB border core option 2019-08-10 01:06:15 +08:00
retro-wertz 9757a880c7 Core options cleanup and a few readability-related updates
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
2019-08-09 22:28:52 +08:00
Edênis Freindorfer Azevedo cfb03d8b3a Set default keybinding when key does not exist.
- Fix #463
2019-08-08 21:31:58 -01:00
retro-wertz 496b372d3e Allow enabling GBA RTC regardless of rom types
- 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)
2019-08-07 20:05:57 +08:00
retro-wertz bb10954466
Update Makefile 2019-08-07 01:55:52 +08:00
retro-wertz 98313652d6 Update Makefile
- Try to fix osx build
- style nits and cleanup
2019-08-06 19:22:14 +08:00
Twinaphex 34de057969
Merge pull request #67 from retro-wertz/update_makefiles
Update Makefiles
2019-08-06 05:45:32 +02:00
retro-wertz d9f8396c67 Cleanup 2019-08-06 08:58:04 +08:00
retro-wertz 9a13449782 Update Makefiles
- Updating makefile from vba_next's makefiles, removing any defines that are not available in this core.
- Update Android.mk
2019-08-04 15:37:18 +08:00
retro-wertz d898288100 Automatically hide some core options depending on rom image type
- loading gba games will automatically hide gb/gbc only related core options at startup
- loading a gb/gbc game will also hide gba only options...
2019-07-30 00:51:06 +08:00
hizzlekizzle c3edd6d433
Merge pull request #65 from retro-wertz/libretro
retro_get_memory_data/size and memory descriptors update
2019-07-28 17:05:10 -05:00
retro-wertz 2084a63e1f Update GB/GBC memory maps (retro_memory_descriptors) 2019-07-28 21:52:13 +08:00
Twinaphex 90b051eee1
Update libretro_core_options.h 2019-07-28 07:40:43 +02:00
retro-wertz a727e22265 GB: Rename this variable to isolate from a global variable of the same name
- this is a temporary variable and should only affect on this section, and not the global one.
2019-07-27 19:35:58 +08:00
retro-wertz 0d423b98fa Cleanup GB palette struct and update retro_get_memory_data/size
- 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.
2019-07-27 19:15:46 +08:00
retro-wertz bc80ecdb39 UtilRetro.cpp: Cleanup 2019-07-27 11:33:32 +08:00
Edênis Freindorfer Azevedo 855db11d98 Fix wxWidgets assertion error on `Logging...` menu. 2019-07-26 19:38:44 -01:00
Zach Bacon c886b6a16d remove wrong and unnecessary #define
This fixes builds with clang on windows.
2019-07-25 21:45:29 -01:00
Rafael Kitover 38561b5713
Merge remote-tracking branch 'vbam-libretro/master' 2019-07-25 02:16:32 +00:00
Edênis Freindorfer Azevedo 770b9c1cf8 Add left analog bind to D-PAD for joystick. 2019-07-25 00:41:34 +00:00
Edênis Freindorfer Azevedo 6de45d4ed2 Set default binding for keyboard.
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.
2019-07-25 00:41:34 +00:00
Edênis Freindorfer Azevedo 78bbe1487a Add individual clear buttons for input config.
Besides that, we also rename the button for all input to `Clear All`.

- Fix #416.
2019-07-25 00:41:34 +00:00
Edênis Freindorfer Azevedo 53002e54db Use hats from joystick as default D-PAD. 2019-07-25 00:41:34 +00:00
Edênis Freindorfer Azevedo 57b7ddf592 Fix small memory leak. 2019-07-25 00:41:34 +00:00
Edênis Freindorfer Azevedo 060da968eb [LINUX] Add option to disable the online updater.
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.
2019-07-25 00:41:34 +00:00
Edênis Freindorfer Azevedo dbb5914fa4 Show which BIOS file is currently selected.
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.
2019-07-25 00:41:34 +00:00
Edênis Freindorfer Azevedo 76756ef916 Fix key shortcuts for toggle menu actions.
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.
2019-07-25 00:41:34 +00:00
Edênis Freindorfer Azevedo 4622f1b833 Whitespace fix. 2019-07-25 00:41:34 +00:00
Edênis Freindorfer Azevedo 3dc738b5c5 Set default keys for input on first run.
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.
2019-07-25 00:41:34 +00:00
Edênis Freindorfer Azevedo 9bc8f33c40 Disable using volume {+,-} actions in main menu.
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.
2019-07-25 00:41:34 +00:00
Twinaphex d1fcffc8c4
Merge pull request #63 from retro-wertz/fix_gba_siocnt
libretro: add SIO Control, normal mode reg
2019-07-23 13:47:12 +02:00
retro-wertz 53ce6fb054 libretro: add SIO Control register (GBA)
- emulate SIOCNT reg, which is still needed for some games to trigger IRQ's even in single, non-link mode
- Fixes Digimon Racing (Europe) stuck in intro as reported in libretro docs page https://docs.libretro.com/library/vba_m/#compatibility
- Related PR: f9efb79a7d (diff-385704891f00846c986e9056b5d7c5a5)
2019-07-23 19:15:45 +08:00
retro-wertz e50812dc79 GB: input, audio, video timing updates 2019-07-23 01:18:13 +08:00
retro-wertz 1532f555fe GB: Reduce input lag by 1 frame, video and audio timing updates...
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
2019-07-23 00:40:28 +08:00
Rafael Kitover 2fcad3f813
joysticks: hack to better support 360 triggers
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>
2019-07-19 12:43:47 +00:00
Rafael Kitover 352eb149ae
Merge remote-tracking branch 'vbam-libretro/master' 2019-07-19 12:12:49 +00:00
Edênis Freindorfer Azevedo 2e97b27ffa Use --config option to load configuration file. 2019-07-18 19:40:42 +00:00
retro-wertz bd5ba43122 Cleanup: Remove previous core option struct and unused variables etc 2019-07-18 19:34:20 +08:00
retro-wertz aac30c72d3 Add GB Color Correction core option 2019-07-18 18:07:00 +08:00
retro-wertz 02a7a48bf3 GB: Fix selected palette not applied when loading content...
- Prevent GB type hardware change during runtime.
2019-07-18 17:35:54 +08:00
retro-wertz 1fa78e69c5 Fix android build 2019-07-18 11:57:42 +08:00
retro-wertz 6dcf016d20 GB: Allow support for colorizer patched games
- a new core option is provided since enabling this support
means allowing invalid access to vram and palette
- works in GBC/GBA hardware mode only
2019-07-18 10:41:59 +08:00
retro-wertz 85bd86cf5f GB: Send LCD interrupt only if there is no INT 48h signal
- Fixes Speedy Gonzales status bar in GB emulated hardware type.
2019-07-18 08:31:33 +08:00
retro-wertz d808297bc6 Fix crash caused by incorrect variable index for analog sticks 2019-07-18 01:02:17 +08:00
retro-wertz 7e8828986e libretro: Add core option sublabels 2019-07-18 00:56:58 +08:00
retro-wertz c5e6a3409a Libretro: Update GBC memory map 2019-07-16 22:51:07 +08:00
Rafael Kitover 296255d492
handle SDL joystick query errors #451
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>
2019-07-11 21:25:51 +00:00
Edênis Freindorfer Azevedo 7569242f77 Fix pause behaviour with `Pause when inactive`.
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.
2019-07-04 04:42:32 +00:00
Edênis Freindorfer Azevedo 030740ee34 Fix some memory leak. 2019-07-04 04:41:26 +00:00
Edênis Freindorfer Azevedo 8ea607e1c7 remove translation from joystick keys
Avoid issues with translation, at least for now,
by not translating joystick button/axis names.
2019-07-04 04:26:48 +00:00
Rafael Kitover e2f06210e0
update Visual Studio support
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>
2019-07-03 23:28:48 +00:00
Edênis Freindorfer Azevedo 91501becf6 Fix small memory leak. 2019-07-03 19:25:11 +00:00
Edênis Freindorfer Azevedo c366907f64 Temporary fix for #65.
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.
2019-07-03 19:25:11 +00:00
Rafael Kitover d585a61049
followup on kbd trans issues fix in 30b92724
Use the table to to replace both the translated string and the English
string.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-07-03 02:17:13 +00:00
Rafael Kitover eaf1ad2429
Merge remote-tracking branch 'vbam-libretro/master' 2019-07-01 08:00:30 +00:00
Rafael Kitover 30b9272412
hopefully fix kbd control translation issues
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>
2019-07-01 07:53:23 +00:00
Edênis Freindorfer Azevedo 90b3f35408 Add hotkeys for changing sizes (1x ... 6x).
Use a accelerator to quickly provide a way to change to/from multipliers
of the original size.

- Fix #415.
2019-06-29 14:04:04 +00:00
Edênis Freindorfer Azevedo fa77010f23 Fix pause toggle keybinding when unmuting.
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.
2019-06-29 14:01:21 +00:00
Edênis Freindorfer Azevedo 8b8efa1b2d fix key shortcuts for save/load states
* 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.
2019-06-26 02:30:31 +00:00
Rafael Kitover 9fa20b49ca
joystick cleanups #444
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>
2019-06-24 20:36:21 +00:00
Rafael Kitover 684b1bb7aa
fix mem error for config global `homeDir`
Fix `homeDir` `ConfigManager` global pointing to freed memory.

Thanks to @FredericHamel for catching this.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-06-23 20:08:23 +00:00
Edênis Freindorfer Azevedo ccc91fa04b quick fix for unicode filenames on windows 2019-06-23 10:59:13 +00:00
Edênis Freindorfer Azevedo dfa4fec3d5 Fix missing shortcuts from key bindings.
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.
2019-06-23 10:50:52 +00:00
Edênis Freindorfer Azevedo 69b581f7e5 Handle key{bindings,shortcuts} correctly on frame.
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.
2019-06-23 10:50:52 +00:00
Edênis Freindorfer Azevedo cec1dbfd36 Split configuration for default keys.
Split for keyboard and joystick with two arrays variables for
refactoring purposes.
2019-06-23 10:50:52 +00:00
Edênis Freindorfer Azevedo d655031a8f Fix removing multiple system keys shortcuts.
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.
2019-06-23 10:50:52 +00:00
Edênis Freindorfer Azevedo 996d5b9df8 Do not set these options on `MainMenu.xrc`.
We already set the default values on `opts.cpp`, therefore these
values are not needed here.
2019-06-23 10:50:52 +00:00
Edênis Freindorfer Azevedo 019ab5a7e1 Fix "Joybus host invalid; disabling" warning.
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.
2019-06-23 10:07:24 +00:00
Edênis Freindorfer Azevedo f6bfe67632 Have better support for maximized window.
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.
2019-06-23 10:04:37 +00:00
Edênis Freindorfer Azevedo dcc0afa0d4 Fix window size when {en,dis}abling status bar.
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.
2019-06-23 10:04:37 +00:00
Edênis Freindorfer Azevedo bf6f2d4ac2 Change where the config dir is created.
On Windows, if there is a `vbam.ini` where the exe is, we should not
create the configuration directory `%LOCALAPPDATA%\visualboyadvance-m`.
2019-05-31 00:42:08 -07:00
Edênis Freindorfer Azevedo b0ec84693e fix stuck keys on ubuntu and on focus loss #142
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.
2019-05-29 12:08:18 -07:00
Edênis Freindorfer Azevedo 3d57750c16
Follow-up work on #142.
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.
2019-05-23 20:04:18 -03:00
Aaron Kling 055b7c4d49 libretro: jni: Switch to clang compiler in preparation for ndk r20 2019-05-23 15:29:16 -05:00
Aaron Kling 2e1333e1bb regparm is an x86 only attribute, only define it there 2019-05-23 15:28:09 -05:00
Edênis Freindorfer Azevedo 22307de6c8 Fix continuous sprinting when using a modifier key
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.
2019-05-22 10:59:16 -07:00
Rafael Kitover 504597120f
wx: only rename config if new file doesn't exist
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>
2019-04-28 12:35:27 +00:00
retro-wertz 0a95486fd8 Sound.cpp: Update
- minor, non-function changing updates like float value changes, some unrolled sections
- break soundEvent into separate 8 / 16 bit data writes.
2019-04-28 04:02:45 -07:00
retro-wertz 240257a01b wx: Change max volume from 400 to 200
- global implementation has set max at 200% (2.0 float), its already loud enough at 100%
2019-04-27 15:49:55 -07:00
Rafael Kitover 2fedaa63a6
support FreeBSD
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>
2019-04-25 16:22:07 +00:00
Rafael Kitover a0c375b6e4
Merge remote-tracking branch 'vbam-libretro/master'
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-04-20 08:39:54 +00:00
Rafael Kitover ac35e37ca0
fix game geometry on windows
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>
2019-04-17 13:38:29 +00:00
Rafael Kitover 9fa544d1bb
cmake: wxWidgets Release config for visual studio
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>
2019-04-17 13:15:13 +00:00
Rafael Kitover 3cacb363a6
libretro: put " " between version and git sha
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>
2019-04-16 15:51:30 +00:00
Rafael Kitover c2656f1375
libretro: remove "-" between version and git sha
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>
2019-04-16 15:46:32 +00:00
Rafael Kitover 4203bb53f2
libretro: set version with git sha
Read version from `CHANGELOG.md` and append the short git sha if not on
the released commit.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-04-16 14:13:22 +00:00
Wes Smith b6bb24e016
Merge pull request #1 from libretro/master
Rebase
2019-04-15 22:27:52 -04:00
Rafael Kitover ed16d625e3
add unistd.h compat header for visual studio
Using:

https://stackoverflow.com/a/826027/262458

Revert 5019a201.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-04-13 22:50:05 +00:00
Zach Bacon 5019a20165
[SDL Front] MSVC doesn't have an unistd.h system file, closest is io.h, this will fix building the SDL frontend with msvc again. 2019-04-10 17:27:45 -04:00
Edênis Freindorfer Azevedo 2ae72f38cd fix starting game pos and geometry #406
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.
2019-04-09 15:49:13 +00:00
Rafael Kitover 2beb561838
cmake: move wx funcs and macros into separate file
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>
2019-04-09 02:04:50 +00:00
retro-wertz 5012969a59 Bump version to 2.1.1 2019-04-06 20:11:14 +02:00
retro-wertz 755f476799 Fix #52 2019-04-06 20:11:13 +02:00
Rafael Kitover 5b9d1a7174
cmake: improve finding wx utils
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>
2019-04-06 01:37:02 +00:00
Rafael Kitover 836b74a162
remove DOS line-ends from src/wx/xrc/*.xrc
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-04-04 19:21:20 +00:00
Rafael Kitover 49205bf28a
remove unused "multithread filter" menu item
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-04-04 19:20:20 +00:00
Edênis Freindorfer Azevedo 331d9d331c Fix compilation warnings for MacOS build. 2019-04-04 18:01:05 -01:00
Edênis Freindorfer Azevedo 5540790ff1
fix some compilation warnings
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Merged #396
2019-04-03 17:32:25 +00:00
Edênis Freindorfer Azevedo d919728138 Fix for resizing window geometry when loading games. 2019-04-03 11:51:56 +00:00
Rafael Kitover 64a9c0945f
fix analog stick regression from e57beed8 #400
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>
2019-04-01 09:38:51 -07:00
Rafael Kitover 0f0d2400bc
more specific check for 3.1.2 xrc error
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>
2019-04-01 09:28:19 -07:00
Rafael Kitover d9a7df6105
fix if statement in SDL sound driver #396
@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>
2019-04-01 08:42:52 -07:00
Rafael Kitover 2097b5aaa5
wx 2.8 compat fixes, centos support, cmake fixes
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 #395
Closes #297
2019-03-28 21:45:06 +00:00
Rafael Kitover b69fced749
cmake: refactor, better clang support
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>
2019-03-27 03:25:43 +00:00
Rafael Kitover f2e9dc5530
cmake: check for policy CMP0077 existence
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>
2019-03-26 13:40:35 +00:00
Rafael Kitover ae38a70d1e
cmake: gcc/clang colors with ninja, fix warnings
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>
2019-03-26 00:35:23 +00:00
Rafael Kitover 59e9c69097
reset Xorg screensaver on joy events
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>
2019-03-22 11:30:31 -07:00
Rafael Kitover a0283eadb6
fix game panel size on wxGTK #325
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>
2019-03-22 11:24:56 -07:00
Rafael Kitover f1ecd7c322
auto deps for visual studio, take 1
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>
2019-03-21 16:01:46 -07:00
Edênis Freindorfer Azevedo c714ff825a fix problems of command line parameters
* Fix return code for wrong command line parameters.

* Update return code for incorrect command line option on WX port.
2019-03-18 20:38:42 -07:00
Edênis Freindorfer Azevedo a1f0c34ace XDG followup work #94
* 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.
2019-03-18 01:08:53 -07:00
Edênis Freindorfer Azevedo a57e51f699 Return non-error code for given command line parameters. 2019-03-14 16:17:45 -07:00
Edênis Freindorfer Azevedo 3fd444da91 XDG related cleanups #94
* Add migration support for 'vbam.cfg' to 'vbam.ini' on MacOS and Windows.

* Cleanup from XDG Base Dir code.

* Set home to NULL after using free().
2019-03-13 22:05:02 -07:00
Edênis Freindorfer Azevedo 1ebb8efdb6 Fix to set correctly position Y. 2019-03-12 11:16:09 -07:00
Edênis Freindorfer Azevedo 944c263e7f auto save/load geometry for wx GUI #94
* 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.
2019-03-11 10:32:39 -07:00
Rafael Kitover 530af14030
rpi plugins fix + paths enhancements #94
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>
2019-03-07 07:13:07 -08:00
Rafael Kitover 6a98f3c200
define S_ISDIR for win32 #94
Followup on #383.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-03-06 18:53:22 -08:00
Edênis Freindorfer Azevedo 7373da1528 Fix segmentation fault issue when using WX port command line
on Linux and MacOS.
2019-03-06 18:03:37 -08:00
Edênis Freindorfer Azevedo 36453885fc XDG Base Dir Spec followup #383
* 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.
2019-03-06 15:38:57 -08:00
Wes Smith f87e085079 added a8a35 2019-03-05 15:22:21 -05:00
retro-wertz 286c8ff487 Fix #52 2019-03-03 15:16:11 -05:00
Rafael Kitover 24fd4e91a0
move factory reset to help menu
Per Squall's suggestion.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-03-02 14:37:08 -08:00
Rafael Kitover 5835dafe9a
translate battery save error #318
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-03-02 11:04:06 -08:00
Rafael Kitover d2922cfc5d
stop showing "wrote battery" msg on panel #318
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>
2019-03-02 08:15:30 -08:00
Edênis Freindorfer Azevedo 646557e24e Add support for the XDG Base Dir Spec for Linux with legacy support.
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`.
2019-02-28 16:22:09 -08:00
retro-wertz eaa9b6c57b Map Viewer: Fix crash when running a gb/gbc game,
...caused by invalid start address of mapbase.

Fix https://github.com/visualboyadvance-m/visualboyadvance-m/issues/372
2019-02-24 18:31:24 -08:00
Rafael Kitover 98cb298efc
GB: fix 32/64 bit save/state incompatibility
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>
2019-02-23 13:40:25 -08:00
Rafael Kitover d7cf15e076
implement factory reset option #368
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>
2019-02-20 19:44:42 -08:00
laqieer 7b350c09b9 bugfix: crash when loading elf 2019-02-05 20:44:17 +08:00
Rafael Kitover eb6dfb4bfa
fix libretro build broken in 16dd5d40 #339
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>
2019-02-03 15:28:26 -08:00
Rafael Kitover 16dd5d4068
make speedup/turbo configurable + misc #339
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>
2019-02-02 18:43:55 -08:00
ZachBacon 5379708fcc I guess I'll try the gtk2 build of wxwidgets instead 2019-02-02 18:32:38 -05:00
ZachBacon d70dd37326 Let's use the proper wxwidgets package 2019-02-02 18:29:19 -05:00
ZachBacon ede6b371a4 Fix snap deps 2019-02-02 18:23:24 -05:00
ZachBacon 44208c82d7 Add basic snapcraft yaml for building a snap 2019-02-02 18:01:59 -05:00
retro-wertz ba678f4f2e GB: Make gbTimerOn an INT type instead of BOOL 2019-01-31 16:35:36 -08:00
retro-wertz 43647d3234 GB: Prevent gbSpritesTicks from going out-of-bounds 2019-01-31 16:35:36 -08:00
Rafael Kitover f8c6953151 fix drawing panel alignment in frame #325
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>
2019-01-31 14:59:41 -08:00
retro-wertz e912c359f6 GBA: Remove some magic numbers for main pointers and save types size 2019-01-30 04:10:35 -08:00
retro-wertz 0697922179 Update libretro.cpp 2019-01-29 08:28:17 -08:00
retro-wertz 4700a2c1bf libretro: Enable mirroring for classic/famicom games for GBA and update 2019-01-29 08:28:17 -08:00
retro-wertz f2b3496298 GB: Add missing battery save for MMM01 cart 2019-01-29 08:28:17 -08:00
retro-wertz a0cec107a2 Update GBA save type detection and cleanup...
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
2019-01-29 08:28:17 -08:00
retro-wertz 2a796d48a0 libretro: Add GB color palettes 2019-01-26 06:45:35 -08:00
Rafael Kitover 4f9003112d persist chosen audio device in config file #353
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>
2019-01-24 03:14:23 -08:00
retro-wertz 3b87576e41 GB: Fix rumble support (MBC5)
- Fix missing call to rumble function on MBC5
- fix rumble flag gets disabled causing rumble not to work at all.
2019-01-21 05:28:27 -08:00
retro-wertz 089d7a40e5 libretro: Add support for tilt, gyro sensors and rumble pak (WIP)
- 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.
2019-01-21 05:28:27 -08:00
retro-wertz a2b3dd76a1 libretro: Update input descriptors for 4-player SGB and cleanup...
- 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)...
2019-01-19 00:11:16 +08:00
Rafael Kitover 9d058abb41 libretro: don't include getopt.h in configmanager
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.
2019-01-17 10:36:18 -08:00
retro-wertz d5642fa333
libretro: Android buildfix (#348) 2019-01-17 23:56:12 +08:00
retro-wertz 093818a1d7 GBA: Resolve shifting negative value issue in some thumb/arm opcodes 2019-01-17 05:54:31 -08:00
retro-wertz 59f76d05b8 libretro: Use gbWram[] for $C000 in CGB mode
This uses full size of gbWram[] so we have a continouos memory block
for RAM addresses $C000 and $D000 in CGB mode. This helps with
retroachievements.
2019-01-14 09:42:53 -08:00
retro-wertz f9efb79a7d libretro: Fix GB games that uses serial (WIP)
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.
2019-01-14 08:20:18 -08:00
retro-wertz af3fe01822 libretro: Update GB's memory map, expose all usuable ram 2019-01-14 08:20:18 -08:00
retro-wertz 470d86f5c8 libretro: Cleanup 2019-01-13 04:29:02 -08:00
retro-wertz ad432a6f70 libretro: Silence warning 2019-01-13 04:29:02 -08:00
retro-wertz bff08eafb7 libretro: Update Makefile, fix ASAN 2019-01-13 04:29:02 -08:00
retro-wertz c2b31635dd GBA: Only use eepromReset/flashReset during reset event (CPUReset) 2019-01-10 19:29:48 +00:00
retro-wertz 0d73da01a1 GBA: Get rid of blip_time() 2019-01-10 19:29:48 +00:00
Rafael Kitover 83b3ebd7f0 fix audio api radio buttons
Only the first wxRadioButton in a group is supposed to have the wxRB_GROUP
style, I broke this in 964f086b.
2019-01-09 08:32:03 -08:00
Rafael Kitover f6ad9a8ca7 remove bad hardcoded keybinds #298 #334
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.
2019-01-05 12:32:10 -08:00
Rafael Kitover ff2d31bf5e faudio: minor change
This translated xaudio2 driver may not be feasible to get working, but
I'll try at some point.
2019-01-02 07:16:08 -08:00
Rafael Kitover 964f086bea fix audioapi opt enum, reorder xrc
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.
2019-01-01 18:44:51 -08:00
Rafael Kitover 8cb3f5a78c fix sound api config on linux/mac
Missing "|" in option spec would create the "sdlopenal" option instead
of separate "sdl|openal" options.

Add missing "|" to option spec.
2018-12-31 03:49:31 -08:00
Rafael Kitover 55a60e3e73 only block key event propagation for game keys #88
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
2018-12-28 21:51:28 -08:00
Rafael Kitover f8b5627bd8 fix support for old SDL versions
Check for at least SDL 2.0.6 when using the
SDL_JoystickGetAxisInitialState() API introduced in e57beed8.
2018-12-28 05:22:17 -08:00
Rafael Kitover e57beed890 ignore depressed gamepad triggers #88
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
2018-12-28 04:36:41 -08:00
Rafael Kitover 979ef8ebbd cmake: fix building without FAudio
Only add FAudio to target_link_libraries() if it's enabld.
2018-12-26 10:56:27 -08:00
Rafael Kitover edf2c0c461 fix xaudio2 when openal is disabled
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.
2018-12-26 07:35:42 -08:00
Rafael Kitover 3ed08e8d68 finish connecting new faudio 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.
2018-12-26 06:53:52 -08:00
Rafael Kitover 296e8e1693 fix valid sound driver config values + faudio fix
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.)
2018-12-26 06:09:29 -08:00
Rafael Kitover 1f4487b836 faudio: add gui code for selecting driver
Add code to swtich to faudio api when the option is selected in the
config dialog in guiinit.cpp.
2018-12-26 05:33:19 -08:00
Rafael Kitover 396227661e add some missing faudio initialization code
Add case for faudio in the code for getting audio devices in
guiinit.cpp.
2018-12-26 05:28:53 -08:00
Rafael Kitover 0c2906d026 fix SDL sound defaulting code
The #if logic was leftover from when OpenAL was the default.

Default to SDL sound always instead.
2018-12-26 05:24:21 -08:00
ZachBacon 580a11e39e Let's not force FAudio just yet 2018-12-26 06:37:53 -05:00
ZachBacon d6f3fd23de Finish hooking up FAudio to the rest of the frontend 2018-12-25 20:58:31 -05:00
Rafael Kitover 539027ca16 remove problematic default joy binds #88
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.
2018-12-25 17:42:46 -08:00
ZachBacon 5da48769ae fixed a typo and added faudio, but there's still persisting issues 2018-12-25 20:31:29 -05:00
Zach Bacon 514f355664
Merge pull request #337 from visualboyadvance-m/light-weight
Light weight
2018-12-25 20:00:09 -05:00
ZachBacon 429b8ceba2 I'm pretty sure some of this is very hacky and needs correcting, but it compiles at least. 2018-12-25 19:57:49 -05:00
ZachBacon 53e16e0411 Need to hook up the effects chain parameters 2018-12-25 18:48:55 -05:00
ZachBacon 8939455bb9 Next on the list is adding a few more arguments for certain functions 2018-12-25 17:47:21 -05:00
ZachBacon a8c44364e5 Next on the list is correcting the incomplete types 2018-12-25 17:31:22 -05:00
ZachBacon 4b664c69f7 Still not quite ready for d3d, but this one header mingw has anyways. 2018-12-25 16:22:13 -05:00
ZachBacon 14815135bc we need to release with the proper function in faudio 2018-12-25 16:07:12 -05:00
ZachBacon 0bfbcfa332 Needed the FAudio Processor in FAudioCreate 2018-12-25 15:40:14 -05:00
ZachBacon af98f532b1 Inbound FAudio fixes 2018-12-25 15:29:11 -05:00
Rafael Kitover 5f38c0da8a cmake: static: check for link file when editing
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.
2018-12-23 19:43:32 -08:00
ZachBacon ba563c71b3 Add FAudio to the xrc 2018-12-23 12:46:01 -05:00
retro-wertz 0c579b20a1 Revert to a default audio api (SDL) when config is invalid
Prevents crash when an invalid or a non existing api is used in
vbam.conf
2018-12-23 09:29:48 +08:00
ZachBacon 4361c45b16 Fixed a few things, still have lots to fix though before it's a usable state. 2018-12-18 10:46:45 -05:00
ZachBacon 99795b270d cmake hookup is done, there are some issues that I'll be trying to fix within faudio.cpp before it's ready for mainstream 2018-12-18 10:24:39 -05:00
ZachBacon eab039cd78 This should allow faudio to be supported in vba-m, next is to further modify cmake to find faudio 2018-12-18 08:59:11 -05:00
ZachBacon e00aca18df Initial work on switching to faudio, WIP 2018-12-17 23:20:29 -05:00
retro-wertz 85891fc7fd Reduce input delay by 1 frame and audio timing fix 2018-12-10 18:47:09 +08:00
Rafael Kitover 27a874e3ba
Merge branch 'master' into tasks/add-lldb-support 2018-12-05 14:23:20 -08:00
Scott Knight a52eddb5b4 Handle debugger disconnect and reconnect properly
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.
2018-12-05 14:17:52 -08:00
Scott Knight 6ba3b7791d Set correct register number in gdb stop reply
https://github.com/bminor/binutils-gdb/blob/master/gdb/features/arm/arm-core.xml

According to the current arm register definition file in gdb the cpsr register is
actually register number 25 and not 16.
2018-12-05 14:17:01 -08:00
Scott Knight f385fb2faf Update gdb remote query support
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
2018-12-05 14:17:01 -08:00
retro-wertz ca56ccffeb libretro: Simplify cheats, add multiline support for GB/GBC 2018-12-01 07:24:54 +08:00
retro-wertz a2d5c260ec libretro: Add turbo buttons 2018-12-01 07:13:14 +08:00
Scott Knight 3484ecc419
Add support for LLDB qHostInfo packet
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.
2018-11-28 08:50:50 -05:00
Scott Knight dd2a1d9b51
Fix stack overflow in remoteMemoryRead
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.
2018-11-28 08:50:49 -05:00
Scott Knight 4f28e84632
Fix stack overflow in remotePutPacket
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.
2018-11-28 08:50:48 -05:00
Zach Bacon 5e58e4c3e6 when it comes to cross compiling, Most unices like linux are case sensitive 2018-10-23 22:06:18 -04:00
Rafael Kitover 9cb9ce86bd fix Windows XP Compatibility #315
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.
2018-10-23 06:19:34 -07:00
ZachBacon 58083d9d4a Gonna use universaldxsdk for xaudio 2018-09-16 15:20:06 -04:00
retro-wertz 916c091a49 Libretro: Add GB/GBC cheat support...
- Add wram and vram to retro_get_memory* and minor cleanup
2018-08-19 23:34:38 +08:00
retro-wertz 14086d0007 Libretro: Fix crash on some linux systems 2018-08-19 22:19:06 +08:00
Rafael Kitover e67b513e94 rename mac-localizations to mac-translations.cmake
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.
2018-08-11 15:05:12 -07:00
Rafael Kitover bf4606fc18 install translations into mac .app
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.
2018-08-11 14:52:18 -07:00
Rafael Kitover 6cbad61f36 fix cmake regression introduced in bfe21aee
Before calling list(REMOVE_ITEM ...) check if the variable exists, if it
doesn't cmake throws an error.
2018-08-10 09:37:55 -07:00
Rafael Kitover bfe21aee3e remove -fpermissive compiler flag
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.
2018-08-10 06:46:51 -07:00
Rafael Kitover 571ecbe3e8 support mac-hosted mingw builds, misc. fixes
- 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.
2018-08-10 04:31:05 -07:00
retro-wertz f45935af98
Add vbam_libretro.info
to be copied into <retroarch_folder>/<core_info_folder
2018-08-06 13:46:48 +08:00
Rafael Kitover be508eb2fd simplify check for renamed wx-config, fix gentoo
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.
2018-08-05 21:16:33 -07:00