| 2249 | } |
| 2250 | |
| 2251 | void MainWindow::onInputRecNewActionTriggered() |
| 2252 | { |
| 2253 | const bool wasPaused = s_vm_paused; |
| 2254 | const bool wasRunning = s_vm_valid; |
| 2255 | if (wasRunning && !wasPaused) |
| 2256 | { |
| 2257 | g_emu_thread->setVMPaused(true); |
| 2258 | } |
| 2259 | |
| 2260 | NewInputRecordingDlg dlg(this); |
| 2261 | const auto result = dlg.exec(); |
| 2262 | |
| 2263 | if (result == QDialog::Accepted) |
| 2264 | { |
| 2265 | Host::RunOnCPUThread( |
| 2266 | [filePath = dlg.getFilePath(), fromSavestate = dlg.getInputRecType() == InputRecording::Type::FROM_SAVESTATE, |
| 2267 | authorName = dlg.getAuthorName()]() { |
| 2268 | if (g_InputRecording.create(filePath, fromSavestate, authorName)) |
| 2269 | { |
| 2270 | QtHost::RunOnUIThread([]() { |
| 2271 | g_main_window->m_ui.actionInputRecNew->setEnabled(false); |
| 2272 | g_main_window->m_ui.actionInputRecStop->setEnabled(true); |
| 2273 | g_main_window->m_ui.actionReset->setEnabled(!g_InputRecording.isTypeSavestate()); |
| 2274 | g_main_window->m_ui.actionToolbarReset->setEnabled(!g_InputRecording.isTypeSavestate()); |
| 2275 | }); |
| 2276 | } |
| 2277 | else |
| 2278 | { |
| 2279 | Host::ReportErrorAsync( |
| 2280 | TRANSLATE_SV("MainWindow", "Input Recording Failed"), |
| 2281 | fmt::format(TRANSLATE_FS("MainWindow", "Failed to create file: {}"), filePath)); |
| 2282 | } |
| 2283 | }); |
| 2284 | } |
| 2285 | |
| 2286 | if (wasRunning && !wasPaused) |
| 2287 | { |
| 2288 | g_emu_thread->setVMPaused(false); |
| 2289 | } |
| 2290 | } |
| 2291 | |
| 2292 | void MainWindow::onInputRecPlayActionTriggered() |
| 2293 | { |
nothing calls this directly
no test coverage detected