diff options
| author | Jonas <104419015+jojo-chaechae@users.noreply.github.com> | 2026-11-03 04:18:21 +0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-11-03 04:18:21 +0600 |
| commit | 155bf34fc297b6b8e4c281ecf7ea5d9ce3140762 (patch) | |
| tree | ef69b034a8bd3bfc710c182c52e34e0acd4b3735 /src/yuzu/main_window.cpp | |
| parent | 05259375e0fb436c78882f8d9b95f9e2ce69af13 (diff) | |
| parent | 9f4f01f76e8556941c0c0c3f57edc1d600ed23ea (diff) | |
Merge pull request #337 from Sssnowyyy/nx2-review-fixes
nx2: fix pokopia regressions, textures that handle shader computes, and more
Diffstat (limited to 'src/yuzu/main_window.cpp')
| -rw-r--r-- | src/yuzu/main_window.cpp | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/src/yuzu/main_window.cpp b/src/yuzu/main_window.cpp index e5a8f81424..02b36cf9cf 100644 --- a/src/yuzu/main_window.cpp +++ b/src/yuzu/main_window.cpp @@ -320,6 +320,7 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; constexpr int default_mouse_hide_timeout = 2500; constexpr int default_input_update_timeout = 1; +constexpr int EmuThreadStopTimeoutMs = 10'000; constexpr size_t CopyBufferSize = 1_MiB; @@ -2209,6 +2210,23 @@ void MainWindow::OnShutdownBeginDialog() { void MainWindow::OnEmulationStopTimeExpired() { if (QtCommon::emu_thread) { QtCommon::emu_thread->ForceStop(); + emu_terminate_timer.setSingleShot(true); + emu_terminate_timer.start(EmuThreadStopTimeoutMs); + connect(&emu_terminate_timer, &QTimer::timeout, this, &MainWindow::OnEmulationStopTimeout, + Qt::UniqueConnection); + } +} + +void MainWindow::OnEmulationStopTimeout() { + TerminateEmulationThread(); + OnEmulationStopped(); +} + +void MainWindow::TerminateEmulationThread() { + if (QtCommon::emu_thread && QtCommon::emu_thread->isRunning()) { + LOG_ERROR(Frontend, "Emulation thread failed to stop, terminating it"); + QtCommon::emu_thread->terminate(); + QtCommon::emu_thread->wait(); } } @@ -2220,6 +2238,7 @@ void MainWindow::OnEmulationStopped() { return; } shutdown_timer.stop(); + emu_terminate_timer.stop(); if (QtCommon::emu_thread) { QtCommon::emu_thread->disconnect(); QtCommon::emu_thread->wait(); @@ -2309,13 +2328,17 @@ void MainWindow::ShutdownGame() { play_time_manager->Stop(); OnShutdownBegin(); OnEmulationStopTimeExpired(); - if (QtCommon::emu_thread) { + emu_terminate_timer.stop(); + if (QtCommon::emu_thread && QtCommon::emu_thread->isRunning()) { QEventLoop loop; + QTimer timeout; + timeout.setSingleShot(true); connect(QtCommon::emu_thread.get(), &QThread::finished, &loop, &QEventLoop::quit); - if (QtCommon::emu_thread->isRunning()) { - loop.exec(QEventLoop::ExcludeUserInputEvents); - } + connect(&timeout, &QTimer::timeout, &loop, &QEventLoop::quit); + timeout.start(EmuThreadStopTimeoutMs); + loop.exec(QEventLoop::ExcludeUserInputEvents); } + TerminateEmulationThread(); OnEmulationStopped(); } |
