Compare commits

..

No commits in common. "master" and "2.0" have entirely different histories.
master ... 2.0

31 changed files with 1032 additions and 3870 deletions

38
.gitattributes vendored
View file

@ -1,38 +0,0 @@
* 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

View file

@ -1,158 +0,0 @@
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/*

View file

@ -1,154 +0,0 @@
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
View file

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

4
.hgignore Normal file
View file

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

View file

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

View file

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

View file

@ -1,19 +1,22 @@
![Logo](https://upload.wikimedia.org/wikipedia/commons/thumb/4/41/Mupen64plus.svg/127px-Mupen64plus.svg.png)
# https://mupen64plus.org/wiki/index.php/ControllerSetup
# Mupen64plus-input-sdl README v2.0
===============================================================================
-------------------------------------------------------------------------------
Mupen64plus-input-sdl README v2.0
-------------------------------------------------------------------------------
===============================================================================
The latest documentation for this plugin can be found in wiki format at:
https://mupen64plus.org/wiki/index.php/KeyboardSetup
https://mupen64plus.org/wiki/index.php/ControllerSetup
https://code.google.com/p/mupen64plus/wiki/KeyboardSetup
https://code.google.com/p/mupen64plus/wiki/ControllerSetup
The format and usage of this plugin's "mupen64plus.cfg" configuration options
can be found at:
https://mupen64plus.org/wiki/index.php/Mupen64Plus_Plugin_Parameters#Input-SDL
http://mupen64plus.retrouprising.com/mediawiki/index.php?title=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
to True, the plugin will hide the mouse cursor and 'grab' the mouse pointer. The user
@ -22,78 +25,33 @@ https://mupen64plus.org/wiki/index.php/Mupen64Plus_Plugin_Parameters#Input-SDL
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.
## Default Keyboard interface:
-------------------------------------------------------------------------------
Notes for supported joysticks for auto-configuration:
-------------------------------------------------------------------------------
```
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)
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.
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 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 10 is the start button.
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.
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 Xbox 360 controller and clones:
4. Microsoft X-Box 360 pad:
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.
```
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:
5. MP-8866 Dual USB Joypad:
This is a USB adapter for PlayStation controllers (2).
```
D-Pad: hat(0)
L-Stick: x:0, y:1
R-Stick: x:2, y:3
@ -110,36 +68,12 @@ Select: button(9)
L3: button(10)
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).
```
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:
6. N64 controller:
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.
8) Playstation 3 Controller:
```
7. Playstation 3 Controller:
Left analog stick - analog stick
Right analog stick - C-pad
D-Pad - D-Pad
@ -148,9 +82,8 @@ Square - B
L1 / R1 - L / R
L2 - Z
Start - Start
```
9) SAITEK P880:
8. SAITEK P880:
The gamepad doesnt have enough keys to real assign all buttons. The second
analog stick can be used as button by pushing him insight.
@ -163,16 +96,14 @@ 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
button.
10) Xbox Gamepad (userspace driver)
9. Xbox Gamepad (userspace driver)
I created an Input Config for a Xbox 360 controller running with
xboxdrv on a Linux system (http://pingus.seul.org/~grumbel/xboxdrv/).
```
Z = Left shoulder button
L = Left shoulder trigger
A = A Button
B = X Button
```
everything else should be obvious.
@ -185,7 +116,6 @@ 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
not actually neccessary for the config to work.
```
[xboxdrv]
silent=true
trigger-as-button=true
@ -197,78 +127,20 @@ guide=KEY_ESC
[axismap]
x2^deadzone:27000
y2^deadzone:27000
```
11) Saitek Cyborg V.3 Rumble Pad (aka Saitek PS2700)
10. 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.
12) Arsenal Gaming PS3 controller (aka. "Gasia Co.,Ltd PS(R) Gamepad")
11. Default Keyboard interface:
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,116 +1,6 @@
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
-----------------------------------------
- re-write auto-configuration logic to be more user friendly. Add new 'mode' parameter.

View file

@ -1,43 +0,0 @@
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

@ -1,169 +0,0 @@
# 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

@ -1,105 +0,0 @@
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

@ -1,161 +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="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

@ -0,0 +1,112 @@
<?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

@ -0,0 +1,232 @@
<?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 homepage: https://mupen64plus.org/ *
# * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
# * Copyright (C) 2007-2009 Richard Goedeken *
# * *
# * This program is free software; you can redistribute it and/or modify *
@ -52,6 +52,7 @@ ifeq ("$(UNAME)","OpenBSD")
OS = FREEBSD
SO_EXTENSION = so
SHARED = -shared
$(warning OS type "$(UNAME)" not officially supported.')
endif
ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","")
OS = LINUX
@ -65,12 +66,13 @@ ifeq ("$(patsubst MINGW%,MINGW,$(UNAME))","MINGW")
PIC = 0
endif
ifeq ("$(OS)","NONE")
$(error OS type "$(UNAME)" not supported. Please file bug report at 'https://github.com/mupen64plus/mupen64plus-core/issues')
$(error OS type "$(UNAME)" not supported. Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
endif
# detect system architecture, only if it matters for build flags
# detect system architecture
HOST_CPU ?= $(shell uname -m)
CPU := OTHER
NO_ASM ?= 1
CPU := NONE
ifneq ("$(filter x86_64 amd64,$(HOST_CPU))","")
CPU := X86
ifeq ("$(BITS)", "32")
@ -86,19 +88,37 @@ ifneq ("$(filter pentium i%86,$(HOST_CPU))","")
ARCH_DETECTED := 32BITS
PIC ?= 0
endif
ifeq ("$(CPU)","OTHER")
ifneq ("$(filter ppc macppc socppc powerpc,$(HOST_CPU))","")
CPU := PPC
ARCH_DETECTED := 32BITS
BIG_ENDIAN := 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
SRCDIR = ../../src
OBJDIR = _obj$(POSTFIX)
# base CFLAGS, LDLIBS, and LDFLAGS
OPTFLAGS ?= -O3 -flto
WARNFLAGS ?= -Wall
CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -fvisibility=hidden -I$(SRCDIR) -D_GNU_SOURCE=1
CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -fno-strict-aliasing -fvisibility=hidden -I../../src -D_GNU_SOURCE=1
LDFLAGS += $(SHARED)
LDLIBS += -lm
# 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
@ -108,60 +128,57 @@ else
CFLAGS += -fno-PIC
endif
ifeq ($(BIG_ENDIAN), 1)
CFLAGS += -DM64P_BIG_ENDIAN
endif
# tweak flags for 32-bit build on 64-bit system
ifeq ($(ARCH_DETECTED), 64BITS_32)
ifeq ($(OS), FREEBSD)
$(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
# 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)
LDLIBS += -ldl
endif
ifeq ($(OS), OSX)
OSX_SDK_PATH = $(shell xcrun --sdk macosx --show-sdk-path)
# Select the proper SDK
# 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 ($(ARCH_DETECTED), 64BITS)
CFLAGS += -arch x86_64 -mmacosx-version-min=10.9 -isysroot $(OSX_SDK_PATH)
CFLAGS += -arch x86_64 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk
LDLIBS += -ldl
else
CFLAGS += -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=10.9 -isysroot $(OSX_SDK_PATH)
CFLAGS += -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk
LDLIBS += -ldl -read_only_relocs suppress
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
ifeq ($(origin SDL_CFLAGS) $(origin SDL_LDLIBS), undefined undefined)
ifeq ($(shell $(PKG_CONFIG) --modversion sdl2 2>/dev/null),)
$(error No SDL2 development libraries found!)
SDL_CONFIG = $(CROSS_COMPILE)sdl-config
ifeq ($(shell which $(SDL_CONFIG) 2>/dev/null),)
$(error No SDL development libraries found!)
endif
SDL_CFLAGS += $(shell $(PKG_CONFIG) --cflags sdl2)
SDL_LDLIBS += $(shell $(PKG_CONFIG) --libs sdl2)
SDL_CFLAGS += $(shell $(SDL_CONFIG) --cflags)
SDL_LDLIBS += $(shell $(SDL_CONFIG) --libs)
endif
CFLAGS += $(SDL_CFLAGS)
LDLIBS += $(SDL_LDLIBS)
@ -210,7 +227,6 @@ ifeq ($(DEBUG),1)
CFLAGS += -g
INSTALL_STRIP_FLAG ?=
else
CFLAGS += -DNDEBUG
ifneq ($(OS),OSX)
INSTALL_STRIP_FLAG ?= -s
endif
@ -233,11 +249,13 @@ ifeq ($(PLUGINDIR),)
PLUGINDIR := $(LIBDIR)/mupen64plus
endif
SRCDIR = ../../src
OBJDIR = _obj$(POSTFIX)
# list of source files to compile
SOURCE = \
$(SRCDIR)/plugin.c \
$(SRCDIR)/autoconfig.c \
$(SRCDIR)/sdl_key_converter.c \
$(SRCDIR)/config.c
ifeq ($(OS),MINGW)
@ -286,7 +304,7 @@ install: $(TARGET)
$(INSTALL) -d "$(DESTDIR)$(PLUGINDIR)"
$(INSTALL) -m 0644 $(INSTALL_STRIP_FLAG) $(TARGET) "$(DESTDIR)$(PLUGINDIR)"
$(INSTALL) -d "$(DESTDIR)$(SHAREDIR)"
$(INSTALL) -m 0644 "$(SRCDIR)/../data/InputAutoCfg.ini" "$(DESTDIR)$(SHAREDIR)"
$(INSTALL) -m 0644 "../../data/InputAutoCfg.ini" "$(DESTDIR)$(SHAREDIR)"
uninstall:
$(RM) "$(DESTDIR)$(PLUGINDIR)/$(TARGET)"
@ -298,7 +316,7 @@ clean:
rebuild: clean all
# build dependency files
CFLAGS += -MD -MP
CFLAGS += -MD
-include $(OBJECTS:.o=.d)
# standard build rules

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-input-sdl - autoconfig.c *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2009-2013 Richard Goedeken *
* *
* This program is free software; you can redistribute it and/or modify *
@ -19,14 +19,12 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "autoconfig.h"
#include "m64p_config.h"
#include "m64p_types.h"
#include "m64p_config.h"
#include "osal_preproc.h"
#include "autoconfig.h"
#include "plugin.h"
/* local definitions */
@ -117,81 +115,6 @@ int auto_copy_inputconfig(const char *pccSourceSectionName, const char *pccDestS
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)
{
FILE *pfIn;
@ -201,7 +124,6 @@ int auto_set_defaults(int iDeviceIdx, const char *joySDLName)
char *pchIni, *pchNextLine, *pchCurLine;
long iniLength;
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 (joySDLName == NULL)
@ -223,12 +145,6 @@ int auto_set_defaults(int iDeviceIdx, const char *joySDLName)
fseek(pfIn, 0L, SEEK_END);
iniLength = ftell(pfIn);
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);
if (pchIni == NULL)
{
@ -247,13 +163,11 @@ int auto_set_defaults(int iDeviceIdx, const char *joySDLName)
pchIni[iniLength] = 0;
/* parse the INI file, line by line */
DebugMessage(M64MSG_INFO, "Using auto-config file at: '%s'", CfgFilePath);
pchNextLine = pchIni;
eParseState = E_NAME_SEARCH;
while (pchNextLine != NULL && *pchNextLine != 0)
{
char *pivot = NULL;
int joyFound = 0;
/* set up character pointers */
pchCurLine = pchNextLine;
pchNextLine = strchr(pchNextLine, '\n');
@ -268,18 +182,66 @@ int auto_set_defaults(int iDeviceIdx, const char *joySDLName)
/* handle section (joystick name in ini file) */
if (*pchCurLine == '[' && pchCurLine[strlen(pchCurLine)-1] == ']')
{
/* only switch to name search when some section body was identified since last header */
if (eParseState == E_PARAM_READ)
eParseState = E_NAME_SEARCH;
char Word[64];
char *wordPtr;
int joyFound = 1;
if (eParseState == E_PARAM_READ)
{
/* 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 */
pchCurLine[strlen(pchCurLine)-1] = 0;
joyFound = auto_compare_name(joySDLName, StripSpace(pchCurLine + 1));
wordPtr = 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 (joyFound > joyFoundScore)
if (joyFound)
{
char SectionName[32];
ControllersFound = 0;
sprintf(SectionName, "AutoConfig%i", ControllersFound);
if (ConfigOpenSection(SectionName, &pConfig) != M64ERR_SUCCESS)
{
@ -290,7 +252,6 @@ int auto_set_defaults(int iDeviceIdx, const char *joySDLName)
eParseState = E_NAME_FOUND;
ControllersFound++;
ConfigSetParameter(pConfig, "device", M64TYPE_INT, &iDeviceIdx);
joyFoundScore = joyFound;
}
continue;
}
@ -307,7 +268,7 @@ int auto_set_defaults(int iDeviceIdx, const char *joySDLName)
*pivot++ = 0;
pchCurLine = StripSpace(pchCurLine);
pivot = StripSpace(pivot);
if (strcasecmp(pchCurLine, "device") == 0)
if (strcasecmp(pchCurLine, "plugin") == 0 || strcasecmp(pchCurLine, "device") == 0)
{
int iVal = atoi(pivot);
ConfigSetParameter(pConfig, pchCurLine, M64TYPE_INT, &iVal);
@ -330,7 +291,6 @@ int auto_set_defaults(int iDeviceIdx, const char *joySDLName)
/* if we haven't found the correct section yet, just skip this */
if (eParseState == E_NAME_SEARCH)
continue;
eParseState = E_PARAM_READ;
/* otherwise parse the keyword */
if (strcmp(pchCurLine, "__NextController:") == 0)
{
@ -363,7 +323,7 @@ int auto_set_defaults(int iDeviceIdx, const char *joySDLName)
DebugMessage(M64MSG_ERROR, "Invalid line in %s: '%s'", INI_FILE_NAME, pchCurLine);
}
if (joyFoundScore != -1)
if (eParseState == E_PARAM_READ)
{
/* we've finished parsing all parameters for the discovered input device, which is the last in the .ini file */
free(pchIni);

View file

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

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-input-sdl - config.c *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2009-2013 Richard Goedeken *
* *
* This program is free software; you can redistribute it and/or modify *
@ -20,18 +20,17 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <SDL.h>
#include <stdio.h>
#include <string.h>
#define M64P_PLUGIN_PROTOTYPES 1
#include "autoconfig.h"
#include "config.h"
#include "m64p_config.h"
#include "m64p_plugin.h"
#include "m64p_types.h"
#include "m64p_plugin.h"
#include "m64p_config.h"
#include "osal_preproc.h"
#include "autoconfig.h"
#include "plugin.h"
#include "sdl_key_converter.h"
#include "config.h"
#define HAT_POS_NAME( hat ) \
((hat == SDL_HAT_UP) ? "Up" : \
@ -89,7 +88,7 @@ static void clear_controller(int iCtrlIdx)
controller[iCtrlIdx].device = DEVICE_NO_JOYSTICK;
controller[iCtrlIdx].control->Present = 0;
controller[iCtrlIdx].control->RawData = 0;
controller[iCtrlIdx].control->Plugin = PLUGIN_MEMPAK;
controller[iCtrlIdx].control->Plugin = PLUGIN_NONE;
for( b = 0; b < 16; b++ )
{
controller[iCtrlIdx].button[b].button = -1;
@ -121,6 +120,15 @@ static const char * get_sdl_joystick_name(int iCtrlIdx)
{
static char JoyName[256];
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 */
joySDLName = SDL_JoystickName(iCtrlIdx);
@ -132,6 +140,10 @@ static const char * get_sdl_joystick_name(int iCtrlIdx)
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 (joySDLName == NULL)
return NULL;
@ -139,6 +151,29 @@ static const char * get_sdl_joystick_name(int iCtrlIdx)
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()
// return value: 1 = OK
@ -161,12 +196,17 @@ static int load_controller_config(const char *SectionName, int i, int sdlDeviceI
/* set SDL device number */
controller[i].device = sdlDeviceIdx;
/* throw warnings if 'plugged' is missing */
/* throw warnings if 'plugged' or 'plugin' are missing */
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);
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 */
ConfigGetParameter(pConfig, "mouse", M64TYPE_BOOL, &controller[i].mouse, sizeof(int));
if (ConfigGetParameter(pConfig, "MouseSensitivity", M64TYPE_STRING, input_str, 256) == M64ERR_SUCCESS)
@ -192,13 +232,9 @@ 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);
continue;
}
if ((config_ptr = strstr(input_str, "key")) != NULL) {
if (sscanf(config_ptr, "key(%i)", (int *) &controller[i].button[j].key) != 1) {
if ((config_ptr = strstr(input_str, "key")) != NULL)
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);
} else {
controller[i].button[j].key = sdl_keysym2native(controller[i].button[j].key);
}
}
if ((config_ptr = strstr(input_str, "button")) != NULL)
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);
@ -234,14 +270,9 @@ 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);
continue;
}
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 ((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)
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 (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);
@ -293,7 +324,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");
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");
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");
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");
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]);
@ -311,7 +342,7 @@ static void init_controller_config(int iCtrlIdx, const char *pccDeviceName, eMod
ParamString[0] = 0;
if (controller[iCtrlIdx].button[j].key > 0)
{
sprintf(Param, "key(%i) ", sdl_native2keysym(controller[iCtrlIdx].button[j].key));
sprintf(Param, "key(%i) ", controller[iCtrlIdx].button[j].key);
strcat(ParamString, Param);
}
if (controller[iCtrlIdx].button[j].button >= 0)
@ -357,7 +388,7 @@ static void init_controller_config(int iCtrlIdx, const char *pccDeviceName, eMod
ParamString[0] = 0;
if (controller[iCtrlIdx].axis[j].key_a > 0 && controller[iCtrlIdx].axis[j].key_b > 0)
{
sprintf(Param, "key(%i,%i) ", sdl_native2keysym(controller[iCtrlIdx].axis[j].key_a), sdl_native2keysym(controller[iCtrlIdx].axis[j].key_b));
sprintf(Param, "key(%i,%i) ", controller[iCtrlIdx].axis[j].key_a, controller[iCtrlIdx].axis[j].key_b);
strcat(ParamString, Param);
}
if (controller[iCtrlIdx].axis[j].button_a >= 0 && controller[iCtrlIdx].axis[j].button_b >= 0)
@ -413,6 +444,7 @@ static int setup_auto_controllers(int bPreConfig, int n64CtrlStart, int sdlCtrlI
if (!bPreConfig)
DebugMessage(M64MSG_INFO, "N64 Controller #%i: Using auto-config with SDL joystick %i ('%s')", n64CtrlStart+1, sdlCtrlIdx, sdlJoyName);
ActiveControllers++;
ConfigSaveSection(SectionName);
}
else
{
@ -450,6 +482,7 @@ static int setup_auto_controllers(int bPreConfig, int n64CtrlStart, int sdlCtrlI
if (!bPreConfig)
DebugMessage(M64MSG_INFO, "N64 Controller #%i: Using auto-config with SDL joystick %i ('%s')", n64CtrlStart+j+1, sdlCtrlIdx, sdlJoyName);
ActiveControllers++;
ConfigSaveSection(SectionName);
/* 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;
}
@ -504,7 +537,7 @@ void load_configuration(int bPreConfig)
int ControlDevice[4];
char DeviceName[4][256];
int ActiveControllers = 0;
int sdlNumJoysticks = SDL_NumJoysticks();
int sdlNumJoysticks = get_sdl_num_joysticks();
float fVersion = 0.0f;
const char *sdl_name;
int ControllersFound = 0;
@ -540,6 +573,8 @@ void load_configuration(int bPreConfig)
DeviceName[n64CtrlIdx][0] = 0;
// write blank config for GUI front-ends
init_controller_config(n64CtrlIdx, "", E_MODE_FULL_AUTO);
// save it to the file too
ConfigSaveSection(SectionName);
}
else
{
@ -561,11 +596,6 @@ void load_configuration(int bPreConfig)
{
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;
}
}
}
@ -615,6 +645,7 @@ void load_configuration(int bPreConfig)
/* copy the auto-config settings to the controller config section */
auto_copy_inputconfig("AutoConfig0", SectionName, "Keyboard");
ActiveControllers++;
ConfigSaveSection(SectionName);
}
else
{
@ -711,6 +742,7 @@ void load_configuration(int bPreConfig)
ConfigSetParameter(section, "device", M64TYPE_INT, &iNoDevice);
if (OrigControlMode[n64CtrlIdx] == E_MODE_FULL_AUTO)
ConfigSetParameter(section, "name", M64TYPE_STRING, "");
ConfigSaveSection(SectionName);
}
}
}
@ -729,6 +761,7 @@ void load_configuration(int bPreConfig)
else
auto_copy_inputconfig("AutoConfig0", "Input-SDL-Control1", NULL); // don't overwrite 'name' parameter
ActiveControllers++;
ConfigSaveSection("Input-SDL-Control1");
}
else
{

View file

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

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-core - osal/dynamiclib.h *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2009 Richard Goedeken *
* *
* 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 homepage: https://mupen64plus.org/ *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2009 Richard Goedeken *
* *
* 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <dlfcn.h>
#include "m64p_types.h"
#include "osal_dynamiclib.h"

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-ui-console - osal_dynamiclib_win32.c *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2009 Richard Goedeken *
* *
* 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include "m64p_types.h"
#include "osal_dynamiclib.h"

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus - osal_preproc.h *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2009 Richard Goedeken *
* Copyright (C) 2002 Hacktarux *
* *
@ -30,16 +30,4 @@
#define strcasecmp _stricmp
#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

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-input-sdl - plugin.c *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2008-2011 Richard Goedeken *
* Copyright (C) 2008 Tillin9 *
* Copyright (C) 2002 Blight *
@ -21,28 +21,28 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <SDL.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <SDL.h>
#define M64P_PLUGIN_PROTOTYPES 1
#include "config.h"
#include "m64p_types.h"
#include "m64p_plugin.h"
#include "m64p_common.h"
#include "m64p_config.h"
#include "m64p_plugin.h"
#include "m64p_types.h"
#include "osal_dynamiclib.h"
#include "plugin.h"
#include "config.h"
#include "version.h"
#include "osal_dynamiclib.h"
#ifdef __linux__
#include <unistd.h>
#include <dirent.h>
#include <fcntl.h>
#include <sys/types.h>
#include <unistd.h>
#include <linux/input.h>
#endif /* __linux__ */
@ -60,7 +60,9 @@
/* definitions of pointers to Core config functions */
ptr_ConfigOpenSection ConfigOpenSection = NULL;
ptr_ConfigDeleteSection ConfigDeleteSection = NULL;
ptr_ConfigSaveSection ConfigSaveSection = NULL;
ptr_ConfigListParameters ConfigListParameters = NULL;
ptr_ConfigSaveFile ConfigSaveFile = NULL;
ptr_ConfigSetParameter ConfigSetParameter = NULL;
ptr_ConfigGetParameter ConfigGetParameter = NULL;
ptr_ConfigGetParameterHelp ConfigGetParameterHelp = NULL;
@ -85,8 +87,6 @@ SController controller[4]; // 4 controllers
static void (*l_DebugCallback)(void *, int, const char *) = NULL;
static void *l_DebugCallContext = NULL;
static int l_PluginInit = 0;
static int l_joyWasInit = 0;
static int l_hapticWasInit = 0;
static unsigned short button_bits[] = {
0x0001, // R_DPAD
@ -111,6 +111,12 @@ static int romopen = 0; // is a rom opened
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 */
void DebugMessage(int level, const char *message, ...)
{
@ -164,6 +170,8 @@ EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle CoreLibHandle, void *Con
/* Get the core config function pointers from the library handle */
ConfigOpenSection = (ptr_ConfigOpenSection) osal_dynlib_getproc(CoreLibHandle, "ConfigOpenSection");
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");
ConfigSetParameter = (ptr_ConfigSetParameter) osal_dynlib_getproc(CoreLibHandle, "ConfigSetParameter");
ConfigGetParameter = (ptr_ConfigGetParameter) osal_dynlib_getproc(CoreLibHandle, "ConfigGetParameter");
@ -181,7 +189,7 @@ EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle CoreLibHandle, void *Con
ConfigGetUserDataPath = (ptr_ConfigGetUserDataPath) osal_dynlib_getproc(CoreLibHandle, "ConfigGetUserDataPath");
ConfigGetUserCachePath = (ptr_ConfigGetUserCachePath) osal_dynlib_getproc(CoreLibHandle, "ConfigGetUserCachePath");
if (!ConfigOpenSection || !ConfigDeleteSection || !ConfigSetParameter || !ConfigGetParameter ||
if (!ConfigOpenSection || !ConfigDeleteSection || !ConfigSaveFile || !ConfigSaveSection || !ConfigSetParameter || !ConfigGetParameter ||
!ConfigSetDefaultInt || !ConfigSetDefaultFloat || !ConfigSetDefaultBool || !ConfigSetDefaultString ||
!ConfigGetParamInt || !ConfigGetParamFloat || !ConfigGetParamBool || !ConfigGetParamString ||
!ConfigGetSharedDataFilepath || !ConfigGetUserConfigPath || !ConfigGetUserDataPath || !ConfigGetUserCachePath)
@ -202,15 +210,6 @@ EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle CoreLibHandle, void *Con
for (i = 0; i < 4; 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 */
load_configuration(1);
@ -227,10 +226,6 @@ EXPORT m64p_error CALL PluginShutdown(void)
l_DebugCallback = NULL;
l_DebugCallContext = NULL;
/* quit the joystick subsystem if necessary */
if (!l_joyWasInit)
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
l_PluginInit = 0;
return M64ERR_SUCCESS;
}
@ -260,7 +255,7 @@ EXPORT m64p_error CALL PluginGetVersion(m64p_plugin_type *PluginType, int *Plugi
/* Helper function to handle the SDL keys */
static void
doSdlKeys(const unsigned char* keystate)
doSdlKeys(unsigned char* keystate)
{
int c, b, axis_val, axis_max_val;
static int grabmouse = 1, grabtoggled = 0;
@ -269,7 +264,7 @@ doSdlKeys(const unsigned char* keystate)
if (keystate[SDL_SCANCODE_RCTRL])
axis_max_val -= 40;
if (keystate[SDL_SCANCODE_RSHIFT])
axis_max_val -= 25;
axis_max_val -= 20;
for( c = 0; c < 4; c++ )
{
@ -301,12 +296,6 @@ doSdlKeys(const unsigned char* keystate)
else
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 (keystate[SDL_SCANCODE_LCTRL] && keystate[SDL_SCANCODE_LALT])
@ -316,7 +305,11 @@ doSdlKeys(const unsigned char* keystate)
grabtoggled = 1;
grabmouse = !grabmouse;
// grab/ungrab mouse
SDL_SetRelativeMouseMode(grabmouse ? SDL_TRUE : SDL_FALSE);
#if SDL_VERSION_ATLEAST(2,0,0)
#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 );
}
}
@ -409,21 +402,31 @@ EXPORT void CALL ControllerCommand(int Control, unsigned char *Command)
unsigned int dwAddress = (Command[3] << 8) + (Command[4] & 0xE0);
if (dwAddress == PAK_IO_RUMBLE && *Data)
DebugMessage(M64MSG_VERBOSE, "Triggering rumble pack.");
if(dwAddress == PAK_IO_RUMBLE && controller[Control].event_joystick) {
#if SDL_VERSION_ATLEAST(2,0,18)
if (*Data) {
SDL_JoystickRumble(controller[Control].joystick, 0xFFFF, 0xFFFF, SDL_HAPTIC_INFINITY);
} else {
SDL_JoystickRumble(controller[Control].joystick, 0, 0, 0);
#ifdef __linux__
struct input_event play;
if( dwAddress == PAK_IO_RUMBLE && controller[Control].event_joystick != 0)
{
if( *Data )
{
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
if (*Data) {
SDL_HapticRumblePlay(controller[Control].event_joystick, 1, SDL_HAPTIC_INFINITY);
} else {
SDL_HapticRumbleStop(controller[Control].event_joystick);
else
{
play.type = EV_FF;
play.code = ffeffect[Control].id;
play.value = 0;
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 );
}
break;
@ -457,32 +460,14 @@ EXPORT void CALL GetKeys( int Control, BUTTONS *Keys )
{
static int mousex_residual = 0;
static int mousey_residual = 0;
int b, axis_val, axis_max_val;
int b, axis_val;
SDL_Event event;
unsigned char mstate;
SDL_PumpEvents();
// Handle keyboard input first
doSdlKeys(SDL_GetKeyboardState(NULL));
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
SDL_JoystickUpdate();
@ -499,7 +484,7 @@ EXPORT void CALL GetKeys( int Control, BUTTONS *Keys )
int deadzone = controller[Control].button[b].axis_deadzone;
axis_val = SDL_JoystickGetAxis( controller[Control].joystick, controller[Control].button[b].axis );
if (deadzone < 0)
deadzone = 16384; /* default */
deadzone = 6000; /* default */
if( (controller[Control].button[b].axis_dir < 0) && (axis_val <= -deadzone) )
controller[Control].buttons.Value |= button_bits[b];
else if( (controller[Control].button[b].axis_dir > 0) && (axis_val >= deadzone) )
@ -513,8 +498,6 @@ EXPORT void CALL GetKeys( int Control, BUTTONS *Keys )
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++ )
{
/* from the N64 func ref: The 3D Stick data is of type signed char and in the range between -80 and +80 */
@ -525,53 +508,50 @@ EXPORT void CALL GetKeys( int Control, BUTTONS *Keys )
continue;
if( b == 0 )
axis_val = iX;
axis_val = controller[Control].buttons.X_AXIS;
else
axis_val = -iY;
axis_val = -controller[Control].buttons.Y_AXIS;
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 axis_dir = controller[Control].axis[b].axis_dir_a;
if (joy_val * axis_dir > deadzone)
axis_val = -((abs(joy_val) - deadzone) * axis_max_val / range);
axis_val = -((abs(joy_val) - deadzone) * 80 / range);
if (axis_val < -80)
axis_val = -80;
}
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 axis_dir = controller[Control].axis[b].axis_dir_b;
if (joy_val * axis_dir > deadzone)
axis_val = ((abs(joy_val) - deadzone) * axis_max_val / range);
axis_val = ((abs(joy_val) - deadzone) * 80 / range);
if (axis_val > 80)
axis_val = 80;
}
if( controller[Control].axis[b].hat >= 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 )
axis_val = -axis_max_val;
axis_val = -80;
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 )
axis_val = axis_max_val;
axis_val = 80;
}
if( controller[Control].axis[b].button_a >= 0 )
if( SDL_JoystickGetButton( controller[Control].joystick, controller[Control].axis[b].button_a ) )
axis_val = -axis_max_val;
axis_val = -80;
if( controller[Control].axis[b].button_b >= 0 )
if( SDL_JoystickGetButton( controller[Control].joystick, controller[Control].axis[b].button_b ) )
axis_val = axis_max_val;
axis_val = 80;
if( b == 0 )
iX = axis_val;
controller[Control].buttons.X_AXIS = axis_val;
else
iY = -axis_val;
controller[Control].buttons.Y_AXIS = -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
@ -586,13 +566,18 @@ EXPORT void CALL GetKeys( int Control, BUTTONS *Keys )
if (controller[Control].mouse)
{
if (SDL_GetRelativeMouseMode())
#if SDL_VERSION_ATLEAST(2,0,0)
#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)
#else
while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_EVENTMASK(SDL_MOUSEMOTION)) == 1)
#endif
{
int w, h;
SDL_Window *focus;
if (event.motion.xrel)
{
mousex_residual += (int) (event.motion.xrel * controller[Control].mouse_sens[0]);
@ -601,39 +586,29 @@ EXPORT void CALL GetKeys( int Control, BUTTONS *Keys )
{
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
#endif
{
mousex_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
@ -642,108 +617,150 @@ EXPORT void CALL GetKeys( int Control, BUTTONS *Keys )
*Keys = controller[Control].buttons;
/* handle mempack / rumblepak switching (only if rumble is active on joystick) */
#if !SDL_VERSION_ATLEAST(2,0,18)
if (controller[Control].event_joystick) {
#ifdef __linux__
if (controller[Control].event_joystick != 0)
{
struct input_event play;
static unsigned int SwitchPackTime[4] = {0, 0, 0, 0}, SwitchPackType[4] = {0, 0, 0, 0};
if (controller[Control].buttons.Value & button_bits[14]) {
// 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])
{
SwitchPackTime[Control] = SDL_GetTicks(); // time at which the 'switch pack' command was given
SwitchPackType[Control] = PLUGIN_MEMPAK; // type of new pack to insert
controller[Control].control->Plugin = PLUGIN_NONE;// remove old pack
SDL_HapticRumblePlay(controller[Control].event_joystick, 0.5, 500);
play.type = EV_FF;
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
SwitchPackType[Control] = PLUGIN_RAW; // type of new pack to insert
controller[Control].control->Plugin = PLUGIN_NONE;// remove old pack
SDL_HapticRumblePlay(controller[Control].event_joystick, 1, 500);
play.type = EV_FF;
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
if (SwitchPackTime[Control] != 0 && (SDL_GetTicks() - SwitchPackTime[Control]) >= 1000)
{
SDL_HapticRumbleStop(controller[Control].event_joystick);
controller[Control].control->Plugin = SwitchPackType[Control];
SwitchPackTime[Control] = 0;
}
}
#endif /* SDL_VERSION_ATLEAST(2,0,18) */
#endif /* __linux__ */
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)
{
l_hapticWasInit = SDL_WasInit(SDL_INIT_HAPTIC);
if (!l_hapticWasInit) {
if (SDL_InitSubSystem(SDL_INIT_HAPTIC) == -1) {
DebugMessage(M64MSG_ERROR, "Couldn't init SDL haptic subsystem: %s", SDL_GetError() );
#ifdef __linux__
DIR* dp;
struct dirent* ep;
unsigned long features[4];
char temp[128];
char temp2[128];
int iFound = 0;
controller[cntrl].event_joystick = 0;
sprintf(temp,"/sys/class/input/js%d/device", controller[cntrl].device);
dp = opendir(temp);
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;
}
}
#if SDL_VERSION_ATLEAST(2,0,18)
if (SDL_JoystickHasRumble(controller[cntrl].joystick) == SDL_FALSE) {
DebugMessage(M64MSG_WARNING, "Joystick #%i doesn't support rumble effect", cntrl + 1);
closedir(dp);
if (!iFound)
{
DebugMessage(M64MSG_WARNING, "Couldn't find input event for rumble support.");
return;
}
controller[cntrl].event_joystick = open(temp, O_RDWR);
if(controller[cntrl].event_joystick==-1)
{
DebugMessage(M64MSG_WARNING, "Couldn't open device file '%s' for rumble support.", temp);
controller[cntrl].event_joystick = 0;
return;
}
controller[cntrl].event_joystick = 1;
#else
controller[cntrl].event_joystick = SDL_HapticOpenFromJoystick(controller[cntrl].joystick);
if (!controller[cntrl].event_joystick) {
DebugMessage(M64MSG_WARNING, "Couldn't open rumble support for joystick #%i", cntrl + 1);
if(ioctl(controller[cntrl].event_joystick, EVIOCGBIT(EV_FF, sizeof(unsigned long) * 4), features)==-1)
{
DebugMessage(M64MSG_WARNING, "Linux kernel communication failed for force feedback (rumble).\n");
controller[cntrl].event_joystick = 0;
return;
}
if (SDL_HapticRumbleSupported(controller[cntrl].event_joystick) == SDL_FALSE) {
SDL_HapticClose(controller[cntrl].event_joystick);
controller[cntrl].event_joystick = NULL;
DebugMessage(M64MSG_WARNING, "Joystick #%i doesn't support rumble effect", cntrl + 1);
if(!test_bit(FF_RUMBLE, features))
{
DebugMessage(M64MSG_WARNING, "No rumble supported on N64 joystick #%i", cntrl + 1);
controller[cntrl].event_joystick = 0;
return;
}
if (SDL_HapticRumbleInit(controller[cntrl].event_joystick) != 0) {
SDL_HapticClose(controller[cntrl].event_joystick);
controller[cntrl].event_joystick = NULL;
DebugMessage(M64MSG_WARNING, "Rumble initialization failed for Joystick #%i", cntrl + 1);
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);
}
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) */
#endif /* __linux__ */
}
/******************************************************************
@ -776,13 +793,10 @@ EXPORT void CALL InitiateControllers(CONTROL_INFO ControlInfo)
for( i = 0; i < 4; i++ )
{
// test for rumble support for this joystick
InitiateJoysticks(i);
InitiateRumble(i);
// if rumble not supported, switch to mempack
if (controller[i].control->Plugin == PLUGIN_RAW && controller[i].event_joystick == 0)
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));
@ -819,13 +833,22 @@ EXPORT void CALL RomClosed(void)
int i;
// close joysticks
for( i = 0; i < 4; i++ ) {
DeinitRumble(i);
DeinitJoystick(i);
for( i = 0; i < 4; i++ )
if( controller[i].joystick )
{
SDL_JoystickClose( controller[i].joystick );
controller[i].joystick = NULL;
}
// quit SDL joystick subsystem
SDL_QuitSubSystem( SDL_INIT_JOYSTICK );
// release/ungrab mouse
SDL_SetRelativeMouseMode(SDL_FALSE);
#if SDL_VERSION_ATLEAST(2,0,0)
#warning SDL mouse grabbing not yet supported with SDL 2.0
#else
SDL_WM_GrabInput( SDL_GRAB_OFF );
#endif
SDL_ShowCursor( 1 );
romopen = 0;
@ -842,19 +865,37 @@ EXPORT int CALL RomOpen(void)
{
int i;
// open joysticks
for (i = 0; i < 4; i++) {
InitiateJoysticks(i);
InitiateRumble(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
for( i = 0; i < 4; i++ )
if( controller[i].device >= 0 )
{
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
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 );
if (SDL_SetRelativeMouseMode(SDL_TRUE) < 0) {
if (SDL_WM_GrabInput( SDL_GRAB_ON ) != SDL_GRAB_ON)
{
DebugMessage(M64MSG_WARNING, "Couldn't grab input! Mouse support won't work!");
}
#endif
}
romopen = 1;

View file

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

View file

@ -1,654 +0,0 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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];
}

View file

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