Commit Graph

1507 Commits

Author SHA1 Message Date
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
Rafael Kitover 68f2badae7 more ./installdeps improvements
Allow selecting target for MSYS2 deps.

For Arch cross builds, do not run yaourt if all deps are already
satisfied.

For Mac Homebrew, only install formulae that do not already have some
version installed, otherwise if the user has a non-default version (such
as --HEAD) the script will error out.
2016-12-12 19:55:44 -08:00
Rafael Kitover 53fb6b4371 ./installdeps + windows cross build improvements
Refactor ./installdeps and add support for mingw-w64 cross builds on
Arch Linux. The latter does not work currently because of a bug in
libuuid in the mingw-w64 crt, and the wxmsw AUR package does not build.
This will hopefully be resolved soon.

Put a copy of FindOpenAL.cmake into our own CMakeScripts/ because
searching for include files with PATH_SUFFIXES of include/ does not work
for cross builds, as it is done in the system version.
2016-12-12 19:46:14 -05:00
Rafael Kitover c216528793 generalize ./installdeps + mac pkg mgrs support
Add a more general purpose ./installdeps script to replace
./installdeps-msys2 that handles: Debian Linux, Arch Linux, MSYS2+MinGW,
Mac Homebrew, MacPorts and Fink for Mac. More OSes and distributions
will be added in the future, and the script may be generalized for use
in other projects.

Move Mac package manager setup code into MacPackageManagers.cmake and
greatly improve it. Handles Homebrew, MacPorts and Fink correctly.

Minor tweaks for FindSDL2.cmake: better include dir searching that works
on cygwin, fix flags for MinGW, and quiet pkg-config program errors.

Add MinGW cross-compilation toolchain files, they can be specified on
the cmake command line with:

-DCMAKE_TOOLCHAIN_FILE=../CMakeScripts/Toolchain-cross-MinGW-w64-i686.cmake

or

-DCMAKE_TOOLCHAIN_FILE=../CMakeScripts/Toolchain-cross-MinGW-w64-x86_64.cmake

these work for Cygwin and should work for MinGW on Linux as well.
2016-12-10 23:41:32 -08:00
Zach Bacon 0e9fb98393 Merge pull request #52 from Mystro256/master
Various fixes
2016-12-10 19:50:19 -05:00
Mystro256 1af42f486c Use full name for wx appdata 2016-12-10 19:34:16 -05:00
Mystro256 8f694f054b Fix FSF address information 2016-12-10 19:19:34 -05:00
Mystro256 8baa415848 Add linux appdata and fixes
Desktop files aren't installed for linux by default
2016-12-10 19:05:30 -05:00
Mystro256 d6228254cf cmake fixes
-Whitespace fixes
-Binaries installation fixes
2016-12-10 18:27:18 -05:00
Mystro256 24d2521914 Manpage fixes 2016-12-10 17:56:04 -05:00
Mystro256 4a3618ef26 Forgot two instances of SYSCONF_INSTALL_DIR 2016-12-10 04:12:36 -05:00
Zach Bacon ea220b4822 one file was missed from the last PR, looking at you Mystro256 :P 2016-12-10 04:08:03 -05:00
Mystro256 87ee8c700a Forgot two instances of SYSCONF_INSTALL_DIR 2016-12-09 23:33:19 -05:00
Rafael Kitover 0e6c1b66e3 Quartz2D display rendering driver for Mac
Implement a Quartz 2D (aka Core Graphics) output renderer for the Wx
interface as a subclass of BasicDrawingPanel called
Quartz2DDrawingPanel.

Split BasicDrawingPanel's DrawArea() into DrawArea() and DrawImage(),
with DrawImage() receiving both the wxPaintDC and the wxImage, the
wxImage is created with a direct pointer to the frame buffer when
possible (24bpp).

Implement Quartz2DDrawingPanel in macsupport.mm based on the code here:

http://www.cocoabuilder.com/archive/cocoa/309165-how-to-quickly-paint-to-cocoa-view-from-bitmap-in-memory.html

and here:

http://stackoverflow.com/questions/2261177/cgimage-from-byte-array

the GetData() method of wxImage is used to avoid copying the frame
buffer.

