Qt: Add 'Controller Test' to tools menu

This commit is contained in:
Stenzek 2025-01-02 00:31:15 +10:00
parent c11468b9f1
commit e036318559
No known key found for this signature in database
4 changed files with 47 additions and 0 deletions

View File

@ -2026,6 +2026,7 @@ void MainWindow::connectSignals()
connect(m_ui.actionMemoryScanner, &QAction::triggered, this, &MainWindow::onToolsMemoryScannerTriggered);
connect(m_ui.actionISOBrowser, &QAction::triggered, this, &MainWindow::onToolsISOBrowserTriggered);
connect(m_ui.actionCoverDownloader, &QAction::triggered, this, &MainWindow::onToolsCoverDownloaderTriggered);
connect(m_ui.actionControllerTest, &QAction::triggered, g_emu_thread, &EmuThread::startControllerTest);
connect(m_ui.actionMediaCapture, &QAction::toggled, this, &MainWindow::onToolsMediaCaptureToggled);
connect(m_ui.actionCaptureGPUFrame, &QAction::triggered, g_emu_thread, &EmuThread::captureGPUFrameDump);
connect(m_ui.actionCPUDebugger, &QAction::triggered, this, &MainWindow::openCPUDebugger);

View File

@ -227,6 +227,7 @@
<addaction name="separator"/>
<addaction name="actionMemoryCardEditor"/>
<addaction name="actionCoverDownloader"/>
<addaction name="actionControllerTest"/>
<addaction name="separator"/>
<addaction name="actionMemoryScanner"/>
<addaction name="actionISOBrowser"/>
@ -979,6 +980,11 @@
<string>Free Camera</string>
</property>
</action>
<action name="actionControllerTest">
<property name="text">
<string>Controller Test</string>
</property>
</action>
</widget>
<resources>
<include location="resources/duckstation-qt.qrc"/>

View File

@ -1334,6 +1334,45 @@ void EmuThread::captureGPUFrameDump()
System::StartRecordingGPUDump();
}
void EmuThread::startControllerTest()
{
static constexpr const char* PADTEST_URL = "https://downloads.duckstation.org/runtime-resources/padtest.psexe";
if (!isCurrentThread())
{
QMetaObject::invokeMethod(this, "startControllerTest", Qt::QueuedConnection);
return;
}
if (System::IsValid())
return;
std::string path = Path::Combine(EmuFolders::UserResources, "padtest.psexe");
if (FileSystem::FileExists(path.c_str()))
{
bootSystem(std::make_shared<SystemBootParameters>(std::move(path)));
return;
}
QtHost::RunOnUIThread([path = std::move(path)]() mutable {
{
auto lock = g_main_window->pauseAndLockSystem();
if (QMessageBox::question(
lock.getDialogParent(), tr("Confirm Download"),
tr("Your DuckStation installation does not have the padtest application "
"available.\n\nThis file is approximately 206KB, do you want to download it now?")) != QMessageBox::Yes)
{
return;
}
if (!QtHost::DownloadFile(lock.getDialogParent(), tr("File Download"), PADTEST_URL, path.c_str()))
return;
}
g_emu_thread->startControllerTest();
});
}
void EmuThread::runOnEmuThread(std::function<void()> callback)
{
callback();

View File

@ -212,6 +212,7 @@ public Q_SLOTS:
void clearInputBindStateFromSource(InputBindingKey key);
void reloadTextureReplacements();
void captureGPUFrameDump();
void startControllerTest();
void setGPUThreadRunIdle(bool active);
private Q_SLOTS: