From 0ec37ac6ea087584cfc6666398cc4e1a4ddb56ae Mon Sep 17 00:00:00 2001 From: bicarus-dev <202771338+bicarus-dev@users.noreply.github.com> Date: Mon, 8 Dec 2025 17:35:59 -0800 Subject: [PATCH] troubleshooter: log soft id (#436) ## Link to GitHub Issue, if one exists n/a ## Description of change Log soft ID (game datecode etc) at the top of auto-troubleshooter output --- src/spice2x/avs/ea3.cpp | 2 ++ src/spice2x/util/deferlog.cpp | 19 +++++++++++++++++++ src/spice2x/util/deferlog.h | 1 + 3 files changed, 22 insertions(+) diff --git a/src/spice2x/avs/ea3.cpp b/src/spice2x/avs/ea3.cpp index cd4c179..f97a0f5 100644 --- a/src/spice2x/avs/ea3.cpp +++ b/src/spice2x/avs/ea3.cpp @@ -8,6 +8,7 @@ #include "games/mfc/mfc.h" #include "hooks/avshook.h" #include "util/detour.h" +#include "util/deferlog.h" #include "util/fileutils.h" #include "util/libutils.h" #include "util/logging.h" @@ -568,6 +569,7 @@ namespace avs { soft_id_code << EA3_EXT; std::string soft_id_code_str = soft_id_code.str(); log_info("avs-ea3", "soft id code: {}", soft_id_code_str); + deferredlogs::set_softid(soft_id_code_str); // set soft ID code avs::core::avs_std_setenv("/env/profile/soft_id_code", soft_id_code_str.c_str()); diff --git a/src/spice2x/util/deferlog.cpp b/src/spice2x/util/deferlog.cpp index fc8eae7..08a6521 100644 --- a/src/spice2x/util/deferlog.cpp +++ b/src/spice2x/util/deferlog.cpp @@ -18,6 +18,14 @@ namespace deferredlogs { std::mutex deferred_errors_mutex; std::vector> deferred_errors; + std::mutex softid_mutex; + std::string softid; + + void set_softid(const std::string& softid_new) { + std::lock_guard lock(softid_mutex); + softid = softid_new; + } + void defer_error_messages(std::initializer_list messages) { std::lock_guard lock(deferred_errors_mutex); deferred_errors.emplace_back(messages); @@ -45,6 +53,17 @@ namespace deferredlogs { msg += "/-------------------------- spice2x auto-troubleshooter -----------------------\\\n"; msg += "\n"; msg += " spice2x version: " + to_string(VERSION_STRING_CFG) + "\n"; + + // soft ID + { + std::lock_guard lock(softid_mutex); + if (!softid.empty()) { + msg += " game version: " + softid + "\n"; + } else { + msg += " game version: unknown\n"; + } + } + msg += "\n"; if (is_crash) { diff --git a/src/spice2x/util/deferlog.h b/src/spice2x/util/deferlog.h index 1679aa2..7fff864 100644 --- a/src/spice2x/util/deferlog.h +++ b/src/spice2x/util/deferlog.h @@ -9,6 +9,7 @@ namespace deferredlogs { // some shared error messages extern const std::initializer_list SUPERSTEP_SOUND_ERROR_MESSAGE; + void set_softid(const std::string& softid); void defer_error_messages(std::initializer_list messages); void dump_to_logger(bool is_crash=false); }