Compare commits

...

282 commits
2.0 ... master

Author SHA1 Message Date
Richard Goedeken
a4dc0d295e
Merge pull request #134 from orbea/sdl
Remove SDL1 support
2024-11-02 21:10:59 -07:00
Richard Goedeken
bb0bf30c37
Merge pull request #133 from orbea/strict-aliasing
build: remove -fno-strict-aliasing
2024-11-02 21:09:21 -07:00
orbea
3d36c9b9fe build: remove -fno-strict-aliasing
This builds with -Werror=strict-aliasing so it should be not required.
2024-10-28 11:55:49 -07:00
orbea
a1bc5235c9 src: remove SDL1 code path 2024-10-28 11:42:58 -07:00
orbea
0eb1743216 build: remove SDL1 support 2024-10-28 11:32:39 -07:00
orbea
aead6d917d build: remove executable permissions from Makefile 2024-10-28 11:31:15 -07:00
Richard Goedeken
f2ca383941 update version and release info for v2.6.0 release 2024-07-14 17:25:41 -07:00
Richard Goedeken
9cbdd4d002 update minimum macos SDK in makefile 2024-07-14 12:00:45 -07:00
Richard Goedeken
3698a2b12b
Merge pull request #132 from Jj0YzL5nvJ/up2024
CI/CD: Update to generic scripts, independent schedule, etc
2024-05-26 19:56:43 -07:00
Jj0YzL5nvJ
80232060cd CI/CD: Update to generic scripts, independent schedule, etc 2024-05-24 11:18:36 -06:00
Richard Goedeken
fd7ffe6360 add 8BitDo N64 controller modkit auto-config from Borden 2023-11-04 08:54:48 -07:00
Richard Goedeken
3486d9277e
Merge pull request #128 from metalj/patch-1
Add support for "Xbox Series X Controller"
2023-10-16 18:43:26 -07:00
Luis Figueroa
bd7c5abbc2
Add support for "Xbox Series X Controller"
I was surprised to see mupen not able to auto-config this controller. This fixes that. All the inputs match and works great.
2023-10-15 21:32:57 -04:00
Richard Goedeken
b175a41675
Merge pull request #127 from Jj0YzL5nvJ/up2023
CI/CD: Fixes Ubuntu i386 builds, among other changes
2023-06-11 12:20:57 -07:00
Jj0YzL5nvJ
e267afb32b CI/CD: Fixes Ubuntu i386 builds, among other changes 2023-05-22 00:37:50 -06:00
Richard Goedeken
557fc95018
Merge pull request #126 from GhostlyDark/rumble-fix2
Update rumble functions for SDL v2.0.18+
2023-05-08 19:27:32 -07:00
GhostlyDark
821debb536 Update rumble functions for SDL v2.0.18+
Co-Authored-By: Rosalie <rosalie@mailbox.org>
2023-05-06 23:48:39 +02:00
Richard Goedeken
b6fd2f99d7
Merge pull request #123 from Jj0YzL5nvJ/lx_x360
Fix inversion in C buttons on Ubuntu 22.04
2023-03-19 21:13:53 -07:00
Jj0YzL5nvJ
d9e650ad83 Fix inversion in C buttons on Ubuntu 22.04 (jammy) 2023-03-18 23:05:45 -06:00
Richard Goedeken
9734fd465f
Merge pull request #122 from Jj0YzL5nvJ/ci-schedule
CI/CD: Integrate scheduled builds and other...
2023-03-02 22:01:00 -08:00
Jj0YzL5nvJ
ca5f6d82c9 CI/CD: Integrate scheduled builds and other necessary updates 2023-02-14 23:49:49 -06:00
Richard Goedeken
2129e942fd fix for issue #120 2023-01-31 19:37:34 -08:00
Richard Goedeken
aa181483bf
Merge pull request #118 from vhns/add-xbox-360-controller-clone
Include yet another 360 controller.
2022-11-29 19:32:37 -08:00
Vitor Hugo Nunes dos Santos
af39198212 Include yet another 360 controller.
I have tested this on Debian 11 with kernel 6.0.0 on Mario 64.
Everything seems to work just fine.
2022-11-27 20:08:38 -03:00
Richard Goedeken
ac3b878cd1
Merge pull request #117 from Jj0YzL5nvJ/up2022
CI/CD: Update MSVC
2022-09-30 16:59:53 -07:00
Jj0YzL5nvJ
6ecfd55072 CI/CD: Update MSVC 2022-09-28 02:07:06 -06:00
Richard Goedeken
9cbe63f8e8
Merge pull request #114 from Jj0YzL5nvJ/ci-update
CI/CD: Update
2022-07-13 19:30:38 -07:00
Jj0YzL5nvJ
23fe417b16 CI/CD: Update 2022-07-10 18:52:22 -06:00
Richard Goedeken
c6bcb296d5
Merge pull request #113 from ppp0/add-ps1-classic-controller
Add USB controller from PS1 Classic
2022-05-13 18:21:10 -07:00
Richard Goedeken
003599b268 add auto-config section for fake playstation controller (SHANWAN PS3 GamePad) from Le Pape on google group mailing list 2022-05-13 16:58:46 -07:00
ppp0
b791f0b7a4 Add USB controller from PS1 Classic 2022-04-25 09:06:40 +02:00
Richard Goedeken
95d901b737
Merge pull request #111 from Jj0YzL5nvJ/ci-github
CI/CD: Implement GitHub Actions and public nightly builds
2022-04-11 20:53:18 -07:00
Richard Goedeken
715058d783 add info for PS4 controller config for Linux 2022-04-11 20:22:38 -07:00
Richard Goedeken
247110f2bc
Merge pull request #110 from aitet/master
Sony PS4 Controller support for linux
2022-04-11 20:08:37 -07:00
Jj0YzL5nvJ
25871f2ebd CI/CD: Implement GitHub Actions and public nightly builds 2021-12-05 09:00:13 -07:00
ait
3b2d5cc0c5 Sony PS4 Controller support for linux 2021-11-29 18:24:12 +01:00
Richard Goedeken
5e20c6f87b
Merge pull request #108 from GhostlyDark/master
Add Xbox One Elite Controller to InputAutoCfg.ini
2021-09-09 20:59:45 -07:00
GhostlyDark
46e90781b5 Add Xbox One Elite Controller to InputAutoCfg.ini
I am actually not using an Elite Controller. It's what both my revised Xbox One and Series controllers are recognized as.
2021-09-07 14:34:46 +02:00
Richard Goedeken
1e7741e474
Merge pull request #109 from GhostlyDark/xbox-one-s-fix
Fix Xbox One S Controller
2021-09-06 21:41:44 -07:00
GhostlyDark
893296b671 Fix Xbox One S Controller
Fixes wrong C-Button configuration.
2021-09-05 20:41:48 +02:00
Richard Goedeken
cb421bbfa9 add auto-configuration for Shan Wan gamecube adapter from Sumbigboi 2021-06-23 21:12:33 -07:00
Richard Goedeken
4340d306b7
Merge pull request #107 from HellMar/master
SAFFUN N64 A and B button and CL and CD button swapped
2021-04-28 19:27:59 -07:00
HellMar
cc1c43525e SAFFUN N64 A and B button and CL and CD button swapped 2021-04-26 16:32:04 +02:00
Richard Goedeken
fb73dcf57f controller config for Xbox One S controller from Magnus Olsen on github 2021-04-20 22:45:53 -07:00
Richard Goedeken
b65f4d5af7
Merge pull request #105 from dmccombs/add-stadia-controller
Add Google Stadia controller to README.md, minor button mapping updates.
2021-04-18 06:34:28 -07:00
Dan McCombs
fabde06a47 Add Google Stadia controller to README.md, minor button mapping updates. 2021-04-17 21:09:26 -04:00
Richard Goedeken
0803c862ed
Merge pull request #104 from dmccombs/add-stadia-controller
Add input config for Google Stadia controller.
2021-04-11 20:22:50 -07:00
Dan McCombs
966bd723a2 Add input config for Google Stadia controller. 2021-04-03 17:36:44 -04:00
Richard Goedeken
6bd512eaf8 add PS5 controller auto-config from z0z0z on github 2021-03-02 17:42:40 -08:00
Ben Slater
44d1d4bd86 Add Dragonbox Pyra Controller Config 2021-02-01 09:02:31 +01:00
Richard Goedeken
0ab2293042 add auto-config for Saitek P2600 from dL classic 2021-01-31 21:40:36 -08:00
Richard Goedeken
d17cfdecd8
Merge pull request #97 from Jj0YzL5nvJ/tiptoe
Enable tiptoe walking mechanics in Banjo games...
2021-01-22 20:43:07 -08:00
orbea
4015a8162a build: Allow out of tree builds. 2020-12-15 10:17:02 +01:00
Jj0YzL5nvJ
daf71bf2ef Enable tiptoe walking mechanics in Banjo games and other platformers with the keyboard 2020-11-10 23:12:10 -07:00
Richard Goedeken
0d7820e35a Revert "Allow non-default compilers without resorting to symbolic links"
This reverts commit 7c701d8b35, as it conflicts with GNU make which always defines default values for certain variables
2020-09-16 22:39:55 -07:00
Richard Goedeken
becff721ff
Merge pull request #94 from Jj0YzL5nvJ/alter_cc_cxx
Allow non-default compilers without resorting to symbolic links
2020-08-30 18:53:30 -07:00
Jj0YzL5nvJ
7c701d8b35 Allow non-default compilers without resorting to symbolic links 2020-08-30 03:53:39 -06:00
Richard Goedeken
5b0c654643
Merge pull request #93 from Jj0YzL5nvJ/alter
Allow to set custom platform toolset from commands
2020-08-19 23:36:23 -07:00
Jj0YzL5nvJ
dd2612bd05 Allow to set custom platform toolset from commands 2020-08-13 12:06:52 -06:00
Richard Goedeken
c0d76df367 fix logitech F710 a/b button mappings as requested by BrandonIrwan on github 2020-06-27 15:57:34 -07:00
Richard Goedeken
954a5dc742
Merge pull request #91 from Henrik0x7F/master
Correctly manage SDL subsystems
2020-05-05 17:21:59 -07:00
Henrik
a3b4a1e829 Correctly manage SDL subsystems
Only shutdown a subsystem if it wasn't already initialized
2020-05-04 20:14:34 +02:00
Richard Goedeken
73f00a0a6e add auto-config for 'SAFFUN N64 Wired USB PC Game pad Joystick' from rawsonjeremy@gmail.com 2020-04-21 19:35:10 -07:00
Richard Goedeken
01c66455c9 add auto-config for EasySMX ESM-9100 from brandonbundy@gmail.com 2020-04-21 19:26:44 -07:00
Richard Goedeken
a7ba9bd935 add auto-config for 'SZMY-POWER CO.,LTD. TIMgames gamepad A3069' from tonywhite1985@gmail.com 2020-04-21 18:32:11 -07:00
Richard Goedeken
978c39988e don't let analog X/Y stick values go outside of legal range 2020-04-21 18:25:07 -07:00
Richard Goedeken
3cbd9c153e
Merge pull request #86 from Mastergatto/controller-fix
Fixes for Nintendo Wii Remote Pro Controller autoconfig
2020-04-21 18:12:15 -07:00
Richard Goedeken
1eb1b873f9
Merge pull request #85 from mrexodia/xeox-autoconfig
add tested autoconfig for "Controller (XEOX Gamepad)"
2020-04-21 18:06:44 -07:00
Richard Goedeken
ad2af4cff4 update auto config based on issue #81 2020-04-21 16:42:26 -07:00
Jj0YzL5nvJ
02a73d3858 AppVeyor with artifact packaging 2020-03-02 09:36:46 +01:00
Jj0YzL5nvJ
c5daef94f4 Changes to have more generic project files 2020-02-26 12:39:44 +01:00
Gillou68310
01af91dd84 Migrate to VS2017 2019-11-13 17:13:10 +01:00
Mastergatto
9972386c14 [Nintendo Wii Remote Pro Controller] Increase value of AnalogDeadzone and AnalogPeak by 75% and 55%, assign buttons for Mempak/Rumblepak switch. 2019-10-19 22:42:02 +02:00
Duncan Ogilvie
7d7a0bd616
add tested autoconfig for "Controller (XEOX Gamepad)" 2019-10-06 21:21:32 +02:00
Richard Goedeken
7dcc45e2cf add function attributes so GCC can find bugs in calls to string formatting functions with variadic arguments 2019-03-03 09:18:32 -08:00
Richard Goedeken
830981f157 bump API version to 2.1.0 to fix issue #79 2019-02-27 23:09:04 -08:00
Richard Goedeken
c8d337aada update version and release info for v2.5.9 BETA release 2019-02-10 10:12:19 -08:00
Richard Goedeken
e68cb6a5f9 fix Travis CI test builds for MXE 32 and 64 bits 2019-01-29 22:12:04 -08:00
Richard Goedeken
25c8ffc0c5
Merge pull request #78 from bugfood/improve-startup
Improve input-sdl startup time.
2019-01-28 20:25:35 -08:00
Corey Hickey
097fc83e2c Improve input-sdl startup time.
SDL_InitSubSystem() takes approximately 0.6s for me, presumably because
it does lots of device enumeration.

When all Input-sdl-ControlX configuration sections are present and
valid, then input-sdl calls SDL_InitSubSystem(SDL_INIT_JOYSTICK) three
times. When configuration is not present, this happens once more for
each connected joysick.

Moving the SDL_InitSubSystem(SDL_INIT_JOYSTICK) calls to a higher level
allows for a reduction to two total calls (whether configuration is
present or not). The first remaining call happens when loading the
plugin and the second call happens when attaching the plugin to the
core. Keeping these calls separate allows SDL to refresh itself in case
the user has plugged/unplugged a joystick in between (not likely with
ui-console, but perhaps with a GUI).

On a system with three joystick devices, loading a game and then
exiting (--testshots 0), this reduces time by:
with configuration:    11.5%
without configuration: 32.1%

Full benchmarks:

[ ----------- original behavior -------------]
[ with configuraton ][ without configuration ]
real    0m5.255s        real    0m7.470s
user    0m1.499s        user    0m1.534s
sys     0m0.110s        sys     0m0.135s

real    0m5.313s        real    0m7.471s
user    0m1.471s        user    0m1.514s
sys     0m0.119s        sys     0m0.120s

real    0m5.360s        real    0m7.414s
user    0m1.496s        user    0m1.569s
sys     0m0.106s        sys     0m0.127s

[ ------------ patched behavior -------------]
[ with configuraton ][ without configuration ]
real    0m4.741s        real    0m5.088s
user    0m1.473s        user    0m1.468s
sys     0m0.122s        sys     0m0.101s

real    0m4.724s        real    0m5.066s
user    0m1.511s        user    0m1.484s
sys     0m0.082s        sys     0m0.090s

real    0m4.628s        real    0m5.024s
user    0m1.494s        user    0m1.504s
sys     0m0.094s        sys     0m0.081s
2019-01-28 19:53:15 -08:00
Richard Goedeken
232000501f
Merge pull request #77 from bugfood/fix-nosaveoptions
Remove use of ConfigSaveSection
2019-01-22 21:53:55 -08:00
Corey Hickey
eb1116c446 Remove use of ConfigSaveSection
Known front-ends have been modified to save configuration after plugin
initialization but before running the game. Now it is no longer
necessary for individual plugins to save their config.

Removing calls to ConfigSaveSection from within plugins makes the
mupen64plus-ui-console '--nosaveoptions' parameter work.

Also remove unused reference to ConfigSaveFile.
2019-01-22 20:59:14 -08:00
Richard Goedeken
cab01d8f6c
Merge pull request #76 from pedrib/patch-3
Recognise DS4 controllers in Bluetooth mode
2019-01-11 22:37:21 -08:00
Richard Goedeken
b3a083b036
Merge pull request #75 from deadmeu/master
Updated support for the TigerGame Adapter
2019-01-11 22:34:18 -08:00
Pedro Ribeiro
c7e31c4f0e
Add a new section as the mappings were all over the place 2019-01-06 23:55:11 +00:00
Pedro Ribeiro
5481b02c06
Recognise DS4 controllers in Bluetooth mode
Legit DS4 controllers advertise themselves as Wireless Controller when connected via Bluetooth.
sony 0005:054C:05C4.0043: input,hidraw4: BLUETOOTH HID v81.00 Gamepad [Wireless Controller] on b0:25:9f:d3:8b:d8
2019-01-06 00:10:49 +00:00
Alex Subaric
1910ed9d28
Updated support for the TigerGame Adapter
Added another name the adapter identifies as.
2019-01-06 03:14:40 +10:00
Richard Goedeken
f5c3995d19 fix mupen64plus-user-issues #709 - newer linux kernel driver maps the two N64 controllers on the HuiJia/Mayflash adapter to separate unix devices, instead of mapping them both to one device 2018-10-12 19:12:40 -07:00
Richard Goedeken
82f29bc1d2 add nintendo switch pro controller auto-config from Nathaniel Carter on google group mailing list 2018-10-03 22:14:07 -07:00
Richard Goedeken
c50780cfa1 remove backup file 2018-09-22 07:43:13 -07:00
Richard Goedeken
f4c518ed88
Merge pull request #72 from bkeys/cmake_build
Added an optional CMake build for mupen64plus-input-sdl
2018-09-21 20:22:25 -07:00
Brigham Henry Keys
7000ee130a Moved CMake project files to the projects/ directory 2018-09-21 02:36:52 -05:00
Richard Goedeken
380f331a1e
Merge pull request #73 from bkeys/markdown_readme
Added Markdown version of the README
2018-09-20 17:49:07 -07:00
Brigham Henry Keys
71c2dce7f8 Removed old README 2018-09-19 13:56:10 -05:00
Brigham Henry Keys
c9868ea0ab Added Markdown version of the README 2018-09-19 13:11:59 -05:00
Brigham Henry Keys
4294f3ce27 Removed extra option 2018-09-19 12:46:08 -05:00
Brigham Henry Keys
7cac1f0182 Added an optional CMake build for mupen64plus-input-sdl 2018-09-19 12:31:13 -05:00
hissingshark
4aff87c99c Added the gioteck VX2 Wireless controller. 2018-04-16 22:51:49 +02:00
Richard Goedeken
394cbc5866
Merge pull request #68 from loganmc10/patch-5
Call SDL_PumpEvents() before processing inputs
2018-03-27 20:21:49 -07:00
Logan
cd554c9022
Call SDL_PumpEvents() before processing inputs 2018-03-23 12:19:59 -06:00
bsmiles32
1a61a9a043 Revert "Update Present field in GetKeys function." 2018-02-20 13:09:39 +01:00
Richard Goedeken
0314ecf174
Merge pull request #66 from bsmiles32/unplug
Update Present field in GetKeys function.
2018-02-16 20:06:07 -08:00
Bobby Smiles
fb68d74829 Update Present field in GetKeys function. 2018-02-15 23:29:20 +01:00
Richard Goedeken
e1f3b93aaf update FSF address in license 2018-02-04 12:58:03 -08:00
Richard Goedeken
e02b4a037d add Xbox Wireless Controller config from Fabian Stumpf via the google group 2018-01-23 22:18:48 -08:00
Richard Goedeken
193ed7bbf7
Merge pull request #65 from Lithium64/patch-1
Added Multilaser Controller JS030
2018-01-23 22:14:39 -08:00
Lithium64
4be57a7511
Added Multilaser Controller JS30
It is recognized as USB Network Joystick on Windows and as Microntek USB Joystick on Ubuntu
2018-01-21 15:29:29 -03:00
Richard Goedeken
6f2290e52a issue #44 - Z and Start buttons swapped for linux and win32 MayFlash N64 controller adapter 2018-01-06 22:38:20 -08:00
Richard Goedeken
8ede639c0a
Merge pull request #63 from bsmiles32/guillemot
Add auto config support for Guillemot Corporation DA Leader
2018-01-05 19:39:04 -08:00
Bobby Smiles
ee729d06ad Add auto config support for Guillemot Corporation DA Leader
contributed by user Spctrlhrm through the mailing list
https://groups.google.com/d/msg/mupen64plus/tHw7rnWFgDE/uA5zCqkKCwAJ
2018-01-04 22:10:30 +01:00
Anthony J. Bentley
7be4d0dd82 Update wiki links. 2018-01-01 17:46:33 +01:00
Anthony J. Bentley
52fd15b4c0 Update homepage. 2018-01-01 17:46:33 +01:00
Anthony J. Bentley
318497be41 Update link to bug tracker. 2018-01-01 17:46:33 +01:00
Richard Goedeken
e6f84b4c8f
Merge pull request #61 from loganmc10/patch-4
If DEBUG not set, set NDEBUG
2017-11-30 19:36:35 -08:00
Logan
4855a9ba29
If DEBUG not set, set NDEBUG 2017-11-30 10:57:49 -07:00
Richard Goedeken
35fdd23231 update Makefile method for finding OSX_SDK_PATH 2017-11-14 16:21:00 -08:00
Richard Goedeken
6c10fddf1e
Merge pull request #60 from charlemagnelasse/travis-mxe
Build MXE targets as additional tests in travis build matrix
2017-11-08 20:06:32 -08:00
Richard Goedeken
3e00ab8f93 remove the ApplyAxisLimits function for now. If we run into problems with games due to over-excursion of joystick position in the corners, then we'll have to add it back in and try and find a happy medium 2017-11-07 20:42:25 -08:00
Charlemagne Lasse
e89b0b6c16 Build MXE targets as additional tests in travis build matrix 2017-11-05 15:34:53 +01:00
Richard Goedeken
1542273dc9 Merge pull request #58 from loganmc10/patch-3
Increase deadzone for axis->N64 button mappings
2017-10-13 22:11:46 -07:00
Logan
854a79353a Increase deadzone for axis->N64 button mappings 2017-10-13 21:48:59 -06:00
Richard Goedeken
5285e6e482 Merge pull request #56 from Jj0YzL5nvJ/patch-1
Fix Microsoft X-Box 360 pad for Linux
2017-10-09 17:24:38 -07:00
Jj0YzL5nvJ
b6b80796e5 Fix Microsoft X-Box 360 pad for Linux
This work best on my distro (Ubuntu 16.04.3 LTS).

The deadzone is very handy for Zelda games, the extra C buttons are indispensable to control Kirby and Jigglypuff in SSB64.
RT (axis(5+)) since always been broken, and interrupt LT (axis(2+))... "There can be only one" (Highlander style =P)
2017-10-09 03:47:02 -06:00
Richard Goedeken
6b58f770d0 Merge pull request #54 from bsmiles32/fix_p990
Fix Rumble switch button for Saitek P990 Dual Analog Pad.
2017-10-02 22:35:36 -07:00
Richard Goedeken
5b55d850c2 minor adjustments to xbox 360 controller config based upon my testing with Windows 7 machine and wired (usb) xb360 controller 2017-10-02 22:06:43 -07:00
Richard Goedeken
23f3b418a7 Merge pull request #53 from tony971/master
Fix XBOX 360 For Windows Controller
2017-10-02 22:02:28 -07:00
Bobby Smiles
1504adf425 Fix Rumble switch button for Saitek P990 Dual Analog Pad. 2017-10-02 11:56:20 +02:00
Tony
9fe1b0bdf3 Fix XBOX 360 For Windows Controller
This makes the mappings match all other xbox 360 mappings listed in the autoconfig. Tested in 3 different Windows 10 machines.
2017-09-29 07:03:25 -04:00
Richard Goedeken
4cc411b724 Merge pull request #45 from loganmc10/tp
Don't set "plugin" as part of autoconfig
2017-09-23 20:22:58 -07:00
Logan McNaughton
e1b542b85c Don't set "plugin" as part of autoconfig 2017-09-23 19:46:12 -06:00
Richard Goedeken
5e660767e1 Merge pull request #50 from loganmc10/patch-2
Re-attach joystick if it has disconnected
2017-09-20 23:02:31 -07:00
Logan
0afa0cd722 Re-attach joystick if it has disconnected 2017-09-19 12:55:18 -06:00
Dorian Fevrier
c3a14e06b0 Merge pull request #48 from charlemagnelasse/travis-container
Use faster container based Travis CI
2017-09-12 22:54:54 +02:00
Richard Goedeken
cf02a743e1 tweak the ApplyAxisLimits function to avoid causing problems mentioned in mupen64plus-input-sdl issue #46 and mupen64plus-user-issues issue #681. Instead of limiting joystick values to 87% of the axis limit on the cardinal directions N/S/E/W, we allow them to reach 100% 2017-09-04 21:11:21 -07:00
Charlemagne Lasse
c97d38e649 Use faster container based Travis CI 2017-09-01 09:57:14 +02:00
Charlemagne Lasse
da0a428d6f Let travis handle the package installation directly
The before_install  currently fails on Travis CI with:

    The following packages have unmet dependencies:
     libsdl2-dev : Depends: libegl1-mesa-dev
                   Depends: libgles2-mesa-dev
    E: Unable to correct problems, you have held broken packages.

