Qt: Add dump VRAM and SPU RAM actions

This commit is contained in:
Connor McLaughlin
2021-01-13 19:24:41 +10:00
parent 5746dcdbd4
commit 2b5cfb272c
9 changed files with 131 additions and 12 deletions

View File

@ -1635,11 +1635,30 @@ void UpdateMemoryCards()
bool DumpRAM(const char* filename)
{
auto fp = FileSystem::OpenManagedCFile(filename, "wb");
if (!fp)
if (!IsValid())
return false;
return std::fwrite(Bus::g_ram, Bus::RAM_SIZE, 1, fp.get()) == 1;
return FileSystem::WriteBinaryFile(filename, Bus::g_ram, Bus::RAM_SIZE);
}
bool DumpVRAM(const char* filename)
{
if (!IsValid())
return false;
g_gpu->RestoreGraphicsAPIState();
const bool result = g_gpu->DumpVRAMToFile(filename);
g_gpu->ResetGraphicsAPIState();
return result;
}
bool DumpSPURAM(const char* filename)
{
if (!IsValid())
return false;
return FileSystem::WriteBinaryFile(filename, g_spu.GetRAM().data(), SPU::RAM_SIZE);
}
bool HasMedia()