Fixed build when virtual joysticks are disabled

This commit is contained in:
Sam Lantinga
2025-03-21 07:34:57 -07:00
parent 758eb256b9
commit fbdb637978

View File

@@ -1122,7 +1122,9 @@ SDL_Joystick *SDL_OpenJoystick(SDL_JoystickID instance_id)
joystick->attached = true; joystick->attached = true;
joystick->led_expiration = SDL_GetTicks(); joystick->led_expiration = SDL_GetTicks();
joystick->battery_percent = -1; joystick->battery_percent = -1;
#ifdef SDL_JOYSTICK_VIRTUAL
joystick->is_virtual = (driver == &SDL_VIRTUAL_JoystickDriver); joystick->is_virtual = (driver == &SDL_VIRTUAL_JoystickDriver);
#endif
if (!driver->Open(joystick, device_index)) { if (!driver->Open(joystick, device_index)) {
SDL_SetObjectValid(joystick, SDL_OBJECT_TYPE_JOYSTICK, false); SDL_SetObjectValid(joystick, SDL_OBJECT_TYPE_JOYSTICK, false);