mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-28 04:00:41 +00:00
Merge branch 'controller-names' into 'controller-menu-touchup'
Controller name fix See merge request SteelTitanium/SRB2!2
This commit is contained in:
commit
8efc32b826
3 changed files with 26 additions and 10 deletions
|
@ -6736,13 +6736,9 @@ static void M_SetupJoystickMenu(INT32 choice)
|
||||||
for (i = 1; i < 8; i++)
|
for (i = 1; i < 8; i++)
|
||||||
{
|
{
|
||||||
if (i <= n && (I_GetJoyName(i)) != NULL)
|
if (i <= n && (I_GetJoyName(i)) != NULL)
|
||||||
{
|
|
||||||
strncpy(joystickInfo[i], I_GetJoyName(i), 28);
|
strncpy(joystickInfo[i], I_GetJoyName(i), 28);
|
||||||
CONS_Printf("%s\n", joystickInfo[i]);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
strcpy(joystickInfo[i], joyNA);
|
strcpy(joystickInfo[i], joyNA);
|
||||||
CONS_Printf("%s\n", joystickInfo[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
M_SetupNextMenu(&OP_JoystickSetDef);
|
M_SetupNextMenu(&OP_JoystickSetDef);
|
||||||
|
|
|
@ -1453,18 +1453,28 @@ INT32 I_NumJoys(void)
|
||||||
return numjoy;
|
return numjoy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char joyname[255]; // MAX_PATH; joystick name is straight from the driver
|
||||||
|
|
||||||
const char *I_GetJoyName(INT32 joyindex)
|
const char *I_GetJoyName(INT32 joyindex)
|
||||||
{
|
{
|
||||||
const char *joyname = "NA";
|
const char *tempname = NULL;
|
||||||
joyindex--; //SDL's Joystick System starts at 0, not 1
|
joyindex--; //SDL's Joystick System starts at 0, not 1
|
||||||
if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0)
|
if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0)
|
||||||
{
|
{
|
||||||
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) != -1)
|
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) != -1)
|
||||||
joyname = SDL_JoystickNameForIndex(joyindex);
|
{
|
||||||
|
tempname = SDL_JoystickNameForIndex(joyindex);
|
||||||
|
if (tempname)
|
||||||
|
strncpy(joyname, tempname, 255);
|
||||||
|
}
|
||||||
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
|
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
joyname = SDL_JoystickNameForIndex(joyindex);
|
{
|
||||||
|
tempname = SDL_JoystickNameForIndex(joyindex);
|
||||||
|
if (tempname)
|
||||||
|
strncpy(joyname, tempname, 255);
|
||||||
|
}
|
||||||
return joyname;
|
return joyname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1575,18 +1575,28 @@ INT32 I_NumJoys(void)
|
||||||
return numjoy;
|
return numjoy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char joyname[255]; // MAX_PATH; joystick name is straight from the driver
|
||||||
|
|
||||||
const char *I_GetJoyName(INT32 joyindex)
|
const char *I_GetJoyName(INT32 joyindex)
|
||||||
{
|
{
|
||||||
const char *joyname = "NA";
|
const char *tempname = NULL;
|
||||||
joyindex--; //SDL's Joystick System starts at 0, not 1
|
joyindex--; //SDL's Joystick System starts at 0, not 1
|
||||||
if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0)
|
if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0)
|
||||||
{
|
{
|
||||||
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) != -1)
|
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) != -1)
|
||||||
joyname = SDL_JoystickName(joyindex);
|
{
|
||||||
|
tempname = SDL_JoystickNameForIndex(joyindex);
|
||||||
|
if (tempname)
|
||||||
|
strncpy(joyname, tempname, 255);
|
||||||
|
}
|
||||||
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
|
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
joyname = SDL_JoystickName(joyindex);
|
{
|
||||||
|
tempname = SDL_JoystickNameForIndex(joyindex);
|
||||||
|
if (tempname)
|
||||||
|
strncpy(joyname, tempname, 255);
|
||||||
|
}
|
||||||
return joyname;
|
return joyname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue