diff options
33 files changed, 208 insertions, 207 deletions
diff --git a/NorthstarDLL/client/audio.cpp b/NorthstarDLL/client/audio.cpp index ea1f6416..9fcac982 100644 --- a/NorthstarDLL/client/audio.cpp +++ b/NorthstarDLL/client/audio.cpp @@ -502,5 +502,5 @@ ON_DLL_LOAD_CLIENT_RELIESON("client.dll", AudioHooks, ConVar, (CModule module)) AUTOHOOK_DISPATCH() Cvar_ns_print_played_sounds = new ConVar("ns_print_played_sounds", "0", FCVAR_NONE, ""); - MilesStopAll = module.Offset(0x580850).As<MilesStopAll_Type>(); + MilesStopAll = module.Offset(0x580850).RCast<MilesStopAll_Type>(); } diff --git a/NorthstarDLL/client/chatcommand.cpp b/NorthstarDLL/client/chatcommand.cpp index c1ad1b3b..9cf34e43 100644 --- a/NorthstarDLL/client/chatcommand.cpp +++ b/NorthstarDLL/client/chatcommand.cpp @@ -28,7 +28,8 @@ void ConCommand_log(const CCommand& args) ON_DLL_LOAD_CLIENT_RELIESON("engine.dll", ClientChatCommand, ConCommand, (CModule module)) { - ClientSayText = module.Offset(0x54780).As<void(__fastcall*)(void* a1, const char* message, uint64_t isIngameChat, bool isTeamChat)>(); + ClientSayText = + module.Offset(0x54780).RCast<void(__fastcall*)(void* a1, const char* message, uint64_t isIngameChat, bool isTeamChat)>(); RegisterConCommand("say", ConCommand_say, "Enters a message in public chat", FCVAR_CLIENTDLL); RegisterConCommand("say_team", ConCommand_say_team, "Enters a message in team chat", FCVAR_CLIENTDLL); RegisterConCommand("log", ConCommand_log, "Log a message to the local chat window", FCVAR_CLIENTDLL); diff --git a/NorthstarDLL/client/clientauthhooks.cpp b/NorthstarDLL/client/clientauthhooks.cpp index 7fca9581..e66da6c8 100644 --- a/NorthstarDLL/client/clientauthhooks.cpp +++ b/NorthstarDLL/client/clientauthhooks.cpp @@ -52,7 +52,7 @@ ON_DLL_LOAD_CLIENT_RELIESON("engine.dll", ClientAuthHooks, ConVar, (CModule modu { AUTOHOOK_DISPATCH() - p3PToken = module.Offset(0x13979D80).As<char*>(); + p3PToken = module.Offset(0x13979D80).RCast<char*>(); // this cvar will save to cfg once initially agreed with Cvar_ns_has_agreed_to_send_token = new ConVar( diff --git a/NorthstarDLL/client/debugoverlay.cpp b/NorthstarDLL/client/debugoverlay.cpp index e3a9292d..cdb14693 100644 --- a/NorthstarDLL/client/debugoverlay.cpp +++ b/NorthstarDLL/client/debugoverlay.cpp @@ -127,13 +127,13 @@ ON_DLL_LOAD_CLIENT_RELIESON("engine.dll", DebugOverlay, ConVar, (CModule module) { AUTOHOOK_DISPATCH() - RenderLine = module.Offset(0x192A70).As<RenderLineType>(); - RenderBox = module.Offset(0x192520).As<RenderBoxType>(); - RenderWireframeBox = module.Offset(0x193DA0).As<RenderBoxType>(); + RenderLine = module.Offset(0x192A70).RCast<RenderLineType>(); + RenderBox = module.Offset(0x192520).RCast<RenderBoxType>(); + RenderWireframeBox = module.Offset(0x193DA0).RCast<RenderBoxType>(); sEngineModule = reinterpret_cast<HMODULE>(module.m_nAddress); // not in g_pCVar->FindVar by this point for whatever reason, so have to get from memory - ConVar* Cvar_enable_debug_overlays = module.Offset(0x10DB0990).As<ConVar*>(); + ConVar* Cvar_enable_debug_overlays = module.Offset(0x10DB0990).RCast<ConVar*>(); Cvar_enable_debug_overlays->SetValue(false); Cvar_enable_debug_overlays->m_pszDefaultValue = (char*)"0"; Cvar_enable_debug_overlays->AddFlags(FCVAR_CHEAT); diff --git a/NorthstarDLL/client/localchatwriter.cpp b/NorthstarDLL/client/localchatwriter.cpp index 57fe98a2..848d898f 100644 --- a/NorthstarDLL/client/localchatwriter.cpp +++ b/NorthstarDLL/client/localchatwriter.cpp @@ -440,10 +440,10 @@ void LocalChatWriter::InsertDefaultFade() ON_DLL_LOAD_CLIENT("client.dll", LocalChatWriter, (CModule module)) { - gGameSettings = module.Offset(0x11BAA48).As<CGameSettings**>(); - gChatFadeLength = module.Offset(0x11BAB78).As<CGameFloatVar**>(); - gChatFadeSustain = module.Offset(0x11BAC08).As<CGameFloatVar**>(); - CHudChat::allHuds = module.Offset(0x11BA9E8).As<CHudChat**>(); + gGameSettings = module.Offset(0x11BAA48).RCast<CGameSettings**>(); + gChatFadeLength = module.Offset(0x11BAB78).RCast<CGameFloatVar**>(); + gChatFadeSustain = module.Offset(0x11BAC08).RCast<CGameFloatVar**>(); + CHudChat::allHuds = module.Offset(0x11BA9E8).RCast<CHudChat**>(); - ConvertANSIToUnicode = module.Offset(0x7339A0).As<ConvertANSIToUnicodeType>(); + ConvertANSIToUnicode = module.Offset(0x7339A0).RCast<ConvertANSIToUnicodeType>(); } diff --git a/NorthstarDLL/client/r2client.cpp b/NorthstarDLL/client/r2client.cpp index fabc0dc6..fea97d8e 100644 --- a/NorthstarDLL/client/r2client.cpp +++ b/NorthstarDLL/client/r2client.cpp @@ -12,8 +12,8 @@ namespace R2 ON_DLL_LOAD("engine.dll", R2EngineClient, (CModule module)) { - g_pLocalPlayerUserID = module.Offset(0x13F8E688).As<char*>(); - g_pLocalPlayerOriginToken = module.Offset(0x13979C80).As<char*>(); + g_pLocalPlayerUserID = module.Offset(0x13F8E688).RCast<char*>(); + g_pLocalPlayerOriginToken = module.Offset(0x13979C80).RCast<char*>(); - GetBaseLocalClient = module.Offset(0x78200).As<GetBaseLocalClientType>(); + GetBaseLocalClient = module.Offset(0x78200).RCast<GetBaseLocalClientType>(); } diff --git a/NorthstarDLL/core/convar/concommand.cpp b/NorthstarDLL/core/convar/concommand.cpp index ce198159..732e0d1f 100644 --- a/NorthstarDLL/core/convar/concommand.cpp +++ b/NorthstarDLL/core/convar/concommand.cpp @@ -148,7 +148,7 @@ void RegisterConCommand( ON_DLL_LOAD("engine.dll", ConCommand, (CModule module)) { - ConCommandConstructor = module.Offset(0x415F60).As<ConCommandConstructorType>(); + ConCommandConstructor = module.Offset(0x415F60).RCast<ConCommandConstructorType>(); AddMiscConCommands(); g_pPluginCommunicationhandler->m_sEngineData.ConCommandConstructor = (void*)ConCommandConstructor; diff --git a/NorthstarDLL/core/convar/convar.cpp b/NorthstarDLL/core/convar/convar.cpp index 5069192e..9aaaca66 100644 --- a/NorthstarDLL/core/convar/convar.cpp +++ b/NorthstarDLL/core/convar/convar.cpp @@ -31,8 +31,8 @@ void* g_pIConVar_Vtable = nullptr; //----------------------------------------------------------------------------- ON_DLL_LOAD("engine.dll", ConVar, (CModule module)) { - conVarMalloc = module.Offset(0x415C20).As<ConVarMallocType>(); - conVarRegister = module.Offset(0x417230).As<ConVarRegisterType>(); + conVarMalloc = module.Offset(0x415C20).RCast<ConVarMallocType>(); + conVarRegister = module.Offset(0x417230).RCast<ConVarRegisterType>(); g_pConVar_Vtable = module.Offset(0x67FD28); g_pIConVar_Vtable = module.Offset(0x67FDC8); diff --git a/NorthstarDLL/core/filesystem/rpakfilesystem.cpp b/NorthstarDLL/core/filesystem/rpakfilesystem.cpp index e42d6826..8d50b07a 100644 --- a/NorthstarDLL/core/filesystem/rpakfilesystem.cpp +++ b/NorthstarDLL/core/filesystem/rpakfilesystem.cpp @@ -338,8 +338,8 @@ ON_DLL_LOAD("engine.dll", RpakFilesystem, (CModule module)) g_pPakLoadManager = new PakLoadManager; - g_pakLoadApi = module.Offset(0x5BED78).Deref().As<PakLoadFuncs*>(); - pUnknownPakLoadSingleton = module.Offset(0x7C5E20).As<void**>(); + g_pakLoadApi = module.Offset(0x5BED78).Deref().RCast<PakLoadFuncs*>(); + pUnknownPakLoadSingleton = module.Offset(0x7C5E20).RCast<void**>(); LoadPakAsyncHook.Dispatch((LPVOID*)g_pakLoadApi->LoadPakAsync); UnloadPakHook.Dispatch((LPVOID*)g_pakLoadApi->UnloadPak); diff --git a/NorthstarDLL/core/memory.cpp b/NorthstarDLL/core/memory.cpp index 7bd87d70..3770586f 100644 --- a/NorthstarDLL/core/memory.cpp +++ b/NorthstarDLL/core/memory.cpp @@ -1,93 +1,93 @@ #include "memory.h" -MemoryAddress::MemoryAddress() : m_nAddress(0) {} -MemoryAddress::MemoryAddress(const uintptr_t nAddress) : m_nAddress(nAddress) {} -MemoryAddress::MemoryAddress(const void* pAddress) : m_nAddress(reinterpret_cast<uintptr_t>(pAddress)) {} +CMemoryAddress::CMemoryAddress() : m_nAddress(0) {} +CMemoryAddress::CMemoryAddress(const uintptr_t nAddress) : m_nAddress(nAddress) {} +CMemoryAddress::CMemoryAddress(const void* pAddress) : m_nAddress(reinterpret_cast<uintptr_t>(pAddress)) {} // operators -MemoryAddress::operator uintptr_t() const +CMemoryAddress::operator uintptr_t() const { return m_nAddress; } -MemoryAddress::operator void*() const +CMemoryAddress::operator void*() const { return reinterpret_cast<void*>(m_nAddress); } -MemoryAddress::operator bool() const +CMemoryAddress::operator bool() const { return m_nAddress != 0; } -bool MemoryAddress::operator==(const MemoryAddress& other) const +bool CMemoryAddress::operator==(const CMemoryAddress& other) const { return m_nAddress == other.m_nAddress; } -bool MemoryAddress::operator!=(const MemoryAddress& other) const +bool CMemoryAddress::operator!=(const CMemoryAddress& other) const { return m_nAddress != other.m_nAddress; } -bool MemoryAddress::operator==(const uintptr_t& addr) const +bool CMemoryAddress::operator==(const uintptr_t& addr) const { return m_nAddress == addr; } -bool MemoryAddress::operator!=(const uintptr_t& addr) const +bool CMemoryAddress::operator!=(const uintptr_t& addr) const { return m_nAddress != addr; } -MemoryAddress MemoryAddress::operator+(const MemoryAddress& other) const +CMemoryAddress CMemoryAddress::operator+(const CMemoryAddress& other) const { return Offset(other.m_nAddress); } -MemoryAddress MemoryAddress::operator-(const MemoryAddress& other) const +CMemoryAddress CMemoryAddress::operator-(const CMemoryAddress& other) const { - return MemoryAddress(m_nAddress - other.m_nAddress); + return CMemoryAddress(m_nAddress - other.m_nAddress); } -MemoryAddress MemoryAddress::operator+(const uintptr_t& addr) const +CMemoryAddress CMemoryAddress::operator+(const uintptr_t& addr) const { return Offset(addr); } -MemoryAddress MemoryAddress::operator-(const uintptr_t& addr) const +CMemoryAddress CMemoryAddress::operator-(const uintptr_t& addr) const { - return MemoryAddress(m_nAddress - addr); + return CMemoryAddress(m_nAddress - addr); } -MemoryAddress MemoryAddress::operator*() const +CMemoryAddress CMemoryAddress::operator*() const { return Deref(); } // traversal -MemoryAddress MemoryAddress::Offset(const uintptr_t nOffset) const +CMemoryAddress CMemoryAddress::Offset(const uintptr_t nOffset) const { - return MemoryAddress(m_nAddress + nOffset); + return CMemoryAddress(m_nAddress + nOffset); } -MemoryAddress MemoryAddress::Deref(const int nNumDerefs) const +CMemoryAddress CMemoryAddress::Deref(const int nNumDerefs) const { uintptr_t ret = m_nAddress; for (int i = 0; i < nNumDerefs; i++) ret = *reinterpret_cast<uintptr_t*>(ret); - return MemoryAddress(ret); + return CMemoryAddress(ret); } // patching -void MemoryAddress::Patch(const uint8_t* pBytes, const size_t nSize) +void CMemoryAddress::Patch(const uint8_t* pBytes, const size_t nSize) { if (nSize) WriteProcessMemory(GetCurrentProcess(), reinterpret_cast<LPVOID>(m_nAddress), pBytes, nSize, NULL); } -void MemoryAddress::Patch(const std::initializer_list<uint8_t> bytes) +void CMemoryAddress::Patch(const std::initializer_list<uint8_t> bytes) { uint8_t* pBytes = new uint8_t[bytes.size()]; @@ -146,13 +146,13 @@ inline std::vector<uint8_t> HexBytesToString(const char* pHexString) return ret; } -void MemoryAddress::Patch(const char* pBytes) +void CMemoryAddress::Patch(const char* pBytes) { std::vector<uint8_t> vBytes = HexBytesToString(pBytes); Patch(vBytes.data(), vBytes.size()); } -void MemoryAddress::NOP(const size_t nSize) +void CMemoryAddress::NOP(const size_t nSize) { uint8_t* pBytes = new uint8_t[nSize]; @@ -162,7 +162,7 @@ void MemoryAddress::NOP(const size_t nSize) delete[] pBytes; } -bool MemoryAddress::IsMemoryReadable(const size_t nSize) +bool CMemoryAddress::IsMemoryReadable(const size_t nSize) { static SYSTEM_INFO sysInfo; if (!sysInfo.dwPageSize) @@ -218,15 +218,15 @@ CModule::CModule(const HMODULE pModule) CModule::CModule(const char* pModuleName) : CModule(GetModuleHandleA(pModuleName)) {} -MemoryAddress CModule::GetExport(const char* pExportName) +CMemoryAddress CModule::GetExport(const char* pExportName) { - return MemoryAddress(reinterpret_cast<uintptr_t>(GetProcAddress(reinterpret_cast<HMODULE>(m_nAddress), pExportName))); + return CMemoryAddress(reinterpret_cast<uintptr_t>(GetProcAddress(reinterpret_cast<HMODULE>(m_nAddress), pExportName))); } -MemoryAddress CModule::FindPattern(const uint8_t* pPattern, const char* pMask) +CMemoryAddress CModule::FindPattern(const uint8_t* pPattern, const char* pMask) { if (!m_ExecutableCode.IsSectionValid()) - return MemoryAddress(); + return CMemoryAddress(); uint64_t nBase = static_cast<uint64_t>(m_ExecutableCode.m_pSectionBase); uint64_t nSize = static_cast<uint64_t>(m_ExecutableCode.m_nSectionSize); @@ -267,21 +267,21 @@ MemoryAddress CModule::FindPattern(const uint8_t* pPattern, const char* pMask) { if ((i + 1) == iNumMasks) { - return MemoryAddress(const_cast<uint8_t*>(pData)); + return CMemoryAddress(const_cast<uint8_t*>(pData)); } } else goto CONTINUE; } - return MemoryAddress((&*(const_cast<uint8_t*>(pData)))); + return CMemoryAddress((&*(const_cast<uint8_t*>(pData)))); } } CONTINUE:; } - return MemoryAddress(); + return CMemoryAddress(); } inline std::pair<std::vector<uint8_t>, std::string> MaskedBytesFromPattern(const char* pPatternString) @@ -340,7 +340,7 @@ inline std::pair<std::vector<uint8_t>, std::string> MaskedBytesFromPattern(const return std::make_pair(vRet, sMask); } -MemoryAddress CModule::FindPattern(const char* pPattern) +CMemoryAddress CModule::FindPattern(const char* pPattern) { const auto pattern = MaskedBytesFromPattern(pPattern); return FindPattern(pattern.first.data(), pattern.second.c_str()); diff --git a/NorthstarDLL/core/memory.h b/NorthstarDLL/core/memory.h index 38c76cb3..db0a38b3 100644 --- a/NorthstarDLL/core/memory.h +++ b/NorthstarDLL/core/memory.h @@ -1,39 +1,39 @@ #pragma once -class MemoryAddress +class CMemoryAddress { public: uintptr_t m_nAddress; public: - MemoryAddress(); - MemoryAddress(const uintptr_t nAddress); - MemoryAddress(const void* pAddress); + CMemoryAddress(); + CMemoryAddress(const uintptr_t nAddress); + CMemoryAddress(const void* pAddress); // operators operator uintptr_t() const; operator void*() const; operator bool() const; - bool operator==(const MemoryAddress& other) const; - bool operator!=(const MemoryAddress& other) const; + bool operator==(const CMemoryAddress& other) const; + bool operator!=(const CMemoryAddress& other) const; bool operator==(const uintptr_t& addr) const; bool operator!=(const uintptr_t& addr) const; - MemoryAddress operator+(const MemoryAddress& other) const; - MemoryAddress operator-(const MemoryAddress& other) const; - MemoryAddress operator+(const uintptr_t& other) const; - MemoryAddress operator-(const uintptr_t& other) const; - MemoryAddress operator*() const; + CMemoryAddress operator+(const CMemoryAddress& other) const; + CMemoryAddress operator-(const CMemoryAddress& other) const; + CMemoryAddress operator+(const uintptr_t& other) const; + CMemoryAddress operator-(const uintptr_t& other) const; + CMemoryAddress operator*() const; - template <typename T> T As() + template <typename T> T RCast() { return reinterpret_cast<T>(m_nAddress); } // traversal - MemoryAddress Offset(const uintptr_t nOffset) const; - MemoryAddress Deref(const int nNumDerefs = 1) const; + CMemoryAddress Offset(const uintptr_t nOffset) const; + CMemoryAddress Deref(const int nNumDerefs = 1) const; // patching void Patch(const uint8_t* pBytes, const size_t nSize); @@ -45,7 +45,7 @@ class MemoryAddress }; // based on https://github.com/Mauler125/r5sdk/blob/master/r5dev/public/include/module.h -class CModule : public MemoryAddress +class CModule : public CMemoryAddress { public: struct ModuleSections_t @@ -84,7 +84,7 @@ class CModule : public MemoryAddress CModule(const HMODULE pModule); CModule(const char* pModuleName); - MemoryAddress GetExport(const char* pExportName); - MemoryAddress FindPattern(const uint8_t* pPattern, const char* pMask); - MemoryAddress FindPattern(const char* pPattern); + CMemoryAddress GetExport(const char* pExportName); + CMemoryAddress FindPattern(const uint8_t* pPattern, const char* pMask); + CMemoryAddress FindPattern(const char* pPattern); }; diff --git a/NorthstarDLL/core/tier0.cpp b/NorthstarDLL/core/tier0.cpp index cbad3ec0..3b9996a1 100644 --- a/NorthstarDLL/core/tier0.cpp +++ b/NorthstarDLL/core/tier0.cpp @@ -29,8 +29,8 @@ ON_DLL_LOAD("tier0.dll", Tier0GameFuncs, (CModule module)) TryCreateGlobalMemAlloc(); // setup tier0 funcs - Tier0::Error = module.GetExport("Error").As<Tier0::ErrorType>(); - Tier0::CommandLine = module.GetExport("CommandLine").As<Tier0::CommandLineType>(); - Tier0::Plat_FloatTime = module.GetExport("Plat_FloatTime").As<Tier0::Plat_FloatTimeType>(); - Tier0::ThreadInServerFrameThread = module.GetExport("ThreadInServerFrameThread").As<Tier0::ThreadInServerFrameThreadType>(); + Tier0::Error = module.GetExport("Error").RCast<Tier0::ErrorType>(); + Tier0::CommandLine = module.GetExport("CommandLine").RCast<Tier0::CommandLineType>(); + Tier0::Plat_FloatTime = module.GetExport("Plat_FloatTime").RCast<Tier0::Plat_FloatTimeType>(); + Tier0::ThreadInServerFrameThread = module.GetExport("ThreadInServerFrameThread").RCast<Tier0::ThreadInServerFrameThreadType>(); } diff --git a/NorthstarDLL/dedicated/dedicated.cpp b/NorthstarDLL/dedicated/dedicated.cpp index a28de0ec..34282f51 100644 --- a/NorthstarDLL/dedicated/dedicated.cpp +++ b/NorthstarDLL/dedicated/dedicated.cpp @@ -137,7 +137,7 @@ ON_DLL_LOAD_DEDI_RELIESON("engine.dll", DedicatedServer, ServerPresence, (CModul { // CModAppSystemGroup::Create // force the engine into dedicated mode by changing the first comparison to IsServerOnly to an assignment - MemoryAddress base = module.Offset(0x1C4EBD); + CMemoryAddress base = module.Offset(0x1C4EBD); // cmp => mov base.Offset(1).Patch("C6 87"); @@ -203,7 +203,7 @@ ON_DLL_LOAD_DEDI_RELIESON("engine.dll", DedicatedServer, ServerPresence, (CModul dedicatedExports->Sys_Printf = Sys_Printf; dedicatedExports->RunServer = RunServer; - *module.Offset(0x13F0B668).As<CDedicatedExports**>() = dedicatedExports; + *module.Offset(0x13F0B668).RCast<CDedicatedExports**>() = dedicatedExports; // extra potential patches: // nop engine.dll+1c67d1 and +1c67d8 to skip videomode creategamewindow diff --git a/NorthstarDLL/dedicated/dedicatedlogtoclient.cpp b/NorthstarDLL/dedicated/dedicatedlogtoclient.cpp index bb62cb36..8d19372f 100644 --- a/NorthstarDLL/dedicated/dedicatedlogtoclient.cpp +++ b/NorthstarDLL/dedicated/dedicatedlogtoclient.cpp @@ -45,5 +45,5 @@ void DedicatedServerLogToClientSink::flush_() {} ON_DLL_LOAD_DEDI("engine.dll", DedicatedServerLogToClient, (CModule module)) { - CGameClient__ClientPrintf = module.Offset(0x1016A0).As<void (*)(R2::CBaseClient*, const char*, ...)>(); + CGameClient__ClientPrintf = module.Offset(0x1016A0).RCast<void (*)(R2::CBaseClient*, const char*, ...)>(); } diff --git a/NorthstarDLL/engine/hoststate.cpp b/NorthstarDLL/engine/hoststate.cpp index 50862e99..2ad21fcf 100644 --- a/NorthstarDLL/engine/hoststate.cpp +++ b/NorthstarDLL/engine/hoststate.cpp @@ -194,5 +194,5 @@ ON_DLL_LOAD_RELIESON("engine.dll", HostState, ConVar, (CModule module)) { AUTOHOOK_DISPATCH() - g_pHostState = module.Offset(0x7CF180).As<CHostState*>(); + g_pHostState = module.Offset(0x7CF180).RCast<CHostState*>(); } diff --git a/NorthstarDLL/engine/r2engine.cpp b/NorthstarDLL/engine/r2engine.cpp index 303cfaf8..67a628fd 100644 --- a/NorthstarDLL/engine/r2engine.cpp +++ b/NorthstarDLL/engine/r2engine.cpp @@ -26,18 +26,18 @@ namespace R2 ON_DLL_LOAD("engine.dll", R2Engine, (CModule module)) { - Cbuf_GetCurrentPlayer = module.Offset(0x120630).As<Cbuf_GetCurrentPlayerType>(); - Cbuf_AddText = module.Offset(0x1203B0).As<Cbuf_AddTextType>(); - Cbuf_Execute = module.Offset(0x1204B0).As<Cbuf_ExecuteType>(); + Cbuf_GetCurrentPlayer = module.Offset(0x120630).RCast<Cbuf_GetCurrentPlayerType>(); + Cbuf_AddText = module.Offset(0x1203B0).RCast<Cbuf_AddTextType>(); + Cbuf_Execute = module.Offset(0x1204B0).RCast<Cbuf_ExecuteType>(); - CCommand__Tokenize = module.Offset(0x418380).As<bool (*)(CCommand&, const char*, R2::cmd_source_t)>(); + CCommand__Tokenize = module.Offset(0x418380).RCast<bool (*)(CCommand&, const char*, R2::cmd_source_t)>(); - g_pEngine = module.Offset(0x7D70C8).Deref().As<CEngine*>(); + g_pEngine = module.Offset(0x7D70C8).Deref().RCast<CEngine*>(); - CBaseClient__Disconnect = module.Offset(0x1012C0).As<void (*)(void*, uint32_t, const char*, ...)>(); - g_pClientArray = module.Offset(0x12A53F90).As<CBaseClient*>(); + CBaseClient__Disconnect = module.Offset(0x1012C0).RCast<void (*)(void*, uint32_t, const char*, ...)>(); + g_pClientArray = module.Offset(0x12A53F90).RCast<CBaseClient*>(); - g_pServerState = module.Offset(0x12A53D48).As<server_state_t*>(); + g_pServerState = module.Offset(0x12A53D48).RCast<server_state_t*>(); - g_pGlobals = module.Offset(0x7C6F70).As<CGlobalVars*>(); + g_pGlobals = module.Offset(0x7C6F70).RCast<CGlobalVars*>(); } diff --git a/NorthstarDLL/logging/loghooks.cpp b/NorthstarDLL/logging/loghooks.cpp index 805a5125..53a85c1b 100644 --- a/NorthstarDLL/logging/loghooks.cpp +++ b/NorthstarDLL/logging/loghooks.cpp @@ -257,5 +257,5 @@ ON_DLL_LOAD_CLIENT_RELIESON("client.dll", ClientPrintHooks, ConVar, (CModule mod AUTOHOOK_DISPATCH_MODULE(client.dll) Cvar_cl_showtextmsg = new ConVar("cl_showtextmsg", "1", FCVAR_NONE, "Enable/disable text messages printing on the screen."); - pInternalCenterPrint = module.Offset(0x216E940).As<ICenterPrint*>(); + pInternalCenterPrint = module.Offset(0x216E940).RCast<ICenterPrint*>(); } diff --git a/NorthstarDLL/scripts/client/scriptbrowserhooks.cpp b/NorthstarDLL/scripts/client/scriptbrowserhooks.cpp index 1462e57f..86b4a356 100644 --- a/NorthstarDLL/scripts/client/scriptbrowserhooks.cpp +++ b/NorthstarDLL/scripts/client/scriptbrowserhooks.cpp @@ -20,5 +20,5 @@ ON_DLL_LOAD_CLIENT("engine.dll", ScriptExternalBrowserHooks, (CModule module)) { AUTOHOOK_DISPATCH() - bIsOriginOverlayEnabled = module.Offset(0x13978255).As<bool*>(); + bIsOriginOverlayEnabled = module.Offset(0x13978255).RCast<bool*>(); } diff --git a/NorthstarDLL/scripts/scriptdatatables.cpp b/NorthstarDLL/scripts/scriptdatatables.cpp index 8a2935c2..8aa52fdb 100644 --- a/NorthstarDLL/scripts/scriptdatatables.cpp +++ b/NorthstarDLL/scripts/scriptdatatables.cpp @@ -887,12 +887,12 @@ void ConCommand_dump_datatables(const CCommand& args) ON_DLL_LOAD_RELIESON("server.dll", ServerScriptDatatables, ServerSquirrel, (CModule module)) { - SQ_GetDatatableInternal<ScriptContext::SERVER> = module.Offset(0x1250f0).As<Datatable* (*)(HSquirrelVM*)>(); + SQ_GetDatatableInternal<ScriptContext::SERVER> = module.Offset(0x1250f0).RCast<Datatable* (*)(HSquirrelVM*)>(); } ON_DLL_LOAD_RELIESON("client.dll", ClientScriptDatatables, ClientSquirrel, (CModule module)) { - SQ_GetDatatableInternal<ScriptContext::CLIENT> = module.Offset(0x1C9070).As<Datatable* (*)(HSquirrelVM*)>(); + SQ_GetDatatableInternal<ScriptContext::CLIENT> = module.Offset(0x1C9070).RCast<Datatable* (*)(HSquirrelVM*)>(); SQ_GetDatatableInternal<ScriptContext::UI> = SQ_GetDatatableInternal<ScriptContext::CLIENT>; } diff --git a/NorthstarDLL/server/alltalk.cpp b/NorthstarDLL/server/alltalk.cpp index 6283a1a2..d71b0bae 100644 --- a/NorthstarDLL/server/alltalk.cpp +++ b/NorthstarDLL/server/alltalk.cpp @@ -15,7 +15,7 @@ size_t __fastcall ShouldAllowAlltalk() ON_DLL_LOAD_RELIESON("engine.dll", ServerAllTalk, ConVar, (CModule module)) { // replace strcmp function called in CClient::ProcessVoiceData with our own code that calls ShouldAllowAllTalk - MemoryAddress base = module.Offset(0x1085FA); + CMemoryAddress base = module.Offset(0x1085FA); base.Patch("48 B8"); // mov rax, 64 bit int // (uint8_t*)&ShouldAllowAlltalk doesn't work for some reason? need to make it a uint64 first diff --git a/NorthstarDLL/server/auth/serverauthentication.cpp b/NorthstarDLL/server/auth/serverauthentication.cpp index 8f62e1dd..d5653dcc 100644 --- a/NorthstarDLL/server/auth/serverauthentication.cpp +++ b/NorthstarDLL/server/auth/serverauthentication.cpp @@ -368,7 +368,7 @@ ON_DLL_LOAD_RELIESON("engine.dll", ServerAuthentication, (ConCommand, ConVar), ( // patch to disable fairfight marking players as cheaters and kicking them module.Offset(0x101012).Patch("E9 90 00"); - CBaseServer__RejectConnection = module.Offset(0x1182E0).As<CBaseServer__RejectConnectionType>(); + CBaseServer__RejectConnection = module.Offset(0x1182E0).RCast<CBaseServer__RejectConnectionType>(); if (Tier0::CommandLine()->CheckParm("-allowdupeaccounts")) { diff --git a/NorthstarDLL/server/buildainfile.cpp b/NorthstarDLL/server/buildainfile.cpp index 848d8569..d0143295 100644 --- a/NorthstarDLL/server/buildainfile.cpp +++ b/NorthstarDLL/server/buildainfile.cpp @@ -388,8 +388,8 @@ ON_DLL_LOAD("server.dll", BuildAINFile, (CModule module)) Cvar_ns_ai_dumpAINfileFromLoad = new ConVar( "ns_ai_dumpAINfileFromLoad", "0", FCVAR_NONE, "For debugging: whether we should dump ain data for ains loaded from disk"); - pUnkStruct0Count = module.Offset(0x1063BF8).As<int*>(); - pppUnkNodeStruct0s = module.Offset(0x1063BE0).As<UnkNodeStruct0***>(); - pUnkLinkStruct1Count = module.Offset(0x1063AA8).As<int*>(); - pppUnkStruct1s = module.Offset(0x1063A90).As<UnkLinkStruct1***>(); + pUnkStruct0Count = module.Offset(0x1063BF8).RCast<int*>(); + pppUnkNodeStruct0s = module.Offset(0x1063BE0).RCast<UnkNodeStruct0***>(); + pUnkLinkStruct1Count = module.Offset(0x1063AA8).RCast<int*>(); + pppUnkStruct1s = module.Offset(0x1063A90).RCast<UnkLinkStruct1***>(); } diff --git a/NorthstarDLL/server/r2server.cpp b/NorthstarDLL/server/r2server.cpp index a8aa84ce..cf7add0d 100644 --- a/NorthstarDLL/server/r2server.cpp +++ b/NorthstarDLL/server/r2server.cpp @@ -11,6 +11,6 @@ namespace R2 ON_DLL_LOAD("server.dll", R2GameServer, (CModule module)) { - Server_GetEntityByIndex = module.Offset(0xFB820).As<CBaseEntity* (*)(int)>(); - UTIL_PlayerByIndex = module.Offset(0x26AA10).As<CBasePlayer*(__fastcall*)(int)>(); + Server_GetEntityByIndex = module.Offset(0xFB820).RCast<CBaseEntity* (*)(int)>(); + UTIL_PlayerByIndex = module.Offset(0x26AA10).RCast<CBasePlayer*(__fastcall*)(int)>(); } diff --git a/NorthstarDLL/server/serverchathooks.cpp b/NorthstarDLL/server/serverchathooks.cpp index 96765697..cb3af244 100644 --- a/NorthstarDLL/server/serverchathooks.cpp +++ b/NorthstarDLL/server/serverchathooks.cpp @@ -151,7 +151,7 @@ ADD_SQFUNC( ON_DLL_LOAD("engine.dll", EngineServerChatHooks, (CModule module)) { - g_pServerGameDLL = module.Offset(0x13F0AA98).As<CServerGameDLL*>(); + g_pServerGameDLL = module.Offset(0x13F0AA98).RCast<CServerGameDLL*>(); } ON_DLL_LOAD_RELIESON("server.dll", ServerChatHooks, ServerSquirrel, (CModule module)) @@ -159,16 +159,16 @@ ON_DLL_LOAD_RELIESON("server.dll", ServerChatHooks, ServerSquirrel, (CModule mod AUTOHOOK_DISPATCH_MODULE(server.dll) CServerGameDLL__OnReceivedSayTextMessage = - module.Offset(0x1595C0).As<void(__fastcall*)(CServerGameDLL*, unsigned int, const char*, int)>(); - CRecipientFilter__Construct = module.Offset(0x1E9440).As<void(__fastcall*)(CRecipientFilter*)>(); - CRecipientFilter__Destruct = module.Offset(0x1E9700).As<void(__fastcall*)(CRecipientFilter*)>(); - CRecipientFilter__AddAllPlayers = module.Offset(0x1E9940).As<void(__fastcall*)(CRecipientFilter*)>(); - CRecipientFilter__AddRecipient = module.Offset(0x1E9B30).As<void(__fastcall*)(CRecipientFilter*, const R2::CBasePlayer*)>(); - CRecipientFilter__MakeReliable = module.Offset(0x1EA4E0).As<void(__fastcall*)(CRecipientFilter*)>(); - - UserMessageBegin = module.Offset(0x15C520).As<void(__fastcall*)(CRecipientFilter*, const char*)>(); - MessageEnd = module.Offset(0x158880).As<void(__fastcall*)()>(); - MessageWriteByte = module.Offset(0x158A90).As<void(__fastcall*)(int)>(); - MessageWriteString = module.Offset(0x158D00).As<void(__fastcall*)(const char*)>(); - MessageWriteBool = module.Offset(0x158A00).As<void(__fastcall*)(bool)>(); + module.Offset(0x1595C0).RCast<void(__fastcall*)(CServerGameDLL*, unsigned int, const char*, int)>(); + CRecipientFilter__Construct = module.Offset(0x1E9440).RCast<void(__fastcall*)(CRecipientFilter*)>(); + CRecipientFilter__Destruct = module.Offset(0x1E9700).RCast<void(__fastcall*)(CRecipientFilter*)>(); + CRecipientFilter__AddAllPlayers = module.Offset(0x1E9940).RCast<void(__fastcall*)(CRecipientFilter*)>(); + CRecipientFilter__AddRecipient = module.Offset(0x1E9B30).RCast<void(__fastcall*)(CRecipientFilter*, const R2::CBasePlayer*)>(); + CRecipientFilter__MakeReliable = module.Offset(0x1EA4E0).RCast<void(__fastcall*)(CRecipientFilter*)>(); + + UserMessageBegin = module.Offset(0x15C520).RCast<void(__fastcall*)(CRecipientFilter*, const char*)>(); + MessageEnd = module.Offset(0x158880).RCast<void(__fastcall*)()>(); + MessageWriteByte = module.Offset(0x158A90).RCast<void(__fastcall*)(int)>(); + MessageWriteString = module.Offset(0x158D00).RCast<void(__fastcall*)(const char*)>(); + MessageWriteBool = module.Offset(0x158A00).RCast<void(__fastcall*)(bool)>(); } diff --git a/NorthstarDLL/server/serverpresence.cpp b/NorthstarDLL/server/serverpresence.cpp index 945f5810..ed9185c1 100644 --- a/NorthstarDLL/server/serverpresence.cpp +++ b/NorthstarDLL/server/serverpresence.cpp @@ -224,5 +224,5 @@ void ServerPresenceManager::SetPlayerCount(const int iPlayerCount) ON_DLL_LOAD_RELIESON("engine.dll", ServerPresence, ConVar, (CModule module)) { g_pServerPresence->CreateConVars(); - Cvar_hostname = module.Offset(0x1315BAE8).Deref().As<ConVar*>(); + Cvar_hostname = module.Offset(0x1315BAE8).Deref().RCast<ConVar*>(); } diff --git a/NorthstarDLL/shared/exploit_fixes/exploitfixes.cpp b/NorthstarDLL/shared/exploit_fixes/exploitfixes.cpp index 338de306..2a0a9c2c 100644 --- a/NorthstarDLL/shared/exploit_fixes/exploitfixes.cpp +++ b/NorthstarDLL/shared/exploit_fixes/exploitfixes.cpp @@ -98,7 +98,7 @@ bool, __fastcall, (void* pMsg)) // 48 8B D1 48 8B 49 18 48 8B 01 48 FF 60 10 auto entry = msg->m_ConVars + i; // Safety check for memory access - if (MemoryAddress(entry).IsMemoryReadable(sizeof(*entry))) + if (CMemoryAddress(entry).IsMemoryReadable(sizeof(*entry))) { // Find null terminators bool nameValid = false, valValid = false; @@ -405,9 +405,9 @@ ON_DLL_LOAD("engine.dll", EngineExploitFixes, (CModule module)) // patch to set bWasWritingStringTableSuccessful in CNetworkStringTableContainer::WriteBaselines if it fails { - MemoryAddress writeAddress(&bWasWritingStringTableSuccessful - module.Offset(0x234EDC).m_nAddress); + CMemoryAddress writeAddress(&bWasWritingStringTableSuccessful - module.Offset(0x234EDC).m_nAddress); - MemoryAddress addr = module.Offset(0x234ED2); + CMemoryAddress addr = module.Offset(0x234ED2); addr.Patch("C7 05"); addr.Offset(2).Patch((BYTE*)&writeAddress, sizeof(writeAddress)); @@ -435,7 +435,7 @@ ON_DLL_LOAD_RELIESON("server.dll", ServerExploitFixes, ConVar, (CModule module)) // Prevent these from actually doing anything for (auto exportName : ANTITAMPER_EXPORTS) { - MemoryAddress exportAddr = module.GetExport(exportName); + CMemoryAddress exportAddr = module.GetExport(exportName); if (exportAddr) { // Just return, none of them have any args or are userpurge diff --git a/NorthstarDLL/shared/exploit_fixes/exploitfixes_utf8parser.cpp b/NorthstarDLL/shared/exploit_fixes/exploitfixes_utf8parser.cpp index de0b0f21..3d97f750 100644 --- a/NorthstarDLL/shared/exploit_fixes/exploitfixes_utf8parser.cpp +++ b/NorthstarDLL/shared/exploit_fixes/exploitfixes_utf8parser.cpp @@ -67,7 +67,7 @@ bool __fastcall CheckUTF8Valid(INT64* a1, DWORD* a2, char* strData) { while (1) { - if (!MemoryAddress(v4).IsMemoryReadable(1)) + if (!CMemoryAddress(v4).IsMemoryReadable(1)) return false; // INVALID v11 = *v4++; // crash potential @@ -195,5 +195,5 @@ ON_DLL_LOAD("engine.dll", EngineExploitFixes_UTF8Parser, (CModule module)) { AUTOHOOK_DISPATCH() - sub_F1320 = module.FindPattern("83 F9 7F 77 08 88 0A").As<INT64(__fastcall*)(DWORD, char*)>(); + sub_F1320 = module.FindPattern("83 F9 7F 77 08 88 0A").RCast<INT64(__fastcall*)(DWORD, char*)>(); } diff --git a/NorthstarDLL/shared/exploit_fixes/ns_limits.cpp b/NorthstarDLL/shared/exploit_fixes/ns_limits.cpp index e69ef41c..c9085cb0 100644 --- a/NorthstarDLL/shared/exploit_fixes/ns_limits.cpp +++ b/NorthstarDLL/shared/exploit_fixes/ns_limits.cpp @@ -289,7 +289,7 @@ ON_DLL_LOAD_RELIESON("engine.dll", ServerLimits, ConVar, (CModule module)) FCVAR_GAMEDLL, "Increase usercmd processing budget by tickinterval * value per tick"); - CEngineServer__GetTimescale = module.Offset(0x240840).As<float (*)()>(); + CEngineServer__GetTimescale = module.Offset(0x240840).RCast<float (*)()>(); } ON_DLL_LOAD("server.dll", ServerLimitsServer, (CModule module)) diff --git a/NorthstarDLL/shared/keyvalues.cpp b/NorthstarDLL/shared/keyvalues.cpp index 06ed8d68..aa22ca65 100644 --- a/NorthstarDLL/shared/keyvalues.cpp +++ b/NorthstarDLL/shared/keyvalues.cpp @@ -1289,9 +1289,9 @@ KeyValues* KeyValues::MakeCopy(void) const ON_DLL_LOAD("vstdlib.dll", KeyValues, (CModule module)) { - V_UTF8ToUnicode = module.GetExport("V_UTF8ToUnicode").As<int (*)(const char*, wchar_t*, int)>(); - V_UnicodeToUTF8 = module.GetExport("V_UnicodeToUTF8").As<int (*)(const wchar_t*, char*, int)>(); - KeyValuesSystem = module.GetExport("KeyValuesSystem").As<CKeyValuesSystem* (*)()>(); + V_UTF8ToUnicode = module.GetExport("V_UTF8ToUnicode").RCast<int (*)(const char*, wchar_t*, int)>(); + V_UnicodeToUTF8 = module.GetExport("V_UnicodeToUTF8").RCast<int (*)(const wchar_t*, char*, int)>(); + KeyValuesSystem = module.GetExport("KeyValuesSystem").RCast<CKeyValuesSystem* (*)()>(); } AUTOHOOK_INIT() diff --git a/NorthstarDLL/shared/maxplayers.cpp b/NorthstarDLL/shared/maxplayers.cpp index dcf4044e..b2a09578 100644 --- a/NorthstarDLL/shared/maxplayers.cpp +++ b/NorthstarDLL/shared/maxplayers.cpp @@ -64,7 +64,7 @@ namespace R2 // use R2 namespace for game funcs } } // namespace R2 -template <class T> void ChangeOffset(MemoryAddress addr, unsigned int offset) +template <class T> void ChangeOffset(CMemoryAddress addr, unsigned int offset) { addr.Patch((BYTE*)&offset, sizeof(T)); } @@ -432,8 +432,8 @@ ON_DLL_LOAD("server.dll", MaxPlayersOverride_Server, (CModule module)) ChangeOffset<unsigned int>(module.Offset(0x5C6654 + 3), CPlayerResource_OriginalSize + PlayerResource_KillStats_Start); ChangeOffset<unsigned int>(module.Offset(0x5C665B + 3), CPlayerResource_OriginalSize + PlayerResource_KillStats_Start); - *module.Offset(0x14E7390).As<DWORD*>() = 0; - auto DT_PlayerResource_Construct = module.Offset(0x5C4FE0).As<__int64(__fastcall*)()>(); + *module.Offset(0x14E7390).RCast<DWORD*>() = 0; + auto DT_PlayerResource_Construct = module.Offset(0x5C4FE0).RCast<__int64(__fastcall*)()>(); DT_PlayerResource_Construct(); constexpr int CTeam_OriginalSize = 3336; @@ -446,8 +446,8 @@ ON_DLL_LOAD("server.dll", MaxPlayersOverride_Server, (CModule module)) // CTeam::CTeam - increase memset length to clean newly allocated data ChangeOffset<unsigned int>(module.Offset(0x2395AE + 2), 256 + CTeam_AddedSize); - *module.Offset(0xC945A0).As<DWORD*>() = 0; - auto DT_Team_Construct = module.Offset(0x238F50).As<__int64(__fastcall*)()>(); + *module.Offset(0xC945A0).RCast<DWORD*>() = 0; + auto DT_Team_Construct = module.Offset(0x238F50).RCast<__int64(__fastcall*)()>(); DT_Team_Construct(); } @@ -621,8 +621,8 @@ ON_DLL_LOAD("client.dll", MaxPlayersOverride_Client, (CModule module)) // Some other get name func 2 (that seems to be unused too) - change m_bConnected address ChangeOffset<unsigned int>(module.Offset(0x164834 + 3), C_PlayerResource_OriginalSize + PlayerResource_Connected_Start); - *module.Offset(0xC35068).As<DWORD*>() = 0; - auto DT_PlayerResource_Construct = module.Offset(0x163400).As<__int64(__fastcall*)()>(); + *module.Offset(0xC35068).RCast<DWORD*>() = 0; + auto DT_PlayerResource_Construct = module.Offset(0x163400).RCast<__int64(__fastcall*)()>(); DT_PlayerResource_Construct(); constexpr int C_Team_OriginalSize = 3200; @@ -638,7 +638,7 @@ ON_DLL_LOAD("client.dll", MaxPlayersOverride_Client, (CModule module)) // DT_Team size ChangeOffset<unsigned int>(module.Offset(0xC3AA0C), C_Team_ModifiedSize); - *module.Offset(0xC3AFF8).As<DWORD*>() = 0; - auto DT_Team_Construct = module.Offset(0x17F950).As<__int64(__fastcall*)()>(); + *module.Offset(0xC3AFF8).RCast<DWORD*>() = 0; + auto DT_Team_Construct = module.Offset(0x17F950).RCast<__int64(__fastcall*)()>(); DT_Team_Construct(); } diff --git a/NorthstarDLL/shared/misccommands.cpp b/NorthstarDLL/shared/misccommands.cpp index 15e12720..5d9ced99 100644 --- a/NorthstarDLL/shared/misccommands.cpp +++ b/NorthstarDLL/shared/misccommands.cpp @@ -172,7 +172,7 @@ void FixupCvarFlags() // make all engine client commands FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS // these are usually checked through CGameClient::IsEngineClientCommand, but we get more control over this if we just do it through // cvar flags - const char** ppEngineClientCommands = CModule("engine.dll").Offset(0x7C5EF0).As<const char**>(); + const char** ppEngineClientCommands = CModule("engine.dll").Offset(0x7C5EF0).RCast<const char**>(); int i = 0; do diff --git a/NorthstarDLL/squirrel/squirrel.cpp b/NorthstarDLL/squirrel/squirrel.cpp index 3bb5c154..0dd23cd7 100644 --- a/NorthstarDLL/squirrel/squirrel.cpp +++ b/NorthstarDLL/squirrel/squirrel.cpp @@ -701,37 +701,37 @@ ON_DLL_LOAD_RELIESON("client.dll", ClientSquirrel, ConCommand, (CModule module)) { AUTOHOOK_DISPATCH_MODULE(client.dll) - g_pSquirrel<ScriptContext::CLIENT>->__sq_defconst = module.Offset(0x12120).As<sq_defconstType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_defconst = module.Offset(0x12120).RCast<sq_defconstType>(); g_pSquirrel<ScriptContext::UI>->__sq_defconst = g_pSquirrel<ScriptContext::CLIENT>->__sq_defconst; - g_pSquirrel<ScriptContext::CLIENT>->__sq_compilebuffer = module.Offset(0x3110).As<sq_compilebufferType>(); - g_pSquirrel<ScriptContext::CLIENT>->__sq_pushroottable = module.Offset(0x5860).As<sq_pushroottableType>(); - g_pSquirrel<ScriptContext::CLIENT>->__sq_compilefile = module.Offset(0xF950).As<sq_compilefileType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_compilebuffer = module.Offset(0x3110).RCast<sq_compilebufferType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_pushroottable = module.Offset(0x5860).RCast<sq_pushroottableType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_compilefile = module.Offset(0xF950).RCast<sq_compilefileType>(); g_pSquirrel<ScriptContext::UI>->__sq_compilebuffer = g_pSquirrel<ScriptContext::CLIENT>->__sq_compilebuffer; g_pSquirrel<ScriptContext::UI>->__sq_pushroottable = g_pSquirrel<ScriptContext::CLIENT>->__sq_pushroottable; g_pSquirrel<ScriptContext::UI>->__sq_compilefile = g_pSquirrel<ScriptContext::CLIENT>->__sq_compilefile; - g_pSquirrel<ScriptContext::CLIENT>->__sq_call = module.Offset(0x8650).As<sq_callType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_call = module.Offset(0x8650).RCast<sq_callType>(); g_pSquirrel<ScriptContext::UI>->__sq_call = g_pSquirrel<ScriptContext::CLIENT>->__sq_call; - g_pSquirrel<ScriptContext::CLIENT>->__sq_newarray = module.Offset(0x39F0).As<sq_newarrayType>(); - g_pSquirrel<ScriptContext::CLIENT>->__sq_arrayappend = module.Offset(0x3C70).As<sq_arrayappendType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_newarray = module.Offset(0x39F0).RCast<sq_newarrayType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_arrayappend = module.Offset(0x3C70).RCast<sq_arrayappendType>(); g_pSquirrel<ScriptContext::UI>->__sq_newarray = g_pSquirrel<ScriptContext::CLIENT>->__sq_newarray; g_pSquirrel<ScriptContext::UI>->__sq_arrayappend = g_pSquirrel<ScriptContext::CLIENT>->__sq_arrayappend; - g_pSquirrel<ScriptContext::CLIENT>->__sq_newtable = module.Offset(0x3960).As<sq_newtableType>(); - g_pSquirrel<ScriptContext::CLIENT>->__sq_newslot = module.Offset(0x70B0).As<sq_newslotType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_newtable = module.Offset(0x3960).RCast<sq_newtableType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_newslot = module.Offset(0x70B0).RCast<sq_newslotType>(); g_pSquirrel<ScriptContext::UI>->__sq_newtable = g_pSquirrel<ScriptContext::CLIENT>->__sq_newtable; g_pSquirrel<ScriptContext::UI>->__sq_newslot = g_pSquirrel<ScriptContext::CLIENT>->__sq_newslot; - g_pSquirrel<ScriptContext::CLIENT>->__sq_pushstring = module.Offset(0x3440).As<sq_pushstringType>(); - g_pSquirrel<ScriptContext::CLIENT>->__sq_pushinteger = module.Offset(0x36A0).As<sq_pushintegerType>(); - g_pSquirrel<ScriptContext::CLIENT>->__sq_pushfloat = module.Offset(0x3800).As<sq_pushfloatType>(); - g_pSquirrel<ScriptContext::CLIENT>->__sq_pushbool = module.Offset(0x3710).As<sq_pushboolType>(); - g_pSquirrel<ScriptContext::CLIENT>->__sq_pushasset = module.Offset(0x3560).As<sq_pushassetType>(); - g_pSquirrel<ScriptContext::CLIENT>->__sq_pushvector = module.Offset(0x3780).As<sq_pushvectorType>(); - g_pSquirrel<ScriptContext::CLIENT>->__sq_pushobject = module.Offset(0x83D0).As<sq_pushobjectType>(); - g_pSquirrel<ScriptContext::CLIENT>->__sq_raiseerror = module.Offset(0x8470).As<sq_raiseerrorType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_pushstring = module.Offset(0x3440).RCast<sq_pushstringType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_pushinteger = module.Offset(0x36A0).RCast<sq_pushintegerType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_pushfloat = module.Offset(0x3800).RCast<sq_pushfloatType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_pushbool = module.Offset(0x3710).RCast<sq_pushboolType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_pushasset = module.Offset(0x3560).RCast<sq_pushassetType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_pushvector = module.Offset(0x3780).RCast<sq_pushvectorType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_pushobject = module.Offset(0x83D0).RCast<sq_pushobjectType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_raiseerror = module.Offset(0x8470).RCast<sq_raiseerrorType>(); g_pSquirrel<ScriptContext::UI>->__sq_pushstring = g_pSquirrel<ScriptContext::CLIENT>->__sq_pushstring; g_pSquirrel<ScriptContext::UI>->__sq_pushinteger = g_pSquirrel<ScriptContext::CLIENT>->__sq_pushinteger; g_pSquirrel<ScriptContext::UI>->__sq_pushfloat = g_pSquirrel<ScriptContext::CLIENT>->__sq_pushfloat; @@ -741,16 +741,16 @@ ON_DLL_LOAD_RELIESON("client.dll", ClientSquirrel, ConCommand, (CModule module)) g_pSquirrel<ScriptContext::UI>->__sq_pushobject = g_pSquirrel<ScriptContext::CLIENT>->__sq_pushobject; g_pSquirrel<ScriptContext::UI>->__sq_raiseerror = g_pSquirrel<ScriptContext::CLIENT>->__sq_raiseerror; - g_pSquirrel<ScriptContext::CLIENT>->__sq_getstring = module.Offset(0x60C0).As<sq_getstringType>(); - g_pSquirrel<ScriptContext::CLIENT>->__sq_getinteger = module.Offset(0x60E0).As<sq_getintegerType>(); - g_pSquirrel<ScriptContext::CLIENT>->__sq_getfloat = module.Offset(0x6100).As<sq_getfloatType>(); - g_pSquirrel<ScriptContext::CLIENT>->__sq_getbool = module.Offset(0x6130).As<sq_getboolType>(); - g_pSquirrel<ScriptContext::CLIENT>->__sq_get = module.Offset(0x7C30).As<sq_getType>(); - g_pSquirrel<ScriptContext::CLIENT>->__sq_getasset = module.Offset(0x6010).As<sq_getassetType>(); - g_pSquirrel<ScriptContext::CLIENT>->__sq_getuserdata = module.Offset(0x63D0).As<sq_getuserdataType>(); - g_pSquirrel<ScriptContext::CLIENT>->__sq_getvector = module.Offset(0x6140).As<sq_getvectorType>(); - g_pSquirrel<ScriptContext::CLIENT>->__sq_getthisentity = module.Offset(0x12F80).As<sq_getthisentityType>(); - g_pSquirrel<ScriptContext::CLIENT>->__sq_getobject = module.Offset(0x6160).As<sq_getobjectType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_getstring = module.Offset(0x60C0).RCast<sq_getstringType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_getinteger = module.Offset(0x60E0).RCast<sq_getintegerType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_getfloat = module.Offset(0x6100).RCast<sq_getfloatType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_getbool = module.Offset(0x6130).RCast<sq_getboolType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_get = module.Offset(0x7C30).RCast<sq_getType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_getasset = module.Offset(0x6010).RCast<sq_getassetType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_getuserdata = module.Offset(0x63D0).RCast<sq_getuserdataType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_getvector = module.Offset(0x6140).RCast<sq_getvectorType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_getthisentity = module.Offset(0x12F80).RCast<sq_getthisentityType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_getobject = module.Offset(0x6160).RCast<sq_getobjectType>(); g_pSquirrel<ScriptContext::UI>->__sq_getstring = g_pSquirrel<ScriptContext::CLIENT>->__sq_getstring; g_pSquirrel<ScriptContext::UI>->__sq_getinteger = g_pSquirrel<ScriptContext::CLIENT>->__sq_getinteger; g_pSquirrel<ScriptContext::UI>->__sq_getfloat = g_pSquirrel<ScriptContext::CLIENT>->__sq_getfloat; @@ -762,27 +762,27 @@ ON_DLL_LOAD_RELIESON("client.dll", ClientSquirrel, ConCommand, (CModule module)) g_pSquirrel<ScriptContext::UI>->__sq_getthisentity = g_pSquirrel<ScriptContext::CLIENT>->__sq_getthisentity; g_pSquirrel<ScriptContext::UI>->__sq_getobject = g_pSquirrel<ScriptContext::CLIENT>->__sq_getobject; - g_pSquirrel<ScriptContext::CLIENT>->__sq_createuserdata = module.Offset(0x38D0).As<sq_createuserdataType>(); - g_pSquirrel<ScriptContext::CLIENT>->__sq_setuserdatatypeid = module.Offset(0x6490).As<sq_setuserdatatypeidType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_createuserdata = module.Offset(0x38D0).RCast<sq_createuserdataType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_setuserdatatypeid = module.Offset(0x6490).RCast<sq_setuserdatatypeidType>(); g_pSquirrel<ScriptContext::UI>->__sq_createuserdata = g_pSquirrel<ScriptContext::CLIENT>->__sq_createuserdata; g_pSquirrel<ScriptContext::UI>->__sq_setuserdatatypeid = g_pSquirrel<ScriptContext::CLIENT>->__sq_setuserdatatypeid; - g_pSquirrel<ScriptContext::CLIENT>->__sq_GetEntityConstant_CBaseEntity = module.Offset(0x3E49B0).As<sq_GetEntityConstantType>(); - g_pSquirrel<ScriptContext::CLIENT>->__sq_getentityfrominstance = module.Offset(0x114F0).As<sq_getentityfrominstanceType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_GetEntityConstant_CBaseEntity = module.Offset(0x3E49B0).RCast<sq_GetEntityConstantType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_getentityfrominstance = module.Offset(0x114F0).RCast<sq_getentityfrominstanceType>(); g_pSquirrel<ScriptContext::UI>->__sq_GetEntityConstant_CBaseEntity = g_pSquirrel<ScriptContext::CLIENT>->__sq_GetEntityConstant_CBaseEntity; g_pSquirrel<ScriptContext::UI>->__sq_getentityfrominstance = g_pSquirrel<ScriptContext::CLIENT>->__sq_getentityfrominstance; // Message buffer stuff g_pSquirrel<ScriptContext::UI>->messageBuffer = g_pSquirrel<ScriptContext::CLIENT>->messageBuffer; - g_pSquirrel<ScriptContext::CLIENT>->__sq_getfunction = module.Offset(0x572FB0).As<sq_getfunctionType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_getfunction = module.Offset(0x572FB0).RCast<sq_getfunctionType>(); g_pSquirrel<ScriptContext::UI>->__sq_getfunction = g_pSquirrel<ScriptContext::CLIENT>->__sq_getfunction; - g_pSquirrel<ScriptContext::CLIENT>->__sq_stackinfos = module.Offset(0x35970).As<sq_stackinfosType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_stackinfos = module.Offset(0x35970).RCast<sq_stackinfosType>(); g_pSquirrel<ScriptContext::UI>->__sq_stackinfos = g_pSquirrel<ScriptContext::CLIENT>->__sq_stackinfos; // Structs - g_pSquirrel<ScriptContext::CLIENT>->__sq_pushnewstructinstance = module.Offset(0x5400).As<sq_pushnewstructinstanceType>(); - g_pSquirrel<ScriptContext::CLIENT>->__sq_sealstructslot = module.Offset(0x5530).As<sq_sealstructslotType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_pushnewstructinstance = module.Offset(0x5400).RCast<sq_pushnewstructinstanceType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_sealstructslot = module.Offset(0x5530).RCast<sq_sealstructslotType>(); g_pSquirrel<ScriptContext::UI>->__sq_pushnewstructinstance = g_pSquirrel<ScriptContext::CLIENT>->__sq_pushnewstructinstance; g_pSquirrel<ScriptContext::UI>->__sq_sealstructslot = g_pSquirrel<ScriptContext::CLIENT>->__sq_sealstructslot; @@ -817,7 +817,7 @@ ON_DLL_LOAD_RELIESON("client.dll", ClientSquirrel, ConCommand, (CModule module)) StubUnsafeSQFuncs<ScriptContext::CLIENT>(); StubUnsafeSQFuncs<ScriptContext::UI>(); - g_pSquirrel<ScriptContext::CLIENT>->__sq_getfunction = module.Offset(0x6CB0).As<sq_getfunctionType>(); + g_pSquirrel<ScriptContext::CLIENT>->__sq_getfunction = module.Offset(0x6CB0).RCast<sq_getfunctionType>(); g_pSquirrel<ScriptContext::UI>->__sq_getfunction = g_pSquirrel<ScriptContext::CLIENT>->__sq_getfunction; SquirrelFunctions s = {}; @@ -829,55 +829,55 @@ ON_DLL_LOAD_RELIESON("server.dll", ServerSquirrel, ConCommand, (CModule module)) { AUTOHOOK_DISPATCH_MODULE(server.dll) - g_pSquirrel<ScriptContext::SERVER>->__sq_defconst = module.Offset(0x1F550).As<sq_defconstType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_defconst = module.Offset(0x1F550).RCast<sq_defconstType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_compilebuffer = module.Offset(0x3110).As<sq_compilebufferType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_pushroottable = module.Offset(0x5840).As<sq_pushroottableType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_call = module.Offset(0x8620).As<sq_callType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_compilefile = module.Offset(0x1CD80).As<sq_compilefileType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_compilebuffer = module.Offset(0x3110).RCast<sq_compilebufferType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_pushroottable = module.Offset(0x5840).RCast<sq_pushroottableType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_call = module.Offset(0x8620).RCast<sq_callType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_compilefile = module.Offset(0x1CD80).RCast<sq_compilefileType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_newarray = module.Offset(0x39F0).As<sq_newarrayType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_arrayappend = module.Offset(0x3C70).As<sq_arrayappendType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_newarray = module.Offset(0x39F0).RCast<sq_newarrayType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_arrayappend = module.Offset(0x3C70).RCast<sq_arrayappendType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_newtable = module.Offset(0x3960).As<sq_newtableType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_newslot = module.Offset(0x7080).As<sq_newslotType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_newtable = module.Offset(0x3960).RCast<sq_newtableType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_newslot = module.Offset(0x7080).RCast<sq_newslotType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_pushstring = module.Offset(0x3440).As<sq_pushstringType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_pushinteger = module.Offset(0x36A0).As<sq_pushintegerType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_pushfloat = module.Offset(0x3800).As<sq_pushfloatType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_pushbool = module.Offset(0x3710).As<sq_pushboolType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_pushasset = module.Offset(0x3560).As<sq_pushassetType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_pushvector = module.Offset(0x3780).As<sq_pushvectorType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_pushobject = module.Offset(0x83A0).As<sq_pushobjectType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_pushstring = module.Offset(0x3440).RCast<sq_pushstringType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_pushinteger = module.Offset(0x36A0).RCast<sq_pushintegerType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_pushfloat = module.Offset(0x3800).RCast<sq_pushfloatType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_pushbool = module.Offset(0x3710).RCast<sq_pushboolType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_pushasset = module.Offset(0x3560).RCast<sq_pushassetType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_pushvector = module.Offset(0x3780).RCast<sq_pushvectorType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_pushobject = module.Offset(0x83A0).RCast<sq_pushobjectType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_raiseerror = module.Offset(0x8440).As<sq_raiseerrorType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_raiseerror = module.Offset(0x8440).RCast<sq_raiseerrorType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_getstring = module.Offset(0x60A0).As<sq_getstringType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_getinteger = module.Offset(0x60C0).As<sq_getintegerType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_getfloat = module.Offset(0x60E0).As<sq_getfloatType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_getbool = module.Offset(0x6110).As<sq_getboolType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_getasset = module.Offset(0x5FF0).As<sq_getassetType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_getuserdata = module.Offset(0x63B0).As<sq_getuserdataType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_getvector = module.Offset(0x6120).As<sq_getvectorType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_get = module.Offset(0x7C00).As<sq_getType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_getstring = module.Offset(0x60A0).RCast<sq_getstringType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_getinteger = module.Offset(0x60C0).RCast<sq_getintegerType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_getfloat = module.Offset(0x60E0).RCast<sq_getfloatType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_getbool = module.Offset(0x6110).RCast<sq_getboolType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_getasset = module.Offset(0x5FF0).RCast<sq_getassetType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_getuserdata = module.Offset(0x63B0).RCast<sq_getuserdataType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_getvector = module.Offset(0x6120).RCast<sq_getvectorType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_get = module.Offset(0x7C00).RCast<sq_getType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_getthisentity = module.Offset(0x203B0).As<sq_getthisentityType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_getobject = module.Offset(0x6140).As<sq_getobjectType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_getthisentity = module.Offset(0x203B0).RCast<sq_getthisentityType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_getobject = module.Offset(0x6140).RCast<sq_getobjectType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_createuserdata = module.Offset(0x38D0).As<sq_createuserdataType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_setuserdatatypeid = module.Offset(0x6470).As<sq_setuserdatatypeidType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_createuserdata = module.Offset(0x38D0).RCast<sq_createuserdataType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_setuserdatatypeid = module.Offset(0x6470).RCast<sq_setuserdatatypeidType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_GetEntityConstant_CBaseEntity = module.Offset(0x418AF0).As<sq_GetEntityConstantType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_getentityfrominstance = module.Offset(0x1E920).As<sq_getentityfrominstanceType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_GetEntityConstant_CBaseEntity = module.Offset(0x418AF0).RCast<sq_GetEntityConstantType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_getentityfrominstance = module.Offset(0x1E920).RCast<sq_getentityfrominstanceType>(); g_pSquirrel<ScriptContext::SERVER>->logger = NS::log::SCRIPT_SV; // Message buffer stuff - g_pSquirrel<ScriptContext::SERVER>->__sq_getfunction = module.Offset(0x6C85).As<sq_getfunctionType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_stackinfos = module.Offset(0x35920).As<sq_stackinfosType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_getfunction = module.Offset(0x6C85).RCast<sq_getfunctionType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_stackinfos = module.Offset(0x35920).RCast<sq_stackinfosType>(); // Structs - g_pSquirrel<ScriptContext::SERVER>->__sq_pushnewstructinstance = module.Offset(0x53e0).As<sq_pushnewstructinstanceType>(); - g_pSquirrel<ScriptContext::SERVER>->__sq_sealstructslot = module.Offset(0x5510).As<sq_sealstructslotType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_pushnewstructinstance = module.Offset(0x53e0).RCast<sq_pushnewstructinstanceType>(); + g_pSquirrel<ScriptContext::SERVER>->__sq_sealstructslot = module.Offset(0x5510).RCast<sq_sealstructslotType>(); MAKEHOOK( module.Offset(0x1DD10), diff --git a/NorthstarDLL/util/wininfo.cpp b/NorthstarDLL/util/wininfo.cpp index b0b77749..4fd64369 100644 --- a/NorthstarDLL/util/wininfo.cpp +++ b/NorthstarDLL/util/wininfo.cpp @@ -5,5 +5,5 @@ HMODULE g_NorthstarModule = 0; ON_DLL_LOAD("engine.dll", WinInfo, (CModule module)) { - g_gameHWND = module.Offset(0x7d88a0).As<HWND*>(); + g_gameHWND = module.Offset(0x7d88a0).RCast<HWND*>(); } |