From 14cde2d227520bff464773442d11935e4bbfdedc Mon Sep 17 00:00:00 2001 From: mazmazz Date: Thu, 13 Dec 2018 23:26:07 -0500 Subject: [PATCH] Change joystick log messages to DBG_GAMELOGIC --- src/sdl/i_system.c | 16 ++++++++++++---- src/sdl/i_video.c | 14 ++++++++++---- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index e4880783..7a943979 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -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 diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 82f26d23..51da55cb 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -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);