mirror of
https://github.com/stenzek/duckstation.git
synced 2026-02-14 02:14:35 +00:00
Qt: Restore disassembly register previews in debugger
Probably got lost when I added branch lines.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: CC-BY-NC-ND-4.0
|
||||
|
||||
#include "debuggercodeview.h"
|
||||
#include "qtutils.h"
|
||||
|
||||
#include "core/bus.h"
|
||||
#include "core/cpu_core.h"
|
||||
@@ -344,6 +345,7 @@ void DebuggerCodeView::drawInstruction(QPainter& painter, VirtualMemoryAddress a
|
||||
x += ADDRESS_COLUMN_WIDTH;
|
||||
|
||||
// Draw instruction bytes
|
||||
SmallString str;
|
||||
if (u32 instruction_bits; CPU::SafeReadInstruction(address, &instruction_bits))
|
||||
{
|
||||
const QString bytes_text = QString::asprintf("%08X", instruction_bits);
|
||||
@@ -351,9 +353,8 @@ void DebuggerCodeView::drawInstruction(QPainter& painter, VirtualMemoryAddress a
|
||||
painter.drawText(x, y, bytes_text);
|
||||
x += BYTES_COLUMN_WIDTH;
|
||||
|
||||
SmallString str;
|
||||
CPU::DisassembleInstruction(&str, address, instruction_bits);
|
||||
const QString disasm_text = QString::fromUtf8(str.c_str(), static_cast<int>(str.length()));
|
||||
const QString disasm_text = QtUtils::StringViewToQString(str);
|
||||
painter.setPen(instruction_color);
|
||||
|
||||
// Highlight registers and immediates in the disassembly
|
||||
@@ -379,6 +380,17 @@ void DebuggerCodeView::drawInstruction(QPainter& painter, VirtualMemoryAddress a
|
||||
|
||||
start_pos = end_pos;
|
||||
}
|
||||
|
||||
if (is_pc)
|
||||
{
|
||||
str.clear();
|
||||
CPU::DisassembleInstructionComment(&str, address, instruction_bits);
|
||||
if (!str.empty())
|
||||
{
|
||||
painter.setPen(address_color);
|
||||
painter.drawText(COMMENT_COLUMN_START, y, QtUtils::StringViewToQString(str));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user