summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp')
-rw-r--r--Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp42
1 files changed, 34 insertions, 8 deletions
diff --git a/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp b/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp
index 5507875997..df6ccc6a5b 100644
--- a/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp
+++ b/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp
@@ -35,6 +35,7 @@
#include "Core/PowerPC/PPCSymbolDB.h"
#include "Core/PowerPC/PowerPC.h"
#include "Core/System.h"
+#include "DolphinQt/Debugger/AssembleInstructionDialog.h"
#include "DolphinQt/Debugger/PatchInstructionDialog.h"
#include "DolphinQt/Host.h"
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
@@ -597,6 +598,8 @@ void CodeViewWidget::OnContextMenu()
auto* insert_nop_action = menu->addAction(tr("Insert &nop"), this, &CodeViewWidget::OnInsertNOP);
auto* replace_action =
menu->addAction(tr("Re&place instruction"), this, &CodeViewWidget::OnReplaceInstruction);
+ auto* assemble_action =
+ menu->addAction(tr("Assemble instruction"), this, &CodeViewWidget::OnAssembleInstruction);
auto* restore_action =
menu->addAction(tr("Restore instruction"), this, &CodeViewWidget::OnRestoreInstruction);
@@ -637,8 +640,9 @@ void CodeViewWidget::OnContextMenu()
run_until_menu->setEnabled(!target.isEmpty());
follow_branch_action->setEnabled(follow_branch_enabled);
- for (auto* action : {copy_address_action, copy_line_action, copy_hex_action, function_action,
- ppc_action, insert_blr_action, insert_nop_action, replace_action})
+ for (auto* action :
+ {copy_address_action, copy_line_action, copy_hex_action, function_action, ppc_action,
+ insert_blr_action, insert_nop_action, replace_action, assemble_action})
{
action->setEnabled(running);
}
@@ -997,8 +1001,17 @@ void CodeViewWidget::OnSetSymbolEndAddress()
void CodeViewWidget::OnReplaceInstruction()
{
- Core::CPUThreadGuard guard(m_system);
+ DoPatchInstruction(false);
+}
+
+void CodeViewWidget::OnAssembleInstruction()
+{
+ DoPatchInstruction(true);
+}
+void CodeViewWidget::DoPatchInstruction(bool assemble)
+{
+ Core::CPUThreadGuard guard(m_system);
const u32 addr = GetContextAddress();
if (!PowerPC::MMU::HostIsInstructionRAMAddress(guard, addr))
@@ -1010,13 +1023,26 @@ void CodeViewWidget::OnReplaceInstruction()
return;
auto& debug_interface = m_system.GetPowerPC().GetDebugInterface();
- PatchInstructionDialog dialog(this, addr, debug_interface.ReadInstruction(guard, addr));
- SetQWidgetWindowDecorations(&dialog);
- if (dialog.exec() == QDialog::Accepted)
+ if (assemble)
{
- debug_interface.SetPatch(guard, addr, dialog.GetCode());
- Update(&guard);
+ AssembleInstructionDialog dialog(this, addr, debug_interface.ReadInstruction(guard, addr));
+ SetQWidgetWindowDecorations(&dialog);
+ if (dialog.exec() == QDialog::Accepted)
+ {
+ debug_interface.SetPatch(guard, addr, dialog.GetCode());
+ Update(&guard);
+ }
+ }
+ else
+ {
+ PatchInstructionDialog dialog(this, addr, debug_interface.ReadInstruction(guard, addr));
+ SetQWidgetWindowDecorations(&dialog);
+ if (dialog.exec() == QDialog::Accepted)
+ {
+ debug_interface.SetPatch(guard, addr, dialog.GetCode());
+ Update(&guard);
+ }
}
}