mirror of
https://github.com/PretendoNetwork/Inkay.git
synced 2026-07-17 09:37:40 -05:00
fix: Only allow the plugin to init Inkay at boot to avoid potential crashes
This commit is contained in:
parent
24f680c6fb
commit
e2cf529b3f
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ public:
|
|||
static bool shown_uninitialized_warning;
|
||||
|
||||
static bool plugin_is_loaded;
|
||||
|
||||
static bool block_initialize;
|
||||
};
|
||||
|
||||
#endif //INKAY_CONFIG_H
|
||||
|
|
|
|||
12
src/main.cpp
12
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() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user