Fix warnings

This commit is contained in:
momo5502 2019-01-20 02:58:28 +01:00
parent d8a3bf135e
commit 0b526b582f
5 changed files with 18 additions and 24 deletions

View File

@ -68,8 +68,7 @@ namespace demonware
static void server_thread(); static void server_thread();
static void bd_logger_stub(int /*type*/, const char* const /*channelName*/, const char*, static void bd_logger_stub(int /*type*/, const char* /*channelName*/, const char*, const char* /*file*/,
const char* const /*file*/, const char* function, unsigned int /*line*/, const char* msg, ...);
const char* const function, const unsigned int /*line*/, const char* const msg, ...);
}; };
} }

View File

@ -2,7 +2,6 @@
#include "loader/module_loader.hpp" #include "loader/module_loader.hpp"
#include "utils/nt.hpp" #include "utils/nt.hpp"
#include "utils/string.hpp" #include "utils/string.hpp"
#include "game/game.hpp"
class game_launcher final : public module class game_launcher final : public module
{ {

View File

@ -2,20 +2,18 @@
#include "loader/module_loader.hpp" #include "loader/module_loader.hpp"
#include "notification.hpp" #include "notification.hpp"
#include "utils/hook.hpp" #include "utils/hook.hpp"
#include "utils/string.hpp"
#include "scheduler.hpp"
std::mutex notification::mutex_; std::mutex notification::mutex_;
std::vector<std::function<void(notification::event*)>> notification::callbacks_; std::vector<std::function<void(notification::event*)>> notification::callbacks_;
void notification::post_load() void notification::post_load()
{ {
utils::hook(SELECT_VALUE(0x6109F3, 0x56B637, 0x4EDFF7), 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(); utils::hook(SELECT_VALUE(0x6128BE, 0x56D541, 0x4EFAF9), &vm_notify_stub, HOOK_CALL).install()->quick();
if (game::is_sp()) 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); //scripting::on_start(cleanup);

View File

@ -25,7 +25,7 @@ scripting::entity::entity(scripting* environment, const unsigned int entity_id)
{ {
if (this->entity_id_) if (this->entity_id_)
{ {
game::native::VariableValue value; game::native::VariableValue value{};
value.type = game::native::SCRIPT_OBJECT; value.type = game::native::SCRIPT_OBJECT;
value.u.entityId = this->entity_id_; value.u.entityId = this->entity_id_;
game::native::AddRefToValue(&value); game::native::AddRefToValue(&value);
@ -102,10 +102,10 @@ scripting::variable::operator game::native::VariableValue() const
scripting::stack_context::stack_context() scripting::stack_context::stack_context()
{ {
this->inparamcount_ = game::native::scr_VmPub->inparamcount; this->in_param_count_ = game::native::scr_VmPub->inparamcount;
this->outparamcount_ = game::native::scr_VmPub->outparamcount; this->out_param_count_ = game::native::scr_VmPub->outparamcount;
this->top_ = game::native::scr_VmPub->top; 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->top = this->stack_;
game::native::scr_VmPub->maxstack = &this->stack_[ARRAYSIZE(this->stack_) - 1]; 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() scripting::stack_context::~stack_context()
{ {
game::native::Scr_ClearOutParams(); game::native::Scr_ClearOutParams();
game::native::scr_VmPub->inparamcount = this->inparamcount_; game::native::scr_VmPub->inparamcount = this->in_param_count_;
game::native::scr_VmPub->outparamcount = this->outparamcount_; game::native::scr_VmPub->outparamcount = this->out_param_count_;
game::native::scr_VmPub->top = this->top_; 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() void scripting::post_start()
@ -146,13 +146,13 @@ void scripting::post_load()
start_hook_.initialize(SELECT_VALUE(0x50C575, 0x50D4F2, 0x48A026), []() start_hook_.initialize(SELECT_VALUE(0x50C575, 0x50D4F2, 0x48A026), []()
{ {
start_execution(); start_execution();
static_cast<void(*)()>(start_hook_.get_original())(); reinterpret_cast<void(*)()>(start_hook_.get_original())();
}, HOOK_CALL)->install()->quick(); }, HOOK_CALL)->install()->quick();
stop_hook_.initialize(SELECT_VALUE(0x528B04, 0x569E46, 0x4F03FA), []() stop_hook_.initialize(SELECT_VALUE(0x528B04, 0x569E46, 0x4F03FA), []()
{ {
stop_execution(); stop_execution();
static_cast<void(*)()>(stop_hook_.get_original())(); reinterpret_cast<void(*)()>(stop_hook_.get_original())();
}, HOOK_CALL)->install()->quick(); }, 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 field_str = game::native::SL_GetString(field_name.data(), 1);
const auto _ = gsl::finally([field_str]() const auto _ = gsl::finally([field_str]()
{ {
game::native::VariableUnion u{}; game::native::RemoveRefToValue(game::native::SCRIPT_STRING, {int(field_str)});
u.stringValue = field_str;
game::native::RemoveRefToValue(game::native::SCRIPT_STRING, u);
}); });
const auto offset = game::native::FindVariable(class_id, field_str); const auto offset = game::native::FindVariable(class_id, field_str);

View File

@ -81,10 +81,10 @@ private:
private: private:
game::native::VariableValue stack_[512]{}; game::native::VariableValue stack_[512]{};
game::native::VariableValue *maxstack_; game::native::VariableValue *max_stack_;
game::native::VariableValue *top_; game::native::VariableValue *top_;
unsigned int inparamcount_; unsigned int in_param_count_;
unsigned int outparamcount_; unsigned int out_param_count_;
}; };
std::unique_ptr<chaiscript::ChaiScript> chai_; std::unique_ptr<chaiscript::ChaiScript> chai_;