Commit Graph

2338 Commits

Author SHA1 Message Date
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 85abf97a21
Transifex pull.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-11-27 23:14:27 +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 d458e75ca6
builder: mingw/msys2 updates.
- Update to new version of icu and patches.

- Update to newer meson based glib.

- Support meson-installed dists.

- On msys2 use the distro ninja to build ninja, because there is some
  kind of issue with building on windows now.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-11-26 14:31:20 +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 1e56cbfcb3
travis: Add minimal build.
Test building on xenial with:

./installdeps --no-openal --no-ffmpeg

Will also need to add --no-sfml to this.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-11-13 01:46:02 +00:00
Rafael Kitover ed14c7bc76
installdeps: Add --no-openal and --no-ffmpeg #563.
Add support for the --no-openal and --no-ffmpeg command line options to
installdeps.

Implement them fully or partially depending on the code for that
distribution.

This will help with adding this variant of the build to the travis CI.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-11-13 01:34:46 +00:00
Rafael Kitover f3282ef0a9
installdeps: debian: detect gtk3 version of wxgtk
Detect and prefer the -gtk3 variants of the libwxgtk3.0 packages on
distros like kali-rolling.

Tested to work on newest kali-rolling and trusty.

Fix #564.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-11-12 18:45:43 +00:00
Rafael Kitover bd7f38ece7
Update win32 dependencies submodule.
Includes the WinSparkle binary release, for the current work integrating
WinSparkle.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-11-10 14:37:57 +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 74dc86f77e
update win32 dependencies submodule
Backing off the winsparkle-static approach for now because it will
require a substantial amount of work to use winsparkle from a static
binary that also uses wxWidgets.

Will try to pack the dll in as a resource, and write it out to a temp
file at runtime and load it with wxDynamicLibrary. This will require a
wrapper for the API as well, which is fortunately very small.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-11-06 07:28:25 +00:00
Rafael Kitover 3fe383c2b5
Update win32 dependencies git submodule.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-11-04 00:59:02 +00:00
Rafael Kitover d999544a3d
update win32 dependencies submodule
To add winsparkle-static.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-11-03 01:58:15 +00:00
Rafael Kitover e113508593
installdeps: fix git submodule update
Add `--init`.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-11-03 00:24:18 +00:00
Rafael Kitover b757048203
transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-11-03 00:21:44 +00:00
Rafael Kitover 8c14138782
transifex pull, delete en.po
Update `de.po` from transifex and delete `en.po` as it seems to not be
managed by transifex.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-10-23 16:46:43 +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
Rafael Kitover c06e3bf3fc
cmake: update vcpkg mod for appveyor build cache
On appveyor we only cache the `vcpkg/installed` directory, so vcpkg
itself still needs to be pulled from git.

Also update vcpkg from git if it has already been cloned, and always
rebuild vcpkg itself.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-10-21 13:58:55 +00:00
mudlord 0535d5c797 Optimize CRC32. 2019-10-21 13:25:19 +00:00
Rafael Kitover a90f4663a5
transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-10-20 08:16:36 +00:00
Rafael Kitover b8f2c8977e
appveyor: use vcpkg installed not whole vcpkg
Try to cache only the `vcpkg/installed` directory instead of the whole
vcpkg directory, which appveyor says is too large to cache.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-10-18 01:28:09 +00:00
Rafael Kitover 252d3f65ab installdeps: detect correct mxe apt repo
Try to guess the correct mxe apt package repository based on
`lsb_release` codename.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-10-17 22:25:56 +00:00
orbea 7f6337b1c7 travis: Make xenial the main distribution.
The end of standard support for trusty ended in April 2019 and
the end of life is April 2022. For xenial the end of standard
support is April 2021 and the end of life is April 2024.

Most users should have xenial or newer at this point.

Source: https://wiki.ubuntu.com/Releases
2019-10-17 22:24:45 +00:00
orbea 73a2450247 travis: Test --help on osx. 2019-10-17 22:23:50 +00:00
Rafael Kitover 36790074c3
cmake: fix linking to libssp and linking bin2c
Only add the macro `-D_FORTIFY_SOURCE=2` if we are linking to libssp
with gcc, do not use it at all on clang.

For `HostCompile.cmake` add the macro `-Dmain=main` to redefine the
macro added by SDL2 to compile flags `-Dmain=SDL_main`.

Fix #548.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-10-17 21:53:15 +00:00
orbea eaa744cc2e cmake: Add generate as a vbamcore dependency.
Fixes https://github.com/visualboyadvance-m/visualboyadvance-m/issues/542.
2019-10-11 07:02:38 -07:00
orbea 2d783f5df8 cmake: Fix ENABLE_ASAN with clang.
Only -fsanitize=address is needed for asan to work with both
gcc and clang.

[170/196] Building CXX object CMakeFiles/vbamcore.dir/src/Util.cpp.o
clang-9: warning: -lasan: 'linker' input unused [-Wunused-command-line-argument]
[171/196] Linking CXX static library libvbamcore.a
[172/196] Generating cmdtab.cpp, cmdhandlers.h, cmd-evtable.h
[173/196] Generating wxvbam.xrs
[174/196] Generating builtin-xrc.h
samu: job failed: cd /tmp/visualboyadvance-m/build/src/wx && /tmp/visualboyadvance-m/build/bin2c wxvbam.xrs builtin-xrc.h builtin_xrs
==4845==Your application is linked against incompatible ASan runtimes.
samu: subcommand failed
2019-10-10 02:49:07 -07: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 84d24b7d71 cmake: Silence _FORTIFY_SOURCE warnings with debug builds.
[79/196] Building CXX object fex/CMakeFiles/fex.dir/fex/Zlib_Inflater.cpp.o
In file included from ../fex/fex/Zlib_Inflater.cpp:3:
In file included from ../fex/fex/Zlib_Inflater.h:7:
In file included from ../fex/fex/Data_Reader.h:7:
In file included from ../fex/fex/blargg_common.h:8:
In file included from /usr/include/assert.h:35:
/usr/include/features.h:382:4: warning: _FORTIFY_SOURCE requires compiling with optimization (-O) [-W#warnings]
   ^
1 warning generated.
2019-10-09 08:48:20 -07:00
orbea 675072f025 travis: Test xvfb on xenial and bionic. 2019-10-08 13:27:35 -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 369da07e7f travis: Test make install. 2019-10-07 17:36:27 -07:00
orbea 3111de5205 travis: Test clang builds. 2019-10-07 11:52:40 -07:00
orbea 6cc00a09fe travis: Clean up. 2019-10-07 11:51:07 -07:00
orbea 65fceab75a travis: Refactor script. 2019-10-07 04:47:57 -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
Rafael Kitover 5b809e3ad1
Drop reference to ubuntu PPA from README.md
The packages in this PPA are completely out of date, even the
dependencies are out of date.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-10-06 06:06:13 +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 ec7d1b15b1
cmake: fix reading version from changelog
Fix version regex to allow version numbers without text and revision.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-10-05 20:32:46 +00: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