This can currently only be solved by using the apt addon to install
packages.
2017-09-01 09:56:16 +02:00
Bobby Smiles
7d8eea23d8 Revert "Allow using compiler other than gcc"
This reverts commit 2766667e73.
2017-06-24 13:34:37 -06:00
bsmiles32
f280fde688 Merge pull request #42 from loganmc10/patch-1
Allow using compiler other than gcc
2017-06-22 20:19:54 -06:00
Logan McNaughton
2766667e73 Allow using compiler other than gcc 2017-06-20 21:16:50 -06:00
Richard Goedeken
68a048bb90 Merge pull request #41 from fprimex/fprimex-macos-version-min
bump macosx-version-min to 10.6 for SDL2.0.5
2017-03-16 23:57:32 -07:00
Richard Goedeken
e01d6de015 Merge pull request #39 from arichnad/master
add PS4 controller name.
2017-03-16 22:40:23 -07:00
Brent Woodruff
74202c7cec bump macosx-version-min to 10.6 for SDL2.0.5 2017-03-16 22:50:34 -04:00
adrian
434ff22b98 add PS4 controller name. 2017-02-19 14:14:07 -05:00
Richard Goedeken
ec69700961 Merge pull request #38 from orbea/horipad
(InputAutoCfg) Configure HORIPAD ONE automatically. [from orbea on 1/1/17: As a side note, in linux this gamepad currently only works correctly with the xpad git master. I'm not sure when that will be merged into the kernel.]
2017-02-02 19:29:02 -08:00
orbea
ae6d7dc308 (InputAutoCfg) Configure HORIPAD ONE automatically. 2017-01-01 10:05:43 -08:00
Richard Goedeken
9d8ec46e9b we dont need all the duplicate entries with version numbers 2016-10-21 23:14:45 -07:00
Richard Goedeken
4ffc65700e Merge pull request #36 from raphnet/raphnet
Add autoconfigs for raphnet-tech v3 series adapters
2016-10-21 23:09:43 -07:00
Raphael Assenat
b7923f746f Add autoconfigs for raphnet-tech v3 series adapters 2016-10-21 23:15:47 -04:00
Richard Goedeken
0056f904b9 libm is required for some linux distributions, possibly others. Hopefully this wont break the build on any architectures; it's also like this in the core makefile 2016-10-18 20:41:56 -07:00
Richard Goedeken
6189125766 experimental change: apply a pair of radius-limiting quadratic functions to the joystick X,Y coordinate values, so that instead of allowing them to have values in the full +/- 80 range for each axis, they are restricted to approximately the same area as that which is physically allowed by the controller case on a real N64 controller 2016-10-18 20:17:55 -07:00
Dorian Fevrier
016547d016 Merge pull request #35 from orbea/logic3
Add Logic3 controller config
2016-10-13 09:16:24 +02:00
orbea
c7efdf9125 Add Logic3 controller config 2016-10-12 19:38:13 -07:00
Richard Goedeken
ba9426c384 Merge pull request #34 from charlemagnelasse/master
Use Ubuntu Trusty as base system for Travis CI
2016-09-01 18:04:31 -07:00
Charlemagne Lasse
7eb46d4073 Use Ubuntu Trusty as base system for Travis CI 2016-09-01 20:23:59 +02:00
Richard Goedeken
799cad4422 Merge pull request #32 from kodlian/master
FIX Auto detection of PLAYSTATION(R)3 Controller on OSX
2016-08-15 22:39:05 -07:00
Jeremy Marchand
52e557184e FIX Auto detection of PLAYSTATION(R)3 Controller on OSX 2016-08-14 11:24:16 +02:00
Richard Goedeken
164472117d change VS2013 project files to build with the XP-compatible vc120 toolset, so the resulting binaries will run on pre-vista machines 2016-07-13 20:04:06 -07:00
Richard Goedeken
8e5e9901b1 add auto-config for Playfect PS3 controller from Reinaert Van de Cruys on google group 2016-07-12 21:08:34 -07:00
Richard Goedeken
dfbb873df0 add auto-config for Mayflash 4-port gamecube controller adapter from Lorenzo Pane on google group 2016-07-06 22:39:18 -07:00
Richard Goedeken
4754a02d49 Merge pull request #31 from Zero86Sk/patch-1
Add autoconfig support for Xbox One Wireless Controller (Dongle)
2016-07-05 22:17:48 -07:00
Zero86Sk
3d29d5bf76 Added Xbox One Wireless Controller (Dongle) support
Added the Xbox One Wireless Dongle device is listed under [Controller (Xbox One For Windows)]
2016-04-17 00:02:53 +02:00
Richard Goedeken
204e8d5784 from paradadf on github, this controller name needs 3 spaces, after the changes to prioritize bit-exact controller names 2016-04-12 20:03:59 -07:00
Richard Goedeken
149a7966ca add auto-config section for Thrustmaster T Mini Wireless from Pablo Casas via google group 2016-03-27 18:43:00 -07:00
Richard Goedeken
d9fff1dd51 fix for issue #152 in github issue tracker for mupen64plus-core 2016-03-16 22:14:25 -07:00
Richard Goedeken
85e9b2598d Logitech WingMan RumblePad apparently has the same button mapping as the WingMan Action Pad 2016-02-24 22:09:54 -08:00
Richard Goedeken
3d1ed346e5 add autoconfig section for NES30 Pro Controller from Wayne on google group 2016-02-24 22:05:24 -08:00
Richard Goedeken
a73230be7f auto-config for xbox 360 wired controller under OSX from Fredrik Daun via google group 2016-01-06 22:00:48 -08:00
Dorian Fevrier
b78b76a76b add 'Aftergl ow Gamepad for Xbox 360' in InputAutoCfg.ini 2016-01-01 23:08:17 -05:00
Richard Goedeken
4cac18ba21 Merge pull request #30 from EricxDu/master
Fix up the "Generic X-Box pad" section in accordance with the README
2015-11-21 20:40:20 -08:00
Eric Duhamel
78d3a43065 Fixed "Xbox 360 Wireless Receiver" section
Axes 3 and 4 were swapped
2015-11-21 12:36:07 -08:00
Eric Duhamel
2586367d2b Fixed a small error in the changed section 2015-11-21 11:54:46 -08:00
Eric Duhamel
77229317d0 Updated "Generic X-Box pad" to conform to the README
The [Generic X-Box pad] section was misconfigured so I updated it
to conform to the README. R-button, L-button, Z-trigger, B-button,
and START are now properly mapped. I tested this config by playing
Ocarina Of Time and the controller layout works well.
2015-11-21 11:51:16 -08:00
Richard Goedeken
d8e1b5b0ad add ShanWan USB autoconfig from Marco on google group list: A Playstation Clone, Rumble Trigger Incorrect 2015-11-04 22:07:11 -08:00
Richard Goedeken
120f4f3273 Merge branch 'master' of https://github.com/mupen64plus/mupen64plus-input-sdl 2015-10-18 21:46:28 -07:00
Richard Goedeken
493b3a6b10 fixes for Gasia PS Gamepad from Marcus Dean Adams on google group email list 2015-10-18 21:46:07 -07:00
Richard Goedeken
e96729614f Merge pull request #29 from gizmo98/USB-gamepad
Add "USB Gamepad "
2015-10-07 20:51:03 -07:00
Stefan
dc33cef836 Add "USB Gamepad " 2015-10-07 21:29:56 +02:00
Richard Goedeken
bcf6892ca6 added specific config for Logitech F310 from Marcus Dean Adams on google group, who suggested that this config is better than the old mapping which used the same config as other XBox Clones 2015-10-01 20:32:35 -07:00
Richard Goedeken
889312e419 Merge pull request #28 from Gillou68310/x64
Added x64 configuration to VisualStudio2013 project file
2015-09-12 21:52:38 -07:00
Richard Goedeken
24cc611bdb add another huijia auto-config from alecjw on github ticket #628 2015-09-12 17:23:22 -07:00
Richard Goedeken
67b4aa7a33 add OUYA wireless controller auto-config from github ticket #600 2015-09-12 16:52:06 -07:00
Gillou68310
58a56c38b2 Added x64 configuration to VisualStudio2013 project file 2015-08-28 16:26:24 +02:00
Richard Goedeken
b6486455a2 add new auto-config section for Rock Candy gamepad and new name for GC/N64 to USB (Raphnet technologies USB converter) 2015-08-02 14:26:57 -07:00
Richard Goedeken
681068aa00 new Saitek PLC Cyborg Force Rumble Pad auto-config from Pierre Neidhardt on the GG list 2015-07-07 22:33:14 -07:00
Richard Goedeken
198b8a7f03 add MayFlash PC048 adapter auto-config from Brandon Bundy via the google group 2015-06-12 21:30:05 -07:00
Richard Goedeken
0dbebae0e4 Merge pull request #26 from bentley/openbsd
Remove unnecessary OpenBSD warning.
2015-06-08 06:31:09 -07:00
Anthony J. Bentley
1580b6819d Remove unnecessary OpenBSD warning. 2015-06-08 01:45:45 -06:00
Richard Goedeken
b7cd607483 add auto-config for Logitech F710 gamepad by me 2015-06-06 21:59:46 -07:00
Richard Goedeken
10f69275e8 add auto-config for Xiaomi Bluetooth Controller from Peter Goelst on google group mailing list 2015-06-06 09:55:53 -07:00
Richard Goedeken
d0d385defa add auto-config for Super Joy Box 13 Gamecube USB adapter from Nick Griffiths on google group mailing list 2015-06-06 08:53:24 -07:00
Richard Goedeken
763107feb0 add auto-config for Snakebyte PS3-style USB controller from user on google group mailing list 2015-06-06 08:42:32 -07:00
Richard Goedeken
06d4271cf3 fix bug whereby a more general controller name in the inputautocfg file (such as OSX: Controller) which appeared earier in the file would be used instead of a more specific name found later. Now we score the name matches such that each matching word is worth 4 points, an OS-specific section is worth 1 point, and the XInput specific section is worth 2 points. The matching config section with the highest points is used, which fixes this bug 2015-06-03 23:29:48 -07:00
Richard Goedeken
53a90dde4a Merge pull request #25 from amietn/master
add config for Sony playstation 4 controller
2015-06-02 19:19:14 -07:00
amietn
bb0ffc3f82 add config for Sony playstation 4 controller and remove conflicting PS3 controller name 2015-05-07 15:22:51 +02:00
Richard Goedeken
bc61822c19 update text files and version number for upcoming 2.5 release 2015-04-26 12:30:51 -07:00
Richard Goedeken
c01ff31def fix for [GS gamepad] 2015-04-24 16:27:15 -07:00
Richard Goedeken
4158c2971a add config section for [GS gamepad] from Rodrigo Costa via google groups 2015-04-23 16:33:58 -07:00
Richard Goedeken
1f5d844f80 Merge pull request #24 from gizmo98/patch-1
Add 8BITDO NES30 and Jess Tech GGE909 PC Recoil Pad
2015-04-19 21:57:03 -07:00
gizmo98
f7e31ddde6 Add 8BITDO NES30 and Jess Tech GGE909 PC Recoil Pad 2015-04-17 17:08:19 +02:00
Richard Goedeken
0b5bf83cac Merge pull request #22 from conchurnavid/includes
Cleanup includes order and add missing includes
2015-03-21 21:28:00 -07:00
Conchúr Navid
0af22c499f Add missing includes and forward declarations 2015-03-21 13:47:40 +01:00
Conchúr Navid
2f3f97f848 Sort the includes based on type and names 2015-03-21 10:58:28 +01:00
Conchúr Navid
40124bf0ae Fix executable bits of files 2015-03-21 10:58:11 +01:00
Richard Goedeken
60b53306b7 Merge pull request #21 from bsmiles32/fix_warning
Fix const correctness warning.
2015-03-19 16:40:25 -07:00
Bobby Smiles
f3be3692d1 Fix const correctness warning. 2015-03-19 18:31:31 +01:00
Richard Goedeken
95f0745768 Merge pull request #20 from mfbeary/master
added config for another wireless XBOX receiver
2015-03-16 21:54:03 -07:00
mfbeary
01db40982b added config for another wireless XBOX receiver
I'm using this receiver: http://www.newegg.com/Product/Product.aspx?Item=9SIA0U008T5260
It identifies as 'Xbox 360 Wireless Receiver (XBOX)', and needed axes 3 and 4 switched from the normal xbox controller config, so I added it as a separate entry.
2015-03-16 18:07:23 -05:00
Richard Goedeken
d373eca182 Merge pull request #19 from rlabrecque/master
Added auto-config for RetroUSB "USB N64 RetroPort"
2015-03-15 08:54:20 -07:00
Riley Labrecque
6b2bc159cd Added auto-config for RetroUSB "USB N64 RetroPort"
Yes there's supposed to be a space at the end...
2015-03-14 04:59:19 -06:00
Richard Goedeken
8227467fb0 Added auto-config for Wii U Gamecube adapter from googlecode wiki comment 2015-03-11 16:43:45 -07:00
Richard Goedeken
ddc4642ed7 Merge pull request #18 from conchurnavid/coverity_fixes
Check if the size calculation for config file failed
2015-03-03 21:25:10 -08:00
Conchúr Navid
ac5b81b8a1 Check if the size calculation for config file failed 2015-03-03 12:14:37 +01:00
bsmiles32
d0fdbf8c60 Add alternative name for Adaptoid device
Reported by user kaito in the google groups [1]
[1] https://groups.google.com/d/msg/mupen64plus/Zzu00-j4Adw/XqsTDtDyKLwJ
2015-02-28 11:24:34 +01:00
Richard Goedeken
ef4d344062 added project/solution file for Visual Studio 2013. removed older MSVS project files. fix code compatilibity problems with MSVC 2015-02-22 07:13:34 -08:00
Dorian Fevrier
90c3a08b05 Merge pull request #17 from gizmo98/patch-1
InputAutoCfg.ini: Add USB,2-axis 8-button gamepad
2015-02-13 22:04:56 -05:00
gizmo98
b9a5a5f4db InputAutoCfg.ini: Add USB,2-axis 8-button gamepad
iBuffalo Gamepad
2015-02-13 23:45:17 +01:00
Richard Goedeken
10253ba90c Merge branch 'master' of https://github.com/mupen64plus/mupen64plus-input-sdl 2015-02-02 09:01:28 -08:00
Richard Goedeken
2d42602f7f update OSX xbox360 mappings from reidgc reported in googlecode.com issue #630 2015-02-02 09:00:52 -08:00
Richard Goedeken
9a2831d0be Merge pull request #16 from Nebuleon/build-changes
Drop architecture checks for cross-platform project
2015-02-01 14:18:07 -08:00
Nebuleon Fumika
630e4c7c2f Unix Makefile: Discard unnecessary architecture checks
Unlike the Mupen64Plus Core, which is sensitive to the architecture
it's compiled for due to its just-in-time compilers, this project does
not require architecture-specific glue code, only operating system
checks to load dynamic libraries and the presence of a well-behaving
port of SDL on the platform.

M64P_BIG_ENDIAN is not used for any decisions in this plugin, either.
Delete the big-endian processor checks.
2015-01-26 10:01:34 +00:00
Dorian Fevrier
611e441a6c Merge pull request #15 from gizmo98/patch-1
InputAutoCfg.ini: Add more PS3 controller variants
2015-01-20 23:19:47 -05:00
gizmo98
720d30a2da InputAutoCfg.ini: Add more PS3 controller variants 2015-01-20 18:48:02 +01:00
Richard Goedeken
19d4107974 Merge pull request #14 from Gillou68310/master
Added project file for MSVC2010
2015-01-07 22:55:19 -08:00
Gillou68310
9d82d61ed3 Added project file for MSVC2010 2015-01-07 15:10:27 +01:00
Richard Goedeken
86075505a1 Merge pull request #13 from conchurnavid/xinput
support new style sdl generic xinput name
2015-01-04 21:15:20 -08:00
Conchúr Navid
975e6f8d00 support new style sdl generic xinput name 2015-01-05 01:04:20 +01:00
Richard Goedeken
6a69cc8b88 Merge pull request #12 from apaugh/master
Added auto-detect for Xbox One pad for the Linux xpad driver
2014-11-17 22:23:10 -08:00
andrew
2ac00fc149 Added auto-detect for Xbox One pad for the Linux xpad driver. Works great with the existing Xbox configuration. 2014-11-17 21:22:55 -08:00
Richard Goedeken
8d714e1e90 Merge pull request #11 from japanese-bird/master
Swap Z and L buttons on Playstation 3 controller
2014-10-25 11:58:28 -07:00
japanese-bird
a2f9a3ad39 Swap Z and L buttons and Playstation 3 controller 2014-10-23 16:49:40 -04:00
Richard Goedeken
6d930ac292 Merge pull request #10 from bsmiles32/mega_world_thrustmaster_32
add auto-config for Mega World Thrustmaster dual analog 3.2 gamepad cont...
2014-10-12 22:17:02 -07:00
Bobby Smiles
ab1d684066 add auto-config for Mega World Thrustmaster dual analog 3.2 gamepad controller 2014-10-12 10:56:44 +02:00
Richard Goedeken
83c33bee69 Merge pull request #9 from rukai/master
...
2014-08-03 14:02:53 -07:00
rukai
010d51c53d Fixed Xbox configuration, n64 R button is properly mapped to the xbox R shoulder button and R trigger. 2014-07-27 19:09:58 +10:00
Richard Goedeken
e260eefe57 added auto-config for Twin USB Gamepad from Arto Kemppainen 2014-07-15 22:45:55 -07:00
Richard Goedeken
730f0da93a add PS1 converter auto-config from Pascal Malo 2014-07-15 22:41:39 -07:00
Richard Goedeken
16b8ec85e9 Merge pull request #8 from fayvel/sdl_key
Fix SDL2 build regression caused by undefined Key usage
2014-07-07 22:10:35 -07:00
Richard Goedeken
c0225faf2f Merge pull request #7 from fayvel/travisci
Add Travis CI configuration file for automatic build tests
2014-07-07 22:03:34 -07:00
Fayvel Victor
e56de36cd4 Fix SDL2 build regression caused by undefined Key usage
3e075586ea ("To prevent undesirable release of
analogue joystick while using touchpad.") used SDLK_LSUPER from SDL1.2 which is
not used anymore in mupen64plus-input-sdl. Instead SDL2 keys must be used and
only the SDL1.2 compatibility wrapper can reference SDLK_*
2014-07-06 13:29:41 +02:00
Fayvel Victor
84f09f2eb5 Add Travis CI configuration file for automatic build tests
Github provides a Travis CI integration which makes it easy to have a quick
check of a patch before a pull request is accepted. It is not enough to prove
the correctness of a contribution but at least helps to avoid some of the worst
build problems.

This feature *must* be enabled by the mupen64plus administrator *before this
commit is merged*:

- https://travis-ci.org/profile/mupen64plus
- Login via your Github account
- Make sure you are on "https://travis-ci.org/profile/mupen64plus"
- Switch repository to "On"
2014-07-06 13:14:56 +02:00
Richard Goedeken
487b64256c fix comment and add special modifier key notes in README 2014-07-05 22:01:44 -07:00
Richard Goedeken
16fc261f76 Merge pull request #6 from s-verma/master
To prevent undesirable return to centre of cursor while using touchpad.
2014-07-05 21:52:15 -07:00
s-verma
3e075586ea To prevent undesirable release of analogue joystick while using touchpad.
While playing FPS game like Goldeneye, The World is not Enough etc with touchpad, the cursor/crosshair/crosswire tries to return to origin/centre thus preventing player to set it to target hence shoot it. Now this can be prevented by pressing Left Window Key, then moving cursor through touchpad.
2014-07-01 16:14:33 +05:30
Richard Goedeken
845fdcaf4a added logitech F310 to xbox controller list, from Matt Harvey via google groups 2014-06-17 17:36:51 -07:00
Richard Goedeken
24af5a8345 Merge pull request #5 from jancborchardt/master
switch order of ipega controllers so the media one works as well
2014-05-17 13:58:20 -07:00
Jan-Christoph Borchardt
7c01d57228 switch order of ipega controllers so the media one works as well 2014-05-17 17:04:14 +02:00
Richard Goedeken
adbacfcacf fix for Wii U Pro controller autoconfig from Mastergatto on github 2014-05-10 16:04:21 -07:00
Richard Goedeken
add0e60ece SDL 1.2 is not deprecated for us, and we shouldnt frighten the user with 6 lines of exclamation points 2014-05-04 11:29:27 -07:00
Ursula Abendroth
0d3e0c3b8f Switch by default to SDL2 for Mupen64Plus 2.1
The current version of SDL is 2.0.3. All new releases of distributions contain
this library already. Current Linux distributions and OpenBSD even backporting
patches from Mupen64Plus 2.1 repo to use SDL 2. Android and other mobile
platform don't have support for legacy SDL 1.2.

People like Anthony J. Bentley and Riley Labrecque already requested
a new release of Mupen64Plus 2.1 with SDL2
2014-04-23 19:32:46 +02:00
Richard Goedeken
f064406ca4 Merge pull request #3 from xoothy/master
add auto-configuration for ACRUX Gamepads
2014-04-08 22:12:48 -07:00
Johannes Janssen
d63ff2a8b8 add auto-configuration for ACRUX Gamepads
Add auto-configuration for ACRUX Gamepads (USB ID: 1a34:080) a Xbox 360
controller clone sold under various brands and clarify mapping description
for Xbox 360 controllers and clones in README.
2014-04-08 17:58:20 +02:00
Richard Goedeken
a0ef74aa38 Merge pull request #2 from jancborchardt/master
fixing ipega gamepad controllers
2014-03-26 21:32:51 -07:00
Jan-Christoph Borchardt
c5e0e50b07 add correct auto-config for ipega media gamepad controller 2014-03-26 15:26:29 +01:00
Jan-Christoph Borchardt
cb47e19d29 fix issue in auto-config of ipega gamepad controller 2014-03-26 15:25:31 +01:00
Richard Goedeken
930efa4731 added auto-config for ipega media gamepad controller from Jan-Christoph Borchardt via google group 2014-03-20 22:05:12 -07:00
Richard Goedeken
c410aa498c Merge pull request #1 from diekmann/patch-1
added gamepad
2014-02-03 22:13:06 -08:00
diekmann
718c4926ee added gamepad
Different names on Linux and Windows

saitek p580 rumble pad (name in windows device manager)
Colour Rumble Pad (name detected by mupen64 on windows 8)
Jess Technology Colour Rumble Pad (name on Linux lsusb)

Tested on windows 8 and Ubuntu 12.04
2014-01-31 19:44:30 +01:00
Richard Goedeken
f78b226b31 add aftermarket PS3 controller config from Jared Klingenberger via GC mailing list 2014-01-29 21:55:58 -08:00
Richard Goedeken
01bf9ccc62 update Win32 MayFlash n64 adapter deadzone/peak values based on recommendation from Xanathol Nyteblade 2014-01-26 09:12:43 -08:00
Sven Eckelmann
4af586cec6 Force line ending type for specific files
Different operation systems (Unix vs. Windows) use different line ending types.
It can easily happen that users from different systems edit files and replace
all line endings of a file with the system specific version. This screws up
diffs and makes merges harder.

Git can normalize line endings for specific files and avoid this problem.
Binary files should be marked to avoid accidentally normalization.
2013-12-19 14:19:06 +01:00
Sven Eckelmann
5a0620b1f4 Convert .hgignore to .gitignore 2013-12-19 14:13:38 +01:00
Richard Goedeken
719fd6afeb bugfix: fall back to key/joy mappings for a controller with mouse=true when the mouse is not grabbed 2013-11-14 19:01:56 -08:00
Gre Pronk
76d0124c20 Add support for Microsoft SideWinder Game Pad Pro USB version 1.0 2013-10-18 13:41:24 +02:00
Sven Eckelmann
917ed484dd Don't fail rebuild when header is removed
The *.d depends files for make just list the files used when building an
object file. Removing a file listed in such a dependency file causes make to
search for a way to recreate it. This usually cannot work because these files
aren't autogenerated.

The gcc option -MP can be used to generate empty rule for these files. Removing
a file in a dependency list will then execute this empty rule and continue with
the execution of the creation of the object file. This compilation process will
then automatically correct the dependency file.
2013-09-20 10:31:41 +02:00
Richard Goedeken
fd8bce5c98 add autoconfig for Wii U Pro controller, from ControllerSetup wiki page on google code site 2013-09-01 15:22:55 -07:00
Richard Goedeken
d30f0403e7 new controller config from William Shipley 2013-09-01 15:05:16 -07:00
Richard Goedeken
d0bcf623e5 add Twin USB Vibration Gamepad auto-config from wiki comment 2013-08-17 16:37:32 -07:00
Richard Goedeken
2dd021df1e new controller auto-configuration for PS3 controller clone, from Ivan Freitas via google group 2013-07-19 20:14:53 -07:00
Richard Goedeken
177ab01049 add new auto-config for Logic 3 PowerPad controller (aka JP283 aka Jess Technology Co., Ltd. USB Game Controllers) from Mark Storey via google group mailing list 2013-07-14 21:19:14 -07:00
richard42
951e990d00 simplify OSX platform detection in makefile using xcode-select. based on patch from John Pender 2013-07-08 07:24:07 -07:00
Richard Goedeken
b5b9fad449 add Nintendo Wiimote Classic auto-config from sayret on google code controller setup wiki 2013-07-04 18:17:17 -07:00
Richard Goedeken
61653ce443 merged heads 2013-07-04 18:10:22 -07:00
Richard Goedeken
32b60e0a09 merged heads 2013-07-04 18:09:06 -07:00
Richard Goedeken
10411f6f0c merged heads 2013-07-04 18:04:20 -07:00
Richard Goedeken
03050e918b merged heads 2013-07-04 18:01:41 -07:00
Richard Goedeken
70017754fc Added tag 2.0 for changeset 161a70203a09 2013-07-04 15:47:16 -07:00
Sven Eckelmann
589290fa4c Allow to read multiple entries from autoconfig
SDL2.0 introduces a new input backend for XInput devices. These have a
different layout (buttons, axis, hats, ...) than the previous backends. This
makes the current AutoConfig entries for such devices useless. Unfortunatelly,
SDL2 doesn't inform us about the backend used to talk to a joystick/gamepad.
This makes it hard to decide whether we must search for an entry without
prefix, with Win32 prefix or with a new "XInput" prefix.

Instead the whole ini is parsed and it is not stopped when a section with a
valid entry is finished. Priorities are saved to decide whether a new found
section is interesting for the user config or not. Entries without a known
prefix have the priority 3, one with a known entry have the priority 2 and
entries with the prefix "XInput" get the priority of 1 on windows with SDL2.
The lowest priority is always preferred.

This allows the autoconfiguration to use XInput configs whenever it is
required and use the old configurations everywhere else.
2013-06-27 20:39:54 +02:00
Sven Eckelmann
69cdefe31e Reduce auto_set_defaults complexity by moving name comparison to extra function 2013-06-27 20:39:54 +02:00
Sven Eckelmann
97c245d47b Use SDL_HapticRumble* instead of creating own effects 2013-06-26 21:08:25 +02:00
Sven Eckelmann
bc7d3057f2 Use SDL2 to play force feedback effects 2013-06-23 11:10:26 +02:00
Sven Eckelmann
4b90486595 Add support for mouse based analog stick using SDL2 2013-06-23 10:26:03 +02:00
Sven Eckelmann
7f379fe044 Use SDL1.2 keysym in the config when using SDL2
It is easier for a user to keep the old SDL1.2 values for the keys in the
config instead of converting them by hand. This is extreme important when the
default (automatic) config is used.
2013-06-22 14:40:18 +02:00
31 changed files with 3873 additions and 1035 deletions

38
.gitattributes vendored Normal file
View file

@ -0,0 +1,38 @@
* text=auto
# normal text files
*.6 text
AUTHORS text
*.c text
*.cfg text
*.cht text
*.conf text
COPYING text
*.cpp text
*.def text
*-license text
*.h text
*.html text
*.ini text
INSTALL text
LICENSES text
Makefile text
*.py text
README text
RELEASE text
*.S text
*.sh text
*.txt text
*.ver text
# windows specific text files
*.sln text eol=crlf
*.vcproj text eol=crlf
*.vcxproj text eol=crlf
*.vcxproj.filters text eol=crlf
# binary files
*.gz binary
*.ttf binary
cursor.tex binary
font.tex binary

158
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,158 @@
name: SDL Input
on:
push:
paths-ignore:
- '.{gitattributes,gitignore,travis.yml}'
- '*.md,appveyor.yml,README'
pull_request:
paths-ignore:
- '.{gitattributes,gitignore,travis.yml}'
- '*.md,appveyor.yml,README'
workflow_dispatch:
jobs:
Linux:
strategy:
fail-fast: false
matrix:
include:
- cc: GCC
arch: x64
- cc: GCC
arch: x86
- cc: Clang
arch: x64
- cc: Clang
arch: x86
name: Linux / ${{ matrix.cc }} / ${{ matrix.arch }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Get build dependencies and arrange the environment
run: |
git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ../mupen64plus-core
export C_CLANG_SUFFIX="-15" C_GCC_SUFFIX="-12"
export BUILD_DEPS="libsdl1.2-dev libsdl2-dev"
./../mupen64plus-core/.github/workflows/scripts/ci_install_ubuntu_deps.sh ${{ matrix.arch }} ${{ matrix.cc }}
- name: Build and related stuff, backup binaries
run: |
export C_CLANG_SUFFIX="-15" C_GCC_SUFFIX="-12"
export PATH="$(pwd)/../mupen64plus-core/.github/workflows/scripts:${PATH}"
export CONFIG_OVERRIDE="SDL_CONFIG="sdl-config""
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }}
export CONFIG_OVERRIDE="SDL_CONFIG="sdl2-config""
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }} makepkg
- name: Upload artifact
if: matrix.cc == 'GCC'
uses: actions/upload-artifact@v4
with:
name: ${{ env.PKG_NAME }}
path: pkg/*.tar.gz
MSYS2:
strategy:
fail-fast: false
matrix:
include:
- cc: GCC
arch: x64
cross: x86_64
env: MINGW64
- cc: GCC
arch: x86
cross: i686
env: MINGW32
name: Windows / MSYS2 ${{ matrix.cc }} / ${{ matrix.arch }}
runs-on: windows-2022
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.env }}
update: true
install: >-
git
libtool
make
mingw-w64-${{ matrix.cross }}-gcc
mingw-w64-${{ matrix.cross }}-toolchain
mingw-w64-${{ matrix.cross }}-ntldd
mingw-w64-${{ matrix.cross }}-SDL2
- name: Build and related stuff, backup binaries
run: |
git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ../mupen64plus-core
./../mupen64plus-core/.github/workflows/scripts/ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }}
- name: Backup dependencies, etc...
run: |
./../mupen64plus-core/.github/workflows/scripts/ci_backup_mingw_deps.sh ${{ matrix.env }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.PKG_NAME }}
path: pkg/*
MSVC:
strategy:
fail-fast: false
matrix:
include:
- toolset: v143
arch: x64
vs: 2022
- toolset: v141_xp
arch: x86
vs: 2019
name: Windows / MSVC with ${{ matrix.toolset }} / ${{ matrix.arch }}
runs-on: windows-${{ matrix.vs }}
defaults:
run:
shell: cmd
steps:
- uses: actions/checkout@v4
- uses: microsoft/setup-msbuild@v2
- name: Build and related stuff, backup binaries
run: |
git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ..\mupen64plus-core
set TOOLSET=${{ matrix.toolset }}
.\..\mupen64plus-core\.github\workflows\scripts\ci_msvc_build.cmd ${{ matrix.arch }}
- name: Backup dependencies, etc...
run: |
.\..\mupen64plus-core\.github\workflows\scripts\ci_backup_msvc_deps.cmd ${{ matrix.arch }} SDL2.dll
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.PKG_NAME }}
path: pkg/*
Nightly-build:
runs-on: ubuntu-latest
if: github.ref_name == 'master'
needs: [Linux, MSYS2, MSVC]
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: binaries
- name: Get some tools
run: |
git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ../mupen64plus-core
sudo apt-get update
sudo apt-get -y install hashdeep
- name: Creating new artifacts and update nightly-build
run: |
./../mupen64plus-core/.github/workflows/scripts/ci_nightly_artifacts.sh
- name: Nightly-build
uses: ncipollo/release-action@v1
with:
prerelease: true
allowUpdates: true
removeArtifacts: true
replacesArtifacts: false
tag: nightly-build
artifacts: pkg/*

154
.github/workflows/schedule.yml vendored Normal file
View file

@ -0,0 +1,154 @@
name: SDL Input - Scheduled
on:
schedule:
- cron: '40 14 21 * *'
jobs:
Linux:
strategy:
fail-fast: false
matrix:
include:
- cc: GCC
arch: x64
- cc: GCC
arch: x86
- cc: Clang
arch: x64
- cc: Clang
arch: x86
name: Linux / ${{ matrix.cc }} / ${{ matrix.arch }}
runs-on: ubuntu-22.04
if: github.repository == 'mupen64plus/mupen64plus-input-sdl'
steps:
- uses: actions/checkout@v4
- name: Get build dependencies and arrange the environment
run: |
git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ../mupen64plus-core
export C_CLANG_SUFFIX="-15" C_GCC_SUFFIX="-12"
export BUILD_DEPS="libsdl1.2-dev libsdl2-dev"
./../mupen64plus-core/.github/workflows/scripts/ci_install_ubuntu_deps.sh ${{ matrix.arch }} ${{ matrix.cc }}
- name: Build and related stuff, backup binaries
run: |
export C_CLANG_SUFFIX="-15" C_GCC_SUFFIX="-12"
export PATH="$(pwd)/../mupen64plus-core/.github/workflows/scripts:${PATH}"
export CONFIG_OVERRIDE="SDL_CONFIG="sdl-config""
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }}
export CONFIG_OVERRIDE="SDL_CONFIG="sdl2-config""
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }} makepkg
- name: Upload artifact
if: matrix.cc == 'GCC'
uses: actions/upload-artifact@v4
with:
name: ${{ env.PKG_NAME }}
path: pkg/*.tar.gz
MSYS2:
strategy:
fail-fast: false
matrix:
include:
- cc: GCC
arch: x64
cross: x86_64
env: MINGW64
- cc: GCC
arch: x86
cross: i686
env: MINGW32
name: Windows / MSYS2 ${{ matrix.cc }} / ${{ matrix.arch }}
runs-on: windows-2022
if: github.repository == 'mupen64plus/mupen64plus-input-sdl'
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.env }}
update: true
install: >-
git
libtool
make
mingw-w64-${{ matrix.cross }}-gcc
mingw-w64-${{ matrix.cross }}-toolchain
mingw-w64-${{ matrix.cross }}-ntldd
mingw-w64-${{ matrix.cross }}-SDL2
- name: Build and related stuff, backup binaries
run: |
git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ../mupen64plus-core
./../mupen64plus-core/.github/workflows/scripts/ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }}
- name: Backup dependencies, etc...
run: |
./../mupen64plus-core/.github/workflows/scripts/ci_backup_mingw_deps.sh ${{ matrix.env }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.PKG_NAME }}
path: pkg/*
MSVC:
strategy:
fail-fast: false
matrix:
include:
- toolset: v143
arch: x64
vs: 2022
- toolset: v141_xp
arch: x86
vs: 2019
name: Windows / MSVC with ${{ matrix.toolset }} / ${{ matrix.arch }}
runs-on: windows-${{ matrix.vs }}
if: github.repository == 'mupen64plus/mupen64plus-input-sdl'
defaults:
run:
shell: cmd
steps:
- uses: actions/checkout@v4
- uses: microsoft/setup-msbuild@v2
- name: Build and related stuff, backup binaries
run: |
git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ..\mupen64plus-core
set TOOLSET=${{ matrix.toolset }}
.\..\mupen64plus-core\.github\workflows\scripts\ci_msvc_build.cmd ${{ matrix.arch }}
- name: Backup dependencies, etc...
run: |
.\..\mupen64plus-core\.github\workflows\scripts\ci_backup_msvc_deps.cmd ${{ matrix.arch }} SDL2.dll
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.PKG_NAME }}
path: pkg/*
Nightly-build:
runs-on: ubuntu-latest
if: github.ref_name == 'master'
needs: [Linux, MSYS2, MSVC]
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: binaries
- name: Get some tools
run: |
git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ../mupen64plus-core
sudo apt-get update
sudo apt-get -y install hashdeep
- name: Creating new artifacts and update nightly-build
run: |
./../mupen64plus-core/.github/workflows/scripts/ci_nightly_artifacts.sh
- name: Nightly-build
uses: ncipollo/release-action@v1
with:
prerelease: true
allowUpdates: true
removeArtifacts: true
replacesArtifacts: false
tag: nightly-build
artifacts: pkg/*

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
/projects/unix/_obj*/
/projects/unix/mupen64plus-input-sdl*.so
/build/

