Addressing feedback from the PR

1. using fmt::format instead of std
2. naming convention text_code instead of textCode
3. Removed temporary scope for CPUThreadGuard
This commit is contained in:
Nitch2024 2025-03-30 11:51:13 -07:00
parent c0d2295d4e
commit d6066f190c

View file

@ -831,25 +831,23 @@ void CodeViewWidget::OnCopyWholeLine()
{
const u32 addr = GetContextAddress();
const std::string textCode = [this, addr] {
Core::CPUThreadGuard guard(m_system);
return m_system.GetPowerPC().GetDebugInterface().Disassemble(&guard, addr);
}();
Core::CPUThreadGuard guard(m_system);
std::string wholeLineText = std::format("{:08x} {}", addr, textCode);
std::string text_code = m_system.GetPowerPC().GetDebugInterface().Disassemble(&guard, addr);
std::string whole_line = fmt::format("{:08x} {}", addr, text_code);
if (IsInstructionLoadStore(textCode))
if (IsInstructionLoadStore(text_code))
{
const std::optional<u32> target_addr =
m_system.GetPowerPC().GetDebugInterface().GetMemoryAddressFromInstruction(textCode);
m_system.GetPowerPC().GetDebugInterface().GetMemoryAddressFromInstruction(text_code);
if (target_addr)
{
wholeLineText += std::format(" targetting {:08x}", *target_addr);
whole_line += fmt::format(" targetting {:08x}", *target_addr);
}
}
QApplication::clipboard()->setText(QString::fromStdString(wholeLineText));
QApplication::clipboard()->setText(QString::fromStdString(whole_line));
}
void CodeViewWidget::OnCopyFunction()