Add RND_QUARTZ2D to the renderers enum and update all config stuff and
the XRC to support it. As well as the DrawingPanel instantiation code in
GameArea::OnIdle().
2016-12-09 13:06:59 -08:00
Zach Bacon 60e98506e7 Merge pull request #49 from Mystro256/master
Fix DSYSCONF_INSTALL_DIR (SDL)
2016-12-09 14:20:13 -05:00
Jeremy Newton c7386503c4 Fix DSYSCONF_INSTALL_DIR
I'm not sure if this was changed in cmake recently, but "SYSCONFDIR" is incorrect. It should be SYSCONF_INSTALL_DIR.

As well CMAKE_INSTALL_PREFIX refers to /usr or /usr/local in linux, so installing it into ${CMAKE_INSTALL_PREFIX}/${SYSCONFDIR} would be incorrect. I've wrapped it in the existing IF( WIN32 ) to preserve the installation for windows, a window dev should fix that if it's incorrect.
2016-12-09 12:44:11 -05:00
Zach Bacon d35d00f650 Added Caelum to the list 2016-12-03 09:01:36 -05:00
Rafael Kitover 37518fc88b add LTO option, disable on GCC+AMD64+Win32
Add ENABLE_LTO cmake option that defaults to ON except on GCC building
for AMD64 on Win32.

Also set the cmake variables AMD64 or X86_32 when one of these
architectures is detected.
2016-11-27 15:37:24 -08:00
Rafael Kitover 7f6374356d rename 'Fullscreen filter' to 'Display filter'
Since filters apply to both window and fullscreen mode, rename the
config option 'Fullscreen filter' to 'Display filter'.
2016-11-23 03:56:30 -08:00
Rafael Kitover 3af0c7ff51 reorganize display config panel
Rename "Advanced" page to "Basic" and move to the first page instead of
last.
2016-11-23 03:49:07 -08:00
Rafael Kitover b468eddfa5 only use -flto=10 with gcc
gcc allows flto=<jobs> to parallelize linking, clang does not understand
this, use just -flto for clang and -flto=10 for gcc.
2016-11-23 03:13:33 -08:00
Rafael Kitover 790c9e13bd update mac link script to 1.0
This version is roughly twice as fast.
2016-11-23 03:07:44 -08:00
Rafael Kitover cdae078e42 pass all compile flags to link step
This makes -static-libgcc -static-libstdc++ actually work, and is
probably better for LTO as well.
2016-11-21 13:53:16 -08:00
Rafael Kitover 349bbd13bc add LTO support, fix libssp link, add -ggdb3 -Og
Add support for Link Time Optimization (LTO) on gcc and Clang.

Link libssp only when it is on the system, some toolchains like Ubuntu's
do not require explicitly linking to libssp. On Win32 try to link it
statically.

In debug builds with GCC, use -ggdb3 -Og, otherwise use -g .

Two new cmake modules were written for this:

* FindSSP.cmake -- this is for finding libssp on the system.

* UseGCCBinUtilsWrappers.cmake -- this is for using gcc binutils
wrappers such as gcc-ar, which is required for gcc LTO to work.

These will be distributed separately as well.
2016-11-21 12:37:21 -08:00
Rafael Kitover 55f6e17f0d compile/link flags improvements
* Bump minimum cmake required to 3.3.2, to make sure generator
  expressions work.

* Force CMAKE_BUILD_TYPE to "Release" if unset, not sure if this
  actually works.

* Merge the older compile flags block with the new one and use generator
  expressions to make sure the relevant flags apply only to C, C++ or
  nasm.

* Add -lssp to the end of the link commands for the -fstack-protector*
  options, this is only needed/done for gcc.

* Add -lversion and -limm32 to SDL2_LIBRARY (Zach asked for this.)

* Builds on msys2 again!
2016-11-20 11:11:52 -08:00
Rafael Kitover 1dd7ecfe0f set Zach's CXXFLAGS only on gcc/clang
Set the flags Zach gave me only when cmake detects gcc or clang, this
way other generators like Visual Studio will still work fine.
2016-11-20 06:15:27 -08:00
Rafael Kitover bbdc6ca577 make ENABLE_SDL default to OFF
Default building options now just build the Wx port.

