From f089088650257908026fd266b45ba36720d2c746 Mon Sep 17 00:00:00 2001 From: Northn Date: Sat, 18 Sep 2021 22:46:58 +0400 Subject: [PATCH] Big reworks Base: - Fixed 'Debug' configuration RakLua: - Added R4-2 support (untested) - Fixed compatibility with some launchers - Fixed recursion at one of the functions - Moved RakClientInterface methods hook to RakClient constructor samp-functions: - Code refactoring MoonFunctions: - Fixed sampSendEnterVehicle - Inline of types with SAMP.Lua rtdhook: - Fixed returning of default protection. --- src/MoonFunctions.hpp | 31 ++++++---- src/RakLua.cpp | 34 +++++------ src/RakLua.h | 2 + src/RakLuaBitStream.cpp | 20 +++--- src/libs/rtdhook/rtdhook.hpp | 97 ++++++++++++++++++++++++++--- src/libs/samp/samp.hpp | 112 +++++++++++++++++++++++++--------- src/main.cpp | 11 ++-- src/moonloader-module.vcxproj | 15 +++-- src/pch.h | 16 ++++- 9 files changed, 249 insertions(+), 89 deletions(-) diff --git a/src/MoonFunctions.hpp b/src/MoonFunctions.hpp index f63dc11..861a96c 100644 --- a/src/MoonFunctions.hpp +++ b/src/MoonFunctions.hpp @@ -201,7 +201,7 @@ uintptr_t raknetBitStreamGetDataPtr(RakLuaBitStream* bs) return bs->getDataPtr(); } -bool raknetEmulPacketReceiveBitStream(uint8_t packetId /* Why, FYP, why?!*/, RakLuaBitStream* bs) +bool raknetEmulPacketReceiveBitStream(uint8_t packetId, RakLuaBitStream* bs) { return bs->emulIncomingPacket(packetId); } @@ -225,7 +225,7 @@ void sampSendClickPlayer(uint16_t playerId, uint8_t source) RakLuaBitStream(&bs).sendRPC(23); } -void sampSendDialogResponse(uint16_t id, uint8_t button, int16_t listItem, std::string_view string = "") +void sampSendDialogResponse(uint16_t id, uint8_t button, uint16_t listItem, std::string_view string = "") { BitStream bs; bs.Write(id); @@ -245,7 +245,7 @@ void sampSendClickTextdraw(uint16_t id) RakLuaBitStream(&bs).sendRPC(62); } -void sampSendGiveDamage(uint16_t id, float damage, int weapon, int bodyPart) +void sampSendGiveDamage(uint16_t id, float damage, int32_t weapon, int32_t bodyPart) { BitStream bs; bs.Write(false); @@ -256,7 +256,7 @@ void sampSendGiveDamage(uint16_t id, float damage, int weapon, int bodyPart) RakLuaBitStream(&bs).sendRPC(115); } -void sampSendTakeDamage(uint16_t id, float damage, int weapon, int bodyPart) +void sampSendTakeDamage(uint16_t id, float damage, int32_t weapon, int32_t bodyPart) { BitStream bs; bs.Write(true); @@ -267,7 +267,10 @@ void sampSendTakeDamage(uint16_t id, float damage, int weapon, int bodyPart) RakLuaBitStream(&bs).sendRPC(115); } -void sampSendEditObject(bool playerObject, uint16_t objectId, int response, float posX, float posY, float posZ, float rotX, float rotY, float rotZ) +void sampSendEditObject(bool playerObject, uint16_t objectId, int32_t response, + float posX, float posY, float posZ, + float rotX, float rotY, float rotZ +) { BitStream bs; bs.Write(playerObject); @@ -286,7 +289,11 @@ void sampSendEditObject(bool playerObject, uint16_t objectId, int response, floa } // TODO: COLOR? -void sampSendEditAttachedObject(int response, int index, int model, int bone, float posX, float posY, float posZ, float rotX, float rotY, float rotZ, float scaleX, float scaleY, float scaleZ) +void sampSendEditAttachedObject(int32_t response, int32_t index, int32_t model, int32_t bone, + float posX, float posY, float posZ, + float rotX, float rotY, float rotZ, + float scaleX, float scaleY, float scaleZ +) { BitStream bs; bs.Write(response); @@ -306,8 +313,8 @@ void sampSendEditAttachedObject(int response, int index, int model, int bone, fl bs.Write(scaleY); bs.Write(scaleZ); - bs.Write(0); - bs.Write(0); + bs.Write(0); + bs.Write(0); RakLuaBitStream(&bs).sendRPC(116); } @@ -324,7 +331,7 @@ void sampSendRequestSpawn() RakLuaBitStream().sendRPC(129); } -void sampSendPickedUpPickup(int id) +void sampSendPickedUpPickup(int32_t id) { BitStream bs; bs.Write(id); @@ -384,7 +391,7 @@ void sampSendEnterVehicle(uint16_t id, bool passenger) { BitStream bs; bs.Write(id); - bs.Write(passenger); + bs.Write(passenger); RakLuaBitStream(&bs).sendRPC(26); } @@ -400,7 +407,7 @@ void sampSendSpawn() RakLuaBitStream().sendRPC(52); } -void sampSendDamageVehicle(uint16_t id, int panel, int doors, uint8_t lights, uint8_t tires) +void sampSendDamageVehicle(uint16_t id, int32_t panel, int32_t doors, uint8_t lights, uint8_t tires) { BitStream bs; bs.Write(id); @@ -414,8 +421,10 @@ void sampSendDamageVehicle(uint16_t id, int panel, int doors, uint8_t lights, ui void sampSendUpdatePlayers() { static DWORD dwLastUpdateTick = 0; +#pragma warning(disable : 28159) // Consider using GetTickCount64 function instead of GetTickCount if ((GetTickCount() - dwLastUpdateTick) > 3000) { dwLastUpdateTick = GetTickCount(); +#pragma warning(default : 28159) RakLuaBitStream().sendRPC(155); } } diff --git a/src/RakLua.cpp b/src/RakLua.cpp index c138439..fbbe939 100644 --- a/src/RakLua.cpp +++ b/src/RakLua.cpp @@ -22,27 +22,24 @@ RakLua::eInitState RakLua::initialize() mState = eInitState::INITIALIZING; - std::thread([&]() { - uintptr_t sampInfo = sampGetSampInfoPtr(); - while (!sampInfo) - sampInfo = sampGetSampInfoPtr(); - - mVmtHook = new rtdhook_vmt(*reinterpret_cast(sampGetRakClientInterface())); - mVmtHook->install(6, &handleOutgoingPacket); - mVmtHook->install(8, &handleIncomingPacket); - mVmtHook->install(25, &handleOutgoingRpc); + mRakClientIntfConstructor = new rtdhook(sampGetRakClientIntfConstructorPtr(), &hookRakClientIntfConstructor, 7); + mRakClientIntfConstructor->install(); - mState = eInitState::OK; - }).detach(); +returnState: + return mState; +} +void RakLua::postRakClientInitialization(uintptr_t rakClientIntf) +{ mIncomingRpcHandlerHook = new rtdhook(sampGetIncomingRpcHandlerPtr(), &handleIncomingRpc); mIncomingRpcHandlerHook->install(); - mRakClientIntfConstructor = new rtdhook(sampGetRakClientIntfConstructorPtr(), &hookRakClientIntfConstructor, 7); - mRakClientIntfConstructor->install(); + mVmtHook = new rtdhook_vmt(rakClientIntf); + mVmtHook->install(6, &handleOutgoingPacket); + mVmtHook->install(8, &handleIncomingPacket); + mVmtHook->install(25, &handleOutgoingRpc); -returnState: - return mState; + mState = eInitState::OK; } bool RakLua::addEventHandler(sol::this_state& ts, eEventType type, sol::function detour) @@ -121,9 +118,7 @@ bool inlineIncomingPacketHandler(uint8_t id, RakLuaBitStream& luaBs) { luaBs.resetReadPointer(); if (!RakLua::safeCall(handler.handler, id, &luaBs)) - { return false; - } } return true; } @@ -238,6 +233,9 @@ uintptr_t hookRakClientIntfConstructor() { uintptr_t rakClientInterface = reinterpret_cast(gRakLua.getIntfConstructorHook()->getTrampoline())(); if (rakClientInterface) - gRakPeer = reinterpret_cast(rakClientInterface - 3550); + { + gRakPeer = reinterpret_cast(rakClientInterface - 0xDDE); + gRakLua.postRakClientInitialization(rakClientInterface); + } return rakClientInterface; } diff --git a/src/RakLua.h b/src/RakLua.h index 87589e2..9fb10b6 100644 --- a/src/RakLua.h +++ b/src/RakLua.h @@ -26,6 +26,8 @@ class RakLua public: eInitState initialize(); bool destroy(); + + void postRakClientInitialization(uintptr_t rakClientIntf); bool addEventHandler(sol::this_state& ts, eEventType type, sol::function detour); void destroyHandlers(sol::this_state& ts); diff --git a/src/RakLuaBitStream.cpp b/src/RakLuaBitStream.cpp index e88ea8d..07e2ba4 100644 --- a/src/RakLuaBitStream.cpp +++ b/src/RakLuaBitStream.cpp @@ -145,7 +145,7 @@ float RakLuaBitStream::readFloat() std::string RakLuaBitStream::readString(int32_t len) { - std::string ret(len, 0); + std::string ret(len, '\0'); bs->Read(ret.data(), len); return ret; } @@ -250,19 +250,21 @@ bool RakLuaBitStream::emulIncomingPacket(uint8_t packetId) Packet* send_packet = reinterpret_cast(sampGetAllocPacketPtr())(send_bs.GetNumberOfBytesUsed()); memcpy(send_packet->data, send_bs.GetData(), send_packet->length); - // RakPeer::AddPacketToProducer - char* packets = static_cast(gRakPeer) + 0xdb6; - auto write_lock = reinterpret_cast(sampGetWriteLockPtr()); - auto write_unlock = reinterpret_cast(sampGetWriteUnlockPtr()); + { + // RakPeer::AddPacketToProducer + char* packets = static_cast(gRakPeer) + 0xdb6; + auto write_lock = reinterpret_cast(sampGetWriteLockPtr()); + auto write_unlock = reinterpret_cast(sampGetWriteUnlockPtr()); - *write_lock(packets) = send_packet; - write_unlock(packets); - // RakPeer::AddPacketToProducer + *write_lock(packets) = send_packet; + write_unlock(packets); + // RakPeer::AddPacketToProducer + } return true; } -#define RAKCLIENT_INTF *reinterpret_cast(sampGetRakClientInterface()) +#define RAKCLIENT_INTF reinterpret_cast(gRakPeer) + 0xDDE bool RakLuaBitStream::sendRPC(int rpcId) { diff --git a/src/libs/rtdhook/rtdhook.hpp b/src/libs/rtdhook/rtdhook.hpp index 81e098c..4afb17e 100644 --- a/src/libs/rtdhook/rtdhook.hpp +++ b/src/libs/rtdhook/rtdhook.hpp @@ -4,7 +4,9 @@ #include // VirtualProtect #include -#pragma warning(disable : 6387) // warning C6387: _Param_(4) may be 0: this does not adhere to the specification for the function "VirtualProtect" +#ifdef _DEBUG +#include +#endif class rtdhook { typedef unsigned char byte_t; @@ -24,7 +26,7 @@ class rtdhook { public: /** * @brief Конструктор - * @details В конструкторе записываются необходимые данные, выделяется область для трамплина и оригинального пролога, методы заменяются позднее через метод install + * @details В конструкторе записываются необходимые данные, выделяется область для трамплина и оригинального пролога, функция хукается позднее через метод install * @param hook_address Адрес функции * @param detour_function Функция, которая будет вызываться вмето оригинального * @param prologue_size Размер пролога @@ -57,7 +59,7 @@ class rtdhook { } /** - * @brief Установка хука на виртуальный метод + * @brief Установка хука на функцию */ void install() { @@ -71,13 +73,13 @@ class rtdhook { memset((void*)(mHookAddress + 5), 0x90, mHookSize - 5); - VirtualProtect((LPVOID)mHookAddress, mHookSize, old_protection, nullptr); + VirtualProtect((LPVOID)mHookAddress, mHookSize, old_protection, &old_protection); setEnabled(true); } /** - * @brief Снятие хука на функцию + * @brief Снятие хука с функции */ void uninstall() { @@ -90,7 +92,7 @@ class rtdhook { memcpy((void*)mHookAddress, (void*)mOriginalPrologue, mHookSize); - VirtualProtect((LPVOID)mHookAddress, mHookSize, old_protection, nullptr); + VirtualProtect((LPVOID)mHookAddress, mHookSize, old_protection, &old_protection); setEnabled(false); } @@ -100,6 +102,85 @@ class rtdhook { inline uintptr_t getTrampoline() { return mTrampoline; } }; +class rtdhook_call { + typedef unsigned char byte_t; +private: + bool mIsEnabled = false; + + uintptr_t mDetourAddress; + uintptr_t mHookAddress; + uintptr_t mHookedFunctionAddress; + + inline void setEnabled(bool enabled) { mIsEnabled = enabled; } + +public: + /** + * @brief Конструктор + * @details В конструкторе записываются необходимые данные, хук происходит позже через метод install() + * @param hook_address Адрес функции + * @param detour_function Функция, которая будет вызываться вместо оригинального + */ + template rtdhook_call(uintptr_t hook_address, T(*detour_function)) + { +#ifdef _DEBUG + assert(*reinterpret_cast(hook_address) == 0xE8); +#endif + + mDetourAddress = reinterpret_cast(detour_function); + mHookAddress = hook_address; + mHookedFunctionAddress = *reinterpret_cast(mHookAddress + 1); + } + + /** + * @brief Деструктор + * @details В деструкторе снимается установленный хук + */ + ~rtdhook_call() + { + uninstall(); + } + + /** + * @brief Установка хука на вызов функции + */ + void install() + { + if (isEnabled()) return; + + DWORD old_protection; + VirtualProtect((LPVOID)mHookAddress, 5, PAGE_EXECUTE_READWRITE, &old_protection); + + *reinterpret_cast(mHookAddress + 1) = mDetourAddress - mHookAddress - 5; + + VirtualProtect((LPVOID)mHookAddress, 5, old_protection, &old_protection); + + setEnabled(true); + } + + /** + * @brief Снятие хука на вызов функции + */ + void uninstall() + { + // TODO: Current realisation will break other hooks installed by this address + + if (!isEnabled()) return; + + DWORD old_protection; + VirtualProtect((LPVOID)mHookAddress, 5, PAGE_EXECUTE_READWRITE, &old_protection); + + *reinterpret_cast(mHookAddress + 1) = mHookedFunctionAddress; + + VirtualProtect((LPVOID)mHookAddress, 5, old_protection, &old_protection); + + setEnabled(false); + } + + inline bool isEnabled() { return mIsEnabled; } + inline uintptr_t getHookAddress() { return mHookAddress; } + inline uintptr_t getHookedFunctionAddress() { return mHookedFunctionAddress + mHookAddress + 5; } +}; + class rtdhook_vmt { typedef struct { int id; uintptr_t original; } vmt_method_t; private: @@ -117,7 +198,7 @@ class rtdhook_vmt { uintptr_t* vmt = *reinterpret_cast(mVmtAddress); VirtualProtect(vmt + method_id, 4, PAGE_EXECUTE_READWRITE, &old_protection); *reinterpret_cast(vmt + method_id) = detour_function; - VirtualProtect(vmt + method_id, 4, old_protection, nullptr); + VirtualProtect(vmt + method_id, 4, old_protection, &old_protection); } public: /** @@ -207,5 +288,3 @@ class rtdhook_vmt { return *reinterpret_cast(vmt + method_id); } }; - -#pragma warning(default : 6387) diff --git a/src/libs/samp/samp.hpp b/src/libs/samp/samp.hpp index b1c014c..ec6633b 100644 --- a/src/libs/samp/samp.hpp +++ b/src/libs/samp/samp.hpp @@ -3,18 +3,16 @@ #define WIN32_LEAN_AND_MEAN #include -enum SAMPVER { - SAMP_NOT_LOADED, - SAMP_UNKNOWN, - SAMP_037_R1, - SAMP_037_R3_1 -}; +#ifdef _DEBUG +#include +#endif -const uintptr_t samp_addressess[][10] -{ - // CNetGame RakClientInterface StringWriteEncoder StringReadDecoder CompressorPtr HandleRpc RakClientIntfConstr, alloc_packet, write_lock, write_unlock - {0x21A0F8, 0x3C9, 0x506B0, 0x507E0, 0x10D894, 0x372f0, 0x33DC0, 0x347e0, 0x35b10, 0x35b50}, // SAMP_037_R1 - {0x26E8DC, 0x2C, 0x53A60, 0x53B90, 0x121914, 0x3a6a0, 0x37170, 0x37b90, 0x38ec0, 0x38f00} // SAMP_037_R3_1 +enum SAMPVER { + SAMP_NOT_LOADED, + SAMP_UNKNOWN, + SAMP_037_R1, + SAMP_037_R3_1, + SAMP_037_R4_2 }; inline uintptr_t sampGetBase() @@ -25,8 +23,6 @@ inline uintptr_t sampGetBase() return sampBase; } -// https://github.com/imring/TimeFormat/blob/master/samp.hpp#L19 - inline SAMPVER sampGetVersion() { static SAMPVER sampVersion = SAMPVER::SAMP_NOT_LOADED; @@ -46,68 +42,126 @@ inline SAMPVER sampGetVersion() case 0xCC4D0: sampVersion = SAMPVER::SAMP_037_R3_1; break; + case 0xCBCB0: + sampVersion = SAMPVER::SAMP_037_R4_2; + break; default: sampVersion = SAMPVER::SAMP_UNKNOWN; +#ifdef _DEBUG + assert(0); +#endif } } return sampVersion; } -#define SAMP_OFFSET samp_addressess[sampGetVersion() - 2] +enum class SampAddresses { + CNetGame, + RakClientInterface, + StringWriteEncoder, + StringReadDecoder, + CompressorPtr, + HandleRpc, + RakClientIntfConstr, + alloc_packet, + write_lock, + write_unlock +}; -inline uintptr_t sampGetSampInfoPtr() +struct SampAddress { - static uintptr_t sampInfo = 0; - if (sampInfo == 0) - sampInfo = *reinterpret_cast(sampGetBase() + SAMP_OFFSET[0]); + uintptr_t R1, R3, R4; - return sampInfo; + uintptr_t get() { + switch (sampGetVersion()) + { + case SAMPVER::SAMP_037_R1: + return R1; + case SAMPVER::SAMP_037_R3_1: + return R3; + case SAMPVER::SAMP_037_R4_2: + return R4; + default: +#ifdef _DEBUG + assert(0); +#endif + return 0; + } + } +}; + +constexpr SampAddress sampGetAddress(SampAddresses element) +{ +#define ENTRY(name, r1, r3, r4) case SampAddresses::name: return {r1, r3, r4}; + switch (element) + { + ENTRY(CNetGame, 0x21A0F8, 0x26E8DC, 0x26EA0C); + ENTRY(StringWriteEncoder, 0x506B0, 0x53A60, 0x541A0 ); + ENTRY(StringReadDecoder, 0x507E0, 0x53B90, 0x542D0 ); + ENTRY(CompressorPtr, 0x10D894, 0x121914, 0x121A3C); + ENTRY(HandleRpc, 0x372F0, 0x3A6A0, 0x3ADE0 ); + ENTRY(RakClientIntfConstr, 0x33DC0, 0x37170, 0x378B0 ); + ENTRY(alloc_packet, 0x347E0, 0x37B90, 0x382D0 ); + ENTRY(write_lock, 0x35B10, 0x38EC0, 0x39600 ); + ENTRY(write_unlock, 0x35B50, 0x38F00, 0x39640 ); + } +#undef ENTRY +#ifdef _DEBUG + assert(0); +#endif + return { 0, 0 }; } -inline uintptr_t sampGetRakClientInterface() +#define SAMP_OFFSET(name) sampGetAddress(SampAddresses::name).get() + +inline uintptr_t sampGetSampInfoPtr() { - return sampGetSampInfoPtr() + SAMP_OFFSET[1]; + static uintptr_t sampInfo = 0; + if (sampInfo == 0) + sampInfo = *reinterpret_cast(sampGetBase() + SAMP_OFFSET(CNetGame)); + + return sampInfo; } inline uintptr_t sampGetEncodedReaderPtr() { - return sampGetBase() + SAMP_OFFSET[3]; + return sampGetBase() + SAMP_OFFSET(StringReadDecoder); } inline uintptr_t sampGetEncodedWriterPtr() { - return sampGetBase() + SAMP_OFFSET[2]; + return sampGetBase() + SAMP_OFFSET(StringWriteEncoder); } inline uintptr_t sampGetEncodeDecodeBasePtr() { - return *reinterpret_cast(sampGetBase() + SAMP_OFFSET[4]); + return *reinterpret_cast(sampGetBase() + SAMP_OFFSET(CompressorPtr)); } inline uintptr_t sampGetIncomingRpcHandlerPtr() { - return sampGetBase() + SAMP_OFFSET[5]; + return sampGetBase() + SAMP_OFFSET(HandleRpc); } inline uintptr_t sampGetRakClientIntfConstructorPtr() { - return sampGetBase() + SAMP_OFFSET[6]; + return sampGetBase() + SAMP_OFFSET(RakClientIntfConstr); } inline uintptr_t sampGetAllocPacketPtr() { - return sampGetBase() + SAMP_OFFSET[7]; + return sampGetBase() + SAMP_OFFSET(alloc_packet); } inline uintptr_t sampGetWriteLockPtr() { - return sampGetBase() + SAMP_OFFSET[8]; + return sampGetBase() + SAMP_OFFSET(write_lock); } inline uintptr_t sampGetWriteUnlockPtr() { - return sampGetBase() + SAMP_OFFSET[9]; + return sampGetBase() + SAMP_OFFSET(write_unlock); } #undef SAMP_OFFSET diff --git a/src/main.cpp b/src/main.cpp index 388d8d0..fce2954 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -102,7 +102,7 @@ void initBitStream(sol::state_view& lua) #undef INIT_METHOD -#define INIT_FUNCTION(name) lua.set_function(#name, name) +#define INIT_FUNCTION(name) lua.set_function(#name, &name) void defineGlobals(sol::this_state ts) { @@ -226,12 +226,15 @@ RakLua::eInitState getState(sol::this_state ts) sol::table open(sol::this_state ts) { - gRakLua.initialize(); - sol::state_view lua(ts); + if (gRakLua.getState() == RakLua::eInitState::NOT_INITIALIZED && *reinterpret_cast(0xC8D4C0) == 9) + lua["print"]("[RakLua] ERROR! Your game is already started.\n\tThis is inacceptible and RakLua can't work properly as long as RakPeer is already initialized.\n\tPlease, restart your game. RakLua must start together with game and SAMP."); + else + gRakLua.initialize(); + sol::table module = lua.create_table(); - module["VERSION"] = 2.01; + module["VERSION"] = 2.1; module.set_function("getState", &getState); module.set_function("registerHandler", ®isterHandler); diff --git a/src/moonloader-module.vcxproj b/src/moonloader-module.vcxproj index 81e3fe6..6bca95c 100644 --- a/src/moonloader-module.vcxproj +++ b/src/moonloader-module.vcxproj @@ -49,7 +49,7 @@ E:\Games\GTA San Andreas\moonloader\lib\ - false + true E:\Games\GTA San Andreas\moonloader\lib\ @@ -63,7 +63,7 @@ pch.h .\libs\lua;.\libs\sol2;.\libs\samp;.\libs\rtdhook;.\libs\raknet;%(AdditionalIncludeDirectories) /Zc:threadSafeInit- %(AdditionalOptions) - MultiThreaded + MultiThreadedDLL stdcpp17 stdc17 26812 @@ -83,11 +83,11 @@ MaxSpeed true true - WIN32;NDEBUG;_WINDOWS;_USRDLL;LUA_BUILD_AS_DLL;MODULE_NAME=$(ProjectName);%(PreprocessorDefinitions) + WIN32;_DEBUG;_WINDOWS;_USRDLL;LUA_BUILD_AS_DLL;MODULE_NAME=$(ProjectName);%(PreprocessorDefinitions) pch.h .\libs\lua;.\libs\sol2;.\libs\samp;.\libs\rtdhook;.\libs\raknet;%(AdditionalIncludeDirectories) /Zc:threadSafeInit- %(AdditionalOptions) - MultiThreaded + MultiThreadedDebugDLL stdcpp17 stdc17 26812 @@ -95,9 +95,12 @@ Windows true - true - true + + + + .\libs\lua\lua51.lib;%(AdditionalDependencies) + false diff --git a/src/pch.h b/src/pch.h index 9cbf543..491d9f7 100644 --- a/src/pch.h +++ b/src/pch.h @@ -2,12 +2,22 @@ #include +#include "rtdhook.hpp" + +#pragma warning(disable : 26495) // Variable '%variable%' is uninitialized. Always initialize a member variable (type.6). +#pragma warning(disable : 6387) // may be : this does not adhere to the specification for the function +#pragma warning(disable : 6308) // 'realloc' may return null pointer: assigning a null pointer to , which is passed as an argument to 'realloc', will cause the original memory block to be leaked +#pragma warning(disable : 26819) // Unannotated fallthrough between switch labels (es.78). +#pragma warning(disable : 26439) // This kind of function may not throw. Declare it 'noexcept'. + #define SOL_ALL_SAFETIES_ON 1 #include "sol.hpp" -#include "rtdhook.hpp" - #include "BitStream.h" #include "RakClient.h" -#include +#pragma warning(default : 26439) +#pragma warning(default : 26819) +#pragma warning(default : 6308) +#pragma warning(default : 6387) +#pragma warning(default : 26495)