View file

@ -1,4 +0,0 @@
syntax: regexp
^projects/unix/_obj/
^projects/unix/mupen64plus-input-sdl.so$

51
.travis.yml Normal file
View file

@ -0,0 +1,51 @@
sudo: required
dist: xenial
language: cpp
compiler:
- gcc
- clang
addons:
apt:
packages:
- git
- libsdl1.2-dev
- libsdl2-dev
before_install:
- git clone --depth=1 --branch=master git://github.com/mupen64plus/mupen64plus-core.git deps/mupen64plus-core
env:
- PLUGINDBG=0
- PLUGINDBG=1
script:
- make -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 clean && LDFLAGS="-Wl,--no-add-needed -Wl,--no-undefined" OPTFLAGS="-O2" make SDL_CONFIG=sdl-config CC="${CC}" CXX="${CXX}" -j$(nproc) -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 all
- make -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 clean && LDFLAGS="-Wl,--no-add-needed -Wl,--no-undefined" OPTFLAGS="-O2" make SDL_CONFIG=sdl2-config CC="${CC}" CXX="${CXX}" -j$(nproc) -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 all
# extra mxe build entries
matrix:
include:
- env:
- MXE_CPU=i686
- PATH="/usr/lib/mxe/usr/bin/:$PATH"
before_install:
- curl -sSL "https://mirror.mxe.cc/repos/apt/client-conf/mxeapt.gpg" | sudo -E apt-key add -
- echo "deb https://mirror.mxe.cc/repos/apt xenial main" | sudo tee -a /etc/apt/sources.list
- sudo apt-get update -qq
- sudo apt-get -y --allow-unauthenticated install mxe-i686-w64-mingw32.shared-gcc
- sudo apt-get -y --allow-unauthenticated install mxe-i686-w64-mingw32.shared-sdl2
- git clone --depth=1 --branch=master git://github.com/mupen64plus/mupen64plus-core.git deps/mupen64plus-core
script:
- make UNAME=MINGW CROSS_COMPILE="${MXE_CPU}-w64-mingw32.shared-" CC="${MXE_CPU}-w64-mingw32.shared-gcc" CXX="${MXE_CPU}-w64-mingw32.shared-g++" HOST_CPU="${MXE_CPU}" SDL_CONFIG="${MXE_CPU}-w64-mingw32.shared-sdl2-config" -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 clean &&
make UNAME=MINGW CROSS_COMPILE="${MXE_CPU}-w64-mingw32.shared-" CC="${MXE_CPU}-w64-mingw32.shared-gcc" CXX="${MXE_CPU}-w64-mingw32.shared-g++" HOST_CPU="${MXE_CPU}" SDL_CONFIG="${MXE_CPU}-w64-mingw32.shared-sdl2-config" -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 -j$(nproc) all
- env:
- MXE_CPU=x86_64
- PATH="/usr/lib/mxe/usr/bin/:$PATH"
before_install:
- curl -sSL "https://mirror.mxe.cc/repos/apt/client-conf/mxeapt.gpg" | sudo -E apt-key add -
- echo "deb https://mirror.mxe.cc/repos/apt xenial main" | sudo tee -a /etc/apt/sources.list
- sudo apt-get update -qq
- sudo apt-get -y --allow-unauthenticated install mxe-x86-64-w64-mingw32.shared-gcc
- sudo apt-get -y --allow-unauthenticated install mxe-x86-64-w64-mingw32.shared-sdl2
- git clone --depth=1 --branch=master git://github.com/mupen64plus/mupen64plus-core.git deps/mupen64plus-core
script:
- make UNAME=MINGW CROSS_COMPILE="${MXE_CPU}-w64-mingw32.shared-" CC="${MXE_CPU}-w64-mingw32.shared-gcc" CXX="${MXE_CPU}-w64-mingw32.shared-g++" HOST_CPU="${MXE_CPU}" SDL_CONFIG="${MXE_CPU}-w64-mingw32.shared-sdl2-config" -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 clean &&
make UNAME=MINGW CROSS_COMPILE="${MXE_CPU}-w64-mingw32.shared-" CC="${MXE_CPU}-w64-mingw32.shared-gcc" CXX="${MXE_CPU}-w64-mingw32.shared-g++" HOST_CPU="${MXE_CPU}" SDL_CONFIG="${MXE_CPU}-w64-mingw32.shared-sdl2-config" -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 -j$(nproc) all

View file

@ -1,4 +1,5 @@
Original author: Gregor Anich <blight> Original author: Gregor Anich <blight>
Subsequent authors: many people from the Mupen64Plus team have worked on this code. Subsequent authors: many people from the Mupen64Plus team have worked on this code.
See the LICENSES file for more details.

View file

@ -14,7 +14,12 @@ The authors of Mupen64Plus-input-sdl are:
* Louai Al-Khanji (slougi) * Louai Al-Khanji (slougi)
* Bob Forder (orbitaldecay) * Bob Forder (orbitaldecay)
* Jason Espinosa (hasone) * Jason Espinosa (hasone)
* Bobby Smiles (bsmiles32)
* conchurnavid
* Fayvel
* HyperHacker * HyperHacker
* Nebuleon
* s-verma
* and others. * and others.
Mupen64Plus is based on GPL-licensed source code from Mupen64 v0.5, originally written by: Mupen64Plus is based on GPL-licensed source code from Mupen64 v0.5, originally written by:
@ -29,7 +34,7 @@ Mupen64Plus is based on GPL-licensed source code from Mupen64 v0.5, originally w
Version 2, June 1991 Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc. Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed. of this license document, but changing it is not allowed.

View file

@ -1,22 +1,19 @@
=============================================================================== ![Logo](https://upload.wikimedia.org/wikipedia/commons/thumb/4/41/Mupen64plus.svg/127px-Mupen64plus.svg.png)
-------------------------------------------------------------------------------
Mupen64plus-input-sdl README v2.0 # https://mupen64plus.org/wiki/index.php/ControllerSetup
------------------------------------------------------------------------------- # Mupen64plus-input-sdl README v2.0
===============================================================================
The latest documentation for this plugin can be found in wiki format at: The latest documentation for this plugin can be found in wiki format at:
https://code.google.com/p/mupen64plus/wiki/KeyboardSetup https://mupen64plus.org/wiki/index.php/KeyboardSetup
https://code.google.com/p/mupen64plus/wiki/ControllerSetup https://mupen64plus.org/wiki/index.php/ControllerSetup
The format and usage of this plugin's "mupen64plus.cfg" configuration options The format and usage of this plugin's "mupen64plus.cfg" configuration options
can be found at: can be found at:
http://mupen64plus.retrouprising.com/mediawiki/index.php?title=Mupen64Plus_Plugin_Parameters#Input-SDL https://mupen64plus.org/wiki/index.php/Mupen64Plus_Plugin_Parameters#Input-SDL
------------------------------------------------------------------------------- ## Notes about usage of SDL input plugin:
Notes about usage of SDL input plugin:
-------------------------------------------------------------------------------
- If one of the enabled controllers has the "mouse" general-purpose config parameters set - If one of the enabled controllers has the "mouse" general-purpose config parameters set
to True, the plugin will hide the mouse cursor and 'grab' the mouse pointer. The user to True, the plugin will hide the mouse cursor and 'grab' the mouse pointer. The user
@ -25,33 +22,78 @@ Notes about usage of SDL input plugin:
being pressed all the way to the edge. To decrease the amount of simulated joystick being pressed all the way to the edge. To decrease the amount of simulated joystick
deflection, the user may press Right Control, Right Shift, or Right Ctrl+Right Shift. deflection, the user may press Right Control, Right Shift, or Right Ctrl+Right Shift.
------------------------------------------------------------------------------- ## Default Keyboard interface:
Notes for supported joysticks for auto-configuration:
-------------------------------------------------------------------------------
1. Jess Tech Rumble Pad (Saitek Rumble) ```
Analog Pad is "Arrow Keys"
C Up/Left/Down/Right are "I", "J", "K", "L"
DPad Up/Left/Down/Right are "W", "A", "S", "D"
Z trig is "z" key
L and R trigs are "x" and "c"
Start is "Enter" ("Return")
A is "left shift"
B is "left control"
Select Mempack = ","
Select Rumblepack = "."
```
## Special modifier keys
- Right-shift key: reduce amplitude of analog joystick X/Y axes by 25%
- Right-control key: reduce amplitude of analog joystick X/Y axes by 50%
- Left-Control + Left-Alt keys: grab or un-grab the mouse cursor (only if mouse control is enabled)
- Left-Windows key: do not auto-center joystick X/Y axes (only when mouse control is enabled)
## Notes for supported joysticks for auto-configuration:
1) Jess Tech Rumble Pad (Saitek Rumble)
The left D-pad is mapped to the D-pad; The joystick is mapped to the left joystick of the gamepad; the C buttons are mapped to the gampad's right joystick. Start button is mapped to start; the A-button is mapped to the lowest button on the gamepad's right front; the B-button to the left button (buttons marked 3 and 1 on my gamepad). The L and R buttons are mapped to the lower left and right rear triggers; the Z button is mapped to the left upper rear trigger. All other buttons are unused. The left D-pad is mapped to the D-pad; The joystick is mapped to the left joystick of the gamepad; the C buttons are mapped to the gampad's right joystick. Start button is mapped to start; the A-button is mapped to the lowest button on the gamepad's right front; the B-button to the left button (buttons marked 3 and 1 on my gamepad). The L and R buttons are mapped to the lower left and right rear triggers; the Z button is mapped to the left upper rear trigger. All other buttons are unused.
2. Logitech Dual Action gamepad, Logitech Cordless Rumblepad 2: 2) Logitech Dual Action gamepad, Logitech Cordless Rumblepad 2:
The digital pad maps to the N64 d-pad. The left analog stick maps to the N64 analog stick. The digital pad maps to the N64 d-pad. The left analog stick maps to the N64 analog stick.
The right analog stick maps to the C-buttons, and the buttons 2 and 1 map to A and B. The right analog stick maps to the C-buttons, and the buttons 2 and 1 map to A and B.
Button 4 is the Z trigger, and the top shoulder buttons map to the left and right N64 triggers. Button 4 is the Z trigger, and the top shoulder buttons map to the left and right N64 triggers.
Button 10 is the start button. Button 10 is the start button.
The bottom shoulder buttons select the memory pack or rumble pak. The bottom shoulder buttons select the memory pack or rumble pak.
3. Logitech Logitech(R) Precision(TM) Gamepad, Gravis GamePad Pro USB 3) Logitech Logitech(R) Precision(TM) Gamepad, Gravis GamePad Pro USB
I came up with what I see as one of the few decent configurations (SSB aside) since it allows access to everything but the dpad. I came up with what I see as one of the few decent configurations (SSB aside) since it allows access to everything but the dpad.
A is L1, B is R1, Z is L2, R is R2, L is select. C buttons are the four buttons, and the dpad acts as the joystick. Not the most orthodox, but it works well. A is L1, B is R1, Z is L2, R is R2, L is select. C buttons are the four buttons, and the dpad acts as the joystick. Not the most orthodox, but it works well.
4. Microsoft X-Box 360 pad: 4) Microsoft Xbox 360 controller and clones:
C button U (up) and C button R (right) are assigned to the Y and B buttons.
All 4 C buttons are assigned to the U and V axis (including the already configured up and right C buttons).
The Z button has been assigned to the left trigger and switching the rumble on and off can be done with the right trigger.
Because there are no other buttons left I decided to use the button click behavior of the left joystick to switch Mempak on and off.
5. MP-8866 Dual USB Joypad: ```
N64 -> Xbox 360:
analog stick -> left stick
digital pad -> directional pad
R -> right bumper, right trigger
L -> left bumper
Z -> left trigger
A -> A
B -> X
start -> start
C buttons -> right stick
C left -> Y (additionally to right stick)
C down -> B (additionally to right stick)
mempak -> none for now
rumblepak -> none for now
```
As discussed in issue #478 Xbox 360 controllers should follow the above
mapping convention. If you want to add a Xbox 360 controller clone please
stick to it. As your clone might has different button naming, you can find
Xbox 360 controller button names at
https://en.wikipedia.org/wiki/File:360_controller.svg
Keys that are still unbound are back (aka. select) and left/right stick button
clicks. Those might be used for mempack and rumblepak toggles.
5) MP-8866 Dual USB Joypad:
This is a USB adapter for PlayStation controllers (2). This is a USB adapter for PlayStation controllers (2).
```
D-Pad: hat(0) D-Pad: hat(0)
L-Stick: x:0, y:1 L-Stick: x:0, y:1
R-Stick: x:2, y:3 R-Stick: x:2, y:3
@ -68,12 +110,36 @@ Select: button(9)
L3: button(10) L3: button(10)
R3: button(11) R3: button(11)
Note: This is when analog mode is selected. If analog is off then D-Pad becomes axes 0/1 and both sticks are disabled (including L3/R3). Note: This is when analog mode is selected. If analog is off then D-Pad becomes axes 0/1 and both sticks are disabled (including L3/R3).
```
6. N64 controller: 6) Nintendo Wiimote Classic
I am on a Mac and used https://code.google.com/p/wjoy/ successfully to connect my Wiimote + Classic Controller.
This is my working Wiimote + Class Controller configuration. You use the Classic Controller for all play, the Wiimote serves only as a host for the Classic Controller. I have swapped the left analog stick set as the C-Buttons and the right analog stick set as the N64 Analog (Y-Axis / X-Axis). This makes playing FPS titles like Perfect Dark a bit more reasonable for me. You can easily switch them by swapping 2 with 4 and 3 with 5 in the axis() sections below.
```
N64 -> Classic Controller
Z -> L
R -> R
L -> ZL
A -> A
B -> B
Start -> Start (+)
DPad -> DPad
CButtons -> Left Analog
Analog -> Right Analog
Mempak switch -> Home
Rumblepak switch -> Select (-)
```
7) N64 controller:
All controls are mapped to their proper place on the N64 controller with an Adaptoid or custom hardware with Gamecon driver. All controls are mapped to their proper place on the N64 controller with an Adaptoid or custom hardware with Gamecon driver.
Rumble and Memory packs can be selected with the 'r' and 'm' keys, respectively. Rumble and Memory packs can be selected with the 'r' and 'm' keys, respectively.
7. Playstation 3 Controller: 8) Playstation 3 Controller:
```
Left analog stick - analog stick Left analog stick - analog stick
Right analog stick - C-pad Right analog stick - C-pad
D-Pad - D-Pad D-Pad - D-Pad
@ -82,8 +148,9 @@ Square - B
L1 / R1 - L / R L1 / R1 - L / R
L2 - Z L2 - Z
Start - Start Start - Start
```
8. SAITEK P880: 9) SAITEK P880:
The gamepad doesnt have enough keys to real assign all buttons. The second The gamepad doesnt have enough keys to real assign all buttons. The second
analog stick can be used as button by pushing him insight. analog stick can be used as button by pushing him insight.
@ -96,14 +163,16 @@ used for A and B and the second and third row was used for C-Buttons - except
for the Button next to the A button which would be C-Down but got the Z for the Button next to the A button which would be C-Down but got the Z
button. button.
9. Xbox Gamepad (userspace driver) 10) Xbox Gamepad (userspace driver)
I created an Input Config for a Xbox 360 controller running with I created an Input Config for a Xbox 360 controller running with
xboxdrv on a Linux system (http://pingus.seul.org/~grumbel/xboxdrv/). xboxdrv on a Linux system (http://pingus.seul.org/~grumbel/xboxdrv/).
```
Z = Left shoulder button Z = Left shoulder button
L = Left shoulder trigger L = Left shoulder trigger
A = A Button A = A Button
B = X Button B = X Button
```
everything else should be obvious. everything else should be obvious.
@ -116,6 +185,7 @@ The guide=KEY_ESC allows you to quit the emulator by pressing the
guide key on the controller. This is obviously just nice-to-have and guide key on the controller. This is obviously just nice-to-have and
not actually neccessary for the config to work. not actually neccessary for the config to work.
```
[xboxdrv] [xboxdrv]
silent=true silent=true
trigger-as-button=true trigger-as-button=true
@ -127,20 +197,78 @@ guide=KEY_ESC
[axismap] [axismap]
x2^deadzone:27000 x2^deadzone:27000
y2^deadzone:27000 y2^deadzone:27000
```
10. Saitek Cyborg V.3 Rumble Pad (aka Saitek PS2700) 11) Saitek Cyborg V.3 Rumble Pad (aka Saitek PS2700)
Honestly, it's one of the best pads that I've used in a long time, so thought I'd contribute this quick config. Basically, Dpad and Analog sticks are unchanged, C-buttons are mapped to the right analog stick, L-R triggers are L1 and R1, Z is mapped to R2, A + B are mapped to X and Square, respectively, start is mapped to the Home button, and Triangle, Square, L2, Start, Select, and the Analog triggers are unused, since it's not intuitive to use them for what's left. Honestly, it's one of the best pads that I've used in a long time, so thought I'd contribute this quick config. Basically, Dpad and Analog sticks are unchanged, C-buttons are mapped to the right analog stick, L-R triggers are L1 and R1, Z is mapped to R2, A + B are mapped to X and Square, respectively, start is mapped to the Home button, and Triangle, Square, L2, Start, Select, and the Analog triggers are unused, since it's not intuitive to use them for what's left.
11. Default Keyboard interface: 12) Arsenal Gaming PS3 controller (aka. "Gasia Co.,Ltd PS(R) Gamepad")
Analog Pad is "Arrow Keys"
C Up/Left/Down/Right are "I", "J", "K", "L"
DPad Up/Left/Down/Right are "W", "A", "S", "D"
Z trig is "z" key
L and R trigs are "x" and "c"
Start is "Enter" ("Return")
A is "left shift"
B is "left control"
Select Mempack = ","
Select Rumblepack = "."
```
N64 Start = PS3 Start
N64 D-pad = PS3 D-pad
N64 joystick = PS3 left joystick
N64 C buttons = PS3 right joystick
N64 A = PS3 X
N64 B = PS3 Square
N64 R = PS3 R1
N64 L = PS3 L1
N64 Z = PS3 L2
Rumble pack swap = PS3 Triangle
Memory pack swap = PS3 Circle
```
13) Google Stadia controller
The Google Stadia controller can be used as a HID joystick by plugging it into a computer via USB-C or USB-C to USB-A.
```
N64 Start = Stadia Logo/Start
N64 D-pad = Stadia D-pad
N64 joystick = Stadia Left Analog Joystick
N64 C buttons = Stadia Right Analog Joystick
N64 A = Stadia A
N64 B = Stadia B
N64 R = Stadia Right Bumper
N64 L = Stadia Left Bumper
N64 Z = Stadia Left Trigger
Rumble pack swap = Stadia Y
Memory pack swap = Stadia X
```
14) PS4 Controller for Linux
The non-Linux configuration for the Sony Interactive Entertainment Wireless Controller had incompatible bindings. Z was right analog stick up.
I made a list of the ps4 buttons:
```
button 0 = cross
button 1 = circle
button 2 = triangle
button 3 = square
button 4 = l1
button 5 = r1
button 6 = l2
button 7 = r2
button 8 = share
button 9 = options
button 10 = ps
button 11 = l3
button 12 = r3
axis 0- = lstick left
axis 0+ = lstick right
axis 1- = lstick up
axis 1+ = lstick down
axis 2+ = l2
axis 2- = l2
axis 3- = rstick left
axis 3+ = rstick right
axis 4- = rstick up
axis 4+ = rstick down
axis 5+ = r2
axis 5- = r2
hat 0 Right = Right
hat 0 Left = Left
hat 0 Down = Down
hat 0 Up = Up
```

110
RELEASE
View file

