Compare commits

..

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

27 changed files with 698 additions and 2217 deletions

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/*

1
.gitignore vendored
View file

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

View file

@ -1,16 +1,11 @@
sudo: required
dist: xenial
language: cpp language: cpp
compiler: compiler:
- gcc - gcc
- clang - clang
addons:
apt:
packages:
- git
- libsdl1.2-dev
- libsdl2-dev
before_install: before_install:
- sudo add-apt-repository --yes ppa:zoogie/sdl2-snapshots
- sudo apt-get update -qq
- sudo apt-get install -y git libsdl1.2-dev libsdl2-dev
- git clone --depth=1 --branch=master git://github.com/mupen64plus/mupen64plus-core.git deps/mupen64plus-core - git clone --depth=1 --branch=master git://github.com/mupen64plus/mupen64plus-core.git deps/mupen64plus-core
env: env:
- PLUGINDBG=0 - PLUGINDBG=0
@ -18,34 +13,3 @@ env:
script: 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=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 - 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

@ -34,7 +34,7 @@ Mupen64Plus is based on GPL-licensed source code from Mupen64 v0.5, originally w
Version 2, June 1991 Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc. Copyright (C) 1989, 1991 Free Software Foundation, Inc.
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 Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed. of this license document, but changing it is not allowed.

View file

@ -1,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: The latest documentation for this plugin can be found in wiki format at:
https://mupen64plus.org/wiki/index.php/KeyboardSetup https://code.google.com/p/mupen64plus/wiki/KeyboardSetup
https://mupen64plus.org/wiki/index.php/ControllerSetup https://code.google.com/p/mupen64plus/wiki/ControllerSetup
The format and usage of this plugin's "mupen64plus.cfg" configuration options The format and usage of this plugin's "mupen64plus.cfg" configuration options
can be found at: can be found at:
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 - If one of the enabled controllers has the "mouse" general-purpose config parameters set
to True, the plugin will hide the mouse cursor and 'grab' the mouse pointer. The user to True, the plugin will hide the mouse cursor and 'grab' the mouse pointer. The user
@ -22,47 +25,26 @@ 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 being pressed all the way to the edge. To decrease the amount of simulated joystick
deflection, the user may press Right Control, Right Shift, or Right Ctrl+Right Shift. deflection, the user may press Right Control, Right Shift, or Right Ctrl+Right Shift.
## Default Keyboard interface: -------------------------------------------------------------------------------
Notes for supported joysticks for auto-configuration:
-------------------------------------------------------------------------------
``` 1. Jess Tech Rumble Pad (Saitek Rumble)
Analog Pad is "Arrow Keys"
C Up/Left/Down/Right are "I", "J", "K", "L"
DPad Up/Left/Down/Right are "W", "A", "S", "D"
Z trig is "z" key
L and R trigs are "x" and "c"
Start is "Enter" ("Return")
A is "left shift"
B is "left control"
Select Mempack = ","
Select Rumblepack = "."
```
## Special modifier keys
- Right-shift key: reduce amplitude of analog joystick X/Y axes by 25%
- Right-control key: reduce amplitude of analog joystick X/Y axes by 50%
- Left-Control + Left-Alt keys: grab or un-grab the mouse cursor (only if mouse control is enabled)
- Left-Windows key: do not auto-center joystick X/Y axes (only when mouse control is enabled)
## Notes for supported joysticks for auto-configuration:
1) Jess Tech Rumble Pad (Saitek Rumble)
The left D-pad is mapped to the D-pad; The joystick is mapped to the left joystick of the gamepad; the C buttons are mapped to the gampad's right joystick. Start button is mapped to start; the A-button is mapped to the lowest button on the gamepad's right front; the B-button to the left button (buttons marked 3 and 1 on my gamepad). The L and R buttons are mapped to the lower left and right rear triggers; the Z button is mapped to the left upper rear trigger. All other buttons are unused. The left D-pad is mapped to the D-pad; The joystick is mapped to the left joystick of the gamepad; the C buttons are mapped to the gampad's right joystick. Start button is mapped to start; the A-button is mapped to the lowest button on the gamepad's right front; the B-button to the left button (buttons marked 3 and 1 on my gamepad). The L and R buttons are mapped to the lower left and right rear triggers; the Z button is mapped to the left upper rear trigger. All other buttons are unused.
2) Logitech Dual Action gamepad, Logitech Cordless Rumblepad 2: 2. Logitech Dual Action gamepad, Logitech Cordless Rumblepad 2:
The digital pad maps to the N64 d-pad. The left analog stick maps to the N64 analog stick. The digital pad maps to the N64 d-pad. The left analog stick maps to the N64 analog stick.
The right analog stick maps to the C-buttons, and the buttons 2 and 1 map to A and B. The right analog stick maps to the C-buttons, and the buttons 2 and 1 map to A and B.
Button 4 is the Z trigger, and the top shoulder buttons map to the left and right N64 triggers. Button 4 is the Z trigger, and the top shoulder buttons map to the left and right N64 triggers.
Button 10 is the start button. Button 10 is the start button.
The bottom shoulder buttons select the memory pack or rumble pak. The bottom shoulder buttons select the memory pack or rumble pak.
3) Logitech Logitech(R) Precision(TM) Gamepad, Gravis GamePad Pro USB 3. Logitech Logitech(R) Precision(TM) Gamepad, Gravis GamePad Pro USB
I came up with what I see as one of the few decent configurations (SSB aside) since it allows access to everything but the dpad. I came up with what I see as one of the few decent configurations (SSB aside) since it allows access to everything but the dpad.
A is L1, B is R1, Z is L2, R is R2, L is select. C buttons are the four buttons, and the dpad acts as the joystick. Not the most orthodox, but it works well. A is L1, B is R1, Z is L2, R is R2, L is select. C buttons are the four buttons, and the dpad acts as the joystick. Not the most orthodox, but it works well.
4) Microsoft Xbox 360 controller and clones: 4. Microsoft Xbox 360 controller and clones:
```
N64 -> Xbox 360: N64 -> Xbox 360:
analog stick -> left stick analog stick -> left stick
@ -79,7 +61,6 @@ C down -> B (additionally to right stick)
mempak -> none for now mempak -> none for now
rumblepak -> none for now rumblepak -> none for now
```
As discussed in issue #478 Xbox 360 controllers should follow the above 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 mapping convention. If you want to add a Xbox 360 controller clone please
@ -90,10 +71,9 @@ https://en.wikipedia.org/wiki/File:360_controller.svg
Keys that are still unbound are back (aka. select) and left/right stick button Keys that are still unbound are back (aka. select) and left/right stick button
clicks. Those might be used for mempack and rumblepak toggles. 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). This is a USB adapter for PlayStation controllers (2).
```
D-Pad: hat(0) D-Pad: hat(0)
L-Stick: x:0, y:1 L-Stick: x:0, y:1
R-Stick: x:2, y:3 R-Stick: x:2, y:3
@ -110,14 +90,12 @@ Select: button(9)
L3: button(10) L3: button(10)
R3: button(11) R3: button(11)
Note: This is when analog mode is selected. If analog is off then D-Pad becomes axes 0/1 and both sticks are disabled (including L3/R3). Note: This is when analog mode is selected. If analog is off then D-Pad becomes axes 0/1 and both sticks are disabled (including L3/R3).
```
6) Nintendo Wiimote Classic 6. Nintendo Wiimote Classic
I am on a Mac and used https://code.google.com/p/wjoy/ successfully to connect my Wiimote + Classic Controller. 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. 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 N64 -> Classic Controller
Z -> L Z -> L
R -> R R -> R
@ -131,15 +109,12 @@ Analog -> Right Analog
Mempak switch -> Home Mempak switch -> Home
Rumblepak switch -> Select (-) Rumblepak switch -> Select (-)
```
7) N64 controller: 7. N64 controller:
All controls are mapped to their proper place on the N64 controller with an Adaptoid or custom hardware with Gamecon driver. All controls are mapped to their proper place on the N64 controller with an Adaptoid or custom hardware with Gamecon driver.
Rumble and Memory packs can be selected with the 'r' and 'm' keys, respectively. Rumble and Memory packs can be selected with the 'r' and 'm' keys, respectively.
8) Playstation 3 Controller: 8. Playstation 3 Controller:
```
Left analog stick - analog stick Left analog stick - analog stick
Right analog stick - C-pad Right analog stick - C-pad
D-Pad - D-Pad D-Pad - D-Pad
@ -148,9 +123,8 @@ Square - B
L1 / R1 - L / R L1 / R1 - L / R
L2 - Z L2 - Z
Start - Start Start - Start
```
9) SAITEK P880: 9. SAITEK P880:
The gamepad doesnt have enough keys to real assign all buttons. The second The gamepad doesnt have enough keys to real assign all buttons. The second
analog stick can be used as button by pushing him insight. analog stick can be used as button by pushing him insight.
@ -163,16 +137,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 for the Button next to the A button which would be C-Down but got the Z
button. button.
10) Xbox Gamepad (userspace driver) 10. Xbox Gamepad (userspace driver)
I created an Input Config for a Xbox 360 controller running with I created an Input Config for a Xbox 360 controller running with
xboxdrv on a Linux system (http://pingus.seul.org/~grumbel/xboxdrv/). xboxdrv on a Linux system (http://pingus.seul.org/~grumbel/xboxdrv/).
```
Z = Left shoulder button Z = Left shoulder button
L = Left shoulder trigger L = Left shoulder trigger
A = A Button A = A Button
B = X Button B = X Button
```
everything else should be obvious. everything else should be obvious.
@ -185,7 +157,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 guide key on the controller. This is obviously just nice-to-have and
not actually neccessary for the config to work. not actually neccessary for the config to work.
```
[xboxdrv] [xboxdrv]
silent=true silent=true
trigger-as-button=true trigger-as-button=true
@ -197,78 +168,26 @@ guide=KEY_ESC
[axismap] [axismap]
x2^deadzone:27000 x2^deadzone:27000
y2^deadzone:27000 y2^deadzone:27000
```
11) Saitek Cyborg V.3 Rumble Pad (aka Saitek PS2700) 11. Saitek Cyborg V.3 Rumble Pad (aka Saitek PS2700)
Honestly, it's one of the best pads that I've used in a long time, so thought I'd contribute this quick config. Basically, Dpad and Analog sticks are unchanged, C-buttons are mapped to the right analog stick, L-R triggers are L1 and R1, Z is mapped to R2, A + B are mapped to X and Square, respectively, start is mapped to the Home button, and Triangle, Square, L2, Start, Select, and the Analog triggers are unused, since it's not intuitive to use them for what's left. Honestly, it's one of the best pads that I've used in a long time, so thought I'd contribute this quick config. Basically, Dpad and Analog sticks are unchanged, C-buttons are mapped to the right analog stick, L-R triggers are L1 and R1, Z is mapped to R2, A + B are mapped to X and Square, respectively, start is mapped to the Home button, and Triangle, Square, L2, Start, Select, and the Analog triggers are unused, since it's not intuitive to use them for what's left.
12) Arsenal Gaming PS3 controller (aka. "Gasia Co.,Ltd PS(R) Gamepad") 12. 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 = "."
``` 13. Special modifier keys
N64 Start = PS3 Start - Right-shift key: reduce amplitude of analog joystick X/Y axes by 25%
N64 D-pad = PS3 D-pad - Right-control key: reduce amplitude of analog joystick X/Y axes by 50%
N64 joystick = PS3 left joystick - Left-Control + Left-Alt keys: grab or un-grab the mouse cursor (only if mouse control is enabled)
N64 C buttons = PS3 right joystick - Left-Windows key: do not auto-center joystick X/Y axes (only when mouse control is enabled)
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
```

100
RELEASE
View file

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

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

@ -0,0 +1,114 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.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>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v120</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" />
<ClCompile Include="..\..\src\sdl_key_converter.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src\autoconfig.h" />
<ClInclude Include="..\..\src\config.h" />
<ClInclude Include="..\..\src\osal_dynamiclib.h" />
<ClInclude Include="..\..\src\osal_preproc.h" />
<ClInclude Include="..\..\src\plugin.h" />
<ClInclude Include="..\..\src\sdl_key_converter.h" />
<ClInclude Include="..\..\src\version.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -1,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>

67
projects/unix/Makefile Normal file → Executable file
View file

@ -1,6 +1,6 @@
#/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
# * Mupen64plus-input-sdl - Makefile * # * Mupen64plus-input-sdl - Makefile *
# * Mupen64Plus homepage: https://mupen64plus.org/ * # * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
# * Copyright (C) 2007-2009 Richard Goedeken * # * Copyright (C) 2007-2009 Richard Goedeken *
# * * # * *
# * This program is free software; you can redistribute it and/or modify * # * This program is free software; you can redistribute it and/or modify *
@ -52,6 +52,7 @@ ifeq ("$(UNAME)","OpenBSD")
OS = FREEBSD OS = FREEBSD
SO_EXTENSION = so SO_EXTENSION = so
SHARED = -shared SHARED = -shared
$(warning OS type "$(UNAME)" not officially supported.')
endif endif
ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","") ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","")
OS = LINUX OS = LINUX
@ -65,7 +66,7 @@ ifeq ("$(patsubst MINGW%,MINGW,$(UNAME))","MINGW")
PIC = 0 PIC = 0
endif endif
ifeq ("$(OS)","NONE") ifeq ("$(OS)","NONE")
$(error OS type "$(UNAME)" not supported. Please file bug report at '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 endif
# detect system architecture, only if it matters for build flags # detect system architecture, only if it matters for build flags
@ -90,15 +91,11 @@ ifeq ("$(CPU)","OTHER")
PIC ?= 1 PIC ?= 1
endif endif
SRCDIR = ../../src
OBJDIR = _obj$(POSTFIX)
# base CFLAGS, LDLIBS, and LDFLAGS # base CFLAGS, LDLIBS, and LDFLAGS
OPTFLAGS ?= -O3 -flto OPTFLAGS ?= -O3 -flto
WARNFLAGS ?= -Wall WARNFLAGS ?= -Wall
CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -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) LDFLAGS += $(SHARED)
LDLIBS += -lm
# Since we are building a shared library, we must compile with -fPIC on some architectures # Since we are building a shared library, we must compile with -fPIC on some architectures
# On 32-bit x86 systems we do not want to use -fPIC because we don't have to and it has a big performance penalty on this arch # On 32-bit x86 systems we do not want to use -fPIC because we don't have to and it has a big performance penalty on this arch
@ -110,58 +107,48 @@ endif
# tweak flags for 32-bit build on 64-bit system # tweak flags for 32-bit build on 64-bit system
ifeq ($(ARCH_DETECTED), 64BITS_32) ifeq ($(ARCH_DETECTED), 64BITS_32)
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 CFLAGS += -m32
LDFLAGS += -Wl,-m,elf_i386 LDFLAGS += -Wl,-m,elf_i386
endif
endif
endif
ifeq ($(ARCH_DETECTED), 64BITS)
ifeq ($(OS), MINGW)
LDFLAGS += -Wl,-m,i386pep
endif
endif endif
# set special flags per-system # set special flags per-system
ifeq ($(OS), FREEBSD)
ifeq ($(ARCH_DETECTED), 64BITS_32)
$(error Do not use the BITS=32 option with FreeBSD, use -m32 and -m elf_i386)
endif
endif
ifeq ($(OS), LINUX) ifeq ($(OS), LINUX)
LDLIBS += -ldl LDLIBS += -ldl
endif endif
ifeq ($(OS), OSX) ifeq ($(OS), OSX)
OSX_SDK_PATH = $(shell xcrun --sdk macosx --show-sdk-path) #xcode-select has been around since XCode 3.0, i.e. OS X 10.5
OSX_SDK_ROOT = $(shell xcode-select -print-path)/Platforms/MacOSX.platform/Developer/SDKs
OSX_SDK_PATH = $(OSX_SDK_ROOT)/$(shell ls $(OSX_SDK_ROOT) | tail -1)
ifeq ($(CPU), X86) ifeq ($(CPU), X86)
ifeq ($(ARCH_DETECTED), 64BITS) ifeq ($(ARCH_DETECTED), 64BITS)
CFLAGS += -arch x86_64 -mmacosx-version-min=10.9 -isysroot $(OSX_SDK_PATH) CFLAGS += -arch x86_64 -mmacosx-version-min=10.5 -isysroot $(OSX_SDK_PATH)
LDLIBS += -ldl LDLIBS += -ldl
else 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=10.5 -isysroot $(OSX_SDK_PATH)
LDLIBS += -ldl -read_only_relocs suppress LDLIBS += -ldl -read_only_relocs suppress
endif endif
endif endif
endif endif
# test for essential build dependencies
ifeq ($(origin PKG_CONFIG), undefined)
PKG_CONFIG = $(CROSS_COMPILE)pkg-config
ifeq ($(shell which $(PKG_CONFIG) 2>/dev/null),)
$(error $(PKG_CONFIG) not found)
endif
endif
# test for presence of SDL # test for presence of SDL
ifeq ($(origin SDL_CFLAGS) $(origin SDL_LDLIBS), undefined undefined) ifeq ($(origin SDL_CFLAGS) $(origin SDL_LDLIBS), undefined undefined)
ifeq ($(shell $(PKG_CONFIG) --modversion sdl2 2>/dev/null),) SDL_CONFIG = $(CROSS_COMPILE)sdl2-config
$(error No SDL2 development libraries found!) ifeq ($(shell which $(SDL_CONFIG) 2>/dev/null),)
SDL_CONFIG = $(CROSS_COMPILE)sdl-config
ifeq ($(shell which $(SDL_CONFIG) 2>/dev/null),)
$(error No SDL development libraries found!)
else
$(warning Using SDL 1.2 libraries)
endif endif
SDL_CFLAGS += $(shell $(PKG_CONFIG) --cflags sdl2) endif
SDL_LDLIBS += $(shell $(PKG_CONFIG) --libs sdl2) SDL_CFLAGS += $(shell $(SDL_CONFIG) --cflags)
SDL_LDLIBS += $(shell $(SDL_CONFIG) --libs)
endif endif
CFLAGS += $(SDL_CFLAGS) CFLAGS += $(SDL_CFLAGS)
LDLIBS += $(SDL_LDLIBS) LDLIBS += $(SDL_LDLIBS)
@ -210,7 +197,6 @@ ifeq ($(DEBUG),1)
CFLAGS += -g CFLAGS += -g
INSTALL_STRIP_FLAG ?= INSTALL_STRIP_FLAG ?=
else else
CFLAGS += -DNDEBUG
ifneq ($(OS),OSX) ifneq ($(OS),OSX)
INSTALL_STRIP_FLAG ?= -s INSTALL_STRIP_FLAG ?= -s
endif endif
@ -233,6 +219,9 @@ ifeq ($(PLUGINDIR),)
PLUGINDIR := $(LIBDIR)/mupen64plus PLUGINDIR := $(LIBDIR)/mupen64plus
endif endif
SRCDIR = ../../src
OBJDIR = _obj$(POSTFIX)
# list of source files to compile # list of source files to compile
SOURCE = \ SOURCE = \
$(SRCDIR)/plugin.c \ $(SRCDIR)/plugin.c \
@ -286,7 +275,7 @@ install: $(TARGET)
$(INSTALL) -d "$(DESTDIR)$(PLUGINDIR)" $(INSTALL) -d "$(DESTDIR)$(PLUGINDIR)"
$(INSTALL) -m 0644 $(INSTALL_STRIP_FLAG) $(TARGET) "$(DESTDIR)$(PLUGINDIR)" $(INSTALL) -m 0644 $(INSTALL_STRIP_FLAG) $(TARGET) "$(DESTDIR)$(PLUGINDIR)"
$(INSTALL) -d "$(DESTDIR)$(SHAREDIR)" $(INSTALL) -d "$(DESTDIR)$(SHAREDIR)"
$(INSTALL) -m 0644 "$(SRCDIR)/../data/InputAutoCfg.ini" "$(DESTDIR)$(SHAREDIR)" $(INSTALL) -m 0644 "../../data/InputAutoCfg.ini" "$(DESTDIR)$(SHAREDIR)"
uninstall: uninstall:
$(RM) "$(DESTDIR)$(PLUGINDIR)/$(TARGET)" $(RM) "$(DESTDIR)$(PLUGINDIR)/$(TARGET)"

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-input-sdl - autoconfig.c * * Mupen64plus-input-sdl - autoconfig.c *
* Mupen64Plus homepage: https://mupen64plus.org/ * * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2009-2013 Richard Goedeken * * Copyright (C) 2009-2013 Richard Goedeken *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
@ -120,7 +120,7 @@ int auto_copy_inputconfig(const char *pccSourceSectionName, const char *pccDestS
static int auto_compare_name(const char *joySDLName, char *line) static int auto_compare_name(const char *joySDLName, char *line)
{ {
char *wordPtr; char *wordPtr;
int joyFound = 1, joyFoundScore = 0; int joyFound = 1, joyFoundPrio = 3;
char Word[64]; char Word[64];
wordPtr = line; wordPtr = line;
@ -128,43 +128,36 @@ static int auto_compare_name(const char *joySDLName, char *line)
#if defined(__unix__) #if defined(__unix__)
if (strncmp(wordPtr, "Unix:", 5) == 0) { if (strncmp(wordPtr, "Unix:", 5) == 0) {
wordPtr = StripSpace(wordPtr + 5); wordPtr = StripSpace(wordPtr + 5);
joyFoundScore = 1; joyFoundPrio = 2;
} }
#endif #endif
#if defined(__linux__) #if defined(__linux__)
if (strncmp(wordPtr, "Linux:", 6) == 0) { if (strncmp(wordPtr, "Linux:", 6) == 0) {
wordPtr = StripSpace(wordPtr + 6); wordPtr = StripSpace(wordPtr + 6);
joyFoundScore = 1; joyFoundPrio = 2;
} }
#endif #endif
#if defined(__APPLE__) #if defined(__APPLE__)
if (strncmp(wordPtr, "OSX:", 4) == 0) { if (strncmp(wordPtr, "OSX:", 4) == 0) {
wordPtr = StripSpace(wordPtr + 4); wordPtr = StripSpace(wordPtr + 4);
joyFoundScore = 1; joyFoundPrio = 2;
} }
#endif #endif
#if defined(WIN32) #if defined(WIN32)
if (strncmp(wordPtr, "Win32:", 6) == 0) { if (strncmp(wordPtr, "Win32:", 6) == 0) {
wordPtr = StripSpace(wordPtr + 6); wordPtr = StripSpace(wordPtr + 6);
joyFoundScore = 1; joyFoundPrio = 2;
} }
#if SDL_VERSION_ATLEAST(2,0,0)
else if (strncmp(wordPtr, "XInput:", 7) == 0) { else if (strncmp(wordPtr, "XInput:", 7) == 0) {
wordPtr = StripSpace(wordPtr + 7); wordPtr = StripSpace(wordPtr + 7);
joyFoundScore = 2; joyFoundPrio = 1;
} }
#endif #endif
/* extra points if the section name is a perfect match */ #endif
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 */ /* 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) 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, ' '); char *nextSpace = strchr(wordPtr, ' ');
if (nextSpace == NULL) if (nextSpace == NULL)
{ {
@ -182,14 +175,12 @@ static int auto_compare_name(const char *joySDLName, char *line)
} }
if (strcasestr(joySDLName, Word) == NULL) if (strcasestr(joySDLName, Word) == NULL)
joyFound = 0; joyFound = 0;
else
joyFoundScore += 4;
} }
if (joyFound) if (joyFound)
return joyFoundScore; return joyFoundPrio;
else else
return -1; return 0;
} }
int auto_set_defaults(int iDeviceIdx, const char *joySDLName) int auto_set_defaults(int iDeviceIdx, const char *joySDLName)
@ -201,7 +192,7 @@ int auto_set_defaults(int iDeviceIdx, const char *joySDLName)
char *pchIni, *pchNextLine, *pchCurLine; char *pchIni, *pchNextLine, *pchCurLine;
long iniLength; long iniLength;
int ControllersFound = 0; int ControllersFound = 0;
int joyFoundScore = -1; int joyFoundPrio = -1;
/* if we couldn't get a name (no joystick plugged in to given port), then return with a failure */ /* if we couldn't get a name (no joystick plugged in to given port), then return with a failure */
if (joySDLName == NULL) if (joySDLName == NULL)
@ -247,7 +238,6 @@ int auto_set_defaults(int iDeviceIdx, const char *joySDLName)
pchIni[iniLength] = 0; pchIni[iniLength] = 0;
/* parse the INI file, line by line */ /* parse the INI file, line by line */
DebugMessage(M64MSG_INFO, "Using auto-config file at: '%s'", CfgFilePath);
pchNextLine = pchIni; pchNextLine = pchIni;
eParseState = E_NAME_SEARCH; eParseState = E_NAME_SEARCH;
while (pchNextLine != NULL && *pchNextLine != 0) while (pchNextLine != NULL && *pchNextLine != 0)
@ -276,7 +266,7 @@ int auto_set_defaults(int iDeviceIdx, const char *joySDLName)
pchCurLine[strlen(pchCurLine)-1] = 0; pchCurLine[strlen(pchCurLine)-1] = 0;
joyFound = auto_compare_name(joySDLName, StripSpace(pchCurLine + 1)); joyFound = auto_compare_name(joySDLName, StripSpace(pchCurLine + 1));
/* if we found the right joystick, then open up the core config section to store parameters and set the 'device' param */ /* if we found the right joystick, then open up the core config section to store parameters and set the 'device' param */
if (joyFound > joyFoundScore) if (joyFound && (joyFoundPrio == -1 || joyFound < joyFoundPrio))
{ {
char SectionName[32]; char SectionName[32];
ControllersFound = 0; ControllersFound = 0;
@ -290,7 +280,7 @@ int auto_set_defaults(int iDeviceIdx, const char *joySDLName)
eParseState = E_NAME_FOUND; eParseState = E_NAME_FOUND;
ControllersFound++; ControllersFound++;
ConfigSetParameter(pConfig, "device", M64TYPE_INT, &iDeviceIdx); ConfigSetParameter(pConfig, "device", M64TYPE_INT, &iDeviceIdx);
joyFoundScore = joyFound; joyFoundPrio = joyFound;
} }
continue; continue;
} }
@ -307,7 +297,7 @@ int auto_set_defaults(int iDeviceIdx, const char *joySDLName)
*pivot++ = 0; *pivot++ = 0;
pchCurLine = StripSpace(pchCurLine); pchCurLine = StripSpace(pchCurLine);
pivot = StripSpace(pivot); pivot = StripSpace(pivot);
if (strcasecmp(pchCurLine, "device") == 0) if (strcasecmp(pchCurLine, "plugin") == 0 || strcasecmp(pchCurLine, "device") == 0)
{ {
int iVal = atoi(pivot); int iVal = atoi(pivot);
ConfigSetParameter(pConfig, pchCurLine, M64TYPE_INT, &iVal); ConfigSetParameter(pConfig, pchCurLine, M64TYPE_INT, &iVal);
@ -363,7 +353,7 @@ int auto_set_defaults(int iDeviceIdx, const char *joySDLName)
DebugMessage(M64MSG_ERROR, "Invalid line in %s: '%s'", INI_FILE_NAME, pchCurLine); DebugMessage(M64MSG_ERROR, "Invalid line in %s: '%s'", INI_FILE_NAME, pchCurLine);
} }
if (joyFoundScore != -1) if (joyFoundPrio != -1)
{ {
/* we've finished parsing all parameters for the discovered input device, which is the last in the .ini file */ /* we've finished parsing all parameters for the discovered input device, which is the last in the .ini file */
free(pchIni); free(pchIni);

View file

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

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-input-sdl - config.c * * Mupen64plus-input-sdl - config.c *
* Mupen64Plus homepage: https://mupen64plus.org/ * * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2009-2013 Richard Goedeken * * Copyright (C) 2009-2013 Richard Goedeken *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
@ -89,7 +89,7 @@ static void clear_controller(int iCtrlIdx)
controller[iCtrlIdx].device = DEVICE_NO_JOYSTICK; controller[iCtrlIdx].device = DEVICE_NO_JOYSTICK;
controller[iCtrlIdx].control->Present = 0; controller[iCtrlIdx].control->Present = 0;
controller[iCtrlIdx].control->RawData = 0; controller[iCtrlIdx].control->RawData = 0;
controller[iCtrlIdx].control->Plugin = PLUGIN_MEMPAK; controller[iCtrlIdx].control->Plugin = PLUGIN_NONE;
for( b = 0; b < 16; b++ ) for( b = 0; b < 16; b++ )
{ {
controller[iCtrlIdx].button[b].button = -1; controller[iCtrlIdx].button[b].button = -1;
@ -121,6 +121,15 @@ static const char * get_sdl_joystick_name(int iCtrlIdx)
{ {
static char JoyName[256]; static char JoyName[256];
const char *joySDLName; const char *joySDLName;
int joyWasInit = SDL_WasInit(SDL_INIT_JOYSTICK);
/* initialize the joystick subsystem if necessary */
if (!joyWasInit)
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1)
{
DebugMessage(M64MSG_ERROR, "Couldn't init SDL joystick subsystem: %s", SDL_GetError() );
return NULL;
}
/* get the name of the corresponding joystick */ /* get the name of the corresponding joystick */
joySDLName = SDL_JoystickName(iCtrlIdx); joySDLName = SDL_JoystickName(iCtrlIdx);
@ -132,6 +141,10 @@ static const char * get_sdl_joystick_name(int iCtrlIdx)
JoyName[255] = 0; JoyName[255] = 0;
} }
/* quit the joystick subsystem if necessary */
if (!joyWasInit)
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
/* if the SDL function had an error, then return NULL, otherwise return local copy of joystick name */ /* if the SDL function had an error, then return NULL, otherwise return local copy of joystick name */
if (joySDLName == NULL) if (joySDLName == NULL)
return NULL; return NULL;
@ -139,6 +152,29 @@ static const char * get_sdl_joystick_name(int iCtrlIdx)
return JoyName; return JoyName;
} }
static int get_sdl_num_joysticks(void)
{
int numJoysticks = 0;
int joyWasInit = SDL_WasInit(SDL_INIT_JOYSTICK);
/* initialize the joystick subsystem if necessary */
if (!joyWasInit)
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1)
{
DebugMessage(M64MSG_ERROR, "Couldn't init SDL joystick subsystem: %s", SDL_GetError() );
return 0;
}
/* get thenumber of joysticks */
numJoysticks = SDL_NumJoysticks();
/* quit the joystick subsystem if necessary */
if (!joyWasInit)
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
return numJoysticks;
}
///////////////////////////////////// /////////////////////////////////////
// load_controller_config() // load_controller_config()
// return value: 1 = OK // return value: 1 = OK
@ -161,12 +197,17 @@ static int load_controller_config(const char *SectionName, int i, int sdlDeviceI
/* set SDL device number */ /* set SDL device number */
controller[i].device = sdlDeviceIdx; controller[i].device = sdlDeviceIdx;
/* throw warnings if 'plugged' is missing */ /* throw warnings if 'plugged' or 'plugin' are missing */
if (ConfigGetParameter(pConfig, "plugged", M64TYPE_BOOL, &controller[i].control->Present, sizeof(int)) != M64ERR_SUCCESS) if (ConfigGetParameter(pConfig, "plugged", M64TYPE_BOOL, &controller[i].control->Present, sizeof(int)) != M64ERR_SUCCESS)
{ {
DebugMessage(M64MSG_WARNING, "missing 'plugged' parameter from config section %s. Setting to 1 (true).", SectionName); DebugMessage(M64MSG_WARNING, "missing 'plugged' parameter from config section %s. Setting to 1 (true).", SectionName);
controller[i].control->Present = 1; controller[i].control->Present = 1;
} }
if (ConfigGetParameter(pConfig, "plugin", M64TYPE_INT, &controller[i].control->Plugin, sizeof(int)) != M64ERR_SUCCESS)
{
DebugMessage(M64MSG_WARNING, "missing 'plugin' parameter from config section %s. Setting to 1 (none).", SectionName);
controller[i].control->Plugin = PLUGIN_NONE;
}
/* load optional parameters */ /* load optional parameters */
ConfigGetParameter(pConfig, "mouse", M64TYPE_BOOL, &controller[i].mouse, sizeof(int)); ConfigGetParameter(pConfig, "mouse", M64TYPE_BOOL, &controller[i].mouse, sizeof(int));
if (ConfigGetParameter(pConfig, "MouseSensitivity", M64TYPE_STRING, input_str, 256) == M64ERR_SUCCESS) if (ConfigGetParameter(pConfig, "MouseSensitivity", M64TYPE_STRING, input_str, 256) == M64ERR_SUCCESS)
@ -293,7 +334,7 @@ static void init_controller_config(int iCtrlIdx, const char *pccDeviceName, eMod
ConfigSetDefaultInt(pConfig, "device", controller[iCtrlIdx].device, "Specifies which joystick is bound to this controller: -1=No joystick, 0 or more= SDL Joystick number"); ConfigSetDefaultInt(pConfig, "device", controller[iCtrlIdx].device, "Specifies which joystick is bound to this controller: -1=No joystick, 0 or more= SDL Joystick number");
ConfigSetDefaultString(pConfig, "name", pccDeviceName, "SDL joystick name (or Keyboard)"); ConfigSetDefaultString(pConfig, "name", pccDeviceName, "SDL joystick name (or Keyboard)");
ConfigSetDefaultBool(pConfig, "plugged", controller[iCtrlIdx].control->Present, "Specifies whether this controller is 'plugged in' to the simulated N64"); ConfigSetDefaultBool(pConfig, "plugged", controller[iCtrlIdx].control->Present, "Specifies whether this controller is 'plugged in' to the simulated N64");
ConfigSetDefaultInt(pConfig, "plugin", controller[iCtrlIdx].control->Plugin, "Specifies which type of expansion pak is in the controller: 1=None, 2=Mem pak, 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"); ConfigSetDefaultBool(pConfig, "mouse", controller[iCtrlIdx].mouse, "If True, then mouse buttons may be used with this controller");
sprintf(Param, "%.2f,%.2f", controller[iCtrlIdx].mouse_sens[0], controller[iCtrlIdx].mouse_sens[1]); sprintf(Param, "%.2f,%.2f", controller[iCtrlIdx].mouse_sens[0], controller[iCtrlIdx].mouse_sens[1]);
@ -413,6 +454,7 @@ static int setup_auto_controllers(int bPreConfig, int n64CtrlStart, int sdlCtrlI
if (!bPreConfig) if (!bPreConfig)
DebugMessage(M64MSG_INFO, "N64 Controller #%i: Using auto-config with SDL joystick %i ('%s')", n64CtrlStart+1, sdlCtrlIdx, sdlJoyName); DebugMessage(M64MSG_INFO, "N64 Controller #%i: Using auto-config with SDL joystick %i ('%s')", n64CtrlStart+1, sdlCtrlIdx, sdlJoyName);
ActiveControllers++; ActiveControllers++;
ConfigSaveSection(SectionName);
} }
else else
{ {
@ -450,6 +492,7 @@ static int setup_auto_controllers(int bPreConfig, int n64CtrlStart, int sdlCtrlI
if (!bPreConfig) if (!bPreConfig)
DebugMessage(M64MSG_INFO, "N64 Controller #%i: Using auto-config with SDL joystick %i ('%s')", n64CtrlStart+j+1, sdlCtrlIdx, sdlJoyName); DebugMessage(M64MSG_INFO, "N64 Controller #%i: Using auto-config with SDL joystick %i ('%s')", n64CtrlStart+j+1, sdlCtrlIdx, sdlJoyName);
ActiveControllers++; ActiveControllers++;
ConfigSaveSection(SectionName);
/* set the local controller mode to Manual so that we won't re-configure this controller in the next loop */ /* set the local controller mode to Manual so that we won't re-configure this controller in the next loop */
ControlMode[n64CtrlStart+j] = E_MODE_MANUAL; ControlMode[n64CtrlStart+j] = E_MODE_MANUAL;
} }
@ -504,7 +547,7 @@ void load_configuration(int bPreConfig)
int ControlDevice[4]; int ControlDevice[4];
char DeviceName[4][256]; char DeviceName[4][256];
int ActiveControllers = 0; int ActiveControllers = 0;
int sdlNumJoysticks = SDL_NumJoysticks(); int sdlNumJoysticks = get_sdl_num_joysticks();
float fVersion = 0.0f; float fVersion = 0.0f;
const char *sdl_name; const char *sdl_name;
int ControllersFound = 0; int ControllersFound = 0;
@ -540,6 +583,8 @@ void load_configuration(int bPreConfig)
DeviceName[n64CtrlIdx][0] = 0; DeviceName[n64CtrlIdx][0] = 0;
// write blank config for GUI front-ends // write blank config for GUI front-ends
init_controller_config(n64CtrlIdx, "", E_MODE_FULL_AUTO); init_controller_config(n64CtrlIdx, "", E_MODE_FULL_AUTO);
// save it to the file too
ConfigSaveSection(SectionName);
} }
else else
{ {
@ -561,11 +606,6 @@ void load_configuration(int bPreConfig)
{ {
DeviceName[n64CtrlIdx][0] = 0; DeviceName[n64CtrlIdx][0] = 0;
} }
if (ConfigGetParameter(pConfig, "plugin", M64TYPE_INT, &controller[n64CtrlIdx].control->Plugin, sizeof(int)) != M64ERR_SUCCESS)
{
DebugMessage(M64MSG_WARNING, "missing 'plugin' parameter from config section %s. Setting to 2 (mempak).", SectionName);
controller[n64CtrlIdx].control->Plugin = PLUGIN_MEMPAK;
}
} }
} }
@ -615,6 +655,7 @@ void load_configuration(int bPreConfig)
/* copy the auto-config settings to the controller config section */ /* copy the auto-config settings to the controller config section */
auto_copy_inputconfig("AutoConfig0", SectionName, "Keyboard"); auto_copy_inputconfig("AutoConfig0", SectionName, "Keyboard");
ActiveControllers++; ActiveControllers++;
ConfigSaveSection(SectionName);
} }
else else
{ {
@ -711,6 +752,7 @@ void load_configuration(int bPreConfig)
ConfigSetParameter(section, "device", M64TYPE_INT, &iNoDevice); ConfigSetParameter(section, "device", M64TYPE_INT, &iNoDevice);
if (OrigControlMode[n64CtrlIdx] == E_MODE_FULL_AUTO) if (OrigControlMode[n64CtrlIdx] == E_MODE_FULL_AUTO)
ConfigSetParameter(section, "name", M64TYPE_STRING, ""); ConfigSetParameter(section, "name", M64TYPE_STRING, "");
ConfigSaveSection(SectionName);
} }
} }
} }
@ -729,6 +771,7 @@ void load_configuration(int bPreConfig)
else else
auto_copy_inputconfig("AutoConfig0", "Input-SDL-Control1", NULL); // don't overwrite 'name' parameter auto_copy_inputconfig("AutoConfig0", "Input-SDL-Control1", NULL); // don't overwrite 'name' parameter
ActiveControllers++; ActiveControllers++;
ConfigSaveSection("Input-SDL-Control1");
} }
else else
{ {

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-ui-console - osal_dynamiclib_win32.c * * 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 * * Copyright (C) 2009 Richard Goedeken *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus - osal_preproc.h * * Mupen64plus - osal_preproc.h *
* Mupen64Plus homepage: https://mupen64plus.org/ * * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2009 Richard Goedeken * * Copyright (C) 2009 Richard Goedeken *
* Copyright (C) 2002 Hacktarux * * Copyright (C) 2002 Hacktarux *
* * * *

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-input-sdl - plugin.c * * 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-2011 Richard Goedeken *
* Copyright (C) 2008 Tillin9 * * Copyright (C) 2008 Tillin9 *
* Copyright (C) 2002 Blight * * Copyright (C) 2002 Blight *
@ -26,7 +26,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <math.h>
#define M64P_PLUGIN_PROTOTYPES 1 #define M64P_PLUGIN_PROTOTYPES 1
#include "config.h" #include "config.h"
@ -60,7 +59,9 @@
/* definitions of pointers to Core config functions */ /* definitions of pointers to Core config functions */
ptr_ConfigOpenSection ConfigOpenSection = NULL; ptr_ConfigOpenSection ConfigOpenSection = NULL;
ptr_ConfigDeleteSection ConfigDeleteSection = NULL; ptr_ConfigDeleteSection ConfigDeleteSection = NULL;
ptr_ConfigSaveSection ConfigSaveSection = NULL;
ptr_ConfigListParameters ConfigListParameters = NULL; ptr_ConfigListParameters ConfigListParameters = NULL;
ptr_ConfigSaveFile ConfigSaveFile = NULL;
ptr_ConfigSetParameter ConfigSetParameter = NULL; ptr_ConfigSetParameter ConfigSetParameter = NULL;
ptr_ConfigGetParameter ConfigGetParameter = NULL; ptr_ConfigGetParameter ConfigGetParameter = NULL;
ptr_ConfigGetParameterHelp ConfigGetParameterHelp = NULL; ptr_ConfigGetParameterHelp ConfigGetParameterHelp = NULL;
@ -85,8 +86,6 @@ SController controller[4]; // 4 controllers
static void (*l_DebugCallback)(void *, int, const char *) = NULL; static void (*l_DebugCallback)(void *, int, const char *) = NULL;
static void *l_DebugCallContext = NULL; static void *l_DebugCallContext = NULL;
static int l_PluginInit = 0; static int l_PluginInit = 0;
static int l_joyWasInit = 0;
static int l_hapticWasInit = 0;
static unsigned short button_bits[] = { static unsigned short button_bits[] = {
0x0001, // R_DPAD 0x0001, // R_DPAD
@ -111,6 +110,12 @@ static int romopen = 0; // is a rom opened
static unsigned char myKeyState[SDL_NUM_SCANCODES]; static unsigned char myKeyState[SDL_NUM_SCANCODES];
#if __linux__ && !SDL_VERSION_ATLEAST(2,0,0)
static struct ff_effect ffeffect[4];
static struct ff_effect ffstrong[4];
static struct ff_effect ffweak[4];
#endif //__linux__
/* Global functions */ /* Global functions */
void DebugMessage(int level, const char *message, ...) void DebugMessage(int level, const char *message, ...)
{ {
@ -164,6 +169,8 @@ EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle CoreLibHandle, void *Con
/* Get the core config function pointers from the library handle */ /* Get the core config function pointers from the library handle */
ConfigOpenSection = (ptr_ConfigOpenSection) osal_dynlib_getproc(CoreLibHandle, "ConfigOpenSection"); ConfigOpenSection = (ptr_ConfigOpenSection) osal_dynlib_getproc(CoreLibHandle, "ConfigOpenSection");
ConfigDeleteSection = (ptr_ConfigDeleteSection) osal_dynlib_getproc(CoreLibHandle, "ConfigDeleteSection"); ConfigDeleteSection = (ptr_ConfigDeleteSection) osal_dynlib_getproc(CoreLibHandle, "ConfigDeleteSection");
ConfigSaveFile = (ptr_ConfigSaveFile) osal_dynlib_getproc(CoreLibHandle, "ConfigSaveFile");
ConfigSaveSection = (ptr_ConfigSaveSection) osal_dynlib_getproc(CoreLibHandle, "ConfigSaveSection");
ConfigListParameters = (ptr_ConfigListParameters) osal_dynlib_getproc(CoreLibHandle, "ConfigListParameters"); ConfigListParameters = (ptr_ConfigListParameters) osal_dynlib_getproc(CoreLibHandle, "ConfigListParameters");
ConfigSetParameter = (ptr_ConfigSetParameter) osal_dynlib_getproc(CoreLibHandle, "ConfigSetParameter"); ConfigSetParameter = (ptr_ConfigSetParameter) osal_dynlib_getproc(CoreLibHandle, "ConfigSetParameter");
ConfigGetParameter = (ptr_ConfigGetParameter) osal_dynlib_getproc(CoreLibHandle, "ConfigGetParameter"); ConfigGetParameter = (ptr_ConfigGetParameter) osal_dynlib_getproc(CoreLibHandle, "ConfigGetParameter");
@ -181,7 +188,7 @@ EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle CoreLibHandle, void *Con
ConfigGetUserDataPath = (ptr_ConfigGetUserDataPath) osal_dynlib_getproc(CoreLibHandle, "ConfigGetUserDataPath"); ConfigGetUserDataPath = (ptr_ConfigGetUserDataPath) osal_dynlib_getproc(CoreLibHandle, "ConfigGetUserDataPath");
ConfigGetUserCachePath = (ptr_ConfigGetUserCachePath) osal_dynlib_getproc(CoreLibHandle, "ConfigGetUserCachePath"); ConfigGetUserCachePath = (ptr_ConfigGetUserCachePath) osal_dynlib_getproc(CoreLibHandle, "ConfigGetUserCachePath");
if (!ConfigOpenSection || !ConfigDeleteSection || !ConfigSetParameter || !ConfigGetParameter || if (!ConfigOpenSection || !ConfigDeleteSection || !ConfigSaveFile || !ConfigSaveSection || !ConfigSetParameter || !ConfigGetParameter ||
!ConfigSetDefaultInt || !ConfigSetDefaultFloat || !ConfigSetDefaultBool || !ConfigSetDefaultString || !ConfigSetDefaultInt || !ConfigSetDefaultFloat || !ConfigSetDefaultBool || !ConfigSetDefaultString ||
!ConfigGetParamInt || !ConfigGetParamFloat || !ConfigGetParamBool || !ConfigGetParamString || !ConfigGetParamInt || !ConfigGetParamFloat || !ConfigGetParamBool || !ConfigGetParamString ||
!ConfigGetSharedDataFilepath || !ConfigGetUserConfigPath || !ConfigGetUserDataPath || !ConfigGetUserCachePath) !ConfigGetSharedDataFilepath || !ConfigGetUserConfigPath || !ConfigGetUserDataPath || !ConfigGetUserCachePath)
@ -202,15 +209,6 @@ EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle CoreLibHandle, void *Con
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
controller[i].control = temp_core_controlinfo + i; controller[i].control = temp_core_controlinfo + i;
/* initialize the joystick subsystem if necessary */
l_joyWasInit = SDL_WasInit(SDL_INIT_JOYSTICK);
if (!l_joyWasInit)
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1)
{
DebugMessage(M64MSG_ERROR, "Couldn't init SDL joystick subsystem: %s", SDL_GetError() );
return M64ERR_SYSTEM_FAIL;
}
/* read plugin config from core config database, auto-config if necessary and update core database */ /* read plugin config from core config database, auto-config if necessary and update core database */
load_configuration(1); load_configuration(1);
@ -227,10 +225,6 @@ EXPORT m64p_error CALL PluginShutdown(void)
l_DebugCallback = NULL; l_DebugCallback = NULL;
l_DebugCallContext = NULL; l_DebugCallContext = NULL;
/* quit the joystick subsystem if necessary */
if (!l_joyWasInit)
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
l_PluginInit = 0; l_PluginInit = 0;
return M64ERR_SUCCESS; return M64ERR_SUCCESS;
} }
@ -269,7 +263,7 @@ doSdlKeys(const unsigned char* keystate)
if (keystate[SDL_SCANCODE_RCTRL]) if (keystate[SDL_SCANCODE_RCTRL])
axis_max_val -= 40; axis_max_val -= 40;
if (keystate[SDL_SCANCODE_RSHIFT]) if (keystate[SDL_SCANCODE_RSHIFT])
axis_max_val -= 25; axis_max_val -= 20;
for( c = 0; c < 4; c++ ) for( c = 0; c < 4; c++ )
{ {
@ -301,12 +295,6 @@ doSdlKeys(const unsigned char* keystate)
else else
controller[c].buttons.Y_AXIS = -axis_val; controller[c].buttons.Y_AXIS = -axis_val;
} }
// sqrt-2 fix for too-fast diagonal movement
if (abs(controller[c].buttons.X_AXIS) == axis_max_val && abs(controller[c].buttons.Y_AXIS) == axis_max_val)
{
controller[c].buttons.X_AXIS = (int) (controller[c].buttons.X_AXIS / 1.41421356f);
controller[c].buttons.Y_AXIS = (int) (controller[c].buttons.Y_AXIS / 1.41421356f);
}
if (controller[c].mouse) if (controller[c].mouse)
{ {
if (keystate[SDL_SCANCODE_LCTRL] && keystate[SDL_SCANCODE_LALT]) if (keystate[SDL_SCANCODE_LCTRL] && keystate[SDL_SCANCODE_LALT])
@ -316,7 +304,11 @@ doSdlKeys(const unsigned char* keystate)
grabtoggled = 1; grabtoggled = 1;
grabmouse = !grabmouse; grabmouse = !grabmouse;
// grab/ungrab mouse // grab/ungrab mouse
#if SDL_VERSION_ATLEAST(2,0,0)
SDL_SetRelativeMouseMode(grabmouse ? SDL_TRUE : SDL_FALSE); SDL_SetRelativeMouseMode(grabmouse ? SDL_TRUE : SDL_FALSE);
#else
SDL_WM_GrabInput( grabmouse ? SDL_GRAB_ON : SDL_GRAB_OFF );
#endif
SDL_ShowCursor( grabmouse ? 0 : 1 ); SDL_ShowCursor( grabmouse ? 0 : 1 );
} }
} }
@ -409,21 +401,39 @@ EXPORT void CALL ControllerCommand(int Control, unsigned char *Command)
unsigned int dwAddress = (Command[3] << 8) + (Command[4] & 0xE0); unsigned int dwAddress = (Command[3] << 8) + (Command[4] & 0xE0);
if (dwAddress == PAK_IO_RUMBLE && *Data) if (dwAddress == PAK_IO_RUMBLE && *Data)
DebugMessage(M64MSG_VERBOSE, "Triggering rumble pack."); DebugMessage(M64MSG_VERBOSE, "Triggering rumble pack.");
#if SDL_VERSION_ATLEAST(2,0,0)
if(dwAddress == PAK_IO_RUMBLE && controller[Control].event_joystick) { 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);
}
#else
if (*Data) { if (*Data) {
SDL_HapticRumblePlay(controller[Control].event_joystick, 1, SDL_HAPTIC_INFINITY); SDL_HapticRumblePlay(controller[Control].event_joystick, 1, SDL_HAPTIC_INFINITY);
} else { } else {
SDL_HapticRumbleStop(controller[Control].event_joystick); SDL_HapticRumbleStop(controller[Control].event_joystick);
} }
#endif /* SDL_VERSION_ATLEAST(2,0,18) */
} }
#elif __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
{
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 //__linux__
Data[32] = DataCRC( Data, 32 ); Data[32] = DataCRC( Data, 32 );
} }
break; break;
@ -457,32 +467,14 @@ EXPORT void CALL GetKeys( int Control, BUTTONS *Keys )
{ {
static int mousex_residual = 0; static int mousex_residual = 0;
static int mousey_residual = 0; static int mousey_residual = 0;
int b, axis_val, axis_max_val; int b, axis_val;
SDL_Event event; SDL_Event event;
unsigned char mstate; unsigned char mstate;
SDL_PumpEvents();
// Handle keyboard input first // Handle keyboard input first
doSdlKeys(SDL_GetKeyboardState(NULL)); doSdlKeys(SDL_GetKeyboardState(NULL));
doSdlKeys(myKeyState); doSdlKeys(myKeyState);
// attenuate maximum analog stick movement if right shift/control is pressed
axis_max_val = 80;
if (myKeyState[SDL_SCANCODE_RCTRL])
axis_max_val -= 40;
if (myKeyState[SDL_SCANCODE_RSHIFT])
axis_max_val -= 25;
for ( b = 0; b < 4; ++b )
{
if (controller[b].device >= 0)
{
if (!SDL_JoystickGetAttached(controller[b].joystick))
controller[b].joystick = SDL_JoystickOpen(controller[b].device);
}
}
// read joystick state // read joystick state
SDL_JoystickUpdate(); SDL_JoystickUpdate();
@ -499,7 +491,7 @@ EXPORT void CALL GetKeys( int Control, BUTTONS *Keys )
int deadzone = controller[Control].button[b].axis_deadzone; int deadzone = controller[Control].button[b].axis_deadzone;
axis_val = SDL_JoystickGetAxis( controller[Control].joystick, controller[Control].button[b].axis ); axis_val = SDL_JoystickGetAxis( controller[Control].joystick, controller[Control].button[b].axis );
if (deadzone < 0) if (deadzone < 0)
deadzone = 16384; /* default */ deadzone = 6000; /* default */
if( (controller[Control].button[b].axis_dir < 0) && (axis_val <= -deadzone) ) if( (controller[Control].button[b].axis_dir < 0) && (axis_val <= -deadzone) )
controller[Control].buttons.Value |= button_bits[b]; controller[Control].buttons.Value |= button_bits[b];
else if( (controller[Control].button[b].axis_dir > 0) && (axis_val >= deadzone) ) else if( (controller[Control].button[b].axis_dir > 0) && (axis_val >= deadzone) )
@ -513,8 +505,6 @@ EXPORT void CALL GetKeys( int Control, BUTTONS *Keys )
controller[Control].buttons.Value |= button_bits[b]; controller[Control].buttons.Value |= button_bits[b];
} }
} }
int iX = controller[Control].buttons.X_AXIS;
int iY = controller[Control].buttons.Y_AXIS;
for( b = 0; b < 2; b++ ) for( b = 0; b < 2; b++ )
{ {
/* from the N64 func ref: The 3D Stick data is of type signed char and in the range between -80 and +80 */ /* from the N64 func ref: The 3D Stick data is of type signed char and in the range between -80 and +80 */
@ -525,53 +515,50 @@ EXPORT void CALL GetKeys( int Control, BUTTONS *Keys )
continue; continue;
if( b == 0 ) if( b == 0 )
axis_val = iX; axis_val = controller[Control].buttons.X_AXIS;
else else
axis_val = -iY; axis_val = -controller[Control].buttons.Y_AXIS;
if( controller[Control].axis[b].axis_a >= 0 ) /* up and left for N64 */ if( controller[Control].axis[b].axis_a >= 0 ) /* up and left for N64 */
{ {
int joy_val = SDL_JoystickGetAxis(controller[Control].joystick, controller[Control].axis[b].axis_a); int joy_val = SDL_JoystickGetAxis(controller[Control].joystick, controller[Control].axis[b].axis_a);
int axis_dir = controller[Control].axis[b].axis_dir_a; int axis_dir = controller[Control].axis[b].axis_dir_a;
if (joy_val * axis_dir > deadzone) if (joy_val * axis_dir > deadzone)
axis_val = -((abs(joy_val) - deadzone) * 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 */ if( controller[Control].axis[b].axis_b >= 0 ) /* down and right for N64 */
{ {
int joy_val = SDL_JoystickGetAxis(controller[Control].joystick, controller[Control].axis[b].axis_b); int joy_val = SDL_JoystickGetAxis(controller[Control].joystick, controller[Control].axis[b].axis_b);
int axis_dir = controller[Control].axis[b].axis_dir_b; int axis_dir = controller[Control].axis[b].axis_dir_b;
if (joy_val * axis_dir > deadzone) if (joy_val * axis_dir > deadzone)
axis_val = ((abs(joy_val) - deadzone) * 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 >= 0 )
{ {
if( controller[Control].axis[b].hat_pos_a >= 0 ) if( controller[Control].axis[b].hat_pos_a >= 0 )
if( SDL_JoystickGetHat( controller[Control].joystick, controller[Control].axis[b].hat ) & controller[Control].axis[b].hat_pos_a ) if( SDL_JoystickGetHat( controller[Control].joystick, controller[Control].axis[b].hat ) & controller[Control].axis[b].hat_pos_a )
axis_val = -axis_max_val; axis_val = -80;
if( controller[Control].axis[b].hat_pos_b >= 0 ) if( controller[Control].axis[b].hat_pos_b >= 0 )
if( SDL_JoystickGetHat( controller[Control].joystick, controller[Control].axis[b].hat ) & controller[Control].axis[b].hat_pos_b ) if( SDL_JoystickGetHat( controller[Control].joystick, controller[Control].axis[b].hat ) & controller[Control].axis[b].hat_pos_b )
axis_val = axis_max_val; axis_val = 80;
} }
if( controller[Control].axis[b].button_a >= 0 ) if( controller[Control].axis[b].button_a >= 0 )
if( SDL_JoystickGetButton( controller[Control].joystick, controller[Control].axis[b].button_a ) ) if( SDL_JoystickGetButton( controller[Control].joystick, controller[Control].axis[b].button_a ) )
axis_val = -axis_max_val; axis_val = -80;
if( controller[Control].axis[b].button_b >= 0 ) if( controller[Control].axis[b].button_b >= 0 )
if( SDL_JoystickGetButton( controller[Control].joystick, controller[Control].axis[b].button_b ) ) if( SDL_JoystickGetButton( controller[Control].joystick, controller[Control].axis[b].button_b ) )
axis_val = axis_max_val; axis_val = 80;
if( b == 0 ) if( b == 0 )
iX = axis_val; controller[Control].buttons.X_AXIS = axis_val;
else 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 // process mouse events
@ -586,12 +573,23 @@ EXPORT void CALL GetKeys( int Control, BUTTONS *Keys )
if (controller[Control].mouse) if (controller[Control].mouse)
{ {
#if SDL_VERSION_ATLEAST(2,0,0)
if (SDL_GetRelativeMouseMode()) if (SDL_GetRelativeMouseMode())
#else
if (SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_ON)
#endif
{ {
SDL_PumpEvents();
#if SDL_VERSION_ATLEAST(1,3,0)
while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_MOUSEMOTION, SDL_MOUSEMOTION) == 1) while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_MOUSEMOTION, SDL_MOUSEMOTION) == 1)
#else
while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_EVENTMASK(SDL_MOUSEMOTION)) == 1)
#endif
{ {
#if SDL_VERSION_ATLEAST(2,0,0)
int w, h; int w, h;
SDL_Window *focus; SDL_Window *focus;
#endif
if (event.motion.xrel) if (event.motion.xrel)
{ {
@ -602,6 +600,7 @@ EXPORT void CALL GetKeys( int Control, BUTTONS *Keys )
mousey_residual += (int) (event.motion.yrel * controller[Control].mouse_sens[1]); mousey_residual += (int) (event.motion.yrel * controller[Control].mouse_sens[1]);
} }
#if SDL_VERSION_ATLEAST(2,0,0)
focus = SDL_GetKeyboardFocus(); focus = SDL_GetKeyboardFocus();
if (focus) { if (focus) {
SDL_GetWindowSize(focus, &w, &h); SDL_GetWindowSize(focus, &w, &h);
@ -610,18 +609,20 @@ EXPORT void CALL GetKeys( int Control, BUTTONS *Keys )
mousex_residual = 0; mousex_residual = 0;
mousey_residual = 0; mousey_residual = 0;
} }
#endif
} }
axis_val = mousex_residual;
/* store the result */ if (axis_val < -80)
int iX = mousex_residual; axis_val = -80;
int iY = -mousey_residual; else if (axis_val > 80)
if (iX < -80) iX = -80; axis_val = 80;
if (iX > 80) iX = 80; controller[Control].buttons.X_AXIS = axis_val;
if (iY < -80) iY = -80; axis_val = mousey_residual;
if (iY > 80) iY = 80; if (axis_val < -80)
controller[Control].buttons.X_AXIS = iX; axis_val = -80;
controller[Control].buttons.Y_AXIS = iY; else if (axis_val > 80)
axis_val = 80;
controller[Control].buttons.Y_AXIS = -axis_val;
/* the mouse x/y values decay exponentially (returns to center), unless the left "Windows" key is held down */ /* the mouse x/y values decay exponentially (returns to center), unless the left "Windows" key is held down */
if (!myKeyState[SDL_SCANCODE_LGUI]) if (!myKeyState[SDL_SCANCODE_LGUI])
{ {
@ -642,7 +643,7 @@ EXPORT void CALL GetKeys( int Control, BUTTONS *Keys )
*Keys = controller[Control].buttons; *Keys = controller[Control].buttons;
/* handle mempack / rumblepak switching (only if rumble is active on joystick) */ /* handle mempack / rumblepak switching (only if rumble is active on joystick) */
#if !SDL_VERSION_ATLEAST(2,0,18) #if SDL_VERSION_ATLEAST(2,0,0)
if (controller[Control].event_joystick) { if (controller[Control].event_joystick) {
static unsigned int SwitchPackTime[4] = {0, 0, 0, 0}, SwitchPackType[4] = {0, 0, 0, 0}; static unsigned int SwitchPackTime[4] = {0, 0, 0, 0}, SwitchPackType[4] = {0, 0, 0, 0};
if (controller[Control].buttons.Value & button_bits[14]) { if (controller[Control].buttons.Value & button_bits[14]) {
@ -665,13 +666,55 @@ EXPORT void CALL GetKeys( int Control, BUTTONS *Keys )
SwitchPackTime[Control] = 0; SwitchPackTime[Control] = 0;
} }
} }
#endif /* SDL_VERSION_ATLEAST(2,0,18) */ #elif __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};
// 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
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])
{
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
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)
{
controller[Control].control->Plugin = SwitchPackType[Control];
SwitchPackTime[Control] = 0;
}
}
#endif /* __linux__ */
controller[Control].buttons.Value = 0; controller[Control].buttons.Value = 0;
} }
static void InitiateJoysticks(int cntrl) static void InitiateJoysticks(int cntrl)
{ {
// 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;
}
if (controller[cntrl].device >= 0) { if (controller[cntrl].device >= 0) {
controller[cntrl].joystick = SDL_JoystickOpen(controller[cntrl].device); controller[cntrl].joystick = SDL_JoystickOpen(controller[cntrl].device);
if (!controller[cntrl].joystick) if (!controller[cntrl].joystick)
@ -683,31 +726,24 @@ static void InitiateJoysticks(int cntrl)
static void DeinitJoystick(int cntrl) static void DeinitJoystick(int cntrl)
{ {
#if SDL_VERSION_ATLEAST(2,0,0)
if (controller[cntrl].joystick) { if (controller[cntrl].joystick) {
SDL_JoystickClose(controller[cntrl].joystick); SDL_JoystickClose(controller[cntrl].joystick);
controller[cntrl].joystick = NULL; controller[cntrl].joystick = NULL;
} }
#endif
} }
static void InitiateRumble(int cntrl) static void InitiateRumble(int cntrl)
{ {
l_hapticWasInit = SDL_WasInit(SDL_INIT_HAPTIC); #if SDL_VERSION_ATLEAST(2,0,0)
if (!l_hapticWasInit) { if (!SDL_WasInit(SDL_INIT_HAPTIC)) {
if (SDL_InitSubSystem(SDL_INIT_HAPTIC) == -1) { if (SDL_InitSubSystem(SDL_INIT_HAPTIC) == -1) {
DebugMessage(M64MSG_ERROR, "Couldn't init SDL haptic subsystem: %s", SDL_GetError() ); DebugMessage(M64MSG_ERROR, "Couldn't init SDL haptic subsystem: %s", SDL_GetError() );
return; 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);
controller[cntrl].event_joystick = 0;
return;
}
controller[cntrl].event_joystick = 1;
#else
controller[cntrl].event_joystick = SDL_HapticOpenFromJoystick(controller[cntrl].joystick); controller[cntrl].event_joystick = SDL_HapticOpenFromJoystick(controller[cntrl].joystick);
if (!controller[cntrl].event_joystick) { if (!controller[cntrl].event_joystick) {
DebugMessage(M64MSG_WARNING, "Couldn't open rumble support for joystick #%i", cntrl + 1); DebugMessage(M64MSG_WARNING, "Couldn't open rumble support for joystick #%i", cntrl + 1);
@ -727,23 +763,120 @@ static void InitiateRumble(int cntrl)
DebugMessage(M64MSG_WARNING, "Rumble initialization failed for Joystick #%i", cntrl + 1); DebugMessage(M64MSG_WARNING, "Rumble initialization failed for Joystick #%i", cntrl + 1);
return; return;
} }
#endif /* SDL_VERSION_ATLEAST(2,0,18) */
DebugMessage(M64MSG_INFO, "Rumble activated on N64 joystick #%i", cntrl + 1); DebugMessage(M64MSG_INFO, "Rumble activated on N64 joystick #%i", cntrl + 1);
#elif __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;
}
}
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;
}
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(!test_bit(FF_RUMBLE, features))
{
DebugMessage(M64MSG_WARNING, "No rumble supported on N64 joystick #%i", cntrl + 1);
controller[cntrl].event_joystick = 0;
return;
}
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);
#endif /* __linux__ */
} }
static void DeinitRumble(int cntrl) static void DeinitRumble(int cntrl)
{ {
/* quit the haptic subsystem if necessary */ #if SDL_VERSION_ATLEAST(2,0,0)
if (!l_hapticWasInit)
SDL_QuitSubSystem(SDL_INIT_HAPTIC);
#if !SDL_VERSION_ATLEAST(2,0,18)
if (controller[cntrl].event_joystick) { if (controller[cntrl].event_joystick) {
SDL_HapticClose(controller[cntrl].event_joystick); SDL_HapticClose(controller[cntrl].event_joystick);
controller[cntrl].event_joystick = NULL; controller[cntrl].event_joystick = NULL;
} }
#endif /* !SDL_VERSION_ATLEAST(2,0,18) */ #endif
} }
/****************************************************************** /******************************************************************
@ -824,8 +957,15 @@ EXPORT void CALL RomClosed(void)
DeinitJoystick(i); DeinitJoystick(i);
} }
// quit SDL joystick subsystem
SDL_QuitSubSystem( SDL_INIT_JOYSTICK );
// release/ungrab mouse // release/ungrab mouse
#if SDL_VERSION_ATLEAST(2,0,0)
SDL_SetRelativeMouseMode(SDL_FALSE); SDL_SetRelativeMouseMode(SDL_FALSE);
#else
SDL_WM_GrabInput( SDL_GRAB_OFF );
#endif
SDL_ShowCursor( 1 ); SDL_ShowCursor( 1 );
romopen = 0; romopen = 0;
@ -842,6 +982,14 @@ EXPORT int CALL RomOpen(void)
{ {
int i; int i;
// init SDL joystick subsystem
if( !SDL_WasInit( SDL_INIT_JOYSTICK ) )
if( SDL_InitSubSystem( SDL_INIT_JOYSTICK ) == -1 )
{
DebugMessage(M64MSG_ERROR, "Couldn't init SDL joystick subsystem: %s", SDL_GetError() );
return 0;
}
// open joysticks // open joysticks
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
InitiateJoysticks(i); InitiateJoysticks(i);
@ -852,9 +1000,16 @@ EXPORT int CALL RomOpen(void)
if (controller[0].mouse || controller[1].mouse || controller[2].mouse || controller[3].mouse) if (controller[0].mouse || controller[1].mouse || controller[2].mouse || controller[3].mouse)
{ {
SDL_ShowCursor( 0 ); SDL_ShowCursor( 0 );
#if SDL_VERSION_ATLEAST(2,0,0)
if (SDL_SetRelativeMouseMode(SDL_TRUE) < 0) { if (SDL_SetRelativeMouseMode(SDL_TRUE) < 0) {
DebugMessage(M64MSG_WARNING, "Couldn't grab input! Mouse support won't work!"); DebugMessage(M64MSG_WARNING, "Couldn't grab input! Mouse support won't work!");
} }
#else
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; romopen = 1;

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-input-sdl - plugin.h * * 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-2009 Richard Goedeken *
* Copyright (C) 2008 Tillin9 * * Copyright (C) 2008 Tillin9 *
* Copyright (C) 2002 Blight * * Copyright (C) 2002 Blight *
@ -24,14 +24,23 @@
#ifndef __PLUGIN_H__ #ifndef __PLUGIN_H__
#define __PLUGIN_H__ #define __PLUGIN_H__
#if defined(__GNUC__)
#define ATTR_FMT(fmtpos, attrpos) __attribute__ ((format (printf, fmtpos, attrpos)))
#else
#define ATTR_FMT(fmtpos, attrpos)
#endif
#include <SDL.h> #include <SDL.h>
#include <string.h> #include <string.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_LGUI SDLK_LSUPER
#define SDL_Scancode SDLKey
#endif
#if SDL_VERSION_ATLEAST(2,0,0)
static inline const char* _SDL_JoystickName(int device_index) static inline const char* _SDL_JoystickName(int device_index)
{ {
@ -56,6 +65,8 @@ static inline const char* _SDL_JoystickName(int device_index)
#define SDL_JoystickName(device_index) _SDL_JoystickName(device_index) #define SDL_JoystickName(device_index) _SDL_JoystickName(device_index)
#endif
#define M64P_PLUGIN_PROTOTYPES 1 #define M64P_PLUGIN_PROTOTYPES 1
#include "m64p_config.h" #include "m64p_config.h"
#include "m64p_plugin.h" #include "m64p_plugin.h"
@ -126,10 +137,10 @@ typedef struct
int device; // joystick device; -1 = keyboard; -2 = none int device; // joystick device; -1 = keyboard; -2 = none
int mouse; // mouse enabled: 0 = no; 1 = yes int mouse; // mouse enabled: 0 = no; 1 = yes
SDL_Joystick *joystick; // SDL joystick device SDL_Joystick *joystick; // SDL joystick device
#if SDL_VERSION_ATLEAST(2,0,18) #if SDL_VERSION_ATLEAST(2,0,0)
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 SDL_Haptic *event_joystick; // the sdl device for force feeback
#else
int event_joystick; // the /dev/input/eventX device for force feeback
#endif #endif
int axis_deadzone[2]; // minimum absolute value before analog movement is recognized int axis_deadzone[2]; // minimum absolute value before analog movement is recognized
int axis_peak[2]; // highest analog value returned by SDL, used for scaling int axis_peak[2]; // highest analog value returned by SDL, used for scaling
@ -140,13 +151,15 @@ typedef struct
extern SController controller[4]; // 4 controllers extern SController controller[4]; // 4 controllers
/* global function definitions */ /* global function definitions */
extern void DebugMessage(int level, const char *message, ...) ATTR_FMT(2,3); extern void DebugMessage(int level, const char *message, ...);
/* declarations of pointers to Core config functions */ /* declarations of pointers to Core config functions */
extern ptr_ConfigListSections ConfigListSections; extern ptr_ConfigListSections ConfigListSections;
extern ptr_ConfigOpenSection ConfigOpenSection; extern ptr_ConfigOpenSection ConfigOpenSection;
extern ptr_ConfigDeleteSection ConfigDeleteSection; extern ptr_ConfigDeleteSection ConfigDeleteSection;
extern ptr_ConfigListParameters ConfigListParameters; extern ptr_ConfigListParameters ConfigListParameters;
extern ptr_ConfigSaveFile ConfigSaveFile;
extern ptr_ConfigSaveSection ConfigSaveSection;
extern ptr_ConfigSetParameter ConfigSetParameter; extern ptr_ConfigSetParameter ConfigSetParameter;
extern ptr_ConfigGetParameter ConfigGetParameter; extern ptr_ConfigGetParameter ConfigGetParameter;
extern ptr_ConfigGetParameterHelp ConfigGetParameterHelp; extern ptr_ConfigGetParameterHelp ConfigGetParameterHelp;

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus - sdl_key_converter.c * * Mupen64plus - sdl_key_converter.c *
* Mupen64Plus homepage: https://mupen64plus.org/ * * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2013 Mupen64plus development team * * Copyright (C) 2013 Mupen64plus development team *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus - sdl_key_converter.h * * Mupen64plus - sdl_key_converter.h *
* Mupen64Plus homepage: https://mupen64plus.org/ * * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2013 Mupen64plus development team * * Copyright (C) 2013 Mupen64plus development team *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
@ -27,6 +27,8 @@
uint16_t sdl_keysym2scancode(uint16_t keysym); uint16_t sdl_keysym2scancode(uint16_t keysym);
uint16_t sdl_scancode2keysym(uint16_t scancode); uint16_t sdl_scancode2keysym(uint16_t scancode);
#if SDL_VERSION_ATLEAST(1,3,0)
static osal_inline uint16_t sdl_keysym2native(uint16_t keysym) static osal_inline uint16_t sdl_keysym2native(uint16_t keysym)
{ {
return sdl_keysym2scancode(keysym); return sdl_keysym2scancode(keysym);
@ -36,3 +38,17 @@ static osal_inline uint16_t sdl_native2keysym(uint16_t native)
{ {
return sdl_scancode2keysym(native); return sdl_scancode2keysym(native);
} }
#else
static osal_inline uint16_t sdl_keysym2native(uint16_t keysym)
{
return keysym;
}
static osal_inline uint16_t sdl_native2keysym(uint16_t native)
{
return native;
}
#endif

View file

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