diff --git a/src/client/component/dvars.cpp b/src/client/component/dvars.cpp index f4de075d..40703391 100644 --- a/src/client/component/dvars.cpp +++ b/src/client/component/dvars.cpp @@ -74,16 +74,6 @@ namespace dvars initial_config_read = true; 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(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 @@ -93,7 +83,6 @@ namespace dvars { 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); } }; diff --git a/src/client/component/ui_scripting.cpp b/src/client/component/ui_scripting.cpp index f283457e..e23ddd28 100644 --- a/src/client/component/ui_scripting.cpp +++ b/src/client/component/ui_scripting.cpp @@ -204,7 +204,8 @@ namespace ui_scripting lua["table"]["unpack"] = lua["unpack"]; 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("data/ui_scripts/"); } @@ -229,7 +230,8 @@ namespace ui_scripting { // Fetch the names of the local files so file overrides are already handled 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("data/ui_scripts/"); return; @@ -384,7 +386,6 @@ namespace ui_scripting dvar_cg_enable_unsafe_lua_functions->debugName = "cg_enable_unsafe_lua_functions"; scheduler::once([]() { - game::dvar_t* dvar_callstack_ship = game::Dvar_FindVar("ui_error_callstack_ship"); dvar_callstack_ship->flags = (game::dvarFlags_e)0; game::dvar_t* dvar_report_delay= game::Dvar_FindVar("ui_error_report_delay"); diff --git a/src/client/game/game.cpp b/src/client/game/game.cpp index d6bad074..18ca63bf 100644 --- a/src/client/game/game.cpp +++ b/src/client/game/game.cpp @@ -4,20 +4,23 @@ namespace game { - const utils::nt::library& get_host_library() + namespace { - static auto host_library = [] + const utils::nt::library& get_host_library() { - utils::nt::library host{}; - if (!host || host == utils::nt::library::get_by_address(get_base)) + static const auto host_library = [] { - throw std::runtime_error("Invalid host application"); - } + utils::nt::library host{}; + if (!host || host == utils::nt::library::get_by_address(get_base)) + { + throw std::runtime_error("Invalid host application"); + } - return host; - }(); + return host; + }(); - return host_library; + return host_library; + } } size_t get_base() diff --git a/src/client/game/game.hpp b/src/client/game/game.hpp index 26769c24..02e6fa59 100644 --- a/src/client/game/game.hpp +++ b/src/client/game/game.hpp @@ -5,7 +5,6 @@ namespace game { - const utils::nt::library& get_host_library(); size_t get_base(); bool is_server(); diff --git a/src/client/game/ui_scripting/execution.cpp b/src/client/game/ui_scripting/execution.cpp index 826fad10..09572a6e 100644 --- a/src/client/game/ui_scripting/execution.cpp +++ b/src/client/game/ui_scripting/execution.cpp @@ -1,8 +1,6 @@ #include #include "execution.hpp" -//#include "component/console.hpp" - namespace ui_scripting { namespace