@ -1,6 +1,116 @@
SDL Input plugin for Mupen64Plus SDL Input plugin for Mupen64Plus
-------------------------------- --------------------------------
----------------------------------------------
# Mupen64Plus-input-sdl v2.6.0 - July 14, 2024
## Merged PRs
* [132](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/132): CI/CD: Update to generic scripts, independent schedule, etc
* [128](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/128): Add support for "Xbox Series X Controller"
* [127](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/127): CI/CD: Fixes Ubuntu i386 builds, among other changes
* [126](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/126): Update rumble functions for SDL v2.0.18+
* [123](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/123): Fix inversion in C buttons on Ubuntu 22.04
* [122](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/122): CI/CD: Integrate scheduled builds and other...
* [118](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/118): Include yet another 360 controller.
* [117](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/117): CI/CD: Update MSVC
* [114](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/114): CI/CD: Update
* [113](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/113): Add USB controller from PS1 Classic
* [111](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/111): CI/CD: Implement GitHub Actions and public nightly builds
* [110](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/110): Sony PS4 Controller support for linux
* [109](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/109): Fix Xbox One S Controller
* [108](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/108): Add Xbox One Elite Controller to InputAutoCfg.ini
* [107](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/107): SAFFUN N64 A and B button and CL and CD button swapped
* [105](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/105): Add Google Stadia controller to README.md, minor button mapping updates.
* [104](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/104): Add input config for Google Stadia controller.
* [101](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/101): Add Dragonbox Pyra Controller Config
* [98](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/98): build: Allow out of tree builds.
* [97](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/97): Enable tiptoe walking mechanics in Banjo games...
* [94](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/94): Allow non-default compilers without resorting to symbolic links
* [93](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/93): Allow to set custom platform toolset from commands
* [91](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/91): Correctly manage SDL subsystems
* [90](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/90): AppVeyor with artifact packaging
* [89](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/89): Changes to have more generic project files
* [86](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/86): Fixes for Nintendo Wii Remote Pro Controller autoconfig
* [85](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/85): add tested autoconfig for "Controller (XEOX Gamepad)"
## Closed Issues
* [131](https://github.com/mupen64plus/mupen64plus-input-sdl/issues/131): No InputAutoConfig.ini entry for 'Xbox Series X Controller'
* [130](https://github.com/mupen64plus/mupen64plus-input-sdl/issues/130): vibration support
* [120](https://github.com/mupen64plus/mupen64plus-input-sdl/issues/120): [BUG] Key Modifier when pressing a diagonal
* [119](https://github.com/mupen64plus/mupen64plus-input-sdl/issues/119): inputautocfg.ini from home
* [103](https://github.com/mupen64plus/mupen64plus-input-sdl/issues/103): PS5 DS5 Dualsense controller on Linux button axis mapping
* [92](https://github.com/mupen64plus/mupen64plus-input-sdl/issues/92): InputAutoCfg.ini / Wrong Logitech F710 mappings for A and B.
* [84](https://github.com/mupen64plus/mupen64plus-input-sdl/issues/84): Numpad not working and unhandled exception when binding numpad key 5 with num lock turned off.
* [81](https://github.com/mupen64plus/mupen64plus-input-sdl/issues/81): Logitech F310 auto configuration issue
* [87](https://github.com/mupen64plus/mupen64plus-input-sdl/issues/87): Two MAYFLASH N64 Controller Adaptors Issue
* [80](https://github.com/mupen64plus/mupen64plus-input-sdl/issues/80): joy con on mupen64 discussion
* [79](https://github.com/mupen64plus/mupen64plus-input-sdl/issues/79): 2.5.9: Missing INPUT_API_VERSION change (2.5 Input plugin not working with 2.5.9 core)
## Top Contributors (2 or more commits)
1. richard42
2. Jj0YzL5nvJ
3. GhostlyDark
--------------------------------------------------
# Mupen64Plus-input-sdl v2.5.9 - February 10, 2019
## Merged PRs
* [78](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/78): Improve input-sdl startup time.
* [77](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/77): Remove use of ConfigSaveSection
* [76](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/76): Recognise DS4 controllers in Bluetooth mode
* [75](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/75): Updated support for the TigerGame Adapter
* [73](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/73): Added Markdown version of the README
* [72](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/72): Added an optional CMake build for mupen64plus-input-sdl
* [69](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/69): Added the gioteck VX2 Wireless controller.
* [68](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/68): Call SDL_PumpEvents() before processing inputs
* [65](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/65): Added Multilaser Controller JS030
* [63](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/63): Add auto config support for Guillemot Corporation DA Leader
* [62](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/62): Update homepage links
* [61](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/61): If DEBUG not set, set NDEBUG
* [60](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/60): Build MXE targets as additional tests in travis build matrix
* [58](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/58): Increase deadzone for axis->N64 button mappings
* [56](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/56): Fix Microsoft X-Box 360 pad for Linux
* [54](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/54): Fix Rumble switch button for Saitek P990 Dual Analog Pad.
* [53](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/53): Fix XBOX 360 For Windows Controller
* [50](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/50): Re-attach joystick if it has disconnected
* [48](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/48): Use faster container based Travis CI
* [45](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/45): Don't set "plugin" as part of autoconfig
* [41](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/41): bump macosx-version-min to 10.6 for SDL2.0.5
* [39](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/39): add PS4 controller name.
* [38](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/38): (InputAutoCfg) Configure HORIPAD ONE automatically.
* [36](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/36): Add autoconfigs for raphnet-tech v3 series adapters
* [35](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/35): Add Logic3 controller config
* [34](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/34): Use Ubuntu Trusty as base system for Travis CI
* [32](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/32): FIX Auto detection of PLAYSTATION(R)3 Controller on OSX
* [31](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/31): Add autoconfig support for Xbox One Wireless Controller (Dongle)
* [30](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/30): Fix up the "Generic X-Box pad" section in accordance with the README
* [29](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/29): Add "USB Gamepad "
* [28](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/28): Added x64 configuration to VisualStudio2013 project file
* [26](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/26): Remove unnecessary OpenBSD warning.
* [25](https://github.com/mupen64plus/mupen64plus-input-sdl/pull/25): add config for Sony playstation 4 controller
## Closed Issues
* [44](https://github.com/mupen64plus/mupen64plus-input-sdl/issues/44): Linux MayFlash Z and Start inverted
* [46](https://github.com/mupen64plus/mupen64plus-input-sdl/issues/46): Yoshis Story Stamp with 360 Controller
Mupen64Plus-input-sdl v2.5 - April 26, 2015
-------------------------------------------
- use SDL1.2 keysyms in the mupen64plus.cfg file Input section even when built against SDL2, with keysym converter
- SDL2: support for mapping mouse to controller analog x/y
- SDL2: improve/simplify rumble effect code
- use prioritization to decide among multiple matching auto-config sections (for SDL2 / XInput)
- New auto-config sections for: Wiimote Classic, Wii U Gamecube / Pro, MS SideWinder GamePad Pro, 17 others
- When Mouse=True but pointer is un-grabbed, fall back to joystick settings for analog x/y
- Prevent mouse/trackpad auto-centering behavior by pressing left-Windows key
Mupen64Plus-input-sdl v2.0 - July 4, 2013 Mupen64Plus-input-sdl v2.0 - July 4, 2013
----------------------------------------- -----------------------------------------
- re-write auto-configuration logic to be more user friendly. Add new 'mode' parameter. - re-write auto-configuration logic to be more user friendly. Add new 'mode' parameter.

43
appveyor.yml Normal file
View file

@ -0,0 +1,43 @@
version: 1.0.{build}
image: Visual Studio 2022
skip_tags: true
skip_commits:
files:
- '**/*.md'
- .github/
- data/*
- .gitattributes
- .gitignore
- .travis.yml
- README
configuration:
- Release
platform:
- Win32
- x64
before_build:
- git tag --delete nightly-build
- git clone --depth 1 https://github.com/mupen64plus/mupen64plus-win32-deps.git ..\mupen64plus-win32-deps
- git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ..\mupen64plus-core
build_script:
- msbuild projects\msvc\mupen64plus-input-sdl.vcxproj /p:Configuration=%configuration%;Platform=%platform%
after_build:
- ps: $env:rev1 = git describe --tags
- set rev2=%platform%
- if "%rev2%"=="Win32" set rev2=x86
- set filepkg=mupen64plus-input-sdl_v%rev1%_%rev2%
- cd projects\msvc\%platform%\%configuration%
- copy *.dll ..\..\..\..\data
- cd ..\..\..\..\data
- 7z a -t7z ..\build\%filepkg%.7z *
artifacts:
- path: build\$(filepkg).7z
name: $(filepkg)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,169 @@
# This module defines
# SDL2_LIBRARY, the name of the library to link against
# SDL2_FOUND, if false, do not try to link to SDL2
# SDL2_INCLUDE_DIR, where to find SDL.h
#
# This module responds to the the flag:
# SDL2_BUILDING_LIBRARY
# If this is defined, then no SDL2main will be linked in because
# only applications need main().
# Otherwise, it is assumed you are building an application and this
# module will attempt to locate and set the the proper link flags
# as part of the returned SDL2_LIBRARY variable.
#
# Don't forget to include SDLmain.h and SDLmain.m your project for the
# OS X framework based version. (Other versions link to -lSDL2main which
# this module will try to find on your behalf.) Also for OS X, this
# module will automatically add the -framework Cocoa on your behalf.
#
#
# Additional Note: If you see an empty SDL2_LIBRARY_TEMP in your configuration
# and no SDL2_LIBRARY, it means CMake did not find your SDL2 library
# (SDL2.dll, libsdl2.so, SDL2.framework, etc).
# Set SDL2_LIBRARY_TEMP to point to your SDL2 library, and configure again.
# Similarly, if you see an empty SDL2MAIN_LIBRARY, you should set this value
# as appropriate. These values are used to generate the final SDL2_LIBRARY
# variable, but when these values are unset, SDL2_LIBRARY does not get created.
#
#
# $SDL2DIR is an environment variable that would
# correspond to the ./configure --prefix=$SDL2DIR
# used in building SDL2.
# l.e.galup 9-20-02
#
# Modified by Eric Wing.
# Added code to assist with automated building by using environmental variables
# and providing a more controlled/consistent search behavior.
# Added new modifications to recognize OS X frameworks and
# additional Unix paths (FreeBSD, etc).
# Also corrected the header search path to follow "proper" SDL guidelines.
# Added a search for SDL2main which is needed by some platforms.
# Added a search for threads which is needed by some platforms.
# Added needed compile switches for MinGW.
#
# On OSX, this will prefer the Framework version (if found) over others.
# People will have to manually change the cache values of
# SDL2_LIBRARY to override this selection or set the CMake environment
# CMAKE_INCLUDE_PATH to modify the search paths.
#
# Note that the header path has changed from SDL2/SDL.h to just SDL.h
# This needed to change because "proper" SDL convention
# is #include "SDL.h", not <SDL2/SDL.h>. This is done for portability
# reasons because not all systems place things in SDL2/ (see FreeBSD).
#=============================================================================
# Copyright 2003-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
message("<FindSDL2.cmake>")
SET(SDL2_SEARCH_PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
${SDL2_PATH}
)
FIND_PATH(SDL2_INCLUDE_DIR SDL.h
HINTS
$ENV{SDL2DIR}
PATH_SUFFIXES include/SDL2 include
PATHS ${SDL2_SEARCH_PATHS}
)
FIND_LIBRARY(SDL2_LIBRARY_TEMP
NAMES SDL2
HINTS
$ENV{SDL2DIR}
PATH_SUFFIXES lib64 lib
PATHS ${SDL2_SEARCH_PATHS}
)
IF(NOT SDL2_BUILDING_LIBRARY)
IF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
# Non-OS X framework versions expect you to also dynamically link to
# SDL2main. This is mainly for Windows and OS X. Other (Unix) platforms
# seem to provide SDL2main for compatibility even though they don't
# necessarily need it.
FIND_LIBRARY(SDL2MAIN_LIBRARY
NAMES SDL2main
HINTS
$ENV{SDL2DIR}
PATH_SUFFIXES lib64 lib
PATHS ${SDL2_SEARCH_PATHS}
)
ENDIF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
ENDIF(NOT SDL2_BUILDING_LIBRARY)
# SDL2 may require threads on your system.
# The Apple build may not need an explicit flag because one of the
# frameworks may already provide it.
# But for non-OSX systems, I will use the CMake Threads package.
IF(NOT APPLE)
FIND_PACKAGE(Threads)
ENDIF(NOT APPLE)
# MinGW needs an additional library, mwindows
# It's total link flags should look like -lmingw32 -lSDL2main -lSDL2 -lmwindows
# (Actually on second look, I think it only needs one of the m* libraries.)
IF(MINGW)
SET(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW")
ENDIF(MINGW)
IF(SDL2_LIBRARY_TEMP)
# For SDL2main
IF(NOT SDL2_BUILDING_LIBRARY)
IF(SDL2MAIN_LIBRARY)
SET(SDL2_LIBRARY_TEMP ${SDL2MAIN_LIBRARY} ${SDL2_LIBRARY_TEMP})
ENDIF(SDL2MAIN_LIBRARY)
ENDIF(NOT SDL2_BUILDING_LIBRARY)
# For OS X, SDL2 uses Cocoa as a backend so it must link to Cocoa.
# CMake doesn't display the -framework Cocoa string in the UI even
# though it actually is there if I modify a pre-used variable.
# I think it has something to do with the CACHE STRING.
# So I use a temporary variable until the end so I can set the
# "real" variable in one-shot.
IF(APPLE)
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework Cocoa")
ENDIF(APPLE)
# For threads, as mentioned Apple doesn't need this.
# In fact, there seems to be a problem if I used the Threads package
# and try using this line, so I'm just skipping it entirely for OS X.
IF(NOT APPLE)
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT})
ENDIF(NOT APPLE)
# For MinGW library
IF(MINGW)
SET(SDL2_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARY_TEMP})
ENDIF(MINGW)
# Set the final string here so the GUI reflects the final state.
SET(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL2 Library can be found")
# Set the temp variable to INTERNAL so it is not seen in the CMake GUI
SET(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "")
ENDIF(SDL2_LIBRARY_TEMP)
message("</FindSDL2.cmake>")
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR)

View file

@ -0,0 +1,105 @@
cmake_minimum_required(VERSION 2.8.11)
project(mupen64plus-input-sdl)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(M64_APIDIR "${CMAKE_SOURCE_DIR}/../../../mupen64plus-core/src/api")
message("${CMAKE_SOURCE_DIR}/../../src/")
# State directories for modules and binaries
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Find)
set(CMAKE_CC_FLAGS "-ffast-math -fno-strict-aliasing -fvisibility=hidden -D_GNU_SOURCE=1")
set(CMAKE_CXX_FLAGS "-pthread -fvisibility-inlines-hidden")
set(SRCS
${CMAKE_SOURCE_DIR}/../../src/autoconfig.c
${CMAKE_SOURCE_DIR}/../../src/config.c
${CMAKE_SOURCE_DIR}/../../src/plugin.c
${CMAKE_SOURCE_DIR}/../../src/sdl_key_converter.c
)
if(WIN32)
set(SRCS
${SRCS}
${CMAKE_SOURCE_DIR}/../../src/osal_dynamiclib_win32.c
)
else()
set(SRCS
${SRCS}
${CMAKE_SOURCE_DIR}/../../src/osal_dynamiclib_unix.c
)
endif()
# Find dependencies
find_package(PNG REQUIRED)
if(NOT ZLIB_FOUND)
include(ZLIB)
message(FATAL_ERROR "Package zlib is required, but not found!")
endif(NOT ZLIB_FOUND)
find_package(PNG REQUIRED)
if(NOT PNG_FOUND)
include(PNG)
message(FATAL_ERROR "Package libpng is required, but not found!")
endif(NOT PNG_FOUND)
find_package(SDL2 REQUIRED)
if(NOT SDL2_FOUND)
include(SDL2)
message(FATAL_ERROR "Package SDL2 is required, but not found!")
endif(NOT SDL2_FOUND)
find_package(OpenGL REQUIRED)
if(NOT OpenGL_FOUND)
message(FATAL_ERROR "Package OpenGL is required, but not found!")
endif(NOT OpenGL_FOUND)
find_package(Freetype REQUIRED)
if(NOT FREETYPE_FOUND)
message(FATAL_ERROR "Package FreeType is required, but not found!")
endif(NOT FREETYPE_FOUND)
# Specify include directories
include_directories(
${PNG_INCLUDE_DIR}
${OpenGL_INCLUDE_DIR}
${SDL2_INCLUDE_DIR}
${FREETYPE_INCLUDE_DIR_ft2build}
${FREETYPE_INCLUDE_DIR_freetype2}
${M64_APIDIR}
${CMAKE_SOURCE_DIR}/../../src/
)
# Create the binary
add_library(${CMAKE_PROJECT_NAME} SHARED ${SRCS})
# Link the libraries
# add_dependencies(${CMAKE_PROJECT_NAME} ${SDL2_LIBRARIES})
if(WIN32)
target_link_libraries(${CMAKE_PROJECT_NAME}
${PNG_LIBRARY}
${OPENGL_LIBRARIES}
${SDL2_LIBRARY}
${ZLIB_LIBRARY}
)
elseif(APPLE)
target_link_libraries(${CMAKE_PROJECT_NAME}
${PNG_LIBRARY}
${OPENGL_LIBRARIES}
${SDL2_LIBRARY}
${ZLIB_LIBRARY}
)
else()
target_link_libraries(${CMAKE_PROJECT_NAME}
${PNG_LIBRARY}
${OPENGL_LIBRARIES}
${SDL2_LIBRARY}
${ZLIB_LIBRARY}
${FREETYPE_LIBRARIES}
dl
)
endif()

View file

@ -0,0 +1,161 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{7F3178D0-0E2E-471B-9160-69F0354F9DE9}</ProjectGuid>
<RootNamespace>mupen64plusinputsdl</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition="'$(WindowsTargetPlatformVersion)'=='' and '$(VisualStudioVersion)' != '14.0'">
<LatestTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</LatestTargetPlatformVersion>
<WindowsTargetPlatformVersion>$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion>
<TargetPlatformVersion>$(WindowsTargetPlatformVersion)</TargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(PlatformToolset)'=='' or '$(PlatformToolset)'=='v100'" Label="Configuration">
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\mupen64plus-core\src\api;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
</ClCompile>
<Link>
<AdditionalDependencies>..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\lib\x86\SDL2.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\mupen64plus-core\src\api;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
</ClCompile>
<Link>
<AdditionalDependencies>..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\lib\x64\SDL2.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..\..\..\mupen64plus-core\src\api;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile>
<Link>
<AdditionalDependencies>..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\lib\x86\SDL2.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..\..\..\mupen64plus-core\src\api;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile>
<Link>
<AdditionalDependencies>..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\lib\x64\SDL2.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\src\autoconfig.c" />
<ClCompile Include="..\..\src\config.c" />
<ClCompile Include="..\..\src\osal_dynamiclib_win32.c" />
<ClCompile Include="..\..\src\plugin.c" />
<ClCompile Include="..\..\src\sdl_key_converter.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src\autoconfig.h" />
<ClInclude Include="..\..\src\config.h" />
<ClInclude Include="..\..\src\osal_dynamiclib.h" />
<ClInclude Include="..\..\src\osal_preproc.h" />
<ClInclude Include="..\..\src\plugin.h" />
<ClInclude Include="..\..\src\sdl_key_converter.h" />
<ClInclude Include="..\..\src\version.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -1,112 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{7F3178D0-0E2E-471B-9160-69F0354F9DE9}</ProjectGuid>
<RootNamespace>mupen64plusinputsdl</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\mupen64plus-core\src\api;..\..\..\mupen64plus-win32-deps\SDL-1.2.14\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>..\..\..\mupen64plus-win32-deps\SDL-1.2.14\lib\SDL.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..\..\..\mupen64plus-core\src\api;..\..\..\mupen64plus-win32-deps\SDL-1.2.14\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>..\..\..\mupen64plus-win32-deps\SDL-1.2.14\lib\SDL.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\src\autoconfig.c" />
<ClCompile Include="..\..\src\config.c" />
<ClCompile Include="..\..\src\osal_dynamiclib_win32.c" />
<ClCompile Include="..\..\src\plugin.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src\autoconfig.h" />
<ClInclude Include="..\..\src\config.h" />
<ClInclude Include="..\..\src\osal_dynamiclib.h" />
<ClInclude Include="..\..\src\osal_preproc.h" />
<ClInclude Include="..\..\src\plugin.h" />
<ClInclude Include="..\..\src\version.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -1,232 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="mupen64plus-input-sdl"
ProjectGUID="{7F3178D0-0E2E-471B-9160-69F0354F9DE9}"
RootNamespace="mupen64plusinputsdl"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\mupen64plus-core\src\api;..\..\..\mupen64plus-win32-deps\SDL-1.2.14\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="..\..\..\mupen64plus-win32-deps\SDL-1.2.14\lib\SDL.lib"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\mupen64plus-core\src\api;..\..\..\mupen64plus-win32-deps\SDL-1.2.14\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="..\..\..\mupen64plus-win32-deps\SDL-1.2.14\lib\SDL.lib"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\src\autoconfig.c"
>
</File>
<File
RelativePath="..\..\src\config.c"
>
</File>
<File
RelativePath="..\..\src\osal_dynamiclib_win32.c"
>
</File>
<File
RelativePath="..\..\src\plugin.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\..\src\autoconfig.h"
>
</File>
<File
RelativePath="..\..\src\config.h"
>
</File>
<File
RelativePath="..\..\src\osal_dynamiclib.h"
>
</File>
<File
RelativePath="..\..\src\osal_preproc.h"
>
</File>
<File
RelativePath="..\..\src\plugin.h"
>
</File>
<File
RelativePath="..\..\src\version.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -1,6 +1,6 @@
#/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
# * Mupen64plus-input-sdl - Makefile * # * Mupen64plus-input-sdl - Makefile *
# * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ * # * Mupen64Plus homepage: https://mupen64plus.org/ *
# * Copyright (C) 2007-2009 Richard Goedeken * # * Copyright (C) 2007-2009 Richard Goedeken *
# * * # * *
# * This program is free software; you can redistribute it and/or modify * # * This program is free software; you can redistribute it and/or modify *
@ -52,7 +52,6 @@ ifeq ("$(UNAME)","OpenBSD")
OS = FREEBSD OS = FREEBSD
SO_EXTENSION = so SO_EXTENSION = so
SHARED = -shared SHARED = -shared
$(warning OS type "$(UNAME)" not officially supported.')
endif endif
ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","") ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","")
OS = LINUX OS = LINUX
@ -66,13 +65,12 @@ ifeq ("$(patsubst MINGW%,MINGW,$(UNAME))","MINGW")
PIC = 0 PIC = 0
endif endif
ifeq ("$(OS)","NONE") ifeq ("$(OS)","NONE")
$(error OS type "$(UNAME)" not supported. Please file bug report at 'http://code.google.com/p/mupen64plus/issues') $(error OS type "$(UNAME)" not supported. Please file bug report at 'https://github.com/mupen64plus/mupen64plus-core/issues')
endif endif
# detect system architecture # detect system architecture, only if it matters for build flags
HOST_CPU ?= $(shell uname -m) HOST_CPU ?= $(shell uname -m)
NO_ASM ?= 1 CPU := OTHER
CPU := NONE
ifneq ("$(filter x86_64 amd64,$(HOST_CPU))","") ifneq ("$(filter x86_64 amd64,$(HOST_CPU))","")
CPU := X86 CPU := X86
ifeq ("$(BITS)", "32") ifeq ("$(BITS)", "32")
@ -88,37 +86,19 @@ ifneq ("$(filter pentium i%86,$(HOST_CPU))","")
ARCH_DETECTED := 32BITS ARCH_DETECTED := 32BITS
PIC ?= 0 PIC ?= 0
endif endif
ifneq ("$(filter ppc macppc socppc powerpc,$(HOST_CPU))","") ifeq ("$(CPU)","OTHER")
CPU := PPC
ARCH_DETECTED := 32BITS
BIG_ENDIAN := 1
PIC ?= 1 PIC ?= 1
$(warning Architecture "$(HOST_CPU)" not officially supported.')
endif
ifneq ("$(filter ppc64 powerpc64,$(HOST_CPU))","")
CPU := PPC
ARCH_DETECTED := 64BITS
BIG_ENDIAN := 1
PIC ?= 1
$(warning Architecture "$(HOST_CPU)" not officially supported.')
endif
ifneq ("$(filter arm%,$(HOST_CPU))","")
ifeq ("$(filter arm%b,$(HOST_CPU))","")
CPU := ARM
ARCH_DETECTED := 32BITS
PIC ?= 1
$(warning Architecture "$(HOST_CPU)" not officially supported.')
endif
endif
ifeq ("$(CPU)","NONE")
$(error CPU type "$(HOST_CPU)" not supported. Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
endif endif
SRCDIR = ../../src
OBJDIR = _obj$(POSTFIX)
# base CFLAGS, LDLIBS, and LDFLAGS # base CFLAGS, LDLIBS, and LDFLAGS
OPTFLAGS ?= -O3 -flto OPTFLAGS ?= -O3 -flto
WARNFLAGS ?= -Wall WARNFLAGS ?= -Wall
CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -fno-strict-aliasing -fvisibility=hidden -I../../src -D_GNU_SOURCE=1 CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -fvisibility=hidden -I$(SRCDIR) -D_GNU_SOURCE=1
LDFLAGS += $(SHARED) LDFLAGS += $(SHARED)
LDLIBS += -lm
# Since we are building a shared library, we must compile with -fPIC on some architectures # Since we are building a shared library, we must compile with -fPIC on some architectures
# On 32-bit x86 systems we do not want to use -fPIC because we don't have to and it has a big performance penalty on this arch # On 32-bit x86 systems we do not want to use -fPIC because we don't have to and it has a big performance penalty on this arch
@ -128,57 +108,60 @@ else
CFLAGS += -fno-PIC CFLAGS += -fno-PIC
endif endif
ifeq ($(BIG_ENDIAN), 1)
CFLAGS += -DM64P_BIG_ENDIAN
endif
# tweak flags for 32-bit build on 64-bit system # tweak flags for 32-bit build on 64-bit system
ifeq ($(ARCH_DETECTED), 64BITS_32) ifeq ($(ARCH_DETECTED), 64BITS_32)
CFLAGS += -m32 ifeq ($(OS), FREEBSD)
LDFLAGS += -Wl,-m,elf_i386 $(error Do not use the BITS=32 option with FreeBSD, use -m32 and -m elf_i386)
endif
ifneq ($(OS), OSX)
ifeq ($(OS), MINGW)
LDFLAGS += -Wl,-m,i386pe
else
CFLAGS += -m32
LDFLAGS += -Wl,-m,elf_i386
endif
endif
endif
ifeq ($(ARCH_DETECTED), 64BITS)
ifeq ($(OS), MINGW)
LDFLAGS += -Wl,-m,i386pep
endif
endif endif
# set special flags per-system # set special flags per-system
ifeq ($(OS), FREEBSD)
ifeq ($(ARCH_DETECTED), 64BITS_32)
$(error Do not use the BITS=32 option with FreeBSD, use -m32 and -m elf_i386)
endif
endif
ifeq ($(OS), LINUX) ifeq ($(OS), LINUX)
LDLIBS += -ldl LDLIBS += -ldl
endif endif
ifeq ($(OS), OSX) ifeq ($(OS), OSX)
# Select the proper SDK OSX_SDK_PATH = $(shell xcrun --sdk macosx --show-sdk-path)
# Also, SDKs are stored in a different location since XCode 4.3
OSX_SDK ?= $(shell sw_vers -productVersion | cut -f1 -f2 -d .)
OSX_XCODEMAJ = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f1 -d .)
OSX_XCODEMIN = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f2 -d .)
OSX_XCODEGE43 = $(shell echo "`expr $(OSX_XCODEMAJ) \>= 4``expr $(OSX_XCODEMIN) \>= 3`")
ifeq ($(OSX_XCODEGE43), 11)
OSX_SYSROOT := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
else
OSX_SYSROOT := /Developer/SDKs
endif
ifeq ($(CPU), X86) ifeq ($(CPU), X86)
ifeq ($(ARCH_DETECTED), 64BITS) ifeq ($(ARCH_DETECTED), 64BITS)
CFLAGS += -arch x86_64 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk CFLAGS += -arch x86_64 -mmacosx-version-min=10.9 -isysroot $(OSX_SDK_PATH)
LDLIBS += -ldl LDLIBS += -ldl
else else
CFLAGS += -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk CFLAGS += -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=10.9 -isysroot $(OSX_SDK_PATH)
LDLIBS += -ldl -read_only_relocs suppress LDLIBS += -ldl -read_only_relocs suppress
endif endif
endif endif
endif endif
# test for essential build dependencies
ifeq ($(origin PKG_CONFIG), undefined)
PKG_CONFIG = $(CROSS_COMPILE)pkg-config
ifeq ($(shell which $(PKG_CONFIG) 2>/dev/null),)
$(error $(PKG_CONFIG) not found)
endif
endif
# test for presence of SDL # test for presence of SDL
ifeq ($(origin SDL_CFLAGS) $(origin SDL_LDLIBS), undefined undefined) ifeq ($(origin SDL_CFLAGS) $(origin SDL_LDLIBS), undefined undefined)
SDL_CONFIG = $(CROSS_COMPILE)sdl-config ifeq ($(shell $(PKG_CONFIG) --modversion sdl2 2>/dev/null),)
ifeq ($(shell which $(SDL_CONFIG) 2>/dev/null),) $(error No SDL2 development libraries found!)
$(error No SDL development libraries found!)
endif endif
SDL_CFLAGS += $(shell $(SDL_CONFIG) --cflags) SDL_CFLAGS += $(shell $(PKG_CONFIG) --cflags sdl2)
SDL_LDLIBS += $(shell $(SDL_CONFIG) --libs) SDL_LDLIBS += $(shell $(PKG_CONFIG) --libs sdl2)
endif endif
CFLAGS += $(SDL_CFLAGS) CFLAGS += $(SDL_CFLAGS)
LDLIBS += $(SDL_LDLIBS) LDLIBS += $(SDL_LDLIBS)
@ -227,6 +210,7 @@ ifeq ($(DEBUG),1)
CFLAGS += -g CFLAGS += -g
INSTALL_STRIP_FLAG ?= INSTALL_STRIP_FLAG ?=
else else
CFLAGS += -DNDEBUG
ifneq ($(OS),OSX) ifneq ($(OS),OSX)
INSTALL_STRIP_FLAG ?= -s INSTALL_STRIP_FLAG ?= -s
endif endif
@ -249,13 +233,11 @@ ifeq ($(PLUGINDIR),)
PLUGINDIR := $(LIBDIR)/mupen64plus PLUGINDIR := $(LIBDIR)/mupen64plus
endif endif
SRCDIR = ../../src
OBJDIR = _obj$(POSTFIX)
# list of source files to compile # list of source files to compile
SOURCE = \ SOURCE = \
$(SRCDIR)/plugin.c \ $(SRCDIR)/plugin.c \
$(SRCDIR)/autoconfig.c \ $(SRCDIR)/autoconfig.c \
$(SRCDIR)/sdl_key_converter.c \
$(SRCDIR)/config.c $(SRCDIR)/config.c
ifeq ($(OS),MINGW) ifeq ($(OS),MINGW)
@ -304,7 +286,7 @@ install: $(TARGET)
$(INSTALL) -d "$(DESTDIR)$(PLUGINDIR)" $(INSTALL) -d "$(DESTDIR)$(PLUGINDIR)"
$(INSTALL) -m 0644 $(INSTALL_STRIP_FLAG) $(TARGET) "$(DESTDIR)$(PLUGINDIR)" $(INSTALL) -m 0644 $(INSTALL_STRIP_FLAG) $(TARGET) "$(DESTDIR)$(PLUGINDIR)"
$(INSTALL) -d "$(DESTDIR)$(SHAREDIR)" $(INSTALL) -d "$(DESTDIR)$(SHAREDIR)"
$(INSTALL) -m 0644 "../../data/InputAutoCfg.ini" "$(DESTDIR)$(SHAREDIR)" $(INSTALL) -m 0644 "$(SRCDIR)/../data/InputAutoCfg.ini" "$(DESTDIR)$(SHAREDIR)"
uninstall: uninstall:
$(RM) "$(DESTDIR)$(PLUGINDIR)/$(TARGET)" $(RM) "$(DESTDIR)$(PLUGINDIR)/$(TARGET)"
@ -316,7 +298,7 @@ clean:
rebuild: clean all rebuild: clean all
# build dependency files # build dependency files
CFLAGS += -MD CFLAGS += -MD -MP
-include $(OBJECTS:.o=.d) -include $(OBJECTS:.o=.d)
# standard build rules # standard build rules

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-input-sdl - autoconfig.c * * Mupen64plus-input-sdl - autoconfig.c *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ * * Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2009-2013 Richard Goedeken * * Copyright (C) 2009-2013 Richard Goedeken *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
@ -19,12 +19,14 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include "m64p_types.h"
#include "m64p_config.h"
#include "osal_preproc.h"
#include "autoconfig.h" #include "autoconfig.h"
#include "m64p_config.h"
#include "m64p_types.h"
#include "osal_preproc.h"
#include "plugin.h" #include "plugin.h"
/* local definitions */ /* local definitions */
@ -115,6 +117,81 @@ int auto_copy_inputconfig(const char *pccSourceSectionName, const char *pccDestS
return 1; return 1;
} }
static int auto_compare_name(const char *joySDLName, char *line)
{
char *wordPtr;
int joyFound = 1, joyFoundScore = 0;
char Word[64];
wordPtr = line;
/* first, if there is a preceding system name in this .ini device name, and the system matches, then strip out */
#if defined(__unix__)
if (strncmp(wordPtr, "Unix:", 5) == 0) {
wordPtr = StripSpace(wordPtr + 5);
joyFoundScore = 1;
}
#endif
#if defined(__linux__)
if (strncmp(wordPtr, "Linux:", 6) == 0) {
wordPtr = StripSpace(wordPtr + 6);
joyFoundScore = 1;
}
#endif
#if defined(__APPLE__)
if (strncmp(wordPtr, "OSX:", 4) == 0) {
wordPtr = StripSpace(wordPtr + 4);
joyFoundScore = 1;
}
#endif
#if defined(WIN32)
if (strncmp(wordPtr, "Win32:", 6) == 0) {
wordPtr = StripSpace(wordPtr + 6);
joyFoundScore = 1;
}
else if (strncmp(wordPtr, "XInput:", 7) == 0) {
wordPtr = StripSpace(wordPtr + 7);
joyFoundScore = 2;
}
#endif
/* extra points if the section name is a perfect match */
if (strcmp(wordPtr, joySDLName) == 0)
joyFoundScore += 4;
/* search in the .ini device name for all the words in the joystick name. If any are missing, then this is not the right joystick model */
while (wordPtr != NULL && strlen(wordPtr) > 0)
{
/* skip over any preceding spaces */
while (*wordPtr == ' ')
wordPtr++;
if (*wordPtr == 0)
break;
/* search for the next space after the current word */
char *nextSpace = strchr(wordPtr, ' ');
if (nextSpace == NULL)
{
strncpy(Word, wordPtr, 63);
Word[63] = 0;
wordPtr = NULL;
}
else
{
int length = (int) (nextSpace - wordPtr);
if (length > 63) length = 63;
strncpy(Word, wordPtr, length);
Word[length] = 0;
wordPtr = nextSpace + 1;
}
if (strcasestr(joySDLName, Word) == NULL)
joyFound = 0;
else
joyFoundScore += 4;
}
if (joyFound)
return joyFoundScore;
else
return -1;
}
int auto_set_defaults(int iDeviceIdx, const char *joySDLName) int auto_set_defaults(int iDeviceIdx, const char *joySDLName)
{ {
FILE *pfIn; FILE *pfIn;
@ -124,6 +201,7 @@ int auto_set_defaults(int iDeviceIdx, const char *joySDLName)
char *pchIni, *pchNextLine, *pchCurLine; char *pchIni, *pchNextLine, *pchCurLine;
long iniLength; long iniLength;
int ControllersFound = 0; int ControllersFound = 0;
int joyFoundScore = -1;
/* if we couldn't get a name (no joystick plugged in to given port), then return with a failure */ /* if we couldn't get a name (no joystick plugged in to given port), then return with a failure */
if (joySDLName == NULL) if (joySDLName == NULL)
@ -145,6 +223,12 @@ int auto_set_defaults(int iDeviceIdx, const char *joySDLName)
fseek(pfIn, 0L, SEEK_END); fseek(pfIn, 0L, SEEK_END);
iniLength = ftell(pfIn); iniLength = ftell(pfIn);
fseek(pfIn, 0L, SEEK_SET); fseek(pfIn, 0L, SEEK_SET);
if (iniLength < 0) {
DebugMessage(M64MSG_ERROR, "Couldn't get size of config file '%s'", CfgFilePath);
fclose(pfIn);
return 0;
}
pchIni = (char *) malloc(iniLength + 1); pchIni = (char *) malloc(iniLength + 1);
if (pchIni == NULL) if (pchIni == NULL)
{ {
@ -163,11 +247,13 @@ int auto_set_defaults(int iDeviceIdx, const char *joySDLName)
pchIni[iniLength] = 0; pchIni[iniLength] = 0;
/* parse the INI file, line by line */ /* parse the INI file, line by line */
DebugMessage(M64MSG_INFO, "Using auto-config file at: '%s'", CfgFilePath);
pchNextLine = pchIni; pchNextLine = pchIni;
eParseState = E_NAME_SEARCH; eParseState = E_NAME_SEARCH;
while (pchNextLine != NULL && *pchNextLine != 0) while (pchNextLine != NULL && *pchNextLine != 0)
{ {
char *pivot = NULL; char *pivot = NULL;
int joyFound = 0;
/* set up character pointers */ /* set up character pointers */
pchCurLine = pchNextLine; pchCurLine = pchNextLine;
pchNextLine = strchr(pchNextLine, '\n'); pchNextLine = strchr(pchNextLine, '\n');
@ -182,66 +268,18 @@ int auto_set_defaults(int iDeviceIdx, const char *joySDLName)
/* handle section (joystick name in ini file) */ /* handle section (joystick name in ini file) */
if (*pchCurLine == '[' && pchCurLine[strlen(pchCurLine)-1] == ']') if (*pchCurLine == '[' && pchCurLine[strlen(pchCurLine)-1] == ']')
{ {
char Word[64]; /* only switch to name search when some section body was identified since last header */
char *wordPtr;
int joyFound = 1;
if (eParseState == E_PARAM_READ) if (eParseState == E_PARAM_READ)
{ eParseState = E_NAME_SEARCH;
/* we've finished parsing all parameters for the discovered input device */
free(pchIni);
return ControllersFound;
}
else if (eParseState == E_NAME_FOUND)
{
/* this is an equivalent device name to the one we're looking for (and found); keep looking for parameters */
continue;
}
/* we need to look through the device name word by word to see if it matches the joySDLName that we're looking for */ /* we need to look through the device name word by word to see if it matches the joySDLName that we're looking for */
pchCurLine[strlen(pchCurLine)-1] = 0; pchCurLine[strlen(pchCurLine)-1] = 0;
wordPtr = StripSpace(pchCurLine + 1); joyFound = auto_compare_name(joySDLName, StripSpace(pchCurLine + 1));
/* first, if there is a preceding system name in this .ini device name, and the system matches, then strip out */
#if defined(__unix__)
if (strncmp(wordPtr, "Unix:", 5) == 0)
wordPtr = StripSpace(wordPtr + 5);
#endif
#if defined(__linux__)
if (strncmp(wordPtr, "Linux:", 6) == 0)
wordPtr = StripSpace(wordPtr + 6);
#endif
#if defined(__APPLE__)
if (strncmp(wordPtr, "OSX:", 4) == 0)
wordPtr = StripSpace(wordPtr + 4);
#endif
#if defined(WIN32)
if (strncmp(wordPtr, "Win32:", 6) == 0)
wordPtr = StripSpace(wordPtr + 6);
#endif
/* search in the .ini device name for all the words in the joystick name. If any are missing, then this is not the right joystick model */
while (wordPtr != NULL && strlen(wordPtr) > 0)
{
char *nextSpace = strchr(wordPtr, ' ');
if (nextSpace == NULL)
{
strncpy(Word, wordPtr, 63);
Word[63] = 0;
wordPtr = NULL;
}
else
{
int length = (int) (nextSpace - wordPtr);
if (length > 63) length = 63;
strncpy(Word, wordPtr, length);
Word[length] = 0;
wordPtr = nextSpace + 1;
}
if (strcasestr(joySDLName, Word) == NULL)
joyFound = 0;
}
/* if we found the right joystick, then open up the core config section to store parameters and set the 'device' param */ /* if we found the right joystick, then open up the core config section to store parameters and set the 'device' param */
if (joyFound) if (joyFound > joyFoundScore)
{ {
char SectionName[32]; char SectionName[32];
ControllersFound = 0;
sprintf(SectionName, "AutoConfig%i", ControllersFound); sprintf(SectionName, "AutoConfig%i", ControllersFound);
if (ConfigOpenSection(SectionName, &pConfig) != M64ERR_SUCCESS) if (ConfigOpenSection(SectionName, &pConfig) != M64ERR_SUCCESS)
{ {
@ -252,6 +290,7 @@ int auto_set_defaults(int iDeviceIdx, const char *joySDLName)
eParseState = E_NAME_FOUND; eParseState = E_NAME_FOUND;
ControllersFound++; ControllersFound++;
ConfigSetParameter(pConfig, "device", M64TYPE_INT, &iDeviceIdx); ConfigSetParameter(pConfig, "device", M64TYPE_INT, &iDeviceIdx);
joyFoundScore = joyFound;
} }
continue; continue;
} }
@ -268,7 +307,7 @@ int auto_set_defaults(int iDeviceIdx, const char *joySDLName)
*pivot++ = 0; *pivot++ = 0;
pchCurLine = StripSpace(pchCurLine); pchCurLine = StripSpace(pchCurLine);
pivot = StripSpace(pivot); pivot = StripSpace(pivot);
if (strcasecmp(pchCurLine, "plugin") == 0 || strcasecmp(pchCurLine, "device") == 0) if (strcasecmp(pchCurLine, "device") == 0)
{ {
int iVal = atoi(pivot); int iVal = atoi(pivot);
ConfigSetParameter(pConfig, pchCurLine, M64TYPE_INT, &iVal); ConfigSetParameter(pConfig, pchCurLine, M64TYPE_INT, &iVal);
@ -291,6 +330,7 @@ int auto_set_defaults(int iDeviceIdx, const char *joySDLName)
/* if we haven't found the correct section yet, just skip this */ /* if we haven't found the correct section yet, just skip this */
if (eParseState == E_NAME_SEARCH) if (eParseState == E_NAME_SEARCH)
continue; continue;
eParseState = E_PARAM_READ;
/* otherwise parse the keyword */ /* otherwise parse the keyword */
if (strcmp(pchCurLine, "__NextController:") == 0) if (strcmp(pchCurLine, "__NextController:") == 0)
{ {
@ -323,7 +363,7 @@ int auto_set_defaults(int iDeviceIdx, const char *joySDLName)
DebugMessage(M64MSG_ERROR, "Invalid line in %s: '%s'", INI_FILE_NAME, pchCurLine); DebugMessage(M64MSG_ERROR, "Invalid line in %s: '%s'", INI_FILE_NAME, pchCurLine);
} }
if (eParseState == E_PARAM_READ) if (joyFoundScore != -1)
{ {
/* we've finished parsing all parameters for the discovered input device, which is the last in the .ini file */ /* we've finished parsing all parameters for the discovered input device, which is the last in the .ini file */
free(pchIni); free(pchIni);

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-input-sdl - autoconfig.h * * Mupen64plus-input-sdl - autoconfig.h *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ * * Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2009 Richard Goedeken * * Copyright (C) 2009 Richard Goedeken *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-input-sdl - config.c * * Mupen64plus-input-sdl - config.c *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ * * Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2009-2013 Richard Goedeken * * Copyright (C) 2009-2013 Richard Goedeken *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
@ -20,17 +20,18 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <SDL.h> #include <SDL.h>
#include <stdio.h>
#include <string.h>
#define M64P_PLUGIN_PROTOTYPES 1 #define M64P_PLUGIN_PROTOTYPES 1
#include "m64p_types.h"
#include "m64p_plugin.h"
#include "m64p_config.h"
#include "osal_preproc.h"
#include "autoconfig.h" #include "autoconfig.h"
#include "plugin.h"
#include "config.h" #include "config.h"
#include "m64p_config.h"
#include "m64p_plugin.h"
#include "m64p_types.h"
#include "osal_preproc.h"
#include "plugin.h"
#include "sdl_key_converter.h"
#define HAT_POS_NAME( hat ) \ #define HAT_POS_NAME( hat ) \
((hat == SDL_HAT_UP) ? "Up" : \ ((hat == SDL_HAT_UP) ? "Up" : \
@ -88,7 +89,7 @@ static void clear_controller(int iCtrlIdx)
controller[iCtrlIdx].device = DEVICE_NO_JOYSTICK; controller[iCtrlIdx].device = DEVICE_NO_JOYSTICK;
controller[iCtrlIdx].control->Present = 0; controller[iCtrlIdx].control->Present = 0;
controller[iCtrlIdx].control->RawData = 0; controller[iCtrlIdx].control->RawData = 0;
controller[iCtrlIdx].control->Plugin = PLUGIN_NONE; controller[iCtrlIdx].control->Plugin = PLUGIN_MEMPAK;
for( b = 0; b < 16; b++ ) for( b = 0; b < 16; b++ )
{ {
controller[iCtrlIdx].button[b].button = -1; controller[iCtrlIdx].button[b].button = -1;
@ -120,15 +121,6 @@ static const char * get_sdl_joystick_name(int iCtrlIdx)
{ {
static char JoyName[256]; static char JoyName[256];
const char *joySDLName; const char *joySDLName;
int joyWasInit = SDL_WasInit(SDL_INIT_JOYSTICK);
/* initialize the joystick subsystem if necessary */
if (!joyWasInit)
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1)
{
DebugMessage(M64MSG_ERROR, "Couldn't init SDL joystick subsystem: %s", SDL_GetError() );
return NULL;
}
/* get the name of the corresponding joystick */ /* get the name of the corresponding joystick */
joySDLName = SDL_JoystickName(iCtrlIdx); joySDLName = SDL_JoystickName(iCtrlIdx);
@ -140,10 +132,6 @@ static const char * get_sdl_joystick_name(int iCtrlIdx)
JoyName[255] = 0; JoyName[255] = 0;
} }
/* quit the joystick subsystem if necessary */
if (!joyWasInit)
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
/* if the SDL function had an error, then return NULL, otherwise return local copy of joystick name */ /* if the SDL function had an error, then return NULL, otherwise return local copy of joystick name */
if (joySDLName == NULL) if (joySDLName == NULL)
return NULL; return NULL;
@ -151,29 +139,6 @@ static const char * get_sdl_joystick_name(int iCtrlIdx)
return JoyName; return JoyName;
} }
static int get_sdl_num_joysticks(void)
{
int numJoysticks = 0;
int joyWasInit = SDL_WasInit(SDL_INIT_JOYSTICK);
/* initialize the joystick subsystem if necessary */
if (!joyWasInit)
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1)
{
DebugMessage(M64MSG_ERROR, "Couldn't init SDL joystick subsystem: %s", SDL_GetError() );
return 0;
}
/* get thenumber of joysticks */
numJoysticks = SDL_NumJoysticks();
/* quit the joystick subsystem if necessary */
if (!joyWasInit)
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
return numJoysticks;
}
///////////////////////////////////// /////////////////////////////////////
// load_controller_config() // load_controller_config()
// return value: 1 = OK // return value: 1 = OK
@ -196,17 +161,12 @@ static int load_controller_config(const char *SectionName, int i, int sdlDeviceI
/* set SDL device number */ /* set SDL device number */
controller[i].device = sdlDeviceIdx; controller[i].device = sdlDeviceIdx;
/* throw warnings if 'plugged' or 'plugin' are missing */ /* throw warnings if 'plugged' is missing */
if (ConfigGetParameter(pConfig, "plugged", M64TYPE_BOOL, &controller[i].control->Present, sizeof(int)) != M64ERR_SUCCESS) if (ConfigGetParameter(pConfig, "plugged", M64TYPE_BOOL, &controller[i].control->Present, sizeof(int)) != M64ERR_SUCCESS)
{ {
DebugMessage(M64MSG_WARNING, "missing 'plugged' parameter from config section %s. Setting to 1 (true).", SectionName); DebugMessage(M64MSG_WARNING, "missing 'plugged' parameter from config section %s. Setting to 1 (true).", SectionName);
controller[i].control->Present = 1; controller[i].control->Present = 1;
} }
if (ConfigGetParameter(pConfig, "plugin", M64TYPE_INT, &controller[i].control->Plugin, sizeof(int)) != M64ERR_SUCCESS)
{
DebugMessage(M64MSG_WARNING, "missing 'plugin' parameter from config section %s. Setting to 1 (none).", SectionName);
controller[i].control->Plugin = PLUGIN_NONE;
}
/* load optional parameters */ /* load optional parameters */
ConfigGetParameter(pConfig, "mouse", M64TYPE_BOOL, &controller[i].mouse, sizeof(int)); ConfigGetParameter(pConfig, "mouse", M64TYPE_BOOL, &controller[i].mouse, sizeof(int));
if (ConfigGetParameter(pConfig, "MouseSensitivity", M64TYPE_STRING, input_str, 256) == M64ERR_SUCCESS) if (ConfigGetParameter(pConfig, "MouseSensitivity", M64TYPE_STRING, input_str, 256) == M64ERR_SUCCESS)
@ -232,9 +192,13 @@ static int load_controller_config(const char *SectionName, int i, int sdlDeviceI
DebugMessage(M64MSG_WARNING, "missing config key '%s' for controller %i button %i", button_names[j], i+1, j); DebugMessage(M64MSG_WARNING, "missing config key '%s' for controller %i button %i", button_names[j], i+1, j);
continue; continue;
} }
if ((config_ptr = strstr(input_str, "key")) != NULL) if ((config_ptr = strstr(input_str, "key")) != NULL) {
if (sscanf(config_ptr, "key(%i)", (int *) &controller[i].button[j].key) != 1) if (sscanf(config_ptr, "key(%i)", (int *) &controller[i].button[j].key) != 1) {
DebugMessage(M64MSG_WARNING, "parsing error in key() parameter of button '%s' for controller %i", button_names[j], i + 1); DebugMessage(M64MSG_WARNING, "parsing error in key() parameter of button '%s' for controller %i", button_names[j], i + 1);
} else {
controller[i].button[j].key = sdl_keysym2native(controller[i].button[j].key);
}
}
if ((config_ptr = strstr(input_str, "button")) != NULL) if ((config_ptr = strstr(input_str, "button")) != NULL)
if (sscanf(config_ptr, "button(%i)", &controller[i].button[j].button) != 1) if (sscanf(config_ptr, "button(%i)", &controller[i].button[j].button) != 1)
DebugMessage(M64MSG_WARNING, "parsing error in button() parameter of button '%s' for controller %i", button_names[j], i + 1); DebugMessage(M64MSG_WARNING, "parsing error in button() parameter of button '%s' for controller %i", button_names[j], i + 1);
@ -270,9 +234,14 @@ static int load_controller_config(const char *SectionName, int i, int sdlDeviceI
DebugMessage(M64MSG_WARNING, "missing config key '%s' for controller %i axis %i", button_names[j], i+1, axis_idx); DebugMessage(M64MSG_WARNING, "missing config key '%s' for controller %i axis %i", button_names[j], i+1, axis_idx);
continue; continue;
} }
if ((config_ptr = strstr(input_str, "key")) != NULL) if ((config_ptr = strstr(input_str, "key")) != NULL) {
if (sscanf(config_ptr, "key(%i,%i)", (int *) &controller[i].axis[axis_idx].key_a, (int *) &controller[i].axis[axis_idx].key_b) != 2) if (sscanf(config_ptr, "key(%i,%i)", (int *) &controller[i].axis[axis_idx].key_a, (int *) &controller[i].axis[axis_idx].key_b) != 2) {
DebugMessage(M64MSG_WARNING, "parsing error in key() parameter of axis '%s' for controller %i", button_names[j], i + 1); DebugMessage(M64MSG_WARNING, "parsing error in key() parameter of axis '%s' for controller %i", button_names[j], i + 1);
} else {
controller[i].axis[axis_idx].key_a = sdl_keysym2native(controller[i].axis[axis_idx].key_a);
controller[i].axis[axis_idx].key_b = sdl_keysym2native(controller[i].axis[axis_idx].key_b);
}
}
if ((config_ptr = strstr(input_str, "button")) != NULL) if ((config_ptr = strstr(input_str, "button")) != NULL)
if (sscanf(config_ptr, "button(%i,%i)", &controller[i].axis[axis_idx].button_a, &controller[i].axis[axis_idx].button_b) != 2) if (sscanf(config_ptr, "button(%i,%i)", &controller[i].axis[axis_idx].button_a, &controller[i].axis[axis_idx].button_b) != 2)
DebugMessage(M64MSG_WARNING, "parsing error in button() parameter of axis '%s' for controller %i", button_names[j], i + 1); DebugMessage(M64MSG_WARNING, "parsing error in button() parameter of axis '%s' for controller %i", button_names[j], i + 1);
@ -324,7 +293,7 @@ static void init_controller_config(int iCtrlIdx, const char *pccDeviceName, eMod
ConfigSetDefaultInt(pConfig, "device", controller[iCtrlIdx].device, "Specifies which joystick is bound to this controller: -1=No joystick, 0 or more= SDL Joystick number"); ConfigSetDefaultInt(pConfig, "device", controller[iCtrlIdx].device, "Specifies which joystick is bound to this controller: -1=No joystick, 0 or more= SDL Joystick number");
ConfigSetDefaultString(pConfig, "name", pccDeviceName, "SDL joystick name (or Keyboard)"); ConfigSetDefaultString(pConfig, "name", pccDeviceName, "SDL joystick name (or Keyboard)");
ConfigSetDefaultBool(pConfig, "plugged", controller[iCtrlIdx].control->Present, "Specifies whether this controller is 'plugged in' to the simulated N64"); ConfigSetDefaultBool(pConfig, "plugged", controller[iCtrlIdx].control->Present, "Specifies whether this controller is 'plugged in' to the simulated N64");
ConfigSetDefaultInt(pConfig, "plugin", controller[iCtrlIdx].control->Plugin, "Specifies which type of expansion pak is in the controller: 1=None, 2=Mem pak, 5=Rumble pak"); ConfigSetDefaultInt(pConfig, "plugin", controller[iCtrlIdx].control->Plugin, "Specifies which type of expansion pak is in the controller: 1=None, 2=Mem pak, 4=Transfer pak, 5=Rumble pak");
ConfigSetDefaultBool(pConfig, "mouse", controller[iCtrlIdx].mouse, "If True, then mouse buttons may be used with this controller"); ConfigSetDefaultBool(pConfig, "mouse", controller[iCtrlIdx].mouse, "If True, then mouse buttons may be used with this controller");
sprintf(Param, "%.2f,%.2f", controller[iCtrlIdx].mouse_sens[0], controller[iCtrlIdx].mouse_sens[1]); sprintf(Param, "%.2f,%.2f", controller[iCtrlIdx].mouse_sens[0], controller[iCtrlIdx].mouse_sens[1]);
@ -342,7 +311,7 @@ static void init_controller_config(int iCtrlIdx, const char *pccDeviceName, eMod
ParamString[0] = 0; ParamString[0] = 0;
if (controller[iCtrlIdx].button[j].key > 0) if (controller[iCtrlIdx].button[j].key > 0)
{ {
sprintf(Param, "key(%i) ", controller[iCtrlIdx].button[j].key); sprintf(Param, "key(%i) ", sdl_native2keysym(controller[iCtrlIdx].button[j].key));
strcat(ParamString, Param); strcat(ParamString, Param);
} }
if (controller[iCtrlIdx].button[j].button >= 0) if (controller[iCtrlIdx].button[j].button >= 0)
@ -388,7 +357,7 @@ static void init_controller_config(int iCtrlIdx, const char *pccDeviceName, eMod
ParamString[0] = 0; ParamString[0] = 0;
if (controller[iCtrlIdx].axis[j].key_a > 0 && controller[iCtrlIdx].axis[j].key_b > 0) if (controller[iCtrlIdx].axis[j].key_a > 0 && controller[iCtrlIdx].axis[j].key_b > 0)
{ {
sprintf(Param, "key(%i,%i) ", controller[iCtrlIdx].axis[j].key_a, controller[iCtrlIdx].axis[j].key_b); sprintf(Param, "key(%i,%i) ", sdl_native2keysym(controller[iCtrlIdx].axis[j].key_a), sdl_native2keysym(controller[iCtrlIdx].axis[j].key_b));
strcat(ParamString, Param); strcat(ParamString, Param);
} }
if (controller[iCtrlIdx].axis[j].button_a >= 0 && controller[iCtrlIdx].axis[j].button_b >= 0) if (controller[iCtrlIdx].axis[j].button_a >= 0 && controller[iCtrlIdx].axis[j].button_b >= 0)
@ -444,7 +413,6 @@ static int setup_auto_controllers(int bPreConfig, int n64CtrlStart, int sdlCtrlI
if (!bPreConfig) if (!bPreConfig)
DebugMessage(M64MSG_INFO, "N64 Controller #%i: Using auto-config with SDL joystick %i ('%s')", n64CtrlStart+1, sdlCtrlIdx, sdlJoyName); DebugMessage(M64MSG_INFO, "N64 Controller #%i: Using auto-config with SDL joystick %i ('%s')", n64CtrlStart+1, sdlCtrlIdx, sdlJoyName);
ActiveControllers++; ActiveControllers++;
ConfigSaveSection(SectionName);
} }
else else
{ {
@ -482,7 +450,6 @@ static int setup_auto_controllers(int bPreConfig, int n64CtrlStart, int sdlCtrlI
if (!bPreConfig) if (!bPreConfig)
DebugMessage(M64MSG_INFO, "N64 Controller #%i: Using auto-config with SDL joystick %i ('%s')", n64CtrlStart+j+1, sdlCtrlIdx, sdlJoyName); DebugMessage(M64MSG_INFO, "N64 Controller #%i: Using auto-config with SDL joystick %i ('%s')", n64CtrlStart+j+1, sdlCtrlIdx, sdlJoyName);
ActiveControllers++; ActiveControllers++;
ConfigSaveSection(SectionName);
/* set the local controller mode to Manual so that we won't re-configure this controller in the next loop */ /* set the local controller mode to Manual so that we won't re-configure this controller in the next loop */
ControlMode[n64CtrlStart+j] = E_MODE_MANUAL; ControlMode[n64CtrlStart+j] = E_MODE_MANUAL;
} }
@ -537,7 +504,7 @@ void load_configuration(int bPreConfig)
int ControlDevice[4]; int ControlDevice[4];
char DeviceName[4][256]; char DeviceName[4][256];
int ActiveControllers = 0; int ActiveControllers = 0;
int sdlNumJoysticks = get_sdl_num_joysticks(); int sdlNumJoysticks = SDL_NumJoysticks();
float fVersion = 0.0f; float fVersion = 0.0f;
const char *sdl_name; const char *sdl_name;
int ControllersFound = 0; int ControllersFound = 0;
@ -573,8 +540,6 @@ void load_configuration(int bPreConfig)
DeviceName[n64CtrlIdx][0] = 0; DeviceName[n64CtrlIdx][0] = 0;
// write blank config for GUI front-ends // write blank config for GUI front-ends
init_controller_config(n64CtrlIdx, "", E_MODE_FULL_AUTO); init_controller_config(n64CtrlIdx, "", E_MODE_FULL_AUTO);
// save it to the file too
ConfigSaveSection(SectionName);
} }
else else
{ {
@ -596,6 +561,11 @@ void load_configuration(int bPreConfig)
{ {
DeviceName[n64CtrlIdx][0] = 0; DeviceName[n64CtrlIdx][0] = 0;
} }
if (ConfigGetParameter(pConfig, "plugin", M64TYPE_INT, &controller[n64CtrlIdx].control->Plugin, sizeof(int)) != M64ERR_SUCCESS)
{
DebugMessage(M64MSG_WARNING, "missing 'plugin' parameter from config section %s. Setting to 2 (mempak).", SectionName);
controller[n64CtrlIdx].control->Plugin = PLUGIN_MEMPAK;
}
} }
} }
@ -645,7 +615,6 @@ void load_configuration(int bPreConfig)
/* copy the auto-config settings to the controller config section */ /* copy the auto-config settings to the controller config section */
auto_copy_inputconfig("AutoConfig0", SectionName, "Keyboard"); auto_copy_inputconfig("AutoConfig0", SectionName, "Keyboard");
ActiveControllers++; ActiveControllers++;
ConfigSaveSection(SectionName);
} }
else else
{ {
@ -742,7 +711,6 @@ void load_configuration(int bPreConfig)
ConfigSetParameter(section, "device", M64TYPE_INT, &iNoDevice); ConfigSetParameter(section, "device", M64TYPE_INT, &iNoDevice);
if (OrigControlMode[n64CtrlIdx] == E_MODE_FULL_AUTO) if (OrigControlMode[n64CtrlIdx] == E_MODE_FULL_AUTO)
ConfigSetParameter(section, "name", M64TYPE_STRING, ""); ConfigSetParameter(section, "name", M64TYPE_STRING, "");
ConfigSaveSection(SectionName);
} }
} }
} }
@ -761,7 +729,6 @@ void load_configuration(int bPreConfig)
else else
auto_copy_inputconfig("AutoConfig0", "Input-SDL-Control1", NULL); // don't overwrite 'name' parameter auto_copy_inputconfig("AutoConfig0", "Input-SDL-Control1", NULL); // don't overwrite 'name' parameter
ActiveControllers++; ActiveControllers++;
ConfigSaveSection("Input-SDL-Control1");
} }
else else
{ {

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-input-sdl - config.h * * Mupen64plus-input-sdl - config.h *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ * * Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2009 Richard Goedeken * * Copyright (C) 2009 Richard Goedeken *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-core - osal/dynamiclib.h * * Mupen64plus-core - osal/dynamiclib.h *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ * * Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2009 Richard Goedeken * * Copyright (C) 2009 Richard Goedeken *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-core - osal/dynamiclib_unix.c * * Mupen64plus-core - osal/dynamiclib_unix.c *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ * * Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2009 Richard Goedeken * * Copyright (C) 2009 Richard Goedeken *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
@ -19,9 +19,9 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <stdlib.h>
#include <stdio.h>
#include <dlfcn.h> #include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include "m64p_types.h" #include "m64p_types.h"
#include "osal_dynamiclib.h" #include "osal_dynamiclib.h"

View file

@ -1,74 +1,74 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-ui-console - osal_dynamiclib_win32.c * * Mupen64plus-ui-console - osal_dynamiclib_win32.c *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ * * Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2009 Richard Goedeken * * Copyright (C) 2009 Richard Goedeken *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or * * the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. * * (at your option) any later version. *
* * * *
* This program is distributed in the hope that it will be useful, * * This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of * * but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. * * GNU General Public License for more details. *
* * * *
* You should have received a copy of the GNU General Public License * * You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the * * along with this program; if not, write to the *
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <windows.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <windows.h>
#include "m64p_types.h" #include "m64p_types.h"
#include "osal_dynamiclib.h" #include "osal_dynamiclib.h"
m64p_error osal_dynlib_open(m64p_dynlib_handle *pLibHandle, const char *pccLibraryPath) m64p_error osal_dynlib_open(m64p_dynlib_handle *pLibHandle, const char *pccLibraryPath)
{ {
if (pLibHandle == NULL || pccLibraryPath == NULL) if (pLibHandle == NULL || pccLibraryPath == NULL)
return M64ERR_INPUT_ASSERT; return M64ERR_INPUT_ASSERT;
*pLibHandle = LoadLibrary(pccLibraryPath); *pLibHandle = LoadLibrary(pccLibraryPath);
if (*pLibHandle == NULL) if (*pLibHandle == NULL)
{ {
char *pchErrMsg; char *pchErrMsg;
DWORD dwErr = GetLastError(); DWORD dwErr = GetLastError();
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErr, FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErr,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &pchErrMsg, 0, NULL); MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &pchErrMsg, 0, NULL);
fprintf(stderr, "LoadLibrary('%s') error: %s\n", pccLibraryPath, pchErrMsg); fprintf(stderr, "LoadLibrary('%s') error: %s\n", pccLibraryPath, pchErrMsg);
LocalFree(pchErrMsg); LocalFree(pchErrMsg);
return M64ERR_INPUT_NOT_FOUND; return M64ERR_INPUT_NOT_FOUND;
} }
return M64ERR_SUCCESS; return M64ERR_SUCCESS;
} }
void * osal_dynlib_getproc(m64p_dynlib_handle LibHandle, const char *pccProcedureName) void * osal_dynlib_getproc(m64p_dynlib_handle LibHandle, const char *pccProcedureName)
{ {
if (pccProcedureName == NULL) if (pccProcedureName == NULL)
return NULL; return NULL;
return GetProcAddress(LibHandle, pccProcedureName); return GetProcAddress(LibHandle, pccProcedureName);
} }
m64p_error osal_dynlib_close(m64p_dynlib_handle LibHandle) m64p_error osal_dynlib_close(m64p_dynlib_handle LibHandle)
{ {
int rval = FreeLibrary(LibHandle); int rval = FreeLibrary(LibHandle);
if (rval == 0) if (rval == 0)
{ {
char *pchErrMsg; char *pchErrMsg;
DWORD dwErr = GetLastError(); DWORD dwErr = GetLastError();
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErr, FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErr,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &pchErrMsg, 0, NULL); MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &pchErrMsg, 0, NULL);
fprintf(stderr, "FreeLibrary() error: %s\n", pchErrMsg); fprintf(stderr, "FreeLibrary() error: %s\n", pchErrMsg);
LocalFree(pchErrMsg); LocalFree(pchErrMsg);
return M64ERR_INTERNAL; return M64ERR_INTERNAL;
} }
return M64ERR_SUCCESS; return M64ERR_SUCCESS;
} }

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus - osal_preproc.h * * Mupen64plus - osal_preproc.h *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ * * Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2009 Richard Goedeken * * Copyright (C) 2009 Richard Goedeken *
* Copyright (C) 2002 Hacktarux * * Copyright (C) 2002 Hacktarux *
* * * *
@ -30,4 +30,16 @@
#define strcasecmp _stricmp #define strcasecmp _stricmp
#endif // WIN32 #endif // WIN32
#if defined(WIN32) && !defined(__MINGW32__)
// macros
#define osal_inline __inline
#else /* Not WIN32 */
// macros
#define osal_inline inline
#endif
#endif // OSAL_PREPROC_H #endif // OSAL_PREPROC_H

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-input-sdl - plugin.c * * Mupen64plus-input-sdl - plugin.c *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ * * Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2008-2011 Richard Goedeken * * Copyright (C) 2008-2011 Richard Goedeken *
* Copyright (C) 2008 Tillin9 * * Copyright (C) 2008 Tillin9 *
* Copyright (C) 2002 Blight * * Copyright (C) 2002 Blight *
@ -21,28 +21,28 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <SDL.h>
#include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <math.h>
#include <SDL.h>
#define M64P_PLUGIN_PROTOTYPES 1 #define M64P_PLUGIN_PROTOTYPES 1
#include "m64p_types.h" #include "config.h"
#include "m64p_plugin.h"
#include "m64p_common.h" #include "m64p_common.h"
#include "m64p_config.h" #include "m64p_config.h"
#include "m64p_plugin.h"
#include "plugin.h" #include "m64p_types.h"
#include "config.h"
#include "version.h"
#include "osal_dynamiclib.h" #include "osal_dynamiclib.h"
#include "plugin.h"
#include "version.h"
#ifdef __linux__ #ifdef __linux__
#include <unistd.h>
#include <dirent.h> #include <dirent.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h>
#include <linux/input.h> #include <linux/input.h>
#endif /* __linux__ */ #endif /* __linux__ */
@ -60,9 +60,7 @@
/* definitions of pointers to Core config functions */ /* definitions of pointers to Core config functions */
ptr_ConfigOpenSection ConfigOpenSection = NULL; ptr_ConfigOpenSection ConfigOpenSection = NULL;
ptr_ConfigDeleteSection ConfigDeleteSection = NULL; ptr_ConfigDeleteSection ConfigDeleteSection = NULL;
ptr_ConfigSaveSection ConfigSaveSection = NULL;
ptr_ConfigListParameters ConfigListParameters = NULL; ptr_ConfigListParameters ConfigListParameters = NULL;
ptr_ConfigSaveFile ConfigSaveFile = NULL;
ptr_ConfigSetParameter ConfigSetParameter = NULL; ptr_ConfigSetParameter ConfigSetParameter = NULL;
ptr_ConfigGetParameter ConfigGetParameter = NULL; ptr_ConfigGetParameter ConfigGetParameter = NULL;
ptr_ConfigGetParameterHelp ConfigGetParameterHelp = NULL; ptr_ConfigGetParameterHelp ConfigGetParameterHelp = NULL;
@ -87,6 +85,8 @@ SController controller[4]; // 4 controllers
static void (*l_DebugCallback)(void *, int, const char *) = NULL; static void (*l_DebugCallback)(void *, int, const char *) = NULL;
static void *l_DebugCallContext = NULL; static void *l_DebugCallContext = NULL;
static int l_PluginInit = 0; static int l_PluginInit = 0;
static int l_joyWasInit = 0;
static int l_hapticWasInit = 0;
static unsigned short button_bits[] = { static unsigned short button_bits[] = {
0x0001, // R_DPAD 0x0001, // R_DPAD
@ -111,12 +111,6 @@ static int romopen = 0; // is a rom opened
static unsigned char myKeyState[SDL_NUM_SCANCODES]; static unsigned char myKeyState[SDL_NUM_SCANCODES];
#ifdef __linux__
static struct ff_effect ffeffect[4];
static struct ff_effect ffstrong[4];
static struct ff_effect ffweak[4];
#endif //__linux__
/* Global functions */ /* Global functions */
void DebugMessage(int level, const char *message, ...) void DebugMessage(int level, const char *message, ...)
{ {
@ -141,7 +135,7 @@ EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle CoreLibHandle, void *Con
void (*DebugCallback)(void *, int, const char *)) void (*DebugCallback)(void *, int, const char *))
{ {
ptr_CoreGetAPIVersions CoreAPIVersionFunc; ptr_CoreGetAPIVersions CoreAPIVersionFunc;
int i, ConfigAPIVersion, DebugAPIVersion, VidextAPIVersion; int i, ConfigAPIVersion, DebugAPIVersion, VidextAPIVersion;
if (l_PluginInit) if (l_PluginInit)
@ -158,7 +152,7 @@ EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle CoreLibHandle, void *Con
DebugMessage(M64MSG_ERROR, "Core emulator broken; no CoreAPIVersionFunc() function found."); DebugMessage(M64MSG_ERROR, "Core emulator broken; no CoreAPIVersionFunc() function found.");
return M64ERR_INCOMPATIBLE; return M64ERR_INCOMPATIBLE;
} }
(*CoreAPIVersionFunc)(&ConfigAPIVersion, &DebugAPIVersion, &VidextAPIVersion, NULL); (*CoreAPIVersionFunc)(&ConfigAPIVersion, &DebugAPIVersion, &VidextAPIVersion, NULL);
if ((ConfigAPIVersion & 0xffff0000) != (CONFIG_API_VERSION & 0xffff0000) || ConfigAPIVersion < CONFIG_API_VERSION) if ((ConfigAPIVersion & 0xffff0000) != (CONFIG_API_VERSION & 0xffff0000) || ConfigAPIVersion < CONFIG_API_VERSION)
{ {
@ -170,8 +164,6 @@ EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle CoreLibHandle, void *Con
/* Get the core config function pointers from the library handle */ /* Get the core config function pointers from the library handle */
ConfigOpenSection = (ptr_ConfigOpenSection) osal_dynlib_getproc(CoreLibHandle, "ConfigOpenSection"); ConfigOpenSection = (ptr_ConfigOpenSection) osal_dynlib_getproc(CoreLibHandle, "ConfigOpenSection");
ConfigDeleteSection = (ptr_ConfigDeleteSection) osal_dynlib_getproc(CoreLibHandle, "ConfigDeleteSection"); ConfigDeleteSection = (ptr_ConfigDeleteSection) osal_dynlib_getproc(CoreLibHandle, "ConfigDeleteSection");
ConfigSaveFile = (ptr_ConfigSaveFile) osal_dynlib_getproc(CoreLibHandle, "ConfigSaveFile");
ConfigSaveSection = (ptr_ConfigSaveSection) osal_dynlib_getproc(CoreLibHandle, "ConfigSaveSection");
ConfigListParameters = (ptr_ConfigListParameters) osal_dynlib_getproc(CoreLibHandle, "ConfigListParameters"); ConfigListParameters = (ptr_ConfigListParameters) osal_dynlib_getproc(CoreLibHandle, "ConfigListParameters");
ConfigSetParameter = (ptr_ConfigSetParameter) osal_dynlib_getproc(CoreLibHandle, "ConfigSetParameter"); ConfigSetParameter = (ptr_ConfigSetParameter) osal_dynlib_getproc(CoreLibHandle, "ConfigSetParameter");
ConfigGetParameter = (ptr_ConfigGetParameter) osal_dynlib_getproc(CoreLibHandle, "ConfigGetParameter"); ConfigGetParameter = (ptr_ConfigGetParameter) osal_dynlib_getproc(CoreLibHandle, "ConfigGetParameter");
@ -189,7 +181,7 @@ EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle CoreLibHandle, void *Con
ConfigGetUserDataPath = (ptr_ConfigGetUserDataPath) osal_dynlib_getproc(CoreLibHandle, "ConfigGetUserDataPath"); ConfigGetUserDataPath = (ptr_ConfigGetUserDataPath) osal_dynlib_getproc(CoreLibHandle, "ConfigGetUserDataPath");
ConfigGetUserCachePath = (ptr_ConfigGetUserCachePath) osal_dynlib_getproc(CoreLibHandle, "ConfigGetUserCachePath"); ConfigGetUserCachePath = (ptr_ConfigGetUserCachePath) osal_dynlib_getproc(CoreLibHandle, "ConfigGetUserCachePath");
if (!ConfigOpenSection || !ConfigDeleteSection || !ConfigSaveFile || !ConfigSaveSection || !ConfigSetParameter || !ConfigGetParameter || if (!ConfigOpenSection || !ConfigDeleteSection || !ConfigSetParameter || !ConfigGetParameter ||
!ConfigSetDefaultInt || !ConfigSetDefaultFloat || !ConfigSetDefaultBool || !ConfigSetDefaultString || !ConfigSetDefaultInt || !ConfigSetDefaultFloat || !ConfigSetDefaultBool || !ConfigSetDefaultString ||
!ConfigGetParamInt || !ConfigGetParamFloat || !ConfigGetParamBool || !ConfigGetParamString || !ConfigGetParamInt || !ConfigGetParamFloat || !ConfigGetParamBool || !ConfigGetParamString ||
!ConfigGetSharedDataFilepath || !ConfigGetUserConfigPath || !ConfigGetUserDataPath || !ConfigGetUserCachePath) !ConfigGetSharedDataFilepath || !ConfigGetUserConfigPath || !ConfigGetUserDataPath || !ConfigGetUserCachePath)
@ -210,6 +202,15 @@ EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle CoreLibHandle, void *Con
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
controller[i].control = temp_core_controlinfo + i; controller[i].control = temp_core_controlinfo + i;
/* initialize the joystick subsystem if necessary */
l_joyWasInit = SDL_WasInit(SDL_INIT_JOYSTICK);
if (!l_joyWasInit)
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1)
{
DebugMessage(M64MSG_ERROR, "Couldn't init SDL joystick subsystem: %s", SDL_GetError() );
return M64ERR_SYSTEM_FAIL;
}
/* read plugin config from core config database, auto-config if necessary and update core database */ /* read plugin config from core config database, auto-config if necessary and update core database */
load_configuration(1); load_configuration(1);
@ -226,6 +227,10 @@ EXPORT m64p_error CALL PluginShutdown(void)
l_DebugCallback = NULL; l_DebugCallback = NULL;
l_DebugCallContext = NULL; l_DebugCallContext = NULL;
/* quit the joystick subsystem if necessary */
if (!l_joyWasInit)
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
l_PluginInit = 0; l_PluginInit = 0;
return M64ERR_SUCCESS; return M64ERR_SUCCESS;
} }
@ -241,7 +246,7 @@ EXPORT m64p_error CALL PluginGetVersion(m64p_plugin_type *PluginType, int *Plugi
if (APIVersion != NULL) if (APIVersion != NULL)
*APIVersion = INPUT_PLUGIN_API_VERSION; *APIVersion = INPUT_PLUGIN_API_VERSION;
if (PluginNamePtr != NULL) if (PluginNamePtr != NULL)
*PluginNamePtr = PLUGIN_NAME; *PluginNamePtr = PLUGIN_NAME;
@ -249,13 +254,13 @@ EXPORT m64p_error CALL PluginGetVersion(m64p_plugin_type *PluginType, int *Plugi
{ {
*Capabilities = 0; *Capabilities = 0;
} }
return M64ERR_SUCCESS; return M64ERR_SUCCESS;
} }
/* Helper function to handle the SDL keys */ /* Helper function to handle the SDL keys */
static void static void
doSdlKeys(unsigned char* keystate) doSdlKeys(const unsigned char* keystate)
{ {
int c, b, axis_val, axis_max_val; int c, b, axis_val, axis_max_val;
static int grabmouse = 1, grabtoggled = 0; static int grabmouse = 1, grabtoggled = 0;
@ -264,7 +269,7 @@ doSdlKeys(unsigned char* keystate)
if (keystate[SDL_SCANCODE_RCTRL]) if (keystate[SDL_SCANCODE_RCTRL])
axis_max_val -= 40; axis_max_val -= 40;
if (keystate[SDL_SCANCODE_RSHIFT]) if (keystate[SDL_SCANCODE_RSHIFT])
axis_max_val -= 20; axis_max_val -= 25;
for( c = 0; c < 4; c++ ) for( c = 0; c < 4; c++ )
{ {
@ -296,6 +301,12 @@ doSdlKeys(unsigned char* keystate)
else else
controller[c].buttons.Y_AXIS = -axis_val; controller[c].buttons.Y_AXIS = -axis_val;
} }
// sqrt-2 fix for too-fast diagonal movement
if (abs(controller[c].buttons.X_AXIS) == axis_max_val && abs(controller[c].buttons.Y_AXIS) == axis_max_val)
{
controller[c].buttons.X_AXIS = (int) (controller[c].buttons.X_AXIS / 1.41421356f);
controller[c].buttons.Y_AXIS = (int) (controller[c].buttons.Y_AXIS / 1.41421356f);
}
if (controller[c].mouse) if (controller[c].mouse)
{ {
if (keystate[SDL_SCANCODE_LCTRL] && keystate[SDL_SCANCODE_LALT]) if (keystate[SDL_SCANCODE_LCTRL] && keystate[SDL_SCANCODE_LALT])
@ -305,11 +316,7 @@ doSdlKeys(unsigned char* keystate)
grabtoggled = 1; grabtoggled = 1;
grabmouse = !grabmouse; grabmouse = !grabmouse;
// grab/ungrab mouse // grab/ungrab mouse
#if SDL_VERSION_ATLEAST(2,0,0) SDL_SetRelativeMouseMode(grabmouse ? SDL_TRUE : SDL_FALSE);
#warning SDL mouse grabbing not yet supported with SDL 2.0
#else
SDL_WM_GrabInput( grabmouse ? SDL_GRAB_ON : SDL_GRAB_OFF );
#endif
SDL_ShowCursor( grabmouse ? 0 : 1 ); SDL_ShowCursor( grabmouse ? 0 : 1 );
} }
} }
@ -402,31 +409,21 @@ EXPORT void CALL ControllerCommand(int Control, unsigned char *Command)
unsigned int dwAddress = (Command[3] << 8) + (Command[4] & 0xE0); unsigned int dwAddress = (Command[3] << 8) + (Command[4] & 0xE0);
if (dwAddress == PAK_IO_RUMBLE && *Data) if (dwAddress == PAK_IO_RUMBLE && *Data)
DebugMessage(M64MSG_VERBOSE, "Triggering rumble pack."); DebugMessage(M64MSG_VERBOSE, "Triggering rumble pack.");
#ifdef __linux__ if(dwAddress == PAK_IO_RUMBLE && controller[Control].event_joystick) {
struct input_event play; #if SDL_VERSION_ATLEAST(2,0,18)
if( dwAddress == PAK_IO_RUMBLE && controller[Control].event_joystick != 0) if (*Data) {
{ SDL_JoystickRumble(controller[Control].joystick, 0xFFFF, 0xFFFF, SDL_HAPTIC_INFINITY);
if( *Data ) } else {
{ SDL_JoystickRumble(controller[Control].joystick, 0, 0, 0);
play.type = EV_FF;
play.code = ffeffect[Control].id;
play.value = 1;
if (write(controller[Control].event_joystick, (const void*) &play, sizeof(play)) == -1)
perror("Error starting rumble effect");
} }
else #else
{ if (*Data) {
play.type = EV_FF; SDL_HapticRumblePlay(controller[Control].event_joystick, 1, SDL_HAPTIC_INFINITY);
play.code = ffeffect[Control].id; } else {
play.value = 0; SDL_HapticRumbleStop(controller[Control].event_joystick);
if (write(controller[Control].event_joystick, (const void*) &play, sizeof(play)) == -1)
perror("Error stopping rumble effect");
} }
#endif /* SDL_VERSION_ATLEAST(2,0,18) */
} }
#endif //__linux__
Data[32] = DataCRC( Data, 32 ); Data[32] = DataCRC( Data, 32 );
} }
break; break;
@ -460,13 +457,31 @@ EXPORT void CALL GetKeys( int Control, BUTTONS *Keys )
{ {
static int mousex_residual = 0; static int mousex_residual = 0;
static int mousey_residual = 0; static int mousey_residual = 0;
int b, axis_val; int b, axis_val, axis_max_val;
SDL_Event event; SDL_Event event;
unsigned char mstate; unsigned char mstate;
SDL_PumpEvents();
// Handle keyboard input first // Handle keyboard input first
doSdlKeys(SDL_GetKeyboardState(NULL)); doSdlKeys(SDL_GetKeyboardState(NULL));
doSdlKeys(myKeyState); doSdlKeys(myKeyState);
// attenuate maximum analog stick movement if right shift/control is pressed
axis_max_val = 80;
if (myKeyState[SDL_SCANCODE_RCTRL])
axis_max_val -= 40;
if (myKeyState[SDL_SCANCODE_RSHIFT])
axis_max_val -= 25;
for ( b = 0; b < 4; ++b )
{
if (controller[b].device >= 0)
{
if (!SDL_JoystickGetAttached(controller[b].joystick))
controller[b].joystick = SDL_JoystickOpen(controller[b].device);
}
}
// read joystick state // read joystick state
SDL_JoystickUpdate(); SDL_JoystickUpdate();
@ -484,7 +499,7 @@ EXPORT void CALL GetKeys( int Control, BUTTONS *Keys )
int deadzone = controller[Control].button[b].axis_deadzone; int deadzone = controller[Control].button[b].axis_deadzone;
axis_val = SDL_JoystickGetAxis( controller[Control].joystick, controller[Control].button[b].axis ); axis_val = SDL_JoystickGetAxis( controller[Control].joystick, controller[Control].button[b].axis );
if (deadzone < 0) if (deadzone < 0)
deadzone = 6000; /* default */ deadzone = 16384; /* default */
if( (controller[Control].button[b].axis_dir < 0) && (axis_val <= -deadzone) ) if( (controller[Control].button[b].axis_dir < 0) && (axis_val <= -deadzone) )
controller[Control].buttons.Value |= button_bits[b]; controller[Control].buttons.Value |= button_bits[b];
else if( (controller[Control].button[b].axis_dir > 0) && (axis_val >= deadzone) ) else if( (controller[Control].button[b].axis_dir > 0) && (axis_val >= deadzone) )
@ -498,6 +513,8 @@ EXPORT void CALL GetKeys( int Control, BUTTONS *Keys )
controller[Control].buttons.Value |= button_bits[b]; controller[Control].buttons.Value |= button_bits[b];
} }
} }
int iX = controller[Control].buttons.X_AXIS;
int iY = controller[Control].buttons.Y_AXIS;
for( b = 0; b < 2; b++ ) for( b = 0; b < 2; b++ )
{ {
/* from the N64 func ref: The 3D Stick data is of type signed char and in the range between -80 and +80 */ /* from the N64 func ref: The 3D Stick data is of type signed char and in the range between -80 and +80 */
@ -508,50 +525,53 @@ EXPORT void CALL GetKeys( int Control, BUTTONS *Keys )
continue; continue;
if( b == 0 ) if( b == 0 )
axis_val = controller[Control].buttons.X_AXIS; axis_val = iX;
else else
axis_val = -controller[Control].buttons.Y_AXIS; axis_val = -iY;
if( controller[Control].axis[b].axis_a >= 0 ) /* up and left for N64 */ if( controller[Control].axis[b].axis_a >= 0 ) /* up and left for N64 */
{ {
int joy_val = SDL_JoystickGetAxis(controller[Control].joystick, controller[Control].axis[b].axis_a); int joy_val = SDL_JoystickGetAxis(controller[Control].joystick, controller[Control].axis[b].axis_a);
int axis_dir = controller[Control].axis[b].axis_dir_a; int axis_dir = controller[Control].axis[b].axis_dir_a;
if (joy_val * axis_dir > deadzone) if (joy_val * axis_dir > deadzone)
axis_val = -((abs(joy_val) - deadzone) * 80 / range); axis_val = -((abs(joy_val) - deadzone) * axis_max_val / range);
if (axis_val < -80)
axis_val = -80;
} }
if( controller[Control].axis[b].axis_b >= 0 ) /* down and right for N64 */ if( controller[Control].axis[b].axis_b >= 0 ) /* down and right for N64 */
{ {
int joy_val = SDL_JoystickGetAxis(controller[Control].joystick, controller[Control].axis[b].axis_b); int joy_val = SDL_JoystickGetAxis(controller[Control].joystick, controller[Control].axis[b].axis_b);
int axis_dir = controller[Control].axis[b].axis_dir_b; int axis_dir = controller[Control].axis[b].axis_dir_b;
if (joy_val * axis_dir > deadzone) if (joy_val * axis_dir > deadzone)
axis_val = ((abs(joy_val) - deadzone) * 80 / range); axis_val = ((abs(joy_val) - deadzone) * axis_max_val / range);
if (axis_val > 80)
axis_val = 80;
} }
if( controller[Control].axis[b].hat >= 0 ) if( controller[Control].axis[b].hat >= 0 )
{ {
if( controller[Control].axis[b].hat_pos_a >= 0 ) if( controller[Control].axis[b].hat_pos_a >= 0 )
if( SDL_JoystickGetHat( controller[Control].joystick, controller[Control].axis[b].hat ) & controller[Control].axis[b].hat_pos_a ) if( SDL_JoystickGetHat( controller[Control].joystick, controller[Control].axis[b].hat ) & controller[Control].axis[b].hat_pos_a )
axis_val = -80; axis_val = -axis_max_val;
if( controller[Control].axis[b].hat_pos_b >= 0 ) if( controller[Control].axis[b].hat_pos_b >= 0 )
if( SDL_JoystickGetHat( controller[Control].joystick, controller[Control].axis[b].hat ) & controller[Control].axis[b].hat_pos_b ) if( SDL_JoystickGetHat( controller[Control].joystick, controller[Control].axis[b].hat ) & controller[Control].axis[b].hat_pos_b )
axis_val = 80; axis_val = axis_max_val;
} }
if( controller[Control].axis[b].button_a >= 0 ) if( controller[Control].axis[b].button_a >= 0 )
if( SDL_JoystickGetButton( controller[Control].joystick, controller[Control].axis[b].button_a ) ) if( SDL_JoystickGetButton( controller[Control].joystick, controller[Control].axis[b].button_a ) )
axis_val = -80; axis_val = -axis_max_val;
if( controller[Control].axis[b].button_b >= 0 ) if( controller[Control].axis[b].button_b >= 0 )
if( SDL_JoystickGetButton( controller[Control].joystick, controller[Control].axis[b].button_b ) ) if( SDL_JoystickGetButton( controller[Control].joystick, controller[Control].axis[b].button_b ) )
axis_val = 80; axis_val = axis_max_val;
if( b == 0 ) if( b == 0 )
controller[Control].buttons.X_AXIS = axis_val; iX = axis_val;
else else
controller[Control].buttons.Y_AXIS = -axis_val; iY = -axis_val;
} }
/* store the result */
if (iX < -80) iX = -80;
if (iX > 80) iX = 80;
if (iY < -80) iY = -80;
if (iY > 80) iY = 80;
controller[Control].buttons.X_AXIS = iX;
controller[Control].buttons.Y_AXIS = iY;
} }
// process mouse events // process mouse events
@ -566,18 +586,13 @@ EXPORT void CALL GetKeys( int Control, BUTTONS *Keys )
if (controller[Control].mouse) if (controller[Control].mouse)
{ {
#if SDL_VERSION_ATLEAST(2,0,0) if (SDL_GetRelativeMouseMode())
#warning SDL mouse grabbing not yet supported with SDL 2.0
#else
if (SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_ON)
{ {
SDL_PumpEvents();
#if SDL_VERSION_ATLEAST(1,3,0)
while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_MOUSEMOTION, SDL_MOUSEMOTION) == 1) while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_MOUSEMOTION, SDL_MOUSEMOTION) == 1)
#else
while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_EVENTMASK(SDL_MOUSEMOTION)) == 1)
#endif
{ {
int w, h;
SDL_Window *focus;
if (event.motion.xrel) if (event.motion.xrel)
{ {
mousex_residual += (int) (event.motion.xrel * controller[Control].mouse_sens[0]); mousex_residual += (int) (event.motion.xrel * controller[Control].mouse_sens[0]);
@ -586,29 +601,39 @@ EXPORT void CALL GetKeys( int Control, BUTTONS *Keys )
{ {
mousey_residual += (int) (event.motion.yrel * controller[Control].mouse_sens[1]); mousey_residual += (int) (event.motion.yrel * controller[Control].mouse_sens[1]);
} }
focus = SDL_GetKeyboardFocus();
if (focus) {
SDL_GetWindowSize(focus, &w, &h);
SDL_WarpMouseInWindow(focus, w / 2, h / 2);
} else {
mousex_residual = 0;
mousey_residual = 0;
}
}
/* store the result */
int iX = mousex_residual;
int iY = -mousey_residual;
if (iX < -80) iX = -80;
if (iX > 80) iX = 80;
if (iY < -80) iY = -80;
if (iY > 80) iY = 80;
controller[Control].buttons.X_AXIS = iX;
controller[Control].buttons.Y_AXIS = iY;
/* the mouse x/y values decay exponentially (returns to center), unless the left "Windows" key is held down */
if (!myKeyState[SDL_SCANCODE_LGUI])
{
mousex_residual = (mousex_residual * 224) / 256;
mousey_residual = (mousey_residual * 224) / 256;
} }
} }
else else
#endif
{ {
mousex_residual = 0; mousex_residual = 0;
mousey_residual = 0; mousey_residual = 0;
} }
axis_val = mousex_residual;
if (axis_val < -80)
axis_val = -80;
else if (axis_val > 80)
axis_val = 80;
controller[Control].buttons.X_AXIS = axis_val;
axis_val = mousey_residual;
if (axis_val < -80)
axis_val = -80;
else if (axis_val > 80)
axis_val = 80;
controller[Control].buttons.Y_AXIS = -axis_val;
/* the mouse x/y values decay exponentially */
mousex_residual = (mousex_residual * 224) / 256;
mousey_residual = (mousey_residual * 224) / 256;
} }
#ifdef _DEBUG #ifdef _DEBUG
@ -617,150 +642,108 @@ EXPORT void CALL GetKeys( int Control, BUTTONS *Keys )
*Keys = controller[Control].buttons; *Keys = controller[Control].buttons;
/* handle mempack / rumblepak switching (only if rumble is active on joystick) */ /* handle mempack / rumblepak switching (only if rumble is active on joystick) */
#ifdef __linux__ #if !SDL_VERSION_ATLEAST(2,0,18)
if (controller[Control].event_joystick != 0) if (controller[Control].event_joystick) {
{
struct input_event play;
static unsigned int SwitchPackTime[4] = {0, 0, 0, 0}, SwitchPackType[4] = {0, 0, 0, 0}; static unsigned int SwitchPackTime[4] = {0, 0, 0, 0}, SwitchPackType[4] = {0, 0, 0, 0};
// when the user switches packs, we should mimick the act of removing 1 pack, and then inserting another 1 second later if (controller[Control].buttons.Value & button_bits[14]) {
if (controller[Control].buttons.Value & button_bits[14])
{
SwitchPackTime[Control] = SDL_GetTicks(); // time at which the 'switch pack' command was given SwitchPackTime[Control] = SDL_GetTicks(); // time at which the 'switch pack' command was given
SwitchPackType[Control] = PLUGIN_MEMPAK; // type of new pack to insert SwitchPackType[Control] = PLUGIN_MEMPAK; // type of new pack to insert
controller[Control].control->Plugin = PLUGIN_NONE;// remove old pack controller[Control].control->Plugin = PLUGIN_NONE;// remove old pack
play.type = EV_FF; SDL_HapticRumblePlay(controller[Control].event_joystick, 0.5, 500);
play.code = ffweak[Control].id;
play.value = 1;
if (write(controller[Control].event_joystick, (const void*) &play, sizeof(play)) == -1)
perror("Error starting rumble effect");
} }
if (controller[Control].buttons.Value & button_bits[15]) if (controller[Control].buttons.Value & button_bits[15]) {
{
SwitchPackTime[Control] = SDL_GetTicks(); // time at which the 'switch pack' command was given SwitchPackTime[Control] = SDL_GetTicks(); // time at which the 'switch pack' command was given
SwitchPackType[Control] = PLUGIN_RAW; // type of new pack to insert SwitchPackType[Control] = PLUGIN_RAW; // type of new pack to insert
controller[Control].control->Plugin = PLUGIN_NONE;// remove old pack controller[Control].control->Plugin = PLUGIN_NONE;// remove old pack
play.type = EV_FF; SDL_HapticRumblePlay(controller[Control].event_joystick, 1, 500);
play.code = ffstrong[Control].id;
play.value = 1;
if (write(controller[Control].event_joystick, (const void*) &play, sizeof(play)) == -1)
perror("Error starting rumble effect");
} }
// handle inserting new pack if the time has arrived // handle inserting new pack if the time has arrived
if (SwitchPackTime[Control] != 0 && (SDL_GetTicks() - SwitchPackTime[Control]) >= 1000) if (SwitchPackTime[Control] != 0 && (SDL_GetTicks() - SwitchPackTime[Control]) >= 1000)
{ {
SDL_HapticRumbleStop(controller[Control].event_joystick);
controller[Control].control->Plugin = SwitchPackType[Control]; controller[Control].control->Plugin = SwitchPackType[Control];
SwitchPackTime[Control] = 0; SwitchPackTime[Control] = 0;
} }
} }
#endif /* __linux__ */ #endif /* SDL_VERSION_ATLEAST(2,0,18) */
controller[Control].buttons.Value = 0; controller[Control].buttons.Value = 0;
} }
static void InitiateJoysticks(int cntrl)
{
if (controller[cntrl].device >= 0) {
controller[cntrl].joystick = SDL_JoystickOpen(controller[cntrl].device);
if (!controller[cntrl].joystick)
DebugMessage(M64MSG_WARNING, "Couldn't open joystick for controller #%d: %s", cntrl + 1, SDL_GetError());
} else {
controller[cntrl].joystick = NULL;
}
}
static void DeinitJoystick(int cntrl)
{
if (controller[cntrl].joystick) {
SDL_JoystickClose(controller[cntrl].joystick);
controller[cntrl].joystick = NULL;
}
}
static void InitiateRumble(int cntrl) static void InitiateRumble(int cntrl)
{ {
#ifdef __linux__ l_hapticWasInit = SDL_WasInit(SDL_INIT_HAPTIC);
DIR* dp; if (!l_hapticWasInit) {
struct dirent* ep; if (SDL_InitSubSystem(SDL_INIT_HAPTIC) == -1) {
unsigned long features[4]; DebugMessage(M64MSG_ERROR, "Couldn't init SDL haptic subsystem: %s", SDL_GetError() );
char temp[128]; return;
char temp2[128]; }
int iFound = 0; }
controller[cntrl].event_joystick = 0; #if SDL_VERSION_ATLEAST(2,0,18)
if (SDL_JoystickHasRumble(controller[cntrl].joystick) == SDL_FALSE) {
sprintf(temp,"/sys/class/input/js%d/device", controller[cntrl].device); DebugMessage(M64MSG_WARNING, "Joystick #%i doesn't support rumble effect", cntrl + 1);
dp = opendir(temp); controller[cntrl].event_joystick = 0;
if(dp==NULL)
return;
while ((ep=readdir(dp)))
{
if (strncmp(ep->d_name, "event",5)==0)
{
sprintf(temp, "/dev/input/%s", ep->d_name);
iFound = 1;
break;
}
else if(strncmp(ep->d_name,"input:event", 11)==0)
{
sscanf(ep->d_name, "input:%s", temp2);
sprintf(temp, "/dev/input/%s", temp2);
iFound = 1;
break;
}
else if(strncmp(ep->d_name,"input:input", 11)==0)
{
strcat(temp, "/");
strcat(temp, ep->d_name);
closedir (dp);
dp = opendir(temp);
if(dp==NULL)
return;
}
}
closedir(dp);
if (!iFound)
{
DebugMessage(M64MSG_WARNING, "Couldn't find input event for rumble support.");
return; return;
} }
controller[cntrl].event_joystick = open(temp, O_RDWR); controller[cntrl].event_joystick = 1;
if(controller[cntrl].event_joystick==-1) #else
{ controller[cntrl].event_joystick = SDL_HapticOpenFromJoystick(controller[cntrl].joystick);
DebugMessage(M64MSG_WARNING, "Couldn't open device file '%s' for rumble support.", temp); if (!controller[cntrl].event_joystick) {
controller[cntrl].event_joystick = 0; DebugMessage(M64MSG_WARNING, "Couldn't open rumble support for joystick #%i", cntrl + 1);
return; return;
} }
if(ioctl(controller[cntrl].event_joystick, EVIOCGBIT(EV_FF, sizeof(unsigned long) * 4), features)==-1) if (SDL_HapticRumbleSupported(controller[cntrl].event_joystick) == SDL_FALSE) {
{ SDL_HapticClose(controller[cntrl].event_joystick);
DebugMessage(M64MSG_WARNING, "Linux kernel communication failed for force feedback (rumble).\n"); controller[cntrl].event_joystick = NULL;
controller[cntrl].event_joystick = 0; DebugMessage(M64MSG_WARNING, "Joystick #%i doesn't support rumble effect", cntrl + 1);
return; return;
} }
if(!test_bit(FF_RUMBLE, features)) if (SDL_HapticRumbleInit(controller[cntrl].event_joystick) != 0) {
{ SDL_HapticClose(controller[cntrl].event_joystick);
DebugMessage(M64MSG_WARNING, "No rumble supported on N64 joystick #%i", cntrl + 1); controller[cntrl].event_joystick = NULL;
controller[cntrl].event_joystick = 0; DebugMessage(M64MSG_WARNING, "Rumble initialization failed for Joystick #%i", cntrl + 1);
return; return;
} }
#endif /* SDL_VERSION_ATLEAST(2,0,18) */
ffeffect[cntrl].type = FF_RUMBLE;
ffeffect[cntrl].id = -1;
ffeffect[cntrl].u.rumble.strong_magnitude = 0xFFFF;
ffeffect[cntrl].u.rumble.weak_magnitude = 0xFFFF;
ffeffect[cntrl].replay.length = 0x7fff; // hack: xboxdrv is buggy and doesn't support infinite replay.
// when xboxdrv is fixed (https://github.com/Grumbel/xboxdrv/issues/47),
// please remove this
ioctl(controller[cntrl].event_joystick, EVIOCSFF, &ffeffect[cntrl]);
ffstrong[cntrl].type = FF_RUMBLE;
ffstrong[cntrl].id = -1;
ffstrong[cntrl].u.rumble.strong_magnitude = 0xFFFF;
ffstrong[cntrl].u.rumble.weak_magnitude = 0x0000;
ffstrong[cntrl].replay.length = 500;
ffstrong[cntrl].replay.delay = 0;
ioctl(controller[cntrl].event_joystick, EVIOCSFF, &ffstrong[cntrl]);
ffweak[cntrl].type = FF_RUMBLE;
ffweak[cntrl].id = -1;
ffweak[cntrl].u.rumble.strong_magnitude = 0x0000;
ffweak[cntrl].u.rumble.weak_magnitude = 0xFFFF;
ffweak[cntrl].replay.length = 500;
ffweak[cntrl].replay.delay = 0;
ioctl(controller[cntrl].event_joystick, EVIOCSFF, &ffweak[cntrl]);
DebugMessage(M64MSG_INFO, "Rumble activated on N64 joystick #%i", cntrl + 1); DebugMessage(M64MSG_INFO, "Rumble activated on N64 joystick #%i", cntrl + 1);
#endif /* __linux__ */ }
static void DeinitRumble(int cntrl)
{
/* quit the haptic subsystem if necessary */
if (!l_hapticWasInit)
SDL_QuitSubSystem(SDL_INIT_HAPTIC);
#if !SDL_VERSION_ATLEAST(2,0,18)
if (controller[cntrl].event_joystick) {
SDL_HapticClose(controller[cntrl].event_joystick);
controller[cntrl].event_joystick = NULL;
}
#endif /* !SDL_VERSION_ATLEAST(2,0,18) */
} }
/****************************************************************** /******************************************************************
@ -793,10 +776,13 @@ EXPORT void CALL InitiateControllers(CONTROL_INFO ControlInfo)
for( i = 0; i < 4; i++ ) for( i = 0; i < 4; i++ )
{ {
// test for rumble support for this joystick // test for rumble support for this joystick
InitiateJoysticks(i);
InitiateRumble(i); InitiateRumble(i);
// if rumble not supported, switch to mempack // if rumble not supported, switch to mempack
if (controller[i].control->Plugin == PLUGIN_RAW && controller[i].event_joystick == 0) if (controller[i].control->Plugin == PLUGIN_RAW && controller[i].event_joystick == 0)
controller[i].control->Plugin = PLUGIN_MEMPAK; controller[i].control->Plugin = PLUGIN_MEMPAK;
DeinitRumble(i);
DeinitJoystick(i);
} }
DebugMessage(M64MSG_INFO, "%s version %i.%i.%i initialized.", PLUGIN_NAME, VERSION_PRINTF_SPLIT(PLUGIN_VERSION)); DebugMessage(M64MSG_INFO, "%s version %i.%i.%i initialized.", PLUGIN_NAME, VERSION_PRINTF_SPLIT(PLUGIN_VERSION));
@ -833,22 +819,13 @@ EXPORT void CALL RomClosed(void)
int i; int i;
// close joysticks // close joysticks
for( i = 0; i < 4; i++ ) for( i = 0; i < 4; i++ ) {
if( controller[i].joystick ) DeinitRumble(i);
{ DeinitJoystick(i);
SDL_JoystickClose( controller[i].joystick ); }
controller[i].joystick = NULL;
}
// quit SDL joystick subsystem
SDL_QuitSubSystem( SDL_INIT_JOYSTICK );
// release/ungrab mouse // release/ungrab mouse
#if SDL_VERSION_ATLEAST(2,0,0) SDL_SetRelativeMouseMode(SDL_FALSE);
#warning SDL mouse grabbing not yet supported with SDL 2.0
#else
SDL_WM_GrabInput( SDL_GRAB_OFF );
#endif
SDL_ShowCursor( 1 ); SDL_ShowCursor( 1 );
romopen = 0; romopen = 0;
@ -865,37 +842,19 @@ EXPORT int CALL RomOpen(void)
{ {
int i; int i;
// init SDL joystick subsystem
if( !SDL_WasInit( SDL_INIT_JOYSTICK ) )
if( SDL_InitSubSystem( SDL_INIT_JOYSTICK ) == -1 )
{
DebugMessage(M64MSG_ERROR, "Couldn't init SDL joystick subsystem: %s", SDL_GetError() );
return 0;
}
// open joysticks // open joysticks
for( i = 0; i < 4; i++ ) for (i = 0; i < 4; i++) {
if( controller[i].device >= 0 ) InitiateJoysticks(i);
{ InitiateRumble(i);
controller[i].joystick = SDL_JoystickOpen( controller[i].device ); }
if( controller[i].joystick == NULL )
DebugMessage(M64MSG_WARNING, "Couldn't open joystick for controller #%d: %s", i + 1, SDL_GetError() );
}
else
controller[i].joystick = NULL;
// grab mouse // grab mouse
if (controller[0].mouse || controller[1].mouse || controller[2].mouse || controller[3].mouse) if (controller[0].mouse || controller[1].mouse || controller[2].mouse || controller[3].mouse)
{ {
#if SDL_VERSION_ATLEAST(2,0,0)
#warning SDL mouse grabbing not yet supported with SDL 2.0
#else
SDL_ShowCursor( 0 ); SDL_ShowCursor( 0 );
if (SDL_WM_GrabInput( SDL_GRAB_ON ) != SDL_GRAB_ON) if (SDL_SetRelativeMouseMode(SDL_TRUE) < 0) {
{
DebugMessage(M64MSG_WARNING, "Couldn't grab input! Mouse support won't work!"); DebugMessage(M64MSG_WARNING, "Couldn't grab input! Mouse support won't work!");
} }
#endif
} }
romopen = 1; romopen = 1;

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-input-sdl - plugin.h * * Mupen64plus-input-sdl - plugin.h *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ * * Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2008-2009 Richard Goedeken * * Copyright (C) 2008-2009 Richard Goedeken *
* Copyright (C) 2008 Tillin9 * * Copyright (C) 2008 Tillin9 *
* Copyright (C) 2002 Blight * * Copyright (C) 2002 Blight *
@ -24,21 +24,14 @@
#ifndef __PLUGIN_H__ #ifndef __PLUGIN_H__
#define __PLUGIN_H__ #define __PLUGIN_H__
#include <SDL.h> #if defined(__GNUC__)
#if ! SDL_VERSION_ATLEAST(1,3,0) #define ATTR_FMT(fmtpos, attrpos) __attribute__ ((format (printf, fmtpos, attrpos)))
#else
#define SDL_GetKeyboardState SDL_GetKeyState #define ATTR_FMT(fmtpos, attrpos)
#define SDL_SCANCODE_UNKNOWN SDLK_UNKNOWN
#define SDL_NUM_SCANCODES SDLK_LAST
#define SDL_SCANCODE_RCTRL SDLK_RCTRL
#define SDL_SCANCODE_RSHIFT SDLK_RSHIFT
#define SDL_SCANCODE_LCTRL SDLK_LCTRL
#define SDL_SCANCODE_LALT SDLK_LALT
#define SDL_Scancode SDLKey
#endif #endif
#if SDL_VERSION_ATLEAST(2,0,0) #include <SDL.h>
#include <string.h>
static inline const char* _SDL_JoystickName(int device_index) static inline const char* _SDL_JoystickName(int device_index)
{ {
@ -63,11 +56,9 @@ static inline const char* _SDL_JoystickName(int device_index)
#define SDL_JoystickName(device_index) _SDL_JoystickName(device_index) #define SDL_JoystickName(device_index) _SDL_JoystickName(device_index)
#endif
#define M64P_PLUGIN_PROTOTYPES 1 #define M64P_PLUGIN_PROTOTYPES 1
#include "m64p_plugin.h"
#include "m64p_config.h" #include "m64p_config.h"
#include "m64p_plugin.h"
#define DEVICE_NO_JOYSTICK (-1) #define DEVICE_NO_JOYSTICK (-1)
@ -135,7 +126,11 @@ typedef struct
int device; // joystick device; -1 = keyboard; -2 = none int device; // joystick device; -1 = keyboard; -2 = none
int mouse; // mouse enabled: 0 = no; 1 = yes int mouse; // mouse enabled: 0 = no; 1 = yes
SDL_Joystick *joystick; // SDL joystick device SDL_Joystick *joystick; // SDL joystick device
int event_joystick; // the /dev/input/eventX device for force feeback #if SDL_VERSION_ATLEAST(2,0,18)
int event_joystick; // if sdl device has rumble support
#else /* SDL_VERSION_ATLEAST(2,0,0) */
SDL_Haptic *event_joystick; // the sdl device for force feeback
#endif
int axis_deadzone[2]; // minimum absolute value before analog movement is recognized int axis_deadzone[2]; // minimum absolute value before analog movement is recognized
int axis_peak[2]; // highest analog value returned by SDL, used for scaling int axis_peak[2]; // highest analog value returned by SDL, used for scaling
float mouse_sens[2]; // mouse sensitivity float mouse_sens[2]; // mouse sensitivity
@ -145,15 +140,13 @@ typedef struct
extern SController controller[4]; // 4 controllers extern SController controller[4]; // 4 controllers
/* global function definitions */ /* global function definitions */
extern void DebugMessage(int level, const char *message, ...); extern void DebugMessage(int level, const char *message, ...) ATTR_FMT(2,3);
/* declarations of pointers to Core config functions */ /* declarations of pointers to Core config functions */
extern ptr_ConfigListSections ConfigListSections; extern ptr_ConfigListSections ConfigListSections;
extern ptr_ConfigOpenSection ConfigOpenSection; extern ptr_ConfigOpenSection ConfigOpenSection;
extern ptr_ConfigDeleteSection ConfigDeleteSection; extern ptr_ConfigDeleteSection ConfigDeleteSection;
extern ptr_ConfigListParameters ConfigListParameters; extern ptr_ConfigListParameters ConfigListParameters;
extern ptr_ConfigSaveFile ConfigSaveFile;
extern ptr_ConfigSaveSection ConfigSaveSection;
extern ptr_ConfigSetParameter ConfigSetParameter; extern ptr_ConfigSetParameter ConfigSetParameter;
extern ptr_ConfigGetParameter ConfigGetParameter; extern ptr_ConfigGetParameter ConfigGetParameter;
extern ptr_ConfigGetParameterHelp ConfigGetParameterHelp; extern ptr_ConfigGetParameterHelp ConfigGetParameterHelp;

654
src/sdl_key_converter.c Normal file
View file

@ -0,0 +1,654 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus - sdl_key_converter.c *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2013 Mupen64plus development team *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "sdl_key_converter.h"
#include <stdint.h>
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
uint16_t sdl_keysym2scancode(uint16_t keysym)
{
static const uint16_t keysym2scancode[323] = {
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x002au, /* SDLK_BACKSPACE -> SDL_SCANCODE_BACKSPACE */
0x002bu, /* SDLK_TAB -> SDL_SCANCODE_TAB */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x009cu, /* SDLK_CLEAR -> SDL_SCANCODE_CLEAR */
0x0028u, /* SDLK_RETURN -> SDL_SCANCODE_RETURN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0048u, /* SDLK_PAUSE -> SDL_SCANCODE_PAUSE */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0029u, /* SDLK_ESCAPE -> SDL_SCANCODE_ESCAPE */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x002cu, /* SDLK_SPACE -> SDL_SCANCODE_SPACE */
0x0000u, /* SDLK_EXCLAIM -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_QUOTEDBL -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_HASH -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_DOLLAR -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_AMPERSAND -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_QUOTE -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_LEFTPAREN -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_RIGHTPAREN -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_ASTERISK -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_PLUS -> SDL_SCANCODE_UNKNOWN */
0x0036u, /* SDLK_COMMA -> SDL_SCANCODE_COMMA */
0x002du, /* SDLK_MINUS -> SDL_SCANCODE_MINUS */
0x0037u, /* SDLK_PERIOD -> SDL_SCANCODE_PERIOD */
0x0038u, /* SDLK_SLASH -> SDL_SCANCODE_SLASH */
0x0027u, /* SDLK_0 -> SDL_SCANCODE_0 */
0x001eu, /* SDLK_1 -> SDL_SCANCODE_1 */
0x001fu, /* SDLK_2 -> SDL_SCANCODE_2 */
0x0020u, /* SDLK_3 -> SDL_SCANCODE_3 */
0x0021u, /* SDLK_4 -> SDL_SCANCODE_4 */
0x0022u, /* SDLK_5 -> SDL_SCANCODE_5 */
0x0023u, /* SDLK_6 -> SDL_SCANCODE_6 */
0x0024u, /* SDLK_7 -> SDL_SCANCODE_7 */
0x0025u, /* SDLK_8 -> SDL_SCANCODE_8 */
0x0026u, /* SDLK_9 -> SDL_SCANCODE_9 */
0x0000u, /* SDLK_COLON -> SDL_SCANCODE_UNKNOWN */
0x0033u, /* SDLK_SEMICOLON -> SDL_SCANCODE_SEMICOLON */
0x0000u, /* SDLK_LESS -> SDL_SCANCODE_UNKNOWN */
0x002eu, /* SDLK_EQUALS -> SDL_SCANCODE_EQUALS */
0x0000u, /* SDLK_GREATER -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_QUESTION -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_AT -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x002fu, /* SDLK_LEFTBRACKET -> SDL_SCANCODE_LEFTBRACKET */
0x0031u, /* SDLK_BACKSLASH -> SDL_SCANCODE_BACKSLASH */
0x0030u, /* SDLK_RIGHTBRACKET -> SDL_SCANCODE_RIGHTBRACKET */
0x0000u, /* SDLK_CARET -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_UNDERSCORE -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_BACKQUOTE -> SDL_SCANCODE_UNKNOWN */
0x0004u, /* SDLK_a -> SDL_SCANCODE_A */
0x0005u, /* SDLK_b -> SDL_SCANCODE_B */
0x0006u, /* SDLK_c -> SDL_SCANCODE_C */
0x0007u, /* SDLK_d -> SDL_SCANCODE_D */
0x0008u, /* SDLK_e -> SDL_SCANCODE_E */
0x0009u, /* SDLK_f -> SDL_SCANCODE_F */
0x000au, /* SDLK_g -> SDL_SCANCODE_G */
0x000bu, /* SDLK_h -> SDL_SCANCODE_H */
0x000cu, /* SDLK_i -> SDL_SCANCODE_I */
0x000du, /* SDLK_j -> SDL_SCANCODE_J */
0x000eu, /* SDLK_k -> SDL_SCANCODE_K */
0x000fu, /* SDLK_l -> SDL_SCANCODE_L */
0x0010u, /* SDLK_m -> SDL_SCANCODE_M */
0x0011u, /* SDLK_n -> SDL_SCANCODE_N */
0x0012u, /* SDLK_o -> SDL_SCANCODE_O */
0x0013u, /* SDLK_p -> SDL_SCANCODE_P */
0x0014u, /* SDLK_q -> SDL_SCANCODE_Q */
0x0015u, /* SDLK_r -> SDL_SCANCODE_R */
0x0016u, /* SDLK_s -> SDL_SCANCODE_S */
0x0017u, /* SDLK_t -> SDL_SCANCODE_T */
0x0018u, /* SDLK_u -> SDL_SCANCODE_U */
0x0019u, /* SDLK_v -> SDL_SCANCODE_V */
0x001au, /* SDLK_w -> SDL_SCANCODE_W */
0x001bu, /* SDLK_x -> SDL_SCANCODE_X */
0x001cu, /* SDLK_y -> SDL_SCANCODE_Y */
0x001du, /* SDLK_z -> SDL_SCANCODE_Z */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x004cu, /* SDLK_DELETE -> SDL_SCANCODE_DELETE */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_0 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_1 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_2 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_3 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_4 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_5 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_6 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_7 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_8 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_9 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_10 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_11 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_12 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_13 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_14 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_15 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_16 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_17 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_18 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_19 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_20 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_21 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_22 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_23 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_24 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_25 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_26 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_27 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_28 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_29 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_30 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_31 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_32 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_33 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_34 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_35 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_36 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_37 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_38 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_39 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_40 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_41 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_42 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_43 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_44 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_45 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_46 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_47 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_48 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_49 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_50 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_51 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_52 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_53 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_54 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_55 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_56 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_57 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_58 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_59 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_60 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_61 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_62 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_63 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_64 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_65 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_66 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_67 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_68 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_69 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_70 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_71 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_72 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_73 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_74 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_75 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_76 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_77 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_78 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_79 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_80 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_81 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_82 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_83 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_84 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_85 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_86 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_87 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_88 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_89 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_90 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_91 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_92 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_93 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_94 -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_WORLD_95 -> SDL_SCANCODE_UNKNOWN */
0x0062u, /* SDLK_KP0 -> SDL_SCANCODE_KP_0 */
0x0059u, /* SDLK_KP1 -> SDL_SCANCODE_KP_1 */
0x005au, /* SDLK_KP2 -> SDL_SCANCODE_KP_2 */
0x005bu, /* SDLK_KP3 -> SDL_SCANCODE_KP_3 */
0x005cu, /* SDLK_KP4 -> SDL_SCANCODE_KP_4 */
0x005du, /* SDLK_KP5 -> SDL_SCANCODE_KP_5 */
0x005eu, /* SDLK_KP6 -> SDL_SCANCODE_KP_6 */
0x005fu, /* SDLK_KP7 -> SDL_SCANCODE_KP_7 */
0x0060u, /* SDLK_KP8 -> SDL_SCANCODE_KP_8 */
0x0061u, /* SDLK_KP9 -> SDL_SCANCODE_KP_9 */
0x0063u, /* SDLK_KP_PERIOD -> SDL_SCANCODE_KP_PERIOD */
0x0054u, /* SDLK_KP_DIVIDE -> SDL_SCANCODE_KP_DIVIDE */
0x0055u, /* SDLK_KP_MULTIPLY -> SDL_SCANCODE_KP_MULTIPLY */
0x0056u, /* SDLK_KP_MINUS -> SDL_SCANCODE_KP_MINUS */
0x0057u, /* SDLK_KP_PLUS -> SDL_SCANCODE_KP_PLUS */
0x0058u, /* SDLK_KP_ENTER -> SDL_SCANCODE_KP_ENTER */
0x0067u, /* SDLK_KP_EQUALS -> SDL_SCANCODE_KP_EQUALS */
0x0052u, /* SDLK_UP -> SDL_SCANCODE_UP */
0x0051u, /* SDLK_DOWN -> SDL_SCANCODE_DOWN */
0x004fu, /* SDLK_RIGHT -> SDL_SCANCODE_RIGHT */
0x0050u, /* SDLK_LEFT -> SDL_SCANCODE_LEFT */
0x0049u, /* SDLK_INSERT -> SDL_SCANCODE_INSERT */
0x004au, /* SDLK_HOME -> SDL_SCANCODE_HOME */
0x004du, /* SDLK_END -> SDL_SCANCODE_END */
0x004bu, /* SDLK_PAGEUP -> SDL_SCANCODE_PAGEUP */
0x004eu, /* SDLK_PAGEDOWN -> SDL_SCANCODE_PAGEDOWN */
0x003au, /* SDLK_F1 -> SDL_SCANCODE_F1 */
0x003bu, /* SDLK_F2 -> SDL_SCANCODE_F2 */
0x003cu, /* SDLK_F3 -> SDL_SCANCODE_F3 */
0x003du, /* SDLK_F4 -> SDL_SCANCODE_F4 */
0x003eu, /* SDLK_F5 -> SDL_SCANCODE_F5 */
0x003fu, /* SDLK_F6 -> SDL_SCANCODE_F6 */
0x0040u, /* SDLK_F7 -> SDL_SCANCODE_F7 */
0x0041u, /* SDLK_F8 -> SDL_SCANCODE_F8 */
0x0042u, /* SDLK_F9 -> SDL_SCANCODE_F9 */
0x0043u, /* SDLK_F10 -> SDL_SCANCODE_F10 */
0x0044u, /* SDLK_F11 -> SDL_SCANCODE_F11 */
0x0045u, /* SDLK_F12 -> SDL_SCANCODE_F12 */
0x0068u, /* SDLK_F13 -> SDL_SCANCODE_F13 */
0x0069u, /* SDLK_F14 -> SDL_SCANCODE_F14 */
0x006au, /* SDLK_F15 -> SDL_SCANCODE_F15 */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* unassigned -> SDL_SCANCODE_UNKNOWN */
0x0053u, /* SDLK_NUMLOCK -> SDL_SCANCODE_NUMLOCKCLEAR */
0x0039u, /* SDLK_CAPSLOCK -> SDL_SCANCODE_CAPSLOCK */
0x0000u, /* SDLK_SCROLLOCK -> SDL_SCANCODE_UNKNOWN */
0x00e5u, /* SDLK_RSHIFT -> SDL_SCANCODE_RSHIFT */
0x00e1u, /* SDLK_LSHIFT -> SDL_SCANCODE_LSHIFT */
0x00e4u, /* SDLK_RCTRL -> SDL_SCANCODE_RCTRL */
0x00e0u, /* SDLK_LCTRL -> SDL_SCANCODE_LCTRL */
0x00e6u, /* SDLK_RALT -> SDL_SCANCODE_RALT */
0x00e2u, /* SDLK_LALT -> SDL_SCANCODE_LALT */
0x0000u, /* SDLK_RMETA -> SDL_SCANCODE_UNKNOWN */
0x0000u, /* SDLK_LMETA -> SDL_SCANCODE_UNKNOWN */
0x00e3u, /* SDLK_LSUPER -> SDL_SCANCODE_LGUI */
0x00e7u, /* SDLK_RSUPER -> SDL_SCANCODE_RGUI */
0x0101u, /* SDLK_MODE -> SDL_SCANCODE_MODE */
0x0000u, /* SDLK_COMPOSE -> SDL_SCANCODE_UNKNOWN */
0x0075u, /* SDLK_HELP -> SDL_SCANCODE_HELP */
0x0000u, /* SDLK_PRINT -> SDL_SCANCODE_UNKNOWN */
0x009au, /* SDLK_SYSREQ -> SDL_SCANCODE_SYSREQ */
0x0000u, /* SDLK_BREAK -> SDL_SCANCODE_UNKNOWN */
0x0076u, /* SDLK_MENU -> SDL_SCANCODE_MENU */
0x0066u, /* SDLK_POWER -> SDL_SCANCODE_POWER */
0x0000u, /* SDLK_EURO -> SDL_SCANCODE_UNKNOWN */
0x007au, /* SDLK_UNDO -> SDL_SCANCODE_UNDO */
};
if (keysym >= ARRAY_SIZE(keysym2scancode))
return 0;
return keysym2scancode[keysym];
}
uint16_t sdl_scancode2keysym(uint16_t scancode)
{
static const uint16_t scancode2keysym[285] = {
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0061u, /* SDL_SCANCODE_A -> SDLK_a */
0x0062u, /* SDL_SCANCODE_B -> SDLK_b */
0x0063u, /* SDL_SCANCODE_C -> SDLK_c */
0x0064u, /* SDL_SCANCODE_D -> SDLK_d */
0x0065u, /* SDL_SCANCODE_E -> SDLK_e */
0x0066u, /* SDL_SCANCODE_F -> SDLK_f */
0x0067u, /* SDL_SCANCODE_G -> SDLK_g */
0x0068u, /* SDL_SCANCODE_H -> SDLK_h */
0x0069u, /* SDL_SCANCODE_I -> SDLK_i */
0x006au, /* SDL_SCANCODE_J -> SDLK_j */
0x006bu, /* SDL_SCANCODE_K -> SDLK_k */
0x006cu, /* SDL_SCANCODE_L -> SDLK_l */
0x006du, /* SDL_SCANCODE_M -> SDLK_m */
0x006eu, /* SDL_SCANCODE_N -> SDLK_n */
0x006fu, /* SDL_SCANCODE_O -> SDLK_o */
0x0070u, /* SDL_SCANCODE_P -> SDLK_p */
0x0071u, /* SDL_SCANCODE_Q -> SDLK_q */
0x0072u, /* SDL_SCANCODE_R -> SDLK_r */
0x0073u, /* SDL_SCANCODE_S -> SDLK_s */
0x0074u, /* SDL_SCANCODE_T -> SDLK_t */
0x0075u, /* SDL_SCANCODE_U -> SDLK_u */
0x0076u, /* SDL_SCANCODE_V -> SDLK_v */
0x0077u, /* SDL_SCANCODE_W -> SDLK_w */
0x0078u, /* SDL_SCANCODE_X -> SDLK_x */
0x0079u, /* SDL_SCANCODE_Y -> SDLK_y */
0x007au, /* SDL_SCANCODE_Z -> SDLK_z */
0x0031u, /* SDL_SCANCODE_1 -> SDLK_1 */
0x0032u, /* SDL_SCANCODE_2 -> SDLK_2 */
0x0033u, /* SDL_SCANCODE_3 -> SDLK_3 */
0x0034u, /* SDL_SCANCODE_4 -> SDLK_4 */
0x0035u, /* SDL_SCANCODE_5 -> SDLK_5 */
0x0036u, /* SDL_SCANCODE_6 -> SDLK_6 */
0x0037u, /* SDL_SCANCODE_7 -> SDLK_7 */
0x0038u, /* SDL_SCANCODE_8 -> SDLK_8 */
0x0039u, /* SDL_SCANCODE_9 -> SDLK_9 */
0x0030u, /* SDL_SCANCODE_0 -> SDLK_0 */
0x000du, /* SDL_SCANCODE_RETURN -> SDLK_RETURN */
0x001bu, /* SDL_SCANCODE_ESCAPE -> SDLK_ESCAPE */
0x0008u, /* SDL_SCANCODE_BACKSPACE -> SDLK_BACKSPACE */
0x0009u, /* SDL_SCANCODE_TAB -> SDLK_TAB */
0x0020u, /* SDL_SCANCODE_SPACE -> SDLK_SPACE */
0x002du, /* SDL_SCANCODE_MINUS -> SDLK_MINUS */
0x003du, /* SDL_SCANCODE_EQUALS -> SDLK_EQUALS */
0x005bu, /* SDL_SCANCODE_LEFTBRACKET -> SDLK_LEFTBRACKET */
0x005du, /* SDL_SCANCODE_RIGHTBRACKET -> SDLK_RIGHTBRACKET */
0x005cu, /* SDL_SCANCODE_BACKSLASH -> SDLK_BACKSLASH */
0x0000u, /* SDL_SCANCODE_NONUSHASH -> SDLK_UNKNOWN */
0x003bu, /* SDL_SCANCODE_SEMICOLON -> SDLK_SEMICOLON */
0x0000u, /* SDL_SCANCODE_APOSTROPHE -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_GRAVE -> SDLK_UNKNOWN */
0x002cu, /* SDL_SCANCODE_COMMA -> SDLK_COMMA */
0x002eu, /* SDL_SCANCODE_PERIOD -> SDLK_PERIOD */
0x002fu, /* SDL_SCANCODE_SLASH -> SDLK_SLASH */
0x012du, /* SDL_SCANCODE_CAPSLOCK -> SDLK_CAPSLOCK */
0x011au, /* SDL_SCANCODE_F1 -> SDLK_F1 */
0x011bu, /* SDL_SCANCODE_F2 -> SDLK_F2 */
0x011cu, /* SDL_SCANCODE_F3 -> SDLK_F3 */
0x011du, /* SDL_SCANCODE_F4 -> SDLK_F4 */
0x011eu, /* SDL_SCANCODE_F5 -> SDLK_F5 */
0x011fu, /* SDL_SCANCODE_F6 -> SDLK_F6 */
0x0120u, /* SDL_SCANCODE_F7 -> SDLK_F7 */
0x0121u, /* SDL_SCANCODE_F8 -> SDLK_F8 */
0x0122u, /* SDL_SCANCODE_F9 -> SDLK_F9 */
0x0123u, /* SDL_SCANCODE_F10 -> SDLK_F10 */
0x0124u, /* SDL_SCANCODE_F11 -> SDLK_F11 */
0x0125u, /* SDL_SCANCODE_F12 -> SDLK_F12 */
0x0000u, /* SDL_SCANCODE_PRINTSCREEN -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_SCROLLLOCK -> SDLK_UNKNOWN */
0x0013u, /* SDL_SCANCODE_PAUSE -> SDLK_PAUSE */
0x0115u, /* SDL_SCANCODE_INSERT -> SDLK_INSERT */
0x0116u, /* SDL_SCANCODE_HOME -> SDLK_HOME */
0x0118u, /* SDL_SCANCODE_PAGEUP -> SDLK_PAGEUP */
0x007fu, /* SDL_SCANCODE_DELETE -> SDLK_DELETE */
0x0117u, /* SDL_SCANCODE_END -> SDLK_END */
0x0119u, /* SDL_SCANCODE_PAGEDOWN -> SDLK_PAGEDOWN */
0x0113u, /* SDL_SCANCODE_RIGHT -> SDLK_RIGHT */
0x0114u, /* SDL_SCANCODE_LEFT -> SDLK_LEFT */
0x0112u, /* SDL_SCANCODE_DOWN -> SDLK_DOWN */
0x0111u, /* SDL_SCANCODE_UP -> SDLK_UP */
0x012cu, /* SDL_SCANCODE_NUMLOCKCLEAR -> SDLK_NUMLOCK */
0x010bu, /* SDL_SCANCODE_KP_DIVIDE -> SDLK_KP_DIVIDE */
0x010cu, /* SDL_SCANCODE_KP_MULTIPLY -> SDLK_KP_MULTIPLY */
0x010du, /* SDL_SCANCODE_KP_MINUS -> SDLK_KP_MINUS */
0x010eu, /* SDL_SCANCODE_KP_PLUS -> SDLK_KP_PLUS */
0x010fu, /* SDL_SCANCODE_KP_ENTER -> SDLK_KP_ENTER */
0x0101u, /* SDL_SCANCODE_KP_1 -> SDLK_KP1 */
0x0102u, /* SDL_SCANCODE_KP_2 -> SDLK_KP2 */
0x0103u, /* SDL_SCANCODE_KP_3 -> SDLK_KP3 */
0x0104u, /* SDL_SCANCODE_KP_4 -> SDLK_KP4 */
0x0105u, /* SDL_SCANCODE_KP_5 -> SDLK_KP5 */
0x0106u, /* SDL_SCANCODE_KP_6 -> SDLK_KP6 */
0x0107u, /* SDL_SCANCODE_KP_7 -> SDLK_KP7 */
0x0108u, /* SDL_SCANCODE_KP_8 -> SDLK_KP8 */
0x0109u, /* SDL_SCANCODE_KP_9 -> SDLK_KP9 */
0x0100u, /* SDL_SCANCODE_KP_0 -> SDLK_KP0 */
0x010au, /* SDL_SCANCODE_KP_PERIOD -> SDLK_KP_PERIOD */
0x0000u, /* SDL_SCANCODE_NONUSBACKSLASH -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_APPLICATION -> SDLK_UNKNOWN */
0x0140u, /* SDL_SCANCODE_POWER -> SDLK_POWER */
0x0110u, /* SDL_SCANCODE_KP_EQUALS -> SDLK_KP_EQUALS */
0x0126u, /* SDL_SCANCODE_F13 -> SDLK_F13 */
0x0127u, /* SDL_SCANCODE_F14 -> SDLK_F14 */
0x0128u, /* SDL_SCANCODE_F15 -> SDLK_F15 */
0x0000u, /* SDL_SCANCODE_F16 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_F17 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_F18 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_F19 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_F20 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_F21 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_F22 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_F23 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_F24 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_EXECUTE -> SDLK_UNKNOWN */
0x013bu, /* SDL_SCANCODE_HELP -> SDLK_HELP */
0x013fu, /* SDL_SCANCODE_MENU -> SDLK_MENU */
0x0000u, /* SDL_SCANCODE_SELECT -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_STOP -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_AGAIN -> SDLK_UNKNOWN */
0x0142u, /* SDL_SCANCODE_UNDO -> SDLK_UNDO */
0x0000u, /* SDL_SCANCODE_CUT -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_COPY -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_PASTE -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_FIND -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_MUTE -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_VOLUMEUP -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_VOLUMEDOWN -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_COMMA -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_EQUALSAS400 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_INTERNATIONAL1 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_INTERNATIONAL2 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_INTERNATIONAL3 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_INTERNATIONAL4 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_INTERNATIONAL5 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_INTERNATIONAL6 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_INTERNATIONAL7 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_INTERNATIONAL8 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_INTERNATIONAL9 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_LANG1 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_LANG2 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_LANG3 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_LANG4 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_LANG5 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_LANG6 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_LANG7 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_LANG8 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_LANG9 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_ALTERASE -> SDLK_UNKNOWN */
0x013du, /* SDL_SCANCODE_SYSREQ -> SDLK_SYSREQ */
0x0000u, /* SDL_SCANCODE_CANCEL -> SDLK_UNKNOWN */
0x000cu, /* SDL_SCANCODE_CLEAR -> SDLK_CLEAR */
0x0000u, /* SDL_SCANCODE_PRIOR -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_RETURN2 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_SEPARATOR -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_OUT -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_OPER -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_CLEARAGAIN -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_CRSEL -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_EXSEL -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_00 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_000 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_THOUSANDSSEPARATOR -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_DECIMALSEPARATOR -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_CURRENCYUNIT -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_CURRENCYSUBUNIT -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_LEFTPAREN -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_RIGHTPAREN -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_LEFTBRACE -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_RIGHTBRACE -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_TAB -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_BACKSPACE -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_A -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_B -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_C -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_D -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_E -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_F -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_XOR -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_POWER -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_PERCENT -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_LESS -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_GREATER -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_AMPERSAND -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_DBLAMPERSAND -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_VERTICALBAR -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_DBLVERTICALBAR -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_COLON -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_HASH -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_SPACE -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_AT -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_EXCLAM -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_MEMSTORE -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_MEMRECALL -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_MEMCLEAR -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_MEMADD -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_MEMSUBTRACT -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_MEMMULTIPLY -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_MEMDIVIDE -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_PLUSMINUS -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_CLEAR -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_CLEARENTRY -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_BINARY -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_OCTAL -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_DECIMAL -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KP_HEXADECIMAL -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0132u, /* SDL_SCANCODE_LCTRL -> SDLK_LCTRL */
0x0130u, /* SDL_SCANCODE_LSHIFT -> SDLK_LSHIFT */
0x0134u, /* SDL_SCANCODE_LALT -> SDLK_LALT */
0x0137u, /* SDL_SCANCODE_LGUI -> SDLK_LSUPER */
0x0131u, /* SDL_SCANCODE_RCTRL -> SDLK_RCTRL */
0x012fu, /* SDL_SCANCODE_RSHIFT -> SDLK_RSHIFT */
0x0133u, /* SDL_SCANCODE_RALT -> SDLK_RALT */
0x0138u, /* SDL_SCANCODE_RGUI -> SDLK_RSUPER */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0000u, /* unassigned -> SDLK_UNKNOWN */
0x0139u, /* SDL_SCANCODE_MODE -> SDLK_MODE */
0x0000u, /* SDL_SCANCODE_AUDIONEXT -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_AUDIOPREV -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_AUDIOSTOP -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_AUDIOPLAY -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_AUDIOMUTE -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_MEDIASELECT -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_WWW -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_MAIL -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_CALCULATOR -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_COMPUTER -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_AC_SEARCH -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_AC_HOME -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_AC_BACK -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_AC_FORWARD -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_AC_STOP -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_AC_REFRESH -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_AC_BOOKMARKS -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_BRIGHTNESSDOWN -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_BRIGHTNESSUP -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_DISPLAYSWITCH -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KBDILLUMTOGGLE -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KBDILLUMDOWN -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_KBDILLUMUP -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_EJECT -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_SLEEP -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_APP1 -> SDLK_UNKNOWN */
0x0000u, /* SDL_SCANCODE_APP2 -> SDLK_UNKNOWN */
};
if (scancode >= ARRAY_SIZE(scancode2keysym))
return 0;
return scancode2keysym[scancode];
}

38
src/sdl_key_converter.h Normal file
View file

@ -0,0 +1,38 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus - sdl_key_converter.h *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2013 Mupen64plus development team *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <SDL.h>
#include <stdint.h>
#include "osal_preproc.h"
uint16_t sdl_keysym2scancode(uint16_t keysym);
uint16_t sdl_scancode2keysym(uint16_t scancode);
static osal_inline uint16_t sdl_keysym2native(uint16_t keysym)
{
return sdl_keysym2scancode(keysym);
}
static osal_inline uint16_t sdl_native2keysym(uint16_t native)
{
return sdl_scancode2keysym(native);
}

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-input-sdl - version.h * * Mupen64plus-input-sdl - version.h *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ * * Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2009-2012 Richard Goedeken * * Copyright (C) 2009-2012 Richard Goedeken *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
@ -27,8 +27,8 @@
#define VERSION_H #define VERSION_H
#define PLUGIN_NAME "Mupen64Plus SDL Input Plugin" #define PLUGIN_NAME "Mupen64Plus SDL Input Plugin"
#define PLUGIN_VERSION 0x020000 #define PLUGIN_VERSION 0x020600
#define INPUT_PLUGIN_API_VERSION 0x020000 #define INPUT_PLUGIN_API_VERSION 0x020100
#define CONFIG_API_VERSION 0x020100 #define CONFIG_API_VERSION 0x020100
#define VERSION_PRINTF_SPLIT(x) (((x) >> 16) & 0xffff), (((x) >> 8) & 0xff), ((x) & 0xff) #define VERSION_PRINTF_SPLIT(x) (((x) >> 16) & 0xffff), (((x) >> 8) & 0xff), ((x) & 0xff)