Commit Graph

1548 Commits

Author SHA1 Message Date
Rafael Kitover 8754a8f6d8 fix cmake -G Ninja support
Use an explicit list of Wx XRC sources instead of a GLOB so that cmake
generators for other build systems such as Ninja work.
2017-02-10 08:22:58 -08:00
Rafael Kitover f10e2e9904 fix directsound loop on unfocus #45
Call GameArea::Pause and ::Resume in MainFrame::OnActivate based on
focus state if the pauseWhenInactive config option is set.

Also stop/play the primary dsound buffer in pause()/resume() in
dsound.cpp, not onlyu the secondary, this may not be necessary but it
doesn't hurt.
2017-02-09 07:30:54 -08:00
Rafael Kitover fcc34394c1 fix build failure on OS X Lion with XCode 4.2
XCode 4.2 generates a broken binary if -fomit-frame-pointer and/or -flto
is used for compile and link flags.

Check for Clang version less than 4.3 on APPLE and remove these flags in
the compile options setting cmake code.
2017-02-03 12:39:10 -08:00
Rafael Kitover 6ecab805e0 fix game freezing on kbd input #54
Apparently in some configurations, holding a key on the keyboard makes
Wx stop processing Idle events, so the emulator does not run until the
key is released, freezing the game and ignoring the key.

Hopefully fix this by calling wxWakeUpIdle() from OnKeyDown() and
OnKeyUp().

Other Misc. Improvements:

- refactor process_key_press() to only return true if the system is in a
  pressed key state on key presses or a game key was released on
  releases and always true on double releases.

- call ev.StopPropagation() from OnKey* events for game keys, this may
  not actually do anything, but just in case.

- remove static OnKeyUp and OnKeyDown events from GameArea, these are
  connected to the DrawingPanel dynamically now.

- remove the dynamic_cast<>s from PaintEv/EraseBackground/OnSize event
  forwarders, since there is already a panel member to use.

TODO:

The state returned by process_key_press() is still not entirely correct,
if a joystick button is pressed, it will return true for a non-game
keyboard press, and it needs to return the correct state for double
releases.
2017-02-02 07:13:39 -08:00
Rafael Kitover 44382a71c5 fix openal.so loading issues on some dists #69
As suggested by @Mystro256, try:

wxDynamicLibrary::CanonicalizeName(wxT("openal"))+wxT(".1")

before just the canonical name for "openal" when trying to load the
library.

Also add a utility method to quietly try loading the library, because on
wx 2.8 wxDL_QUIET does not work.
2017-01-30 20:11:07 -08:00
Rafael Kitover cb0bcfae6b fix msys2 build failure in 34e408cc
cmake automatically passes -std=gnu++11 in some cases, while we were
passing -std=c++11, and this was causing incompatibilites in name
mangling between different objects.

Fix this by using -std=gnu++11 for gcc.
2017-01-30 19:12:04 -08:00
Rafael Kitover f21178f6f7 fix nasm support broken in 34e408cc
The last commit removed generator expressions from ADD_COMPILE_OPTIONS()
which made C/C++ flags apply to nasm as well.

Fix this by removing <FLAGS> from CMAKE_ASM_NASM_COMPILE_OBJECT and
replacing it with the flags we want.
2017-01-30 18:14:33 -08:00
Rafael Kitover 34e408ccb7 fix Debian 8 Jessie and Ubuntu 14 Trusty compat
Fix some porting issues to make everything work on Debian 8 "Jessie"
and Ubuntu 14 "Trusty":

- set cmake minimum version to 2.8.12, this is the Ubuntu 14 version

- combine C and C++ flags and add all of them using
  ADD_COMPILE_OPTIONS() without using generator expressions, which is a
  cmake 3.2 or so feature

- add -fpermissive to force some non-const type casts to compile on
  older versions of gcc

- add -std=c++11 for gcc to enable support on older versions of gcc

- check that the compiler supports -fstack-protector-strong before
  adding it, older versions of gcc do not

- fix the debian section of ./installdeps to include libpng-dev instead
  of libpng16-dev and add gettext for msginit etc.

- fix compat checks in src/common/ffmpeg.cpp and src/wx/cmdevents.cpp to
  check for libavcodec >= 56 instead of > 56, the Debian Jessie version
  is exactly version 56 . With the one exception of
  AV_CODEC_FLAG_GLOBAL_HEADER which is defined in later versions.
2017-01-29 10:14:34 -08:00
Rafael Kitover fdc389c280 fix wx 2.8 compat, debug logging works everywhere
Fix backcompat with wx 2.8. This involved writing
wxPositiveDoubleValidator and rewiring the DrawingPanel inheritance tree
and event handling mechanisms (because 2.8 does not have ->Bind, only
->Connect which is less flexible.) As a result all the event handling
has been gathered into GameArea and the affected code is somewhat
cleaner. 2.8 support is untested on Mac because it requires 32 bit libs
and Carbon.

Add support for cross-compiling for windows using the Fedora MinGW
packages in ./installdeps.

