From 452fb59c7472cebd191f357641f38b6c9049207b Mon Sep 17 00:00:00 2001 From: Megamouse Date: Tue, 23 Mar 2021 20:51:39 +0100 Subject: [PATCH] Qt: select target item in debugger list This should make it easier to spot the item --- rpcs3/rpcs3qt/breakpoint_list.h | 2 +- rpcs3/rpcs3qt/call_stack_list.h | 2 +- rpcs3/rpcs3qt/debugger_frame.cpp | 8 ++++---- rpcs3/rpcs3qt/debugger_list.cpp | 11 ++++++++--- rpcs3/rpcs3qt/debugger_list.h | 2 +- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/rpcs3/rpcs3qt/breakpoint_list.h b/rpcs3/rpcs3qt/breakpoint_list.h index a646e7808a..764967f0f3 100644 --- a/rpcs3/rpcs3qt/breakpoint_list.h +++ b/rpcs3/rpcs3qt/breakpoint_list.h @@ -23,7 +23,7 @@ public: QColor m_text_color_bp; QColor m_color_bp; Q_SIGNALS: - void RequestShowAddress(u32 addr, bool force = false); + void RequestShowAddress(u32 addr, bool select_addr = true, bool force = false); public Q_SLOTS: void HandleBreakpointRequest(u32 addr); private Q_SLOTS: diff --git a/rpcs3/rpcs3qt/call_stack_list.h b/rpcs3/rpcs3qt/call_stack_list.h index 61bc6df1a6..211ba0ccad 100644 --- a/rpcs3/rpcs3qt/call_stack_list.h +++ b/rpcs3/rpcs3qt/call_stack_list.h @@ -16,7 +16,7 @@ public: call_stack_list(QWidget* parent); Q_SIGNALS: - void RequestShowAddress(u32 addr, bool force = false); + void RequestShowAddress(u32 addr, bool select_addr = true, bool force = false); public Q_SLOTS: void HandleUpdate(std::vector> call_stack); private Q_SLOTS: diff --git a/rpcs3/rpcs3qt/debugger_frame.cpp b/rpcs3/rpcs3qt/debugger_frame.cpp index 0c54b6a51f..6be40d4c48 100644 --- a/rpcs3/rpcs3qt/debugger_frame.cpp +++ b/rpcs3/rpcs3qt/debugger_frame.cpp @@ -184,7 +184,7 @@ debugger_frame::debugger_frame(std::shared_ptr settings, QWidget * connect(this, &debugger_frame::CallStackUpdateRequested, m_call_stack_list, &call_stack_list::HandleUpdate); connect(m_call_stack_list, &call_stack_list::RequestShowAddress, m_debugger_list, &debugger_list::ShowAddress); - m_debugger_list->ShowAddress(m_debugger_list->m_pc); + m_debugger_list->ShowAddress(m_debugger_list->m_pc, false); UpdateUnitList(); } @@ -460,7 +460,7 @@ void debugger_frame::keyPressEvent(QKeyEvent* event) } if (auto pos = std::basic_string_view(res.data(), 2).find_last_not_of(UINT32_MAX); pos != umax) - m_debugger_list->ShowAddress(res[pos] - std::max(i, 0) * 4, true); + m_debugger_list->ShowAddress(res[pos] - std::max(i, 0) * 4, true, true); return; } @@ -854,7 +854,7 @@ void debugger_frame::ShowGotoAddressDialog() if (dlg->exec() == QDialog::Accepted) { const u32 address = EvaluateExpression(expression_input->text()); - m_debugger_list->ShowAddress(address); + m_debugger_list->ShowAddress(address, true); } dlg->deleteLater(); @@ -889,7 +889,7 @@ void debugger_frame::ShowPC() const u32 pc = (cpu0 ? cpu0->get_pc() : 0); - m_debugger_list->ShowAddress(pc); + m_debugger_list->ShowAddress(pc, true); } void debugger_frame::DoStep(bool step_over) diff --git a/rpcs3/rpcs3qt/debugger_list.cpp b/rpcs3/rpcs3qt/debugger_list.cpp index e5c36adc5d..95084b1807 100644 --- a/rpcs3/rpcs3qt/debugger_list.cpp +++ b/rpcs3/rpcs3qt/debugger_list.cpp @@ -43,7 +43,7 @@ u32 debugger_list::GetCenteredAddress(u32 address) const return address - ((m_item_count / 2) * 4); } -void debugger_list::ShowAddress(u32 addr, bool force) +void debugger_list::ShowAddress(u32 addr, bool select_addr, bool force) { auto IsBreakpoint = [this](u32 pc) { @@ -114,6 +114,11 @@ void debugger_list::ShowAddress(u32 addr, bool force) list_item->setBackground(default_background); } + if (select_addr && pc == addr) + { + list_item->setSelected(true); + } + if (m_cpu->id_type() == 1 && !vm::check_addr(pc, 0)) { list_item->setText((IsBreakpoint(pc) ? ">> " : " ") + qstr(fmt::format("[%08x] ?? ?? ?? ??:", pc))); @@ -159,7 +164,7 @@ void debugger_list::scroll(s32 steps) steps--; } - ShowAddress(m_pc + (steps * 4), true); + ShowAddress(m_pc + (steps * 4), false, true); } void debugger_list::keyPressEvent(QKeyEvent* event) @@ -298,5 +303,5 @@ void debugger_list::resizeEvent(QResizeEvent* event) delete item(m_item_count); } - ShowAddress(m_pc); + ShowAddress(m_pc, false); } diff --git a/rpcs3/rpcs3qt/debugger_list.h b/rpcs3/rpcs3qt/debugger_list.h index bdb184b824..63a2ba08a1 100644 --- a/rpcs3/rpcs3qt/debugger_list.h +++ b/rpcs3/rpcs3qt/debugger_list.h @@ -30,7 +30,7 @@ public: debugger_list(QWidget* parent, std::shared_ptr settings, breakpoint_handler* handler); void UpdateCPUData(cpu_thread* cpu, CPUDisAsm* disasm); public Q_SLOTS: - void ShowAddress(u32 addr, bool force = false); + void ShowAddress(u32 addr, bool select_addr = true, bool force = false); protected: void keyPressEvent(QKeyEvent* event) override; void mouseDoubleClickEvent(QMouseEvent* event) override;