From fc3578c59201b09a2dea44e80cdc10f15a74e54e Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Wed, 19 Dec 2018 13:11:30 -0600 Subject: [PATCH] Revert GameController stuff --- src/sdl/i_system.c | 60 +++++++++------------------------------------- src/sdl/sdlmain.h | 4 ---- 2 files changed, 11 insertions(+), 53 deletions(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index ee39f455..18f992bf 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -193,12 +193,11 @@ static char returnWadPath[256]; */ static void JoyReset(SDLJoyInfo_t *JoySet) { - if (JoySet->gamepad) - SDL_GameControllerClose(JoySet->gamepad); - else if (JoySet->dev) + if (JoySet->dev) + { SDL_JoystickClose(JoySet->dev); + } JoySet->dev = NULL; - JoySet->gamepad = NULL; JoySet->oldjoy = -1; JoySet->axises = JoySet->buttons = JoySet->hats = JoySet->balls = 0; //JoySet->scale @@ -1052,10 +1051,9 @@ static int joy_open(const char *fname) { int joyindex = atoi(fname); int num_joy = 0; - int num_gc = 0; int i; - if (SDL_WasInit(SDL_INIT_GAMECONTROLLER) == 0) + if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0) { CONS_Printf(M_GetText("Joystick subsystem not started\n")); return -1; @@ -1075,14 +1073,7 @@ static int joy_open(const char *fname) { CONS_Printf(M_GetText("Found %d joysticks on this system\n"), num_joy); for (i = 0; i < num_joy; i++) - { - if (SDL_IsGameController(i)) - { - num_gc++; - CONS_Printf("#%d/(%s) GC\n", i + 1, SDL_GameControllerNameForIndex(i)); - } - CONS_Printf("#%d/(%s)\n", i + 1, SDL_JoystickNameForIndex(i)); - } + CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickNameForIndex(i)); if (num_joy < joyindex) { @@ -1098,15 +1089,8 @@ static int joy_open(const char *fname) return 0; } } - if (SDL_IsGameController(joyindex - 1)) - { - JoyInfo.gamepad = SDL_GameControllerOpen(joyindex - 1); - JoyInfo.dev = SDL_GameControllerGetJoystick(JoyInfo.gamepad); - } - else - JoyInfo.dev = SDL_JoystickOpen(joyindex-1); - JoyInfo.guid = SDL_JoystickGetGUID(JoyInfo.dev); + JoyInfo.dev = SDL_JoystickOpen(joyindex-1); if (JoyInfo.dev == NULL) { @@ -1115,13 +1099,7 @@ static int joy_open(const char *fname) } else { - if (JoyInfo.gamepad) - { - CONS_Printf(M_GetText("Game Controller: %s\n"), SDL_GameControllerName(JoyInfo.gamepad)); - CONS_Printf(M_GetText("Mapping: %s\n"), SDL_GameControllerMapping(JoyInfo.gamepad)); - } - else - CONS_Printf(M_GetText("Joystick: %s\n"), SDL_JoystickName(JoyInfo.dev)); + CONS_Printf(M_GetText("Joystick: %s\n"), SDL_JoystickName(JoyInfo.dev)); JoyInfo.axises = SDL_JoystickNumAxes(JoyInfo.dev); if (JoyInfo.axises > JOYAXISSET*2) JoyInfo.axises = JOYAXISSET*2; @@ -1994,10 +1972,10 @@ void I_InitJoystick(void) if (M_CheckParm("-nojoy")) return; - if (SDL_WasInit(SDL_INIT_GAMECONTROLLER) == 0) + if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0) { CONS_Printf("Initing joy system\n"); - if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) == -1) + if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1) { CONS_Printf(M_GetText("Couldn't initialize joystick: %s\n"), SDL_GetError()); return; @@ -2090,12 +2068,12 @@ static void I_ShutdownInput(void) I_ShutdownJoystick(); I_ShutdownJoystick2(); - if (SDL_WasInit(SDL_INIT_GAMECONTROLLER) == SDL_INIT_GAMECONTROLLER) + if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK) { CONS_Printf("Shutting down joy system\n"); JoyReset(&JoyInfo3); JoyReset(&JoyInfo4); - SDL_QuitSubSystem(SDL_INIT_GAMECONTROLLER); + SDL_QuitSubSystem(SDL_INIT_JOYSTICK); I_OutputMsg("I_Joystick: SDL's Joystick system has been shutdown\n"); } } @@ -2108,22 +2086,6 @@ INT32 I_NumJoys(void) return numjoy; } -INT32 I_NumGameControllers(void) -{ - INT32 numgc = 0; - INT32 numjoy = I_NumJoys(); - INT32 i; - if (SDL_WasInit(SDL_INIT_GAMECONTROLLER) == SDL_INIT_GAMECONTROLLER) - { - for (i = 0; i < numjoy; i++) - { - if (SDL_IsGameController(i)) - numgc++; - } - } - return numgc; -} - static char joyname[255]; // MAX_PATH; joystick name is straight from the driver const char *I_GetJoyName(INT32 joyindex) diff --git a/src/sdl/sdlmain.h b/src/sdl/sdlmain.h index c62288cb..001de92f 100644 --- a/src/sdl/sdlmain.h +++ b/src/sdl/sdlmain.h @@ -39,10 +39,6 @@ typedef struct SDLJoyInfo_s { /// Joystick handle SDL_Joystick *dev; - /// GameController handle - SDL_GameController *gamepad; - /// Joystick GUID - SDL_JoystickGUID guid; /// number of old joystick int oldjoy; /// number of axies