MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / onInputRecPlayActionTriggered

Method onInputRecPlayActionTriggered

pcsx2-qt/MainWindow.cpp:2292–2344  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2290}
2291
2292void MainWindow::onInputRecPlayActionTriggered()
2293{
2294 const bool wasPaused = s_vm_paused;
2295
2296 if (!wasPaused)
2297 {
2298 g_emu_thread->setVMPaused(true);
2299 }
2300
2301 QFileDialog dialog(this);
2302 dialog.setFileMode(QFileDialog::ExistingFile);
2303 dialog.setWindowTitle(tr("Select a File"));
2304 dialog.setNameFilter(tr("Input Recording Files (*.p2m2)"));
2305 QStringList fileNames;
2306 if (dialog.exec())
2307 {
2308 fileNames = dialog.selectedFiles();
2309 }
2310 else
2311 {
2312 if (!wasPaused)
2313 {
2314 g_emu_thread->setVMPaused(false);
2315 return;
2316 }
2317 }
2318
2319 if (fileNames.length() > 0)
2320 {
2321 if (g_InputRecording.isActive())
2322 {
2323 Host::RunOnCPUThread([]() { g_InputRecording.stop(); });
2324 m_ui.actionInputRecStop->setEnabled(false);
2325 }
2326 Host::RunOnCPUThread([filename = QDir::toNativeSeparators(fileNames.first()).toStdString()]() {
2327 if (g_InputRecording.play(filename))
2328 {
2329 QtHost::RunOnUIThread([]() {
2330 g_main_window->m_ui.actionInputRecNew->setEnabled(false);
2331 g_main_window->m_ui.actionInputRecStop->setEnabled(true);
2332 g_main_window->m_ui.actionReset->setEnabled(!g_InputRecording.isTypeSavestate());
2333 g_main_window->m_ui.actionToolbarReset->setEnabled(!g_InputRecording.isTypeSavestate());
2334 });
2335 }
2336 else
2337 {
2338 Host::ReportErrorAsync(
2339 TRANSLATE_SV("MainWindow", "Input Playback Failed"),
2340 fmt::format(TRANSLATE_FS("MainWindow", "Failed to open file: {}"), filename));
2341 }
2342 });
2343 }
2344}
2345
2346void MainWindow::onInputRecStopActionTriggered()
2347{

Callers

nothing calls this directly

Calls 9

setVMPausedMethod · 0.80
setWindowTitleMethod · 0.80
isActiveMethod · 0.80
firstMethod · 0.80
playMethod · 0.80
isTypeSavestateMethod · 0.80
formatFunction · 0.50
lengthMethod · 0.45
stopMethod · 0.45

Tested by

no test coverage detected