From e2cf529b3fcd7da7d78e8525777e6d9e15d70ff6 Mon Sep 17 00:00:00 2001 From: Maschell Date: Mon, 3 Feb 2025 12:45:17 +0100 Subject: [PATCH] fix: Only allow the plugin to init Inkay at boot to avoid potential crashes --- src/config.cpp | 1 + src/config.h | 2 ++ src/main.cpp | 12 +++++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/config.cpp b/src/config.cpp index 5fdb3f0..9201ffd 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -22,3 +22,4 @@ bool Config::connect_to_network = false; bool Config::initialized = false; bool Config::shown_uninitialized_warning = false; bool Config::plugin_is_loaded = false; +bool Config::block_initialize = false; diff --git a/src/config.h b/src/config.h index 6e82ff7..64a2c6c 100644 --- a/src/config.h +++ b/src/config.h @@ -19,6 +19,8 @@ public: static bool shown_uninitialized_warning; static bool plugin_is_loaded; + + static bool block_initialize; }; #endif //INKAY_CONFIG_H diff --git a/src/main.cpp b/src/main.cpp index 0c189be..b06dde2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -126,6 +126,11 @@ static void Inkay_Initialize(bool apply_patches) { if (Config::initialized) return; + if (Config::block_initialize) { + ShowNotification("Failed to init Inkay. Please restart the console to use Pretendo"); + return; + } + // if using pretendo then (try to) apply the ssl patches if (apply_patches) { Config::connect_to_network = true; @@ -212,13 +217,18 @@ WUMS_ALL_APPLICATION_STARTS_DONE() { } if (Config::initialized && !Config::plugin_is_loaded) { DEBUG_FUNCTION_LINE("Inkay is running but the plugin got unloaded"); - ShowNotification("Inkay module is still running. Please restart the console to disable Pretendo."); + if (!Config::block_initialize) { + ShowNotification("Inkay module is still running. Please restart the console to disable Pretendo."); + } Config::shown_uninitialized_warning = true; } else if (!Config::initialized && !Config::shown_uninitialized_warning) { DEBUG_FUNCTION_LINE("Inkay module not initialized"); ShowNotification("Inkay module was not initialized. Ensure you have the Inkay plugin loaded"); Config::shown_uninitialized_warning = true; } + if (!Config::initialized) { + Config::block_initialize = true; + } } WUMS_APPLICATION_ENDS() {