Check for OpenGL support in the wx library being linked, this was
necessary because the Fedora MinGW wx library does not have OpenGL
support.

Remove vbamDebug() in favor of wxLogDebug(), and add an override for it
so that it works in non-debug builds of wx as well as on Windows. Turn
off buffering on stdout and stderr on startup so that debug logging
works in msys2/cygwin mintty as well.

On Windows, build a console binary for debug builds.

Update README.md to reflect Fedora MinGW support and debug logging
support.

Add -Wextra to cflags for debug builds.
2017-01-25 10:53:05 -08:00
Rafael Kitover 82d694df3a disable LTO on Win32 for now
Due to reports of segfaults etc. disabling LTO on Win32 for now.
2016-12-31 04:48:51 -08:00
Rafael Kitover 281e73eee0 correct fix for ddef88f0
Check that codec is not a NULL pointer right after it's first set, this
is done later after configuring the ctx anyway.
2016-12-31 04:07:12 -08:00
DoctorWho11 57adfaf24e Add missing libiconv for enabling nls 2016-12-30 22:48:23 -05:00
Zach Bacon fd693b385e Merge pull request #60 from Mystro256/master
Various fixes
2016-12-30 21:17:00 -05:00
Mystro256 2ef0074f72 Duplicate CMake Option in README.md 2016-12-30 12:14:35 -05:00
Mystro256 24f06848df DeSerialize should pass packet by ref too 2016-12-30 11:43:36 -05:00
Mystro256 ddef88f0c5 Possible null dereference 2016-12-30 11:42:56 -05:00
Mystro256 7bc7ff57f4 Redundant code? 2016-12-30 11:41:33 -05:00
Mystro256 7788e6fc89 Spelling mistake ;) 2016-12-30 11:19:48 -05:00
Mystro256 c3e4969498 Fix gcc parentheses warning 2016-12-30 11:17:18 -05:00
Mystro256 0bcf4a5223 Clean up various used variables 2016-12-30 11:16:00 -05:00
Mystro256 0df6f036d6 Silence gcc misleading-indentation warning 2016-12-30 11:03:34 -05:00
Mystro256 a08d944867 Fix format-extra-args warning 2016-12-30 10:49:22 -05:00
Mystro256 e451ce09dd Missing include, fixes gcc warning 2016-12-30 10:48:05 -05:00
Rafael Kitover b258c004af ./installdeps: support Fedora Linux
Detect and install deps for Fedora Linux in ./installdeps . On 64 bit
intel hosts install both 32 and 64 bit dev libs. Also update README.md
to note that Fedora is supported.

MISC: add nasm to all dep lists for various dists
2016-12-28 08:48:30 -08:00
Rafael Kitover f641620a6c ./installdeps: pull deps submdl for cross targets
Run `git submodule update --init --recursive` for all win32 cross
targets, not just msys2, in check_cross() .
2016-12-25 05:12:23 -08:00
Rafael Kitover d01bf5dbd0 fix control panel link in MSys2 Notes in README.md
Fix the instructions in MSys2 notes for how to change the system PATH in
Control Panel in README.md.
2016-12-23 07:15:47 -08:00
Rafael Kitover 9f051c3813 put CMake options in README.md into table + misc
Make a nice table for CMake options, add a note on making debug vs.
release builds, add nasm to list of deps, add a note in MSys2 notes
about lack of debug console messages.
2016-12-23 06:10:54 -08:00
Rafael Kitover 2483a2c440 add a README.md
Add a link to the homepage, building instructions and some notes on
contributing.
2016-12-23 05:38:50 -08:00
Rafael Kitover f124a28e19 use $MSYSTEM for msys2 target in ./installdeps
Only allow running ./installdeps if $MSYSTEM is MINGW32 or MINGW64, that
is, the user started a MINGW 32 bit or 64 bit shell and **NOT** an MSYS
shell.

Use the value of $MSYSTEM to determine if 32 bit or 64 bit target deps
should be installed.

Update usage() text to reflect this.

MISC: rename generic_build_instructions() to build_instructions() .
2016-12-22 07:04:27 -08:00
Rafael Kitover e2e4105dcd remove src/wx/VBA.ico, dup for src/wx/icons/VBA.ico 2016-12-21 17:10:03 -08:00
Rafael Kitover d06e7afceb full support for cross-compiling to win32 with mxe
Fix all cmake issues related to building for win32 with mxe.

Add support for ./installdeps win32 on Debian/Ubuntu using the mxe apt
repository.

Details:

* default to ENABLE_LTO=OFF on mxe

* set SFML_STATIC_LIBRARIES=TRUE on mxe

* fix the libintl/gettext checking logic

* fix the git dependencies submodule checking logic, and check that it
  triggers for mxe

* revert FindSFML.cmake to upstream version, works fine with mxe

* make 'win32' an alias for the 'MinGW-w64-i686' target for
  ./installdeps, add support for mxe apt repository for Debian/Ubuntu

* change bin2c related cmake code to compile the tool on the host always
  even when cross-compiling

* copy src/win32/res/VBA.ico to src/wx/icons since src/win32 has been
  removed

TODO: generic mxe installer for other unix-likes
2016-12-21 13:02:55 -08:00
Zach Bacon 3279ce2ab8 Merge pull request #56 from Mystro256/master
Appdata fixes
2016-12-21 09:53:55 -05:00
Mystro256 774719ddf6 Appdata fixes
Note that metadata_license is the license of this specific file, apparently
it's not allowed to be GPL, CC-BY-SA-3.0 is close enough.
2016-12-21 09:14:10 -05:00
DoctorWho11 978d5b7991 Missed one other cmake instance of gvbam 2016-12-20 21:26:11 -05:00
DoctorWho11 33febfb4ba add old resources that were in the win32 folder that the wxwidgets interface uses on windows 2016-12-20 17:56:05 -05:00
DoctorWho11 a1bf0f3f82 Drop gtk and mfc interfaces. Things are changing and for the better. 2016-12-20 17:34:34 -05:00
DoctorWho11 ac32a524a3 adjust small things in preparation in a move. 2016-12-20 17:27:30 -05:00
Rafael Kitover 982d639ea2 add gettext-tools to fink deps
gettext-tools needs to be installed in fink for cmake to find msginit,
update ./installdeps to include it.
2016-12-19 02:18:30 -08:00
Rafael Kitover dea31e52e9 fix SDL2 include in 534c4da
For SDL2 includes are specified as:

```cpp
```

rather than as:

```cpp
```

without the `SDL/` prefix, this was causing a compile error.
2016-12-19 02:15:44 -08:00
Rafael Kitover fba7adf3eb trying to create an issue template
This should help with people creating issues with no information about
their build or configuration.
2016-12-18 20:10:18 -08:00
Zach Bacon 0b6942684f Merge pull request #53 from drysyle/master
Fix wx joystick hat diagonals
2016-12-18 21:28:49 -05:00
drysyle 534c4da649 Rewrote joystick hat code to fix diagonal issues 2016-12-18 15:25:18 -08:00
Rafael Kitover f83fcfb40f hopefully fix cross-compiling with SFML
Remove "PATH_SUFFIXES include" in the FIND_PATH(SFML_INCLUDE_DIR ...)
call in FindSFML.cmake, this has fixed cross-compiling issues with
FindOpenAL.cmake and FindSDL2.cmake already.
2016-12-18 12:11:37 -08:00
Zach Bacon f7f67ff6f9 Fixed compiling without sfml. 2016-12-14 16:52:45 -05:00
Rafael Kitover c2a23a9ffe check for RAW_CONTROL only on macs in switch stmts
On e.g. Windows WXK_RAW_CONTROL == WXK_CONTROL so having both in a
switch statement is compile-time error, so wrap the checks for
WXK_RAW_CONTROL in an #ifdef __WXMAC__ .
2016-12-14 06:23:02 -08:00
Rafael Kitover 7b1b1ea236 only use gcc binutils wrappers when LTO is enabled
Use gcc wrappers like gcc-ar/gcc-nm/gcc-ranlib only when LTO is enabled.
2016-12-14 05:48:37 -08:00
Rafael Kitover 8c309eaaf4 fix modifier-only game keys
Fix using modifier keys such as SHIFT or CONTROL by themselves as game
keys.

Modifier keys are sent as a special keycode e.g. WXK_CTRL along with the
modifier flag, however on key release the keycode is sent but the
modifier flag is not. So check for modifier keys in process_key_press()
and always set the modifier flag so that release events are recognized
correctly.

Fix support for RAW_CTRL on Mac (which is the real control, while the
Command key is mapped to CTRL.)

Also disable the debug message emitted by wX when our modifier-only key
parsing code runs.

TODO: map modifier key names on Mac to the actual keys rather than the
wX names such as RAWCTRL.
2016-12-14 00:26:54 -08:00
Rafael Kitover a60d24e91a workaround wX 3.1+ key accel string parsing bug
In wX 3.1+ the behavior of wxAcceleratorEntry::ToString() and
wxAcceleratorEntry::FromString() has changed and the resulting string
can no longer round-trip through these methods.

Use a lookup table based on an internal data structure from the wX
source code to translate the "display name" of some keys to the regular
"name" as a workaround for now.

This allows at least the default keybindings to work and not throw an
error on startup.

TODO: standalone modifiers as game keys are still broken.
2016-12-13 15:08:55 -08:00
Rafael Kitover d5020b905c fix wX XRC for wX 3.2
Some sizeritems in horizontal box sizers had the wxALIGN_RIGHT flag,
which makes no sense in horizontal sizers, since they allow only
aligning things vertically. This was throwing XRC errors on startup.

Remove the erroneous wxALIGN_RIGHT flags from the XRC.
2016-12-13 10:03:38 -08:00
Rafael Kitover 94b62b13b3 minor update to ./installdeps
For arch cross builds, try to install both the mingw -headers-git and
-crt-git .
2016-12-13 10:38:15 -05:00