diff --git a/src/module/dw.hpp b/src/module/dw.hpp index 4f0f6f5..4df1ee3 100644 --- a/src/module/dw.hpp +++ b/src/module/dw.hpp @@ -68,8 +68,7 @@ namespace demonware static void server_thread(); - static void bd_logger_stub(int /*type*/, const char* const /*channelName*/, const char*, - const char* const /*file*/, - const char* const function, const unsigned int /*line*/, const char* const msg, ...); + static void bd_logger_stub(int /*type*/, const char* /*channelName*/, const char*, const char* /*file*/, + const char* function, unsigned int /*line*/, const char* msg, ...); }; } diff --git a/src/module/game_launcher.cpp b/src/module/game_launcher.cpp index 6b22634..3a901d4 100644 --- a/src/module/game_launcher.cpp +++ b/src/module/game_launcher.cpp @@ -2,7 +2,6 @@ #include "loader/module_loader.hpp" #include "utils/nt.hpp" #include "utils/string.hpp" -#include "game/game.hpp" class game_launcher final : public module { diff --git a/src/module/notification.cpp b/src/module/notification.cpp index 1223737..f7d700c 100644 --- a/src/module/notification.cpp +++ b/src/module/notification.cpp @@ -2,20 +2,18 @@ #include "loader/module_loader.hpp" #include "notification.hpp" #include "utils/hook.hpp" -#include "utils/string.hpp" -#include "scheduler.hpp" std::mutex notification::mutex_; std::vector> notification::callbacks_; void notification::post_load() { - utils::hook(SELECT_VALUE(0x6109F3, 0x56B637, 0x4EDFF7), vm_notify_stub, HOOK_CALL).install()->quick(); - utils::hook(SELECT_VALUE(0x6128BE, 0x56D541, 0x4EFAF9), vm_notify_stub, HOOK_CALL).install()->quick(); + utils::hook(SELECT_VALUE(0x6109F3, 0x56B637, 0x4EDFF7), &vm_notify_stub, HOOK_CALL).install()->quick(); + utils::hook(SELECT_VALUE(0x6128BE, 0x56D541, 0x4EFAF9), &vm_notify_stub, HOOK_CALL).install()->quick(); if (game::is_sp()) { - utils::hook(0x610970, vm_notify_stub, HOOK_JUMP).install()->quick(); + utils::hook(0x610970, &vm_notify_stub, HOOK_JUMP).install()->quick(); } //scripting::on_start(cleanup); diff --git a/src/module/scripting.cpp b/src/module/scripting.cpp index 38a48f1..065997a 100644 --- a/src/module/scripting.cpp +++ b/src/module/scripting.cpp @@ -25,7 +25,7 @@ scripting::entity::entity(scripting* environment, const unsigned int entity_id) { if (this->entity_id_) { - game::native::VariableValue value; + game::native::VariableValue value{}; value.type = game::native::SCRIPT_OBJECT; value.u.entityId = this->entity_id_; game::native::AddRefToValue(&value); @@ -102,10 +102,10 @@ scripting::variable::operator game::native::VariableValue() const scripting::stack_context::stack_context() { - this->inparamcount_ = game::native::scr_VmPub->inparamcount; - this->outparamcount_ = game::native::scr_VmPub->outparamcount; + this->in_param_count_ = game::native::scr_VmPub->inparamcount; + this->out_param_count_ = game::native::scr_VmPub->outparamcount; this->top_ = game::native::scr_VmPub->top; - this->maxstack_ = game::native::scr_VmPub->maxstack; + this->max_stack_ = game::native::scr_VmPub->maxstack; game::native::scr_VmPub->top = this->stack_; game::native::scr_VmPub->maxstack = &this->stack_[ARRAYSIZE(this->stack_) - 1]; @@ -116,10 +116,10 @@ scripting::stack_context::stack_context() scripting::stack_context::~stack_context() { game::native::Scr_ClearOutParams(); - game::native::scr_VmPub->inparamcount = this->inparamcount_; - game::native::scr_VmPub->outparamcount = this->outparamcount_; + game::native::scr_VmPub->inparamcount = this->in_param_count_; + game::native::scr_VmPub->outparamcount = this->out_param_count_; game::native::scr_VmPub->top = this->top_; - game::native::scr_VmPub->maxstack = this->maxstack_; + game::native::scr_VmPub->maxstack = this->max_stack_; } void scripting::post_start() @@ -146,13 +146,13 @@ void scripting::post_load() start_hook_.initialize(SELECT_VALUE(0x50C575, 0x50D4F2, 0x48A026), []() { start_execution(); - static_cast(start_hook_.get_original())(); + reinterpret_cast(start_hook_.get_original())(); }, HOOK_CALL)->install()->quick(); stop_hook_.initialize(SELECT_VALUE(0x528B04, 0x569E46, 0x4F03FA), []() { stop_execution(); - static_cast(stop_hook_.get_original())(); + reinterpret_cast(stop_hook_.get_original())(); }, HOOK_CALL)->install()->quick(); } @@ -550,9 +550,7 @@ int scripting::get_field_id(const int classnum, const std::string& field) const const auto field_str = game::native::SL_GetString(field_name.data(), 1); const auto _ = gsl::finally([field_str]() { - game::native::VariableUnion u{}; - u.stringValue = field_str; - game::native::RemoveRefToValue(game::native::SCRIPT_STRING, u); + game::native::RemoveRefToValue(game::native::SCRIPT_STRING, {int(field_str)}); }); const auto offset = game::native::FindVariable(class_id, field_str); diff --git a/src/module/scripting.hpp b/src/module/scripting.hpp index c643e66..feda93a 100644 --- a/src/module/scripting.hpp +++ b/src/module/scripting.hpp @@ -81,10 +81,10 @@ private: private: game::native::VariableValue stack_[512]{}; - game::native::VariableValue *maxstack_; + game::native::VariableValue *max_stack_; game::native::VariableValue *top_; - unsigned int inparamcount_; - unsigned int outparamcount_; + unsigned int in_param_count_; + unsigned int out_param_count_; }; std::unique_ptr chai_;