diff --git a/src/client/component/arxan/arxan.cpp b/src/client/component/arxan/arxan.cpp index db05f31a..89f6dbfd 100644 --- a/src/client/component/arxan/arxan.cpp +++ b/src/client/component/arxan/arxan.cpp @@ -361,9 +361,9 @@ namespace arxan search_and_patch_integrity_checks(); } - int priority() override + component_priority priority() override { - return COMPONENT_MAX_PRIORITY; + return component_priority::arxan; } }; } diff --git a/src/client/component/dvars.cpp b/src/client/component/dvars.cpp index 9f22ee2f..4110c6f2 100644 --- a/src/client/component/dvars.cpp +++ b/src/client/component/dvars.cpp @@ -390,9 +390,9 @@ namespace dvars dvar_register_variant_hook.create(0xCEBDD0_b, dvar_register_variant); } - int priority() override + component_priority priority() override { - return COMPONENT_MAX_PRIORITY - 1; + return component_priority::dvars; } }; } diff --git a/src/client/loader/component_interface.hpp b/src/client/loader/component_interface.hpp index edec6f55..7c6854a1 100644 --- a/src/client/loader/component_interface.hpp +++ b/src/client/loader/component_interface.hpp @@ -1,11 +1,17 @@ #pragma once +enum class component_priority +{ + min = 0, + dvars, + steam_proxy, + arxan, +}; + class component_interface { public: - virtual ~component_interface() - { - } + virtual ~component_interface() = default; virtual void post_start() { @@ -28,13 +34,8 @@ public: return nullptr; } - virtual bool is_supported() + virtual component_priority priority() { - return true; - } - - virtual int priority() - { - return 0; + return component_priority::min; } }; diff --git a/src/client/loader/component_loader.cpp b/src/client/loader/component_loader.cpp index c41152a2..08b7708f 100644 --- a/src/client/loader/component_loader.cpp +++ b/src/client/loader/component_loader.cpp @@ -92,23 +92,6 @@ void component_loader::pre_destroy() } } -void component_loader::clean() -{ - auto& components = get_components(); - for (auto i = components.begin(); i != components.end();) - { - if (!(*i)->is_supported()) - { - (*i)->pre_destroy(); - i = components.erase(i); - } - else - { - ++i; - } - } -} - void component_loader::sort() { auto& components = get_components(); diff --git a/src/client/loader/component_loader.hpp b/src/client/loader/component_loader.hpp index 42882cf4..ba28c2e9 100644 --- a/src/client/loader/component_loader.hpp +++ b/src/client/loader/component_loader.hpp @@ -1,8 +1,6 @@ #pragma once #include "component_interface.hpp" -#define COMPONENT_MAX_PRIORITY 999 - class component_loader final { public: @@ -57,7 +55,6 @@ public: static bool post_load(); static void post_unpack(); static void pre_destroy(); - static void clean(); static void sort(); static void* load_import(const std::string& library, const std::string& function); diff --git a/src/client/main.cpp b/src/client/main.cpp index 43e6674e..79a24608 100644 --- a/src/client/main.cpp +++ b/src/client/main.cpp @@ -119,7 +119,6 @@ int main() { component_loader::sort(); - component_loader::clean(); auto premature_shutdown = true; const auto _ = gsl::finally([&premature_shutdown]()