fix: Only allow the plugin to init Inkay at boot to avoid potential crashes

This commit is contained in:
Maschell 2025-02-03 12:45:17 +01:00
parent 24f680c6fb
commit e2cf529b3f
3 changed files with 14 additions and 1 deletions

View File

@ -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;

View File

@ -19,6 +19,8 @@ public:
static bool shown_uninitialized_warning;
static bool plugin_is_loaded;
static bool block_initialize;
};
#endif //INKAY_CONFIG_H

View File

@ -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() {