Fixed string generation to fit better within codebase as suggested by TryTwo

This commit is contained in:
Nitch2024 2025-03-30 00:50:21 -07:00
commit c0d2295d4e

View file

@ -831,14 +831,12 @@ void CodeViewWidget::OnCopyWholeLine()
{ {
const u32 addr = GetContextAddress(); const u32 addr = GetContextAddress();
const QString textAddress = QStringLiteral("%1").arg(addr, 8, 16, QLatin1Char('0'));
const std::string textCode = [this, addr] { const std::string textCode = [this, addr] {
Core::CPUThreadGuard guard(m_system); Core::CPUThreadGuard guard(m_system);
return m_system.GetPowerPC().GetDebugInterface().Disassemble(&guard, addr); return m_system.GetPowerPC().GetDebugInterface().Disassemble(&guard, addr);
}(); }();
QString textTarget = QStringLiteral(""); std::string wholeLineText = std::format("{:08x} {}", addr, textCode);
if (IsInstructionLoadStore(textCode)) if (IsInstructionLoadStore(textCode))
{ {
@ -847,13 +845,11 @@ void CodeViewWidget::OnCopyWholeLine()
if (target_addr) if (target_addr)
{ {
textTarget = QStringLiteral(" targetting ") + wholeLineText += std::format(" targetting {:08x}", *target_addr);
QStringLiteral("%1").arg(*target_addr, 8, 16, QLatin1Char('0'));
} }
} }
QApplication::clipboard()->setText(textAddress + QString::fromStdString(std::string(" ")) + QApplication::clipboard()->setText(QString::fromStdString(wholeLineText));
QString::fromStdString(textCode) + textTarget);
} }
void CodeViewWidget::OnCopyFunction() void CodeViewWidget::OnCopyFunction()