Commit Graph

2259 Commits

Author SHA1 Message Date
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
Rafael Kitover 3da07f4083
detect llvm toolchain utilities #392
Use `clang -print-prog-path=<tool>` to find the locations of llvm
toolchain utilities such as `llvm-ranlib` and set the appropriate cmake
variables to the resultant paths.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-03-19 18:41:25 -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
Rafael Kitover 2142a46dd5
Revert "travis: try re-enabling binary check"
This reverts commit 101fac5910.

Both ubuntu and mac jobs timeout when trying to call `--help`.
2019-03-16 03:45:36 -07:00
Rafael Kitover 101fac5910
travis: try re-enabling binary sanity check
On the ubuntu and mac jobs, try re-enabling the `--help` check, it
should now work thanks to @denisfa's work on a57e51f6.

If this works we also want to use wine for the mingw jobs to do the
same.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-03-15 19:26:16 -07:00
Rafael Kitover 6ca59412a8
travis: disable mxe pkg key
The mxe package server key has been removed from the keyservers, allow
apt-key to fail and add `--allow-unauthenticated` to the apt-get
options.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-03-15 04:44:45 -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
Rafael Kitover 513b0559ce
minor travis update for mingw jobs
Use the right gpg key id for the mxe apt server and remove the
`--allow-unauthenticated`.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-03-12 19:32:14 -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 36fbf71527
travis update attempt 5
`stretch` mxe binaries are failing due to missing libraries like
`libssl.so.1.1`, try to use the `trusty` repo instead.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-03-08 20:52:09 -08:00
Rafael Kitover 77bcbbf445
travis update attempt 4
Pass --allow-unauthenticated to apt when installing mxe packages,
perhaps the gpg key changed.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-03-08 20:03:17 -08:00
Rafael Kitover 7b3a3a0c4f
travis update attempt 3
Disable the `--help` test for now, for some reason the exit code is 255,
something is still not quite working there.

Update installdeps to force a partial upgrade from trusty to xenial on
travis to get a newer version of libcurl-gnutls, which is necessary to
use the mxe package server.

Fix mxe package server repo url.

Add `mirror.mxe.cc` to list of apt hostnames to ignore SSL errors for.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-03-08 19:55:10 -08:00
Rafael Kitover 8f0a578ade
travis update attempt 2
Use `xvfb` as per instructions at:

https://docs.travis-ci.com/user/gui-and-headless-browsers/

to run the `--help` check on linux.

Try https url for `pkg.mxe.cc`.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-03-08 17:13:48 -08:00
Rafael Kitover dbd1d8c1f8
attempt to re-enable travis mingw slaves
The mxe pkg server seems to be back online with some changes, and an
invalid SSL certificate.

Also thanks to @denisfa's work on 7373da15 we can re-enable the `--help`
check on travis.

Let's see if this works.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-03-08 16:56:46 -08: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 39fd3f6580
add note to README.md about translations
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-03-02 17:34:36 -08: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
Rafael Kitover b5741ee4f6
release v2.1.1
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-02-25 19:17:00 -08:00
Rafael Kitover 286d7ee93a builder: fix 32bit mac build
Compile libicu not in cross mode for 32 bit.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-02-25 03:07:08 -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 91ee8cad9c installdeps: check gtk3-classic on arch/manjaro
Don't try to install gtk3 if the user has gtk3-classic installed on arch
and manjaro.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-02-24 14:43:48 +00: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 b9d6f35f8f
add build32/ to .gitignore (for 32bit builds)
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-02-22 10:20:44 -08:00
Rafael Kitover 6e76fcefef
cmake: fix finding 32 bit wxWidgets on gentoo
Generalize regex and glob against `wx/config` scripts in
`Toolchain-cross-m32.cmake` to work on gentoo, which can append the
`-gtk3` suffix.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-02-22 08:50:04 -08:00
Rafael Kitover 0674b41b6c cmake: remove <INCLUDES> from nasm definition
For some reason on Ubuntu 14 (trusty) cmake translates `<INCLUDES>` in
`CMAKE_ASM_NASM_COMPILE_OBJECT` as a literal `INCLUDES` which produces
an error, remove it because we are not using it anyway.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-02-22 15:11:01 +00:00
Rafael Kitover 7dda58097a cmake: do not use -fPIC on 32 bit x86, breaks asm
Do not add the -fPIC (position independent code) compiler flag on 32 bit
x86 architectures because that breaks inline assembly, and some included
libraries like fex require inline assembly to work.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-02-22 14:53:51 +00:00
Rafael Kitover 3c28a18976 installdeps: support -m32 builds on opensuse
Also allow specifying target as "-m32" instead of "m32".

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-02-21 22:33:14 +00: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
Rafael Kitover 12fa61af82
cmake: refactor FindSSP.cmake
Use a function to not pollute variable scope.

Use modern style.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-02-16 13:04:43 -08:00
Rafael Kitover 5a77d8f4ba
cmake: don't use ccache on msys2+ninja
When using msys ccache with a mingw ninja, the compiler fails to
execute.

Don't try to detect ccache when using the Ninja generator on msys2, it
can still be specified through cmake variables.

Do not check for the mingw ccache because it is broken and I will assume
not being used.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-02-14 14:58:13 -08:00
Zach Bacon ed29b9c497
Merge pull request #364 from laqieer/master
bugfix: crash when loading elf
2019-02-05 08:11:25 -05: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