Change joystick log messages to DBG_GAMELOGIC

This commit is contained in:
mazmazz 2018-12-13 23:26:07 -05:00
parent e81f05c496
commit 14cde2d227
2 changed files with 22 additions and 8 deletions

View file

@ -1088,12 +1088,12 @@ static int joy_open(const char *fname)
if (JoyInfo.dev == NULL)
{
CONS_Printf(M_GetText("Couldn't open joystick: %s\n"), SDL_GetError());
CONS_Debug(DBG_GAMELOGIC, M_GetText("Joystick1: Couldn't open device - %s\n"), SDL_GetError());
return -1;
}
else
{
CONS_Printf(M_GetText("Joystick: %s\n"), SDL_JoystickName(JoyInfo.dev));
CONS_Debug(DBG_GAMELOGIC, M_GetText("Joystick1: %s\n"), SDL_JoystickName(JoyInfo.dev));
JoyInfo.axises = SDL_JoystickNumAxes(JoyInfo.dev);
if (JoyInfo.axises > JOYAXISSET*2)
JoyInfo.axises = JOYAXISSET*2;
@ -1381,12 +1381,12 @@ static int joy_open2(const char *fname)
if (JoyInfo2.dev == NULL)
{
CONS_Printf(M_GetText("Couldn't open joystick2: %s\n"), SDL_GetError());
CONS_Debug(DBG_GAMELOGIC, M_GetText("Joystick2: couldn't open device - %s\n"), SDL_GetError());
return -1;
}
else
{
CONS_Printf(M_GetText("Joystick2: %s\n"), SDL_JoystickName(JoyInfo2.dev));
CONS_Debug(DBG_GAMELOGIC, M_GetText("Joystick2: %s\n"), SDL_JoystickName(JoyInfo2.dev));
JoyInfo2.axises = SDL_JoystickNumAxes(JoyInfo2.dev);
if (JoyInfo2.axises > JOYAXISSET*2)
JoyInfo2.axises = JOYAXISSET*2;
@ -1443,7 +1443,11 @@ void I_InitJoystick(void)
if (JoyInfo.oldjoy <= 0)
JoyInfo.oldjoy = atoi(cv_usejoystick.string);
else
{
CONS_Debug(DBG_GAMELOGIC, "Joystick1 device index has changed: was %d, now %d\n",
JoyInfo.oldjoy, SDL_JoystickInstanceID(JoyInfo.dev) + 1);
JoyInfo.oldjoy = SDL_JoystickInstanceID(JoyInfo.dev) + 1;
}
joystick_started = 1;
}
else
@ -1483,7 +1487,11 @@ void I_InitJoystick2(void)
if (JoyInfo2.oldjoy <= 0)
JoyInfo2.oldjoy = atoi(cv_usejoystick2.string);
else
{
CONS_Debug(DBG_GAMELOGIC, "Joystick2 device index has changed: was %d, now %d\n",
JoyInfo2.oldjoy, SDL_JoystickInstanceID(JoyInfo2.dev) + 1);
JoyInfo2.oldjoy = SDL_JoystickInstanceID(JoyInfo2.dev) + 1;
}
joystick2_started = 1;
}
else

View file

@ -883,12 +883,15 @@ void I_GetEvent(void)
Impl_HandleJoystickButtonEvent(evt.jbutton, evt.type);
break;
case SDL_JOYDEVICEADDED:
CONS_Printf("Joy device %d added\n", evt.jdevice.which);
CONS_Debug(DBG_GAMELOGIC, "Joystick device index %d added\n", evt.jdevice.which + 1);
// recounts hotplugged joysticks
// recount hotplugged joysticks
I_InitJoystick();
I_InitJoystick2();
CONS_Debug(DBG_GAMELOGIC, "Joystick1 device index: %d\n", JoyInfo.oldjoy);
CONS_Debug(DBG_GAMELOGIC, "Joystick2 device index: %d\n", JoyInfo2.oldjoy);
// update the menu
if (currentMenu == &OP_JoystickSetDef)
M_SetupJoystickMenu(0);
@ -896,16 +899,19 @@ void I_GetEvent(void)
case SDL_JOYDEVICEREMOVED:
if (JoyInfo.dev && !SDL_JoystickGetAttached(JoyInfo.dev))
{
CONS_Printf("Joy device %d removed, was first joystick\n", JoyInfo.oldjoy);
CONS_Debug(DBG_GAMELOGIC, "Joystick1 removed, device index: %d\n", JoyInfo.oldjoy);
I_ShutdownJoystick();
}
if (JoyInfo2.dev && !SDL_JoystickGetAttached(JoyInfo2.dev))
{
CONS_Printf("Joy device %d removed, was second joystick\n", JoyInfo2.oldjoy);
CONS_Debug(DBG_GAMELOGIC, "Joystick2 removed, device index: %d\n", JoyInfo2.oldjoy);
I_ShutdownJoystick2();
}
CONS_Debug(DBG_GAMELOGIC, "Joystick1 device index: %d\n", JoyInfo.oldjoy);
CONS_Debug(DBG_GAMELOGIC, "Joystick2 device index: %d\n", JoyInfo2.oldjoy);
// update the menu
if (currentMenu == &OP_JoystickSetDef)
M_SetupJoystickMenu(0);