From 84da6537c418e5cc0f34d86140780c6003496167 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Thu, 22 Sep 2022 10:17:09 -0500 Subject: [PATCH] Fix in_availableJoysticks cvar not updating When in_restart is called or SDL controller added/remove event is received, IN_InitJoystick() tried to update the list but instead of updating the cvar Cvar_Get() just printed a developer message: Warning: cvar "in_availableJoysticks" given initial values: "first joystick ", "first joystick second joystick " --- code/sdl/sdl_input.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/code/sdl/sdl_input.c b/code/sdl/sdl_input.c index 6726b99a..390f7b3b 100644 --- a/code/sdl/sdl_input.c +++ b/code/sdl/sdl_input.c @@ -503,7 +503,10 @@ static void IN_InitJoystick( void ) Q_strcat(buf, sizeof(buf), "\n"); } - Cvar_Get( "in_availableJoysticks", buf, CVAR_ROM ); + Cvar_Get( "in_availableJoysticks", "", CVAR_ROM ); + + // Update cvar on in_restart or controller add/remove. + Cvar_Set( "in_availableJoysticks", buf ); if( !in_joystick->integer ) { Com_DPrintf( "Joystick is not active.\n" );