diff --git a/src/HookUtils.h b/src/HookUtils.h index f339465..db32ae7 100644 --- a/src/HookUtils.h +++ b/src/HookUtils.h @@ -2,8 +2,6 @@ #define BML_HOOKUTILS_H #include -#include -#include namespace utils { void OutputDebugA(const char *format, ...); @@ -21,7 +19,7 @@ namespace utils { template T ForceReinterpretCast(void *base, size_t offset) { - void *p = reinterpret_cast(base) + offset; + void *p = static_cast(base) + offset; return *reinterpret_cast(&p); } @@ -35,16 +33,16 @@ namespace utils { inline void **GetVTable(void *instance) { if (instance) { - return *reinterpret_cast(instance); + return *static_cast(instance); } else { return nullptr; } } template - inline void LoadVTable(void *instance, T &table) { + void LoadVTable(void *instance, T &table) { if (instance) { - void **src = reinterpret_cast(*reinterpret_cast(instance)); + void **src = static_cast(*static_cast(instance)); void **dest = reinterpret_cast(&table); for (size_t i = 0; i < sizeof(T) / sizeof(void *); ++i) { dest[i] = src[i]; @@ -53,22 +51,22 @@ namespace utils { } template - inline void SaveVTable(void *instance, T &table) { + void SaveVTable(void *instance, T &table) { if (instance) { void **src = reinterpret_cast(&table); - void **dest = reinterpret_cast(*reinterpret_cast(instance)); - uint32_t originalProtection = UnprotectRegion((void *) dest, sizeof(T)); + void **dest = static_cast(*static_cast(instance)); + uint32_t originalProtection = UnprotectRegion(dest, sizeof(T)); for (size_t i = 0; i < sizeof(T) / sizeof(void *); ++i) { dest[i] = src[i]; } - ProtectRegion((void *) dest, sizeof(T), originalProtection); + ProtectRegion(dest, sizeof(T), originalProtection); } } void *HookVirtualMethod(void *instance, void *hook, size_t offset); template - inline void *HookVirtualMethod(void *instance, T hook, size_t offset) { + void *HookVirtualMethod(void *instance, T hook, size_t offset) { return HookVirtualMethod(instance, TypeErase(hook), offset); } } diff --git a/src/ScriptHelper.cpp b/src/ScriptHelper.cpp index ff250df..9e2e0d3 100644 --- a/src/ScriptHelper.cpp +++ b/src/ScriptHelper.cpp @@ -1,7 +1,5 @@ #include "BML/ScriptHelper.h" -#include "BML/Defines.h" - namespace ScriptHelper { bool FindBB(CKBehavior *script, std::function callback, const char *name, bool hierarchically, int inputCnt, int outputCnt, int inputParamCnt, int outputParamCnt) { diff --git a/src/StringUtils.cpp b/src/StringUtils.cpp index 5e104e4..0c4521f 100644 --- a/src/StringUtils.cpp +++ b/src/StringUtils.cpp @@ -1,5 +1,8 @@ #include "StringUtils.h" +#include +#include + #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif diff --git a/src/StringUtils.h b/src/StringUtils.h index e419dfb..977cf96 100644 --- a/src/StringUtils.h +++ b/src/StringUtils.h @@ -1,8 +1,6 @@ #ifndef BML_STRINGUTILS_H #define BML_STRINGUTILS_H -#include -#include #include #include