summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinWX/Debugger/CodeView.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/DolphinWX/Debugger/CodeView.cpp')
-rw-r--r--Source/Core/DolphinWX/Debugger/CodeView.cpp43
1 files changed, 13 insertions, 30 deletions
diff --git a/Source/Core/DolphinWX/Debugger/CodeView.cpp b/Source/Core/DolphinWX/Debugger/CodeView.cpp
index da6f29abb7..3a55c61c3f 100644
--- a/Source/Core/DolphinWX/Debugger/CodeView.cpp
+++ b/Source/Core/DolphinWX/Debugger/CodeView.cpp
@@ -45,6 +45,7 @@ enum
IDM_INSERTBLR,
IDM_INSERTNOP,
IDM_ASSEMBLE,
+ IDM_RESTORE,
IDM_RUNTOHERE,
IDM_JITRESULTS,
IDM_FOLLOWBRANCH,
@@ -201,36 +202,10 @@ u32 CCodeView::AddrToBranch(u32 addr)
return 0;
}
-void CCodeView::InsertBlrNop(int Blr)
+void CCodeView::InsertBlrNop(int blr)
{
- // Check if this address has been modified
- int find = -1;
- for (u32 i = 0; i < m_blrList.size(); i++)
- {
- if (m_blrList.at(i).address == m_selection)
- {
- find = i;
- break;
- }
- }
-
- // Save the old value
- if (find >= 0)
- {
- m_debugger->WriteExtraMemory(0, m_blrList.at(find).oldValue, m_selection);
- m_blrList.erase(m_blrList.begin() + find);
- }
- else
- {
- BlrStruct temp;
- temp.address = m_selection;
- temp.oldValue = m_debugger->ReadMemory(m_selection);
- m_blrList.push_back(temp);
- if (Blr == 0)
- m_debugger->Patch(m_selection, 0x4e800020);
- else
- m_debugger->Patch(m_selection, 0x60000000);
- }
+ m_debugger->UnsetPatch(m_selection);
+ m_debugger->SetPatch(m_selection, (blr == 0) ? 0x4e800020 : 0x60000000);
Refresh();
}
@@ -320,13 +295,19 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
unsigned long code;
if (dialog.GetValue().ToULong(&code, 0) && code <= std::numeric_limits<u32>::max())
{
- m_debugger->Patch(m_selection, code);
+ m_debugger->UnsetPatch(m_selection);
+ m_debugger->SetPatch(m_selection, code);
Refresh();
}
}
break;
}
+ case IDM_RESTORE:
+ m_debugger->UnsetPatch(m_selection);
+ Refresh();
+ break;
+
case IDM_JITRESULTS:
{
// Propagate back to the parent window and tell it
@@ -451,6 +432,8 @@ void CCodeView::OnMouseUpR(wxMouseEvent& event)
menu.Append(IDM_INSERTBLR, _("&Insert blr"))->Enable(Core::IsRunning());
menu.Append(IDM_INSERTNOP, _("Insert &nop"))->Enable(Core::IsRunning());
menu.Append(IDM_ASSEMBLE, _("Re&place instruction"))->Enable(Core::IsRunning());
+ menu.Append(IDM_RESTORE, _("Restore instruction"))
+ ->Enable(Core::IsRunning() && m_debugger->HasEnabledPatch(m_selection));
// menu.Append(IDM_PATCHALERT, _("Patch alert"))->Enable(Core::IsRunning());
PopupMenu(&menu);
event.Skip();