diff --git a/src/dummy/i_system.c b/src/dummy/i_system.c index 5cd88243d..4f04769bf 100644 --- a/src/dummy/i_system.c +++ b/src/dummy/i_system.c @@ -71,9 +71,9 @@ INT32 I_NumJoys(void) return 0; } -const char *I_GetJoyName(INT32 joyindex) +const char *I_GetJoyName(INT32 joyid) { - (void)joyindex; + (void)joyid; return NULL; } diff --git a/src/g_game.c b/src/g_game.c index fab75b08e..014f9959d 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1263,7 +1263,7 @@ INT32 G_PlayerInputAnalog(UINT8 p, INT32 gc, boolean digital, SINT8 type) deadzone = (JOYAXISRANGE * deadzonetype) / FRACUNIT; - deviceID = I_GetJoystickDeviceIndexForPlayer(p) + 1; + deviceID = I_GetJoystickIDForPlayer(p) + 1; retrygetcontrol: for (i = 0; i < MAXINPUTMAPPING; i++) diff --git a/src/g_input.c b/src/g_input.c index d04249e38..a2b23762f 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -202,7 +202,7 @@ INT32 G_GetDevicePlayer(INT32 deviceID) for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) { - if (deviceID == I_GetJoystickDeviceIndexForPlayer(i) + 1) + if (deviceID == I_GetJoystickIDForPlayer(i) + 1) { return i; } diff --git a/src/i_system.h b/src/i_system.h index 7cc9c0180..2bd528f7b 100644 --- a/src/i_system.h +++ b/src/i_system.h @@ -235,11 +235,11 @@ extern INT32 numcontrollers; /** \brief The *I_GetJoyName function - \param joyindex which joystick + \param joyid which joystick \return joystick name */ -const char *I_GetJoyName(INT32 joyindex); +const char *I_GetJoyName(INT32 joyid); void I_GamepadRumble(INT32 playernum, UINT16 low_strength, UINT16 high_strength, UINT32 duration); void I_SetGamepadIndicatorColor(INT32 playernum, UINT8 red, UINT8 green, UINT8 blue); @@ -320,7 +320,7 @@ const char *I_LocateWad(void); */ void I_GetJoystickEvents(UINT8 index); -INT32 I_GetJoystickDeviceIndexForPlayer(UINT8 pnum); +INT32 I_GetJoystickIDForPlayer(UINT8 pnum); /** \brief Checks if the mouse needs to be grabbed */ diff --git a/src/sdl/i_system.cpp b/src/sdl/i_system.cpp index c8b081546..74904d9ac 100644 --- a/src/sdl/i_system.cpp +++ b/src/sdl/i_system.cpp @@ -1068,7 +1068,7 @@ void I_JoyScale4(void) } // Cheat to get the device index for a game controller handle -INT32 I_GetJoystickDeviceIndex(SDL_Gamepad *dev) +INT32 I_GetJoystickID(SDL_Gamepad *dev) { SDL_Joystick *joystick = NULL; @@ -1082,7 +1082,7 @@ INT32 I_GetJoystickDeviceIndex(SDL_Gamepad *dev) return -1; } -INT32 I_GetJoystickDeviceIndexForPlayer(UINT8 pnum) +INT32 I_GetJoystickIDForPlayer(UINT8 pnum) { SDL_Joystick *joystick = NULL; @@ -1164,7 +1164,7 @@ void I_ShutdownJoystick(UINT8 index) INT32 i; event_t event; - event.device = I_GetJoystickDeviceIndex(JoyInfo[index].dev); + event.device = I_GetJoystickID(JoyInfo[index].dev); event.type = ev_keyup; event.data2 = 0; event.data3 = 0; @@ -1198,7 +1198,7 @@ void I_ShutdownJoystick(UINT8 index) */ -static int joy_open(int playerIndex, int joyIndex) +static int joy_open(int playerIndex, int joyID) { SDL_Gamepad *newdev = NULL; int num_joy = 0; @@ -1214,7 +1214,7 @@ static int joy_open(int playerIndex, int joyIndex) return -1; } - if (joyIndex <= 0) + if (joyID <= 0) return -1; SDL_GetJoysticks(&num_joy); @@ -1225,7 +1225,7 @@ static int joy_open(int playerIndex, int joyIndex) return -1; } - newdev = SDL_OpenGamepad(joyIndex-1); + newdev = SDL_OpenGamepad(joyID-1); // Handle the edge case where the device <-> joystick index assignment can change due to hotplugging // This indexing is SDL's responsibility and there's not much we can do about it. @@ -1251,7 +1251,7 @@ static int joy_open(int playerIndex, int joyIndex) } JoyInfo[playerIndex].dev = newdev; - JoyInfo[playerIndex].id = I_GetJoystickDeviceIndex(JoyInfo[playerIndex].dev); + JoyInfo[playerIndex].id = I_GetJoystickID(JoyInfo[playerIndex].dev); if (JoyInfo[playerIndex].dev == NULL) { @@ -1345,7 +1345,7 @@ void I_InitJoystick(UINT8 index) break; } - JoyInfo[index].id = I_GetJoystickDeviceIndex(JoyInfo[index].dev); + JoyInfo[index].id = I_GetJoystickID(JoyInfo[index].dev); if (newcontroller && i < MAXSPLITSCREENPLAYERS) // don't override an active device { @@ -1435,14 +1435,14 @@ INT32 I_NumJoys(void) static char joyname[255]; // joystick name is straight from the driver -const char *I_GetJoyName(INT32 joyindex) +const char *I_GetJoyName(INT32 joyid) { const char *tempname = NULL; joyname[0] = 0; - joyindex--; //SDL's Joystick System starts at 0, not 1 + joyid--; //SDL's Joystick System starts at 0, not 1 if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK) { - tempname = SDL_GetJoystickNameForID(joyindex); + tempname = SDL_GetJoystickNameForID(joyid); if (tempname) { strncpy(joyname, tempname, 254); diff --git a/src/sdl/sdlmain.h b/src/sdl/sdlmain.h index 7a8dccbdc..9bb223e6b 100644 --- a/src/sdl/sdlmain.h +++ b/src/sdl/sdlmain.h @@ -78,7 +78,7 @@ void I_GetConsoleEvents(void); void I_ShutdownJoystick(UINT8 index); // Cheat to get the device index for a game controller handle -INT32 I_GetJoystickDeviceIndex(SDL_Gamepad *dev); +INT32 I_GetJoystickID(SDL_Gamepad *dev); // Quick thing to make SDL_JOYDEVICEADDED events less of an abomination void I_UpdateJoystickDeviceIndex(UINT8 player);