Logitech G27 touchups
Some checks failed
Generate Translation Template / Generate Translation Template (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux.sh, gcc, rpcs3/rpcs3-ci-jammy:1.6, ubuntu-24.04) (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (a1d35836e8d45bfc6f63c26f0a3e5d46ef622fe1, rpcs3/rpcs3-binaries-linux-arm64, /rpcs3/.ci/build-linux-aarch64.sh, clang, rpcs3/rpcs3-ci-jammy-aarch64:1.6, ubuntu-24.04-arm) (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (d812f1254a1157c80fd402f94446310560f54e5f, rpcs3/rpcs3-binaries-linux, /rpcs3/.ci/build-linux.sh, clang, rpcs3/rpcs3-ci-jammy:1.6, ubuntu-24.04) (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;