mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Parser and Assembler implementations
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user