Compare commits

...

2 commits

Author SHA1 Message Date
Katharine Chui
487c58558e 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
2025-05-03 19:43:07 +02:00
Elad
cf1e53f9c8
Fix crash in memory viewer launcher (#17152) 2025-05-03 18:34:42 +03:00
5 changed files with 12 additions and 7 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;

View file

@ -22,7 +22,7 @@ instruction_editor_dialog::instruction_editor_dialog(QWidget *parent, u32 _pc, C
: QDialog(parent)
, m_pc(_pc)
, m_disasm(_disasm->copy_type_erased())
, m_get_cpu(std::move(func))
, m_get_cpu(func ? std::move(func) : std::function<cpu_thread*()>(FN(nullptr)))
{
setWindowTitle(tr("Edit instruction"));
setAttribute(Qt::WA_DeleteOnClose);

View file

@ -35,7 +35,7 @@ constexpr auto qstr = QString::fromStdString;
memory_viewer_panel::memory_viewer_panel(QWidget* parent, std::shared_ptr<CPUDisAsm> disasm, u32 addr, std::function<cpu_thread*()> func)
: QDialog(parent)
, m_addr(addr)
, m_get_cpu(std::move(func))
, m_get_cpu(func ? std::move(func) : std::function<cpu_thread*()>(FN(nullptr)))
, m_type([&]()
{
const auto cpu = m_get_cpu();

View file

@ -62,7 +62,7 @@ enum registers : int
register_editor_dialog::register_editor_dialog(QWidget *parent, CPUDisAsm* _disasm, std::function<cpu_thread*()> func)
: QDialog(parent)
, m_disasm(_disasm)
, m_get_cpu(std::move(func))
, m_get_cpu(func ? std::move(func) : std::function<cpu_thread*()>(FN(nullptr)))
{
setWindowTitle(tr("Edit registers"));
setAttribute(Qt::WA_DeleteOnClose);