diff --git a/Source/Core/DolphinQt2/Debugger/CodeViewWidget.cpp b/Source/Core/DolphinQt2/Debugger/CodeViewWidget.cpp index 198202b424..7ecffdd9d7 100644 --- a/Source/Core/DolphinQt2/Debugger/CodeViewWidget.cpp +++ b/Source/Core/DolphinQt2/Debugger/CodeViewWidget.cpp @@ -195,14 +195,14 @@ void CodeViewWidget::SetAddress(u32 address, SetAddressUpdate update) Update(); } -void CodeViewWidget::ReplaceAddress(u32 address, bool blr) +void CodeViewWidget::ReplaceAddress(u32 address, ReplaceWith replace) { auto found = std::find_if(m_repl_list.begin(), m_repl_list.end(), [address](ReplStruct r) { return r.address == address; }); if (found != m_repl_list.end()) { - PowerPC::debug_interface.WriteExtraMemory(0, (*found).old_value, address); + PowerPC::debug_interface.WriteExtraMemory(0, found->old_value, address); m_repl_list.erase(found); } else @@ -214,7 +214,7 @@ void CodeViewWidget::ReplaceAddress(u32 address, bool blr) m_repl_list.push_back(repl); - PowerPC::debug_interface.Patch(address, blr ? 0x60000000 : 0x4e800020); + PowerPC::debug_interface.Patch(address, replace == ReplaceWith::BLR ? 0x4e800020 : 0x60000000); } Update(); @@ -347,14 +347,14 @@ void CodeViewWidget::OnInsertBLR() { const u32 addr = GetContextAddress(); - ReplaceAddress(addr, 0); + ReplaceAddress(addr, ReplaceWith::BLR); } void CodeViewWidget::OnInsertNOP() { const u32 addr = GetContextAddress(); - ReplaceAddress(addr, 1); + ReplaceAddress(addr, ReplaceWith::NOP); } void CodeViewWidget::OnFollowBranch() diff --git a/Source/Core/DolphinQt2/Debugger/CodeViewWidget.h b/Source/Core/DolphinQt2/Debugger/CodeViewWidget.h index a6e038b447..c879b70d4b 100644 --- a/Source/Core/DolphinQt2/Debugger/CodeViewWidget.h +++ b/Source/Core/DolphinQt2/Debugger/CodeViewWidget.h @@ -40,7 +40,13 @@ signals: void BreakpointsChanged(); private: - void ReplaceAddress(u32 address, bool blr); + enum class ReplaceWith + { + BLR, + NOP + }; + + void ReplaceAddress(u32 address, ReplaceWith replace); void resizeEvent(QResizeEvent*) override; void keyPressEvent(QKeyEvent* event) override;