summaryrefslogtreecommitdiff
path: root/plugins/dfinput
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2025-11-16 00:36:51 +0100
committerXavier Del Campo Romero <xavi92@disroot.org>2025-11-16 00:36:51 +0100
commit788fb20656c8450a3f2da8b3f8b1905242103193 (patch)
treeae6e1a2c9e7da0fe72b070d2db580adf26e410af /plugins/dfinput
parent8349bf45e9b19d83506e1bb52f2053a7976922e5 (diff)
WIP TCP/SIOsio
Diffstat (limited to 'plugins/dfinput')
-rw-r--r--plugins/dfinput/pad.c30
-rw-r--r--plugins/dfinput/pad.h2
2 files changed, 16 insertions, 16 deletions
diff --git a/plugins/dfinput/pad.c b/plugins/dfinput/pad.c
index f413d0a4..9755ccbd 100644
--- a/plugins/dfinput/pad.c
+++ b/plugins/dfinput/pad.c
@@ -30,7 +30,7 @@
#if SDL_VERSION_ATLEAST(2,0,0)
int has_haptic;
-SDL_GameControllerButton controllerMap[] = {
+SDL_GameControllerButton controllerMap[DKEY_TOTAL] = {
SDL_CONTROLLER_BUTTON_BACK,
SDL_CONTROLLER_BUTTON_LEFTSTICK,
SDL_CONTROLLER_BUTTON_RIGHTSTICK,
@@ -47,7 +47,7 @@ SDL_GameControllerButton controllerMap[] = {
SDL_CONTROLLER_BUTTON_B,
SDL_CONTROLLER_BUTTON_A,
SDL_CONTROLLER_BUTTON_X,
-
+
SDL_CONTROLLER_BUTTON_GUIDE
};
#endif
@@ -69,7 +69,7 @@ uint32_t PSEgetLibVersion(void) {
static int padDataLenght[] = {0, 2, 3, 1, 1, 3, 3, 3};
void PADsetMode(const int pad, const int mode) {
g.PadState[pad].PadMode = mode;
-
+
if (g.cfg.PadDef[pad].Type == PSE_PAD_TYPE_ANALOGPAD) {
g.PadState[pad].PadID = mode ? 0x73 : 0x41;
}
@@ -77,7 +77,7 @@ void PADsetMode(const int pad, const int mode) {
g.PadState[pad].PadID = (g.cfg.PadDef[pad].Type << 4) |
padDataLenght[g.cfg.PadDef[pad].Type];
}
-
+
g.PadState[pad].Vib0 = 0;
g.PadState[pad].Vib1 = 0;
g.PadState[pad].VibF[0] = 0;
@@ -123,10 +123,10 @@ long PADopen(unsigned long *Disp) {
} else if (SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_NOPARACHUTE) == -1) {
return PSE_PAD_ERR_FAILURE;
}
-
+
#if SDL_VERSION_ATLEAST(2,0,0)
SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER);
-
+
has_haptic = 0;
if (SDL_InitSubSystem(SDL_INIT_HAPTIC) == 0)
has_haptic = 1;
@@ -217,22 +217,22 @@ static uint8_t unk4c[2][8] = {
{0xFF, 0x5A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
};
-static uint8_t unk4d[2][8] = {
+static uint8_t unk4d[2][8] = {
{0xFF, 0x5A, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
{0xFF, 0x5A, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}
};
-static uint8_t stdcfg[2][8] = {
+static uint8_t stdcfg[2][8] = {
{0xFF, 0x5A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0xFF, 0x5A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
};
-static uint8_t stdmode[2][8] = {
+static uint8_t stdmode[2][8] = {
{0xFF, 0x5A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0xFF, 0x5A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
};
-static uint8_t stdmodel[2][8] = {
+static uint8_t stdmodel[2][8] = {
{0xFF,
0x5A,
0x01, // 03 - dualshock2, 01 - dualshock
@@ -241,7 +241,7 @@ static uint8_t stdmodel[2][8] = {
0x02,
0x01,
0x00},
- {0xFF,
+ {0xFF,
0x5A,
0x01, // 03 - dualshock2, 01 - dualshock
0x02, // number of modes
@@ -250,7 +250,7 @@ static uint8_t stdmodel[2][8] = {
0x01,
0x00}
};
-
+
#if !SDL_VERSION_ATLEAST(2,0,0) && defined(__linux__)
/* lifted from SDL; but it's GPL as well */
/* added ffbit, though */
@@ -477,7 +477,7 @@ unsigned char PADpoll(unsigned char value) {
else if(g.PadState[CurPad].PadID == 0x12)
{
CmdLen = 6;
-
+
stdpar[CurPad][4] = g.PadState[0].MouseAxis[0][0];
stdpar[CurPad][5] = g.PadState[0].MouseAxis[0][1];
}
@@ -537,7 +537,7 @@ unsigned char PADpoll(unsigned char value) {
if (!JoyHapticRumble(CurPad, g.PadState[CurPad].VibF[0], g.PadState[CurPad].VibF[1])) {
//gpuVisualVibration(g.PadState[CurPad].VibF[0], g.PadState[CurPad].VibF[1]);
}
-
+
if(gpuVisualVibration != NULL &&
g.cfg.PadDef[CurPad].VisualVibration) {
gpuVisualVibration(g.PadState[CurPad].VibF[0], g.PadState[CurPad].VibF[1]);
@@ -666,7 +666,7 @@ long PADreadPort2(PadDataS *pad) {
long PADkeypressed(void) {
long s;
-
+
static int frame = 0;
if( !frame )
UpdateInput();
diff --git a/plugins/dfinput/pad.h b/plugins/dfinput/pad.h
index 3051e6ad..625d4102 100644
--- a/plugins/dfinput/pad.h
+++ b/plugins/dfinput/pad.h
@@ -151,7 +151,7 @@ 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];
+extern SDL_GameControllerButton controllerMap[DKEY_TOTAL];
#endif
typedef struct tagPadDef {