From 219cb1a59df1be884d7c54ba0cf7731d9b173f82 Mon Sep 17 00:00:00 2001 From: Andrey Moura Date: Tue, 13 May 2025 00:07:36 -0300 Subject: [PATCH] joystick: Fix linker error when building without virtual joystick support SDL_VIRTUAL_JoystickDriver was referenced outside an #ifdef when setting is_virtual, which caused a linker error. I modified it so that is_virtual is set to false if virtual joystick support is not enabled. --- src/joystick/SDL_joystick.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index 71987d109b..7878b7cc68 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -1142,7 +1142,11 @@ SDL_Joystick *SDL_OpenJoystick(SDL_JoystickID instance_id) joystick->attached = true; joystick->led_expiration = SDL_GetTicks(); joystick->battery_percent = -1; +#ifdef SDL_JOYSTICK_VIRTUAL joystick->is_virtual = (driver == &SDL_VIRTUAL_JoystickDriver); +#else + joystick->is_virtual = false; +#endif if (!driver->Open(joystick, device_index)) { SDL_SetObjectValid(joystick, SDL_OBJECT_TYPE_JOYSTICK, false);