From 5b73bad9f91420099530d22253f2e70add29e3b5 Mon Sep 17 00:00:00 2001 From: craftablescience Date: Tue, 17 Dec 2024 01:49:02 -0500 Subject: [PATCH 1/2] fix: disable crash error message when a process has a nonzero exit code after >30 seconds of staying open successfully, disable miniz stdio functions --- CMakeLists.txt | 1 + ext/miniz | 2 +- src/Window.cpp | 11 ++++++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 161143e..916ad9b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,6 +103,7 @@ function(sdk_launcher_configure_target TARGET) endfunction() # miniz +set(BUILD_NO_STDIO ON CACHE INTERNAL "" FORCE) add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/ext/miniz") # Qt diff --git a/ext/miniz b/ext/miniz index 1ff82be..2fa13ca 160000 --- a/ext/miniz +++ b/ext/miniz @@ -1 +1 @@ -Subproject commit 1ff82be7d67f5c2f8b5497f538eea247861e0717 +Subproject commit 2fa13ca8a3cf196345001c9fe17bf42ee32c00f9 diff --git a/src/Window.cpp b/src/Window.cpp index 211c73c..ac6ca59 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -1,5 +1,6 @@ #include "Window.h" +#include #include #include #include @@ -13,7 +14,6 @@ #include #include #include -#include #include #include "Config.h" @@ -306,16 +306,21 @@ void Window::loadGameConfig(const QString& path) { button->setToolTip(action + " " + entry.arguments.join(" ")); QObject::connect(button, &LaunchButton::doubleClicked, this, [this, action, args=entry.arguments, cwd=rootPath] { auto* process = new QProcess; - QObject::connect(process, &QProcess::errorOccurred, this, [this](QProcess::ProcessError code) { + QObject::connect(process, &QProcess::errorOccurred, this, [this, timeStart = std::chrono::steady_clock::now()](QProcess::ProcessError code) { QString error; switch (code) { using enum QProcess::ProcessError; case FailedToStart: error = tr("The process failed to start. Perhaps the executable it points to might not exist?"); break; - case Crashed: + case Crashed: { + auto timeEnd = std::chrono::steady_clock::now(); + if (std::chrono::duration(timeEnd - timeStart).count() > 30'000) { + return; + } error = tr("The process crashed."); break; + } case Timedout: error = tr("The process timed out."); break; From 9135418c1a7a56b99a5a636691be73cfcd8354be Mon Sep 17 00:00:00 2001 From: craftablescience Date: Tue, 17 Dec 2024 01:50:07 -0500 Subject: [PATCH 2/2] chore: bump version --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 916ad9b..fe09068 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.25 FATAL_ERROR) # Create project project(sdk_launcher DESCRIPTION "A minimal SDK launcher for Strata Source engine games" - VERSION "0.4.1" + VERSION "0.4.2" HOMEPAGE_URL "https://github.com/StrataSource/sdk-launcher") set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON)