Logitech G27 touchups
Some checks failed
Generate Translation Template / Generate Translation Template (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled

- TODO note and adjust type for housing SDL_CreateHapticEffect return
- fix implementation of command 0x09 Set LED
- fix LED joystick changes handling
This commit is contained in:
Katharine Chui 2025-05-03 13:35:14 +02:00 committed by Megamouse
parent cf1e53f9c8
commit 487c58558e
2 changed files with 9 additions and 4 deletions

View file

@ -309,11 +309,11 @@ void usb_device_logitech_g27::sdl_refresh()
slot.effect_id = -1;
}
m_default_spring_effect_id = -1;
m_led_joystick_handle = new_led_joystick_handle;
m_haptic_handle = new_haptic_handle;
}
if (led_joystick_changed)
{
SDL_SetJoystickLED(m_led_joystick_handle, 0, 0, 0);
m_led_joystick_handle = new_led_joystick_handle;
}
}
@ -1456,7 +1456,7 @@ void usb_device_logitech_g27::interrupt_transfer(u32 buf_size, u8* buf, u32 endp
{
new_led_level += (buf[1] & (1 << i)) ? 1 : 0;
}
const u8 intensity = new_led_level * 255 / 7;
const u8 intensity = new_led_level * 255 / 8;
SDL_SetJoystickLED(m_led_joystick_handle, intensity, intensity, intensity);
break;
}

View file

@ -28,7 +28,10 @@ struct logitech_g27_ffb_slot
logitech_g27_ffb_state state = logitech_g27_ffb_state::inactive;
u64 last_update = 0;
SDL_HapticEffect last_effect {};
s32 effect_id = -1;
// TODO switch to SDL_HapticEffectID when it becomes available in a future SDL release
// Match the return of SDL_CreateHapticEffect for now
int effect_id = -1;
};
struct sdl_mapping
@ -113,7 +116,9 @@ private:
u16 m_wheel_range = 200;
std::array<logitech_g27_ffb_slot, 4> m_effect_slots {};
SDL_HapticEffect m_default_spring_effect {};
s32 m_default_spring_effect_id = -1;
// TODO switch to SDL_HapticEffectID when it becomes available in a future SDL release
int m_default_spring_effect_id = -1;
bool m_enabled = false;