Also set +x on ./installdeps-msys2 .
2016-11-20 05:46:24 -08:00
Zach Bacon 0ba8166467 Moved all filters into interframe.cpp file, original code by EmporerArthur 2016-11-19 20:43:07 -05:00
Rafael Kitover 180ee60c7a clean up APPLE block in main CMakeLists.txt
Remove some redundant nasm-related code and an outdated comment.

Objective-C++ code is now separated into an .mm file and nothing is done
to change the compiler invocation for it.
2016-11-19 17:13:49 -08:00
Rafael Kitover 40dcb2df7a add some compiler flags
These are the flags Zach wanted.

They work fine with gcc and clang, will test what happens with msvc as
well.
2016-11-19 17:07:30 -08:00
Rafael Kitover 13196c0748 update to latest version of bin2c.c
I maintain it here:

https://github.com/rkitover/bin2c

In terms of functionality, this version is pretty much the same as the
original, just nicer argument handling, a usage screen, etc.
2016-11-18 09:08:09 -08:00
Rafael Kitover 902a7a7e0d fix 32bit build support
Make ASM_CORE, ASM_SCALERS and ENABLE_MMX the defaults for 32bit builds
on intel hosts (the host can be AMD64, as long as the target is 32bits.)

Move mac nasm search into the mac section of the cmake code and stop
defaulting to /usr/bin/nasm, this was screwing up the build on msys2.

Fix src/filters/2xSaImmx.asm to compile and link correctly.

Add nasm to list of mingw deps for ./installdeps-msys2 .

Tested that msys2-built Wx binary runs, including with 2xSaI.

Keyboard doesn't work yet on msys2 builds, but that's a completely
different issue.
2016-11-18 09:04:55 -08:00
Zach Bacon c0f8a8a335 Resolves undefined issues, just doesn't fix using libretro... yet. 2016-11-17 19:29:10 -05:00
Zach Bacon 7c23a38147 Merge pull request #41 from rkitover/msys2_build
msys2 build improvements
2016-11-14 15:27:58 -05:00
Rafael Kitover 3c30d59aba msys2 build improvements
* Enable ffmpeg by default only on linux and msys2, it will be disabled
for normal windows builds and on mac.

* Set SFML_STATIC_LIBRARIES only for normal non-msys2 windows builds,
because msys2 does not currently have static versions of the SFML
sub-libraries, e.g. system, network, etc.. Dynamic linking works fine
for now.

* Fix quoting for -DLOCALEDIR, on windows spaces were causing errors in
make on msys2.

* Update to upstream FindSFML.cmake .

* Add an ./installdeps-msys2 script to install all necessary tools and
libraries on msys2 for building both 64 and 32 bit windows Wx binaries.

* Add the dependencies/mingw-xaudio/include directory to
INCLUDE_DIRECTORIES so that XAudio compiles on msys2, as mingw-w64 does
not currently have XAudio headers. Also check that the user pulled the
git submodule in the process (the ./installdeps-msys2 script does this
for you.)

TODO:

* Generalize ./installdeps to work on more platforms.

* Make console Wx app in debug mode so that debug prints will work.

* Fix game keyboard input for msys2 builds.

* Add HiDPI support for Windows.

* Fix the -D*DIR defines to have the correct paths on windows.
2016-11-14 10:56:50 -08:00
Zach Bacon 39360b88d8 Merge pull request #40 from rkitover/bin2c
enormous speedup for compiling Wx resources
2016-11-13 17:48:10 -05:00
Rafael Kitover 10fd7f926e enormous speedup for compiling Wx resources
Replace bin2c.cmake script with one written in C and compiled as an
intermediate target.

The C version is roughly 12000 times faster.

On msys2, the cmake version takes 7.5 minutes on this system, while the
C version takes 0.037 seconds.
2016-11-13 14:31:34 -08:00
Zach Bacon 1dc4ab845a Merge pull request #39 from atsampson/master
SFML is required for link support.
2016-11-10 07:26:28 -05:00
Adam Sampson 4bf4248985 SFML is required for link support. 2016-11-10 11:39:45 +00:00
Zach Bacon 0d6b94afb7 Slow fix of libretro interface 2016-11-10 00:40:22 -05:00
Zach Bacon 9e0c8cec8b Fix compiling d3d 2016-11-08 09:15:52 -05:00
Zach Bacon a2f5d1338e Merge pull request #38 from rkitover/master
fix wx GL viewport + build improvements
2016-11-08 08:08:36 -05:00