Qt: Expose VRAM and SPU VRAM in memory editor/debugger

pull/3733/head
Stenzek 5 months ago
parent 9251991448
commit 3836986c40
No known key found for this signature in database

@ -830,6 +830,8 @@ static constexpr std::array<std::tuple<PhysicalMemoryAddress, PhysicalMemoryAddr
{Bus::EXP1_BASE, Bus::EXP1_BASE + Bus::EXP1_SIZE, false},
{CPU::SCRATCHPAD_ADDR, CPU::SCRATCHPAD_ADDR + CPU::SCRATCHPAD_SIZE, true},
{Bus::BIOS_BASE, Bus::BIOS_BASE + Bus::BIOS_SIZE, false},
{0, VRAM_SIZE, true},
{0, SPU::RAM_SIZE, true},
}};
PhysicalMemoryAddress Bus::GetMemoryRegionStart(MemoryRegion region)
@ -872,6 +874,12 @@ u8* Bus::GetMemoryRegionPointer(MemoryRegion region)
case MemoryRegion::BIOS:
return g_bios;
case MemoryRegion::VRAM:
return reinterpret_cast<u8*>(g_vram);
case MemoryRegion::SPURAM:
return SPU::GetWritableRAM().data();
default:
return nullptr;
}

@ -212,6 +212,8 @@ enum class MemoryRegion
EXP1,
Scratchpad,
BIOS,
VRAM,
SPURAM,
Count
};

@ -495,6 +495,9 @@ void DebuggerWindow::connectSignals()
connect(m_ui.memoryRegionScratchpad, &QRadioButton::clicked,
[this]() { setMemoryViewRegion(Bus::MemoryRegion::Scratchpad); });
connect(m_ui.memoryRegionBIOS, &QRadioButton::clicked, [this]() { setMemoryViewRegion(Bus::MemoryRegion::BIOS); });
connect(m_ui.memoryRegionVRAM, &QRadioButton::clicked, [this]() { setMemoryViewRegion(Bus::MemoryRegion::VRAM); });
connect(m_ui.memoryRegionSPURAM, &QRadioButton::clicked,
[this]() { setMemoryViewRegion(Bus::MemoryRegion::SPURAM); });
connect(m_ui.memorySearch, &QPushButton::clicked, this, &DebuggerWindow::onMemorySearchTriggered);
connect(m_ui.memorySearchString, &QLineEdit::textChanged, this, &DebuggerWindow::onMemorySearchStringChanged);
@ -595,6 +598,8 @@ void DebuggerWindow::setMemoryViewRegion(Bus::MemoryRegion region)
m_ui.memoryRegionEXP1->setChecked(region == Bus::MemoryRegion::EXP1);
m_ui.memoryRegionScratchpad->setChecked(region == Bus::MemoryRegion::Scratchpad);
m_ui.memoryRegionBIOS->setChecked(region == Bus::MemoryRegion::BIOS);
m_ui.memoryRegionVRAM->setChecked(region == Bus::MemoryRegion::VRAM);
m_ui.memoryRegionSPURAM->setChecked(region == Bus::MemoryRegion::SPURAM);
m_ui.memoryView->repaint();
}
@ -646,6 +651,16 @@ bool DebuggerWindow::tryFollowLoadStore(VirtualMemoryAddress address)
bool DebuggerWindow::scrollToMemoryAddress(VirtualMemoryAddress address)
{
// Keep the existing region if we're viewing VRAM/SPU RAM.
if (m_ui.memoryRegionVRAM->isChecked() || m_ui.memoryRegionSPURAM->isChecked())
{
if (address >= m_ui.memoryView->dataSize())
return false;
m_ui.memoryView->scrollToOffset(address);
return true;
}
const PhysicalMemoryAddress phys_address = CPU::VirtualAddressToPhysical(address);
std::optional<Bus::MemoryRegion> region = Bus::GetMemoryRegionForAddress(phys_address);
if (!region.has_value())

@ -192,6 +192,20 @@
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="memoryRegionVRAM">
<property name="text">
<string>VRAM</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="memoryRegionSPURAM">
<property name="text">
<string>SPU RAM</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">

@ -442,6 +442,8 @@ void MemoryEditorWindow::updateUIEnabled()
m_ui.memoryRegionEXP1->setEnabled(system_valid);
m_ui.memoryRegionScratchpad->setEnabled(system_valid);
m_ui.memoryRegionBIOS->setEnabled(system_valid);
m_ui.memoryRegionVRAM->setEnabled(system_valid);
m_ui.memoryRegionSPURAM->setEnabled(system_valid);
m_ui.memorySearch->setEnabled(system_valid);
m_ui.memorySearchString->setEnabled(system_valid);
m_ui.dataInspector->setEnabled(system_valid);
@ -462,6 +464,16 @@ void MemoryEditorWindow::closeEvent(QCloseEvent* event)
bool MemoryEditorWindow::scrollToMemoryAddress(VirtualMemoryAddress address)
{
// Keep the existing region if we're viewing VRAM/SPU RAM.
if (m_ui.memoryRegionVRAM->isChecked() || m_ui.memoryRegionSPURAM->isChecked())
{
if (address >= m_ui.memoryView->dataSize())
return false;
m_ui.memoryView->scrollToOffset(address);
return true;
}
const PhysicalMemoryAddress phys_address = CPU::VirtualAddressToPhysical(address);
std::optional<Bus::MemoryRegion> region = Bus::GetMemoryRegionForAddress(phys_address);
if (!region.has_value())
@ -490,6 +502,10 @@ void MemoryEditorWindow::updateMemoryViewRegion()
region = Bus::MemoryRegion::Scratchpad;
else if (m_ui.memoryRegionBIOS->isChecked())
region = Bus::MemoryRegion::BIOS;
else if (m_ui.memoryRegionVRAM->isChecked())
region = Bus::MemoryRegion::VRAM;
else if (m_ui.memoryRegionSPURAM->isChecked())
region = Bus::MemoryRegion::SPURAM;
else
region = Bus::MemoryRegion::RAM;

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>1130</width>
<height>474</height>
<height>536</height>
</rect>
</property>
<property name="windowTitle">
@ -88,6 +88,26 @@
</attribute>
</widget>
</item>
<item>
<widget class="QRadioButton" name="memoryRegionVRAM">
<property name="text">
<string>VRAM</string>
</property>
<attribute name="buttonGroup">
<string notr="true">memoryRegionButtonGroup</string>
</attribute>
</widget>
</item>
<item>
<widget class="QRadioButton" name="memoryRegionSPURAM">
<property name="text">
<string>SPU RAM</string>
</property>
<attribute name="buttonGroup">
<string notr="true">memoryRegionButtonGroup</string>
</attribute>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
@ -419,7 +439,7 @@
<connections/>
<buttongroups>
<buttongroup name="baseButtonGroup"/>
<buttongroup name="endianButtonGroup"/>
<buttongroup name="memoryRegionButtonGroup"/>
<buttongroup name="endianButtonGroup"/>
</buttongroups>
</ui>

@ -20,7 +20,10 @@ public:
size_t data_size = 0, bool data_editable = false, EditCallback edit_callback = nullptr);
~MemoryViewWidget();
size_t addressOffset() const { return m_address_offset; }
ALWAYS_INLINE size_t dataSize() const { return m_data_size; }
ALWAYS_INLINE size_t addressOffset() const { return m_address_offset; }
ALWAYS_INLINE size_t startOffset() const { return m_start_offset; }
ALWAYS_INLINE size_t endOffset() const { return m_end_offset; }
size_t selectedAddress() const;
size_t topAddress() const;

Loading…
Cancel
Save