component interface small changes

This commit is contained in:
quaK 2023-02-21 23:57:41 +02:00
parent eb99597d0a
commit 102f8a1f88
6 changed files with 15 additions and 35 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -119,7 +119,6 @@ int main()
{
component_loader::sort();
component_loader::clean();
auto premature_shutdown = true;
const auto _ = gsl::finally([&premature_shutdown]()