diff --git a/rpcs3/rpcs3qt/instruction_editor_dialog.cpp b/rpcs3/rpcs3qt/instruction_editor_dialog.cpp index 241fc3a13e..02ff01bc4f 100644 --- a/rpcs3/rpcs3qt/instruction_editor_dialog.cpp +++ b/rpcs3/rpcs3qt/instruction_editor_dialog.cpp @@ -3,11 +3,13 @@ #include "Emu/Cell/SPUThread.h" #include "Emu/CPU/CPUThread.h" #include "Emu/CPU/CPUDisAsm.h" +#include "Emu/Cell/lv2/sys_spu.h" #include #include #include #include +#include constexpr auto qstr = QString::fromStdString; @@ -56,6 +58,19 @@ instruction_editor_dialog::instruction_editor_dialog(QWidget *parent, u32 _pc, C vbox_right_panel->addWidget(new QLabel(qstr(fmt::format("%08x", m_pc)))); vbox_right_panel->addWidget(m_instr); vbox_right_panel->addWidget(m_preview); + + if (cpu && cpu->id_type() == 2) + { + const auto& spu = static_cast(*cpu); + + if (spu.group && spu.group->max_num > 1) + { + m_apply_for_spu_group = new QCheckBox(tr("For SPUs Group")); + vbox_left_panel->addWidget(m_apply_for_spu_group); + vbox_right_panel->addWidget(new QLabel("")); // For alignment + } + } + vbox_right_panel->setAlignment(Qt::AlignLeft); hbox_b_panel->addWidget(button_ok); @@ -90,6 +105,8 @@ instruction_editor_dialog::instruction_editor_dialog(QWidget *parent, u32 _pc, C return; } + const be_t swapped{static_cast(opcode)}; + if (cpu->id_type() == 1) { if (!ppu_patch(m_pc, static_cast(opcode))) @@ -98,9 +115,18 @@ instruction_editor_dialog::instruction_editor_dialog(QWidget *parent, u32 _pc, C return; } } + else if (m_apply_for_spu_group && m_apply_for_spu_group->isChecked()) + { + for (auto& spu : static_cast(*cpu).group->threads) + { + if (spu) + { + std::memcpy(spu->ls + m_pc, &swapped, 4); + } + } + } else { - const be_t swapped{static_cast(opcode)}; std::memcpy(m_cpu_offset + m_pc, &swapped, 4); } diff --git a/rpcs3/rpcs3qt/instruction_editor_dialog.h b/rpcs3/rpcs3qt/instruction_editor_dialog.h index 27c15ac066..ea48dc25b7 100644 --- a/rpcs3/rpcs3qt/instruction_editor_dialog.h +++ b/rpcs3/rpcs3qt/instruction_editor_dialog.h @@ -8,6 +8,7 @@ class CPUDisAsm; class cpu_thread; +class QCheckBox; class instruction_editor_dialog : public QDialog { @@ -19,6 +20,7 @@ private: CPUDisAsm* m_disasm; QLineEdit* m_instr; QLabel* m_preview; + QCheckBox* m_apply_for_spu_group = nullptr; const std::function m_get_cpu;