mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-16 04:07:51 +00:00
Merge 5fa35ed975
into 18a78a9bab
This commit is contained in:
commit
c8d85f4ca9
@ -579,7 +579,8 @@ void CodeViewWidget::OnContextMenu()
|
||||
auto* copy_line_action =
|
||||
menu->addAction(tr("Copy Code &Line"), this, &CodeViewWidget::OnCopyCode);
|
||||
auto* copy_hex_action = menu->addAction(tr("Copy &Hex"), this, &CodeViewWidget::OnCopyHex);
|
||||
|
||||
auto* copy_whole_line_action =
|
||||
menu->addAction(tr("Copy &Whole Line"), this, &CodeViewWidget::OnCopyWholeLine);
|
||||
menu->addAction(tr("Show in &Memory"), this, &CodeViewWidget::OnShowInMemory);
|
||||
auto* show_target_memory =
|
||||
menu->addAction(tr("Show Target in Memor&y"), this, &CodeViewWidget::OnShowTargetInMemory);
|
||||
@ -645,9 +646,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, run_to_action,
|
||||
ppc_action, insert_blr_action, insert_nop_action, replace_action, assemble_action})
|
||||
for (auto* action : {copy_address_action, copy_line_action, copy_whole_line_action,
|
||||
copy_hex_action, function_action, run_to_action, ppc_action,
|
||||
insert_blr_action, insert_nop_action, replace_action, assemble_action})
|
||||
{
|
||||
action->setEnabled(running);
|
||||
}
|
||||
@ -826,6 +827,29 @@ void CodeViewWidget::OnCopyCode()
|
||||
QApplication::clipboard()->setText(QString::fromStdString(text));
|
||||
}
|
||||
|
||||
void CodeViewWidget::OnCopyWholeLine()
|
||||
{
|
||||
const u32 addr = GetContextAddress();
|
||||
|
||||
Core::CPUThreadGuard guard(m_system);
|
||||
|
||||
const std::string text_code = m_system.GetPowerPC().GetDebugInterface().Disassemble(&guard, addr);
|
||||
std::string whole_line = fmt::format("{:08x} {}", addr, text_code);
|
||||
|
||||
if (IsInstructionLoadStore(text_code))
|
||||
{
|
||||
const std::optional<u32> target_addr =
|
||||
m_system.GetPowerPC().GetDebugInterface().GetMemoryAddressFromInstruction(text_code);
|
||||
|
||||
if (target_addr)
|
||||
{
|
||||
whole_line += fmt::format(" targetting {:08x}", *target_addr);
|
||||
}
|
||||
}
|
||||
|
||||
QApplication::clipboard()->setText(QString::fromStdString(whole_line));
|
||||
}
|
||||
|
||||
void CodeViewWidget::OnCopyFunction()
|
||||
{
|
||||
const u32 address = GetContextAddress();
|
||||
|
@ -86,6 +86,7 @@ private:
|
||||
void OnShowTargetInMemory();
|
||||
void OnCopyFunction();
|
||||
void OnCopyCode();
|
||||
void OnCopyWholeLine();
|
||||
void OnCopyHex();
|
||||
void OnRenameSymbol();
|
||||
void OnSelectionChanged();
|
||||
|
Loading…
Reference in New Issue
Block a user