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

@ -662,6 +662,13 @@ void MainWindow::connectSignals()
else
m_host_interface->stopDumpingAudio();
});
connect(m_ui.actionDumpRAM, &QAction::triggered, [this]() {
const QString filename = QFileDialog::getSaveFileName(this, tr("Destination File"));
if (filename.isEmpty())
return;
m_host_interface->dumpRAM(filename);
});
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.actionDebugShowVRAM, "Debug", "ShowVRAM");
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.actionDebugShowGPUState, "Debug", "ShowGPUState");
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.actionDebugShowCDROMState, "Debug",

View File

@ -149,9 +149,10 @@
<addaction name="menuCPUExecutionMode"/>
<addaction name="menuRenderer"/>
<addaction name="separator"/>
<addaction name="actionDumpAudio"/>
<addaction name="actionDebugDumpCPUtoVRAMCopies"/>
<addaction name="actionDebugDumpVRAMtoCPUCopies"/>
<addaction name="actionDumpAudio"/>
<addaction name="actionDumpRAM"/>
<addaction name="separator"/>
<addaction name="actionDebugShowVRAM"/>
<addaction name="actionDebugShowGPUState"/>
@ -484,6 +485,11 @@
<string>Dump Audio</string>
</property>
</action>
<action name="actionDumpRAM">
<property name="text">
<string>Dump RAM...</string>
</property>
</action>
<action name="actionDebugShowGPUState">
<property name="checkable">
<bool>true</bool>

View File

@ -1026,6 +1026,24 @@ void QtHostInterface::stopDumpingAudio()
StopDumpingAudio();
}
void QtHostInterface::dumpRAM(const QString& filename)
{
if (!isOnWorkerThread())
{
QMetaObject::invokeMethod(this, "dumpRAM", Q_ARG(const QString&, filename));
return;
}
if (System::IsShutdown())
return;
const std::string filename_str = filename.toStdString();
if (System::DumpRAM(filename_str.c_str()))
ReportFormattedMessage("RAM dumped to '%s'", filename_str.c_str());
else
ReportFormattedMessage("Failed to dump RAM to '%s'", filename_str.c_str());
}
void QtHostInterface::saveScreenshot()
{
if (!isOnWorkerThread())

View File

@ -151,6 +151,7 @@ public Q_SLOTS:
void setAudioOutputMuted(bool muted);
void startDumpingAudio();
void stopDumpingAudio();
void dumpRAM(const QString& filename);
void saveScreenshot();
void redrawDisplayWindow();
void toggleFullscreen();