From c088cfccc0dc5f4cc5386e24fc6ba1d6c8094f98 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 13 Jan 2026 11:19:35 +0000 Subject: [PATCH 1/2] Implement fast exit by skipping task wait and using quick_exit - Add `--fastexit` CLI option (default: true). - Skip waiting for background tasks in `NextEngine::End` when fast exit is enabled. - Move `SaveLocTexts` to `NextEngine::End` to ensure data persistence before exit. - Use `std::quick_exit(0)` in `SDL_AppQuit` to bypass static destructors for rapid shutdown. --- src/AndroidMain.cpp | 5 +++++ src/DesktopMain.cpp | 5 +++++ src/Options.cpp | 3 ++- src/Options.hpp | 1 + src/Runtime/Engine.cpp | 9 +++++++-- 5 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/AndroidMain.cpp b/src/AndroidMain.cpp index e97aa433..a0256850 100644 --- a/src/AndroidMain.cpp +++ b/src/AndroidMain.cpp @@ -91,6 +91,11 @@ void SDL_AppQuit(void *appstate, SDL_AppResult result) // Shutdown GApplication->End(); + if (GOption->FastExit) + { + std::quick_exit(0); + } + GApplication.reset(); GOptionPtr.reset(); } diff --git a/src/DesktopMain.cpp b/src/DesktopMain.cpp index acf452cb..b39c1b12 100644 --- a/src/DesktopMain.cpp +++ b/src/DesktopMain.cpp @@ -92,6 +92,11 @@ void SDL_AppQuit(void *appstate, SDL_AppResult result) // Shutdown GApplication->End(); + if (GOption->FastExit) + { + std::quick_exit(0); + } + GApplication.reset(); GOptionPtr.reset(); } diff --git a/src/Options.cpp b/src/Options.cpp index b9d2239d..f5b5e0be 100644 --- a/src/Options.cpp +++ b/src/Options.cpp @@ -37,7 +37,8 @@ Options::Options(const int argc, const char* argv[]) ("dlssrr", "Enable NVIDIA DLSS Ray Reconstruction.", cxxopts::value(DLSSRR)->default_value("false")) ("hwquery", "Forcing hardware raytracing not supported.", cxxopts::value(HardwareQuery)->default_value("true")) ("validation", "Force enable validation layers.", cxxopts::value(Validation)->default_value("false")) - + ("fastexit", "Enable fast exit by skipping task wait.", cxxopts::value(FastExit)->default_value("true")) + ("h,help", "Print usage"); try { diff --git a/src/Options.hpp b/src/Options.hpp index 4ed5fc16..dfb134d9 100644 --- a/src/Options.hpp +++ b/src/Options.hpp @@ -33,6 +33,7 @@ class Options final bool ForceSoftGen{}; bool HardwareQuery{}; bool Validation{}; + bool FastExit{true}; std::string locale{}; // Renderer options. diff --git a/src/Runtime/Engine.cpp b/src/Runtime/Engine.cpp index 816b4733..7d1884e0 100644 --- a/src/Runtime/Engine.cpp +++ b/src/Runtime/Engine.cpp @@ -523,8 +523,11 @@ bool NextEngine::Tick() void NextEngine::End() { - TaskCoordinator::GetInstance()->CancelAllParralledTasks(); - TaskCoordinator::GetInstance()->WaitForAllParralledTask(); + if (!GOption->FastExit) + { + TaskCoordinator::GetInstance()->CancelAllParralledTasks(); + TaskCoordinator::GetInstance()->WaitForAllParralledTask(); + } // sound manager unit soundDataMaps_.clear(); @@ -543,6 +546,8 @@ void NextEngine::End() gameInstance_->OnDestroy(); renderer_->End(); userInterface_.reset(); + + Utilities::Localization::SaveLocTexts(fmt::format("assets/locale/{}.txt", GOption->locale).c_str()); } void NextEngine::RegisterJSCallback(std::function callback) From 6b875332aa058f6da813c4984977d0f26606699e Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 13 Jan 2026 12:15:49 +0000 Subject: [PATCH 2/2] Implement fast exit by skipping task wait and using quick_exit - Add `--fastexit` CLI option (default: true). - Skip waiting for background tasks in `NextEngine::End` when fast exit is enabled. - Move `SaveLocTexts` to `NextEngine::End` to ensure data persistence before exit. - Use `std::quick_exit(0)` in `SDL_AppQuit` to bypass static destructors for rapid shutdown. - Update `run.ps1` to use direct call operator `&` instead of `Start-Process` to fix console restoration issue. --- run.ps1 | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/run.ps1 b/run.ps1 index dc38f292..7e99f6ed 100644 --- a/run.ps1 +++ b/run.ps1 @@ -217,18 +217,8 @@ if ($DryRun) { exit 0 } Push-Location $ResolvedBin try { - $ProcessArgs = @{ - FilePath = ".\$ExeName" - Wait = $true - PassThru = $true - NoNewWindow = $true - } - if ($LaunchArgs.Count -gt 0) { - $ProcessArgs["ArgumentList"] = $LaunchArgs - } - - $Proc = Start-Process @ProcessArgs - exit $Proc.ExitCode + & ".\$ExeName" $LaunchArgs + exit $LASTEXITCODE } finally { Pop-Location } \ No newline at end of file