Add option to dump the contents of RAM to a file

This commit is contained in:
Connor McLaughlin
2020-08-16 23:20:36 +10:00
parent 0aefdf4753
commit 4e62b32d60
8 changed files with 68 additions and 2 deletions

View File

@ -904,6 +904,7 @@ void SDLHostInterface::DrawQuickSettingsMenu()
void SDLHostInterface::DrawDebugMenu()
{
const bool system_valid = System::IsValid();
Settings::DebugSettings& debug_settings = g_settings.debugging;
bool settings_changed = false;
@ -931,6 +932,9 @@ void SDLHostInterface::DrawDebugMenu()
settings_changed |= ImGui::MenuItem("Dump CPU to VRAM Copies", nullptr, &debug_settings.dump_cpu_to_vram_copies);
settings_changed |= ImGui::MenuItem("Dump VRAM to CPU Copies", nullptr, &debug_settings.dump_vram_to_cpu_copies);
if (ImGui::MenuItem("Dump RAM...", nullptr, nullptr, system_valid))
DoDumpRAM();
ImGui::Separator();
settings_changed |= ImGui::MenuItem("Show VRAM", nullptr, &debug_settings.show_vram);
@ -1511,6 +1515,22 @@ void SDLHostInterface::DoChangeDisc()
System::ResetPerformanceCounters();
}
void SDLHostInterface::DoDumpRAM()
{
Assert(!System::IsShutdown());
nfdchar_t* path = nullptr;
if (!NFD_SaveDialog("bin", nullptr, &path) || !path || std::strlen(path) == 0)
return;
if (System::DumpRAM(path))
AddFormattedOSDMessage(5.0f, "Dumped RAM to '%s'", path);
else
AddFormattedOSDMessage(10.0f, "Failed to dump RAM to '%s'", path);
System::ResetPerformanceCounters();
}
void SDLHostInterface::Run()
{
while (!m_quit_request)

View File

@ -79,6 +79,7 @@ private:
void DrawImGuiWindows() override;
void DoStartDisc();
void DoChangeDisc();
void DoDumpRAM();
void HandleSDLEvent(const SDL_Event* event);
void ProcessEvents();