Rename component interfaces

This commit is contained in:
Maurice Heumann 2023-01-01 21:51:04 +01:00
parent 3a6f973473
commit 59586e18e6
23 changed files with 33 additions and 32 deletions

View File

@ -696,7 +696,7 @@ namespace arxan
return zw_terminate_process_hook.invoke<NTSTATUS>(process_handle, exit_status); return zw_terminate_process_hook.invoke<NTSTATUS>(process_handle, exit_status);
} }
struct component final : component_interface struct component final : generic_component
{ {
void post_load() override void post_load() override
{ {

View File

@ -107,7 +107,7 @@ namespace auth
return guid; return guid;
} }
struct component final : client_component_interface struct component final : client_component
{ {
void post_unpack() override void post_unpack() override
{ {

View File

@ -41,7 +41,7 @@ namespace bots
} }
} }
struct component final : client_component_interface struct component final : client_component
{ {
void post_unpack() override void post_unpack() override
{ {

View File

@ -27,7 +27,7 @@ namespace branding
} }
} }
struct component final : client_component_interface struct component final : client_component
{ {
void post_unpack() override void post_unpack() override
{ {

View File

@ -30,7 +30,7 @@ namespace colors
utils::hook::copy(g_color_table + index * 4, color_float, sizeof(color_float)); utils::hook::copy(g_color_table + index * 4, color_float, sizeof(color_float));
} }
struct component final : client_component_interface struct component final : client_component
{ {
void post_unpack() override void post_unpack() override
{ {

View File

@ -46,7 +46,7 @@ namespace command
} }
} }
struct component final : client_component_interface struct component final : client_component
{ {
void post_unpack() override void post_unpack() override
{ {

View File

@ -193,7 +193,7 @@ namespace console
} }
} }
struct component final : client_component_interface struct component final : client_component
{ {
void post_unpack() override void post_unpack() override
{ {

View File

@ -9,7 +9,7 @@ namespace dedicated
{ {
} }
struct component final : server_component_interface struct component final : server_component
{ {
void post_unpack() override void post_unpack() override
{ {

View File

@ -441,7 +441,7 @@ namespace demonware
} }
} }
struct component final : component_interface struct component final : generic_component
{ {
component() component()
{ {

View File

@ -32,7 +32,7 @@ namespace discord
} }
} }
class component final : public client_component_interface class component final : public client_component
{ {
public: public:
void post_load() override void post_load() override

View File

@ -193,7 +193,7 @@ namespace exception
} }
} }
struct component final : component_interface struct component final : generic_component
{ {
component() component()
{ {

View File

@ -29,7 +29,7 @@ namespace icon
} }
} }
struct component final : component_interface struct component final : generic_component
{ {
void post_load() override void post_load() override
{ {

View File

@ -49,7 +49,7 @@ namespace loot
} }
}; };
struct component final : client_component_interface struct component final : client_component
{ {
void post_unpack() override void post_unpack() override
{ {

View File

@ -210,7 +210,7 @@ namespace network
return 2; return 2;
} }
struct component final : client_component_interface struct component final : client_component
{ {
void post_unpack() override void post_unpack() override
{ {

View File

@ -217,7 +217,7 @@ namespace party
network::send(host, "getInfo", challenge); network::send(host, "getInfo", challenge);
} }
struct component final : client_component_interface struct component final : client_component
{ {
void post_unpack() override void post_unpack() override
{ {

View File

@ -149,7 +149,7 @@ namespace scheduler
}, type, delay); }, type, delay);
} }
struct component final : component_interface struct component final : generic_component
{ {
void post_load() override void post_load() override
{ {

View File

@ -165,7 +165,7 @@ namespace splash
} }
} }
struct component final : client_component_interface struct component final : client_component
{ {
component() component()
{ {

View File

@ -205,7 +205,7 @@ namespace steam_proxy
} }
} }
struct component final : component_interface struct component final : generic_component
{ {
void post_load() override void post_load() override
{ {

View File

@ -127,7 +127,7 @@ namespace updater
} }
} }
class component final : public component_interface class component final : public generic_component
{ {
public: public:
component() component()

View File

@ -9,7 +9,7 @@ namespace game
{ {
const utils::nt::library& get_host_library() const utils::nt::library& get_host_library()
{ {
static auto host = [] static auto host_library = []
{ {
utils::nt::library host{}; utils::nt::library host{};
if (!host || host == utils::nt::library::get_by_address(get_base)) if (!host || host == utils::nt::library::get_by_address(get_base))
@ -19,7 +19,8 @@ namespace game
return host; return host;
}(); }();
return host;
return host_library;
} }
} }

View File

@ -17,11 +17,11 @@ enum class component_type
any, any,
}; };
struct component_interface struct generic_component
{ {
static constexpr component_type type = component_type::any; static constexpr component_type type = component_type::any;
virtual ~component_interface() = default; virtual ~generic_component() = default;
virtual void post_load() virtual void post_load()
{ {
@ -41,12 +41,12 @@ struct component_interface
} }
}; };
struct client_component_interface : component_interface struct client_component : generic_component
{ {
static constexpr component_type type = component_type::client; static constexpr component_type type = component_type::client;
}; };
struct server_component_interface : component_interface struct server_component : generic_component
{ {
static constexpr component_type type = component_type::server; static constexpr component_type type = component_type::server;
}; };

View File

@ -7,9 +7,9 @@ namespace component_loader
{ {
namespace namespace
{ {
std::vector<std::unique_ptr<component_interface>>& get_components() std::vector<std::unique_ptr<generic_component>>& get_components()
{ {
using component_vector = std::vector<std::unique_ptr<component_interface>>; using component_vector = std::vector<std::unique_ptr<generic_component>>;
using component_vector_container = std::unique_ptr<component_vector, std::function<void(component_vector*)>> using component_vector_container = std::unique_ptr<component_vector, std::function<void(component_vector*)>>
; ;
@ -29,13 +29,13 @@ namespace component_loader
return functors; return functors;
} }
void activate_component(std::unique_ptr<component_interface> component) void activate_component(std::unique_ptr<generic_component> component)
{ {
auto& components = get_components(); auto& components = get_components();
components.push_back(std::move(component)); components.push_back(std::move(component));
std::ranges::stable_sort(components, [](const std::unique_ptr<component_interface>& a, std::ranges::stable_sort(components, [](const std::unique_ptr<generic_component>& a,
const std::unique_ptr<component_interface>& b) const std::unique_ptr<generic_component>& b)
{ {
return a->priority() > b->priority(); return a->priority() > b->priority();
}); });

View File

@ -3,7 +3,7 @@
namespace component_loader namespace component_loader
{ {
using registration_functor = std::function<std::unique_ptr<component_interface>()>; using registration_functor = std::function<std::unique_ptr<generic_component>()>;
void register_component(registration_functor functor, component_type type); void register_component(registration_functor functor, component_type type);
@ -25,7 +25,7 @@ namespace component_loader
template <typename T> template <typename T>
class installer final class installer final
{ {
static_assert(std::is_base_of_v<component_interface, T>, "component has invalid base class"); static_assert(std::is_base_of_v<generic_component, T>, "component has invalid base class");
public: public:
installer() installer()