From cf1e53f9c80b9e08151ad3a61457902a5a7c018d Mon Sep 17 00:00:00 2001 From: Elad <18193363+elad335@users.noreply.github.com> Date: Sat, 3 May 2025 18:34:42 +0300 Subject: [PATCH 1/2] Fix crash in memory viewer launcher (#17152) --- rpcs3/rpcs3qt/instruction_editor_dialog.cpp | 2 +- rpcs3/rpcs3qt/memory_viewer_panel.cpp | 2 +- rpcs3/rpcs3qt/register_editor_dialog.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rpcs3/rpcs3qt/instruction_editor_dialog.cpp b/rpcs3/rpcs3qt/instruction_editor_dialog.cpp index 26205d2a14..460b7503f6 100644 --- a/rpcs3/rpcs3qt/instruction_editor_dialog.cpp +++ b/rpcs3/rpcs3qt/instruction_editor_dialog.cpp @@ -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(FN(nullptr))) { setWindowTitle(tr("Edit instruction")); setAttribute(Qt::WA_DeleteOnClose); diff --git a/rpcs3/rpcs3qt/memory_viewer_panel.cpp b/rpcs3/rpcs3qt/memory_viewer_panel.cpp index 392b3e0385..c381b18404 100644 --- a/rpcs3/rpcs3qt/memory_viewer_panel.cpp +++ b/rpcs3/rpcs3qt/memory_viewer_panel.cpp @@ -35,7 +35,7 @@ constexpr auto qstr = QString::fromStdString; memory_viewer_panel::memory_viewer_panel(QWidget* parent, std::shared_ptr disasm, u32 addr, std::function func) : QDialog(parent) , m_addr(addr) - , m_get_cpu(std::move(func)) + , m_get_cpu(func ? std::move(func) : std::function(FN(nullptr))) , m_type([&]() { const auto cpu = m_get_cpu(); diff --git a/rpcs3/rpcs3qt/register_editor_dialog.cpp b/rpcs3/rpcs3qt/register_editor_dialog.cpp index 54eb830975..54f50e6f60 100644 --- a/rpcs3/rpcs3qt/register_editor_dialog.cpp +++ b/rpcs3/rpcs3qt/register_editor_dialog.cpp @@ -62,7 +62,7 @@ enum registers : int register_editor_dialog::register_editor_dialog(QWidget *parent, CPUDisAsm* _disasm, std::function func) : QDialog(parent) , m_disasm(_disasm) - , m_get_cpu(std::move(func)) + , m_get_cpu(func ? std::move(func) : std::function(FN(nullptr))) { setWindowTitle(tr("Edit registers")); setAttribute(Qt::WA_DeleteOnClose); From 487c58558edd37b10e8a79c1ccd3873593185923 Mon Sep 17 00:00:00 2001 From: Katharine Chui Date: Sat, 3 May 2025 13:35:14 +0200 Subject: [PATCH 2/2] Logitech G27 touchups - TODO note and adjust type for housing SDL_CreateHapticEffect return - fix implementation of command 0x09 Set LED - fix LED joystick changes handling --- rpcs3/Emu/Io/LogitechG27.cpp | 4 ++-- rpcs3/Emu/Io/LogitechG27.h | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/rpcs3/Emu/Io/LogitechG27.cpp b/rpcs3/Emu/Io/LogitechG27.cpp index af6e89e350..1612c567d6 100644 --- a/rpcs3/Emu/Io/LogitechG27.cpp +++ b/rpcs3/Emu/Io/LogitechG27.cpp @@ -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; } diff --git a/rpcs3/Emu/Io/LogitechG27.h b/rpcs3/Emu/Io/LogitechG27.h index 4bbdc70dec..5a8406486a 100644 --- a/rpcs3/Emu/Io/LogitechG27.h +++ b/rpcs3/Emu/Io/LogitechG27.h @@ -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 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;