Removed unused code, made get_host_library private again

This commit is contained in:
Jari van der Kaap 2023-02-13 21:50:19 +01:00
parent 8d1825d12f
commit d372fc33f6
5 changed files with 16 additions and 26 deletions

View File

@ -74,16 +74,6 @@ namespace dvars
initial_config_read = true; initial_config_read = true;
scheduler::execute(scheduler::pipeline::dvars_loaded); scheduler::execute(scheduler::pipeline::dvars_loaded);
} }
game::dvar_t* dvar_register_new_stub(game::dvarStrHash_t hash, const char* dvar_name, game::dvarType_t type, unsigned int flags,
game::DvarValue value, game::DvarLimits domain, const char* description)
{
auto dvar = dvar_register_new_hook.invoke<game::dvar_t*>(hash, dvar_name, type, flags, value, domain, description);
dvar->debugName = dvar_name; // TODO: gives access violation error
return dvar;
}
} }
class component final : public client_component class component final : public client_component
@ -93,7 +83,6 @@ namespace dvars
{ {
scheduler::once(read_archive_dvars, scheduler::pipeline::main); scheduler::once(read_archive_dvars, scheduler::pipeline::main);
//dvar_register_new_hook.create(0x1422C5330_g, dvar_register_new_stub);
dvar_set_variant_hook.create(0x1422C9A90_g, dvar_set_variant_stub); dvar_set_variant_hook.create(0x1422C9A90_g, dvar_set_variant_stub);
} }
}; };

View File

@ -204,7 +204,8 @@ namespace ui_scripting
lua["table"]["unpack"] = lua["unpack"]; lua["table"]["unpack"] = lua["unpack"];
lua["luiglobals"] = lua; lua["luiglobals"] = lua;
load_scripts(game::get_host_library().get_folder().append("/data/ui_scripts/").string()); utils::nt::library host{};
load_scripts(host.get_folder().append("/data/ui_scripts/").string());
load_scripts("boiii/ui_scripts/"); load_scripts("boiii/ui_scripts/");
load_scripts("data/ui_scripts/"); load_scripts("data/ui_scripts/");
} }
@ -229,7 +230,8 @@ namespace ui_scripting
{ {
// Fetch the names of the local files so file overrides are already handled // Fetch the names of the local files so file overrides are already handled
globals = {}; globals = {};
load_local_script_files(game::get_host_library().get_folder().append("/data/ui_scripts/").string()); utils::nt::library host{};
load_local_script_files(host.get_folder().append("/data/ui_scripts/").string());
load_local_script_files("boiii/ui_scripts/"); load_local_script_files("boiii/ui_scripts/");
load_local_script_files("data/ui_scripts/"); load_local_script_files("data/ui_scripts/");
return; return;
@ -384,7 +386,6 @@ namespace ui_scripting
dvar_cg_enable_unsafe_lua_functions->debugName = "cg_enable_unsafe_lua_functions"; dvar_cg_enable_unsafe_lua_functions->debugName = "cg_enable_unsafe_lua_functions";
scheduler::once([]() { scheduler::once([]() {
game::dvar_t* dvar_callstack_ship = game::Dvar_FindVar("ui_error_callstack_ship"); game::dvar_t* dvar_callstack_ship = game::Dvar_FindVar("ui_error_callstack_ship");
dvar_callstack_ship->flags = (game::dvarFlags_e)0; dvar_callstack_ship->flags = (game::dvarFlags_e)0;
game::dvar_t* dvar_report_delay= game::Dvar_FindVar("ui_error_report_delay"); game::dvar_t* dvar_report_delay= game::Dvar_FindVar("ui_error_report_delay");

View File

@ -3,10 +3,12 @@
#include "game.hpp" #include "game.hpp"
namespace game namespace game
{
namespace
{ {
const utils::nt::library& get_host_library() const utils::nt::library& get_host_library()
{ {
static auto host_library = [] static const 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,6 +21,7 @@ namespace game
return host_library; return host_library;
} }
}
size_t get_base() size_t get_base()
{ {

View File

@ -5,7 +5,6 @@
namespace game namespace game
{ {
const utils::nt::library& get_host_library();
size_t get_base(); size_t get_base();
bool is_server(); bool is_server();

View File

@ -1,8 +1,6 @@
#include <std_include.hpp> #include <std_include.hpp>
#include "execution.hpp" #include "execution.hpp"
//#include "component/console.hpp"
namespace ui_scripting namespace ui_scripting
{ {
namespace namespace