From c875a3566e340e366553beb2dcd6b2bcf4d5ab18 Mon Sep 17 00:00:00 2001 From: "SND\\MaddTheSane_cp" Date: Tue, 8 Apr 2014 02:33:19 +0000 Subject: DFInput: Implement SDL2 GameController support. This change allows the user to use SDL2’s GameController API instead of the Joystick API. The Game Controller API maps the buttons similar to an Xbox 360 controller, so some tricky mapping needed to be done. Note that it currently only supports OS X. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@89828 e17a0e51-4ae3-4d35-97c3-1a29b211df97 --- plugins/dfinput/pad.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'plugins/dfinput/pad.h') diff --git a/plugins/dfinput/pad.h b/plugins/dfinput/pad.h index 205bae41..eb9217fa 100755 --- a/plugins/dfinput/pad.h +++ b/plugins/dfinput/pad.h @@ -38,6 +38,7 @@ extern "C" { #include #if SDL_VERSION_ATLEAST(2,0,0) #include +#include #endif #ifdef _MACOSX @@ -147,12 +148,19 @@ typedef struct tagKeyDef { enum { ANALOG_XP = 0, ANALOG_XM, ANALOG_YP, ANALOG_YM }; +#if SDL_VERSION_ATLEAST(2,0,0) +SDL_GameControllerButton controllerMap[DKEY_TOTAL]; +#endif + typedef struct tagPadDef { int8_t DevNum; uint16_t Type; uint8_t VisualVibration; KEYDEF KeyDef[DKEY_TOTAL]; KEYDEF AnalogDef[ANALOG_TOTAL][4]; +#if SDL_VERSION_ATLEAST(2,0,0) + int8_t UseSDL2; +#endif } PADDEF; typedef struct tagEmuDef { @@ -188,7 +196,8 @@ typedef struct tagPadState { uint8_t Vib0, Vib1; volatile uint8_t VibF[2]; #if SDL_VERSION_ATLEAST(2,0,0) - SDL_Haptic *haptic; + SDL_Haptic *haptic; + SDL_GameController *GCDev; #else #ifdef __linux__ int VibrateDev; -- cgit v1.2.3