diff --git a/r5dev/codecs/Miles/miles_impl.h b/r5dev/codecs/Miles/miles_impl.h index f74e8451..b5889c73 100644 --- a/r5dev/codecs/Miles/miles_impl.h +++ b/r5dev/codecs/Miles/miles_impl.h @@ -26,11 +26,13 @@ class MilesCore : public IDetour { p_AIL_LogFunc = g_GameDll.FindPatternSIMD("40 53 48 83 EC 20 48 8B DA 48 8D 15 ?? ?? ?? ??"); v_AIL_LogFunc = p_AIL_LogFunc.RCast(); - // 0x1409D1420 // 40 53 48 83 EC 20 48 8B DA 48 8D 15 ? ? ? ? // - p_Miles_Initialize = g_GameDll.FindPatternSIMD("E8 ?? ?? ?? ?? FF 0D ?? ?? ?? ?? C6 05 ?? ?? ?? ?? ??").FollowNearCallSelf(); +#if !defined (GAMEDLL_S0) && !defined (GAMEDLL_S1) && !defined (GAMEDLL_S2) + p_Miles_Initialize = g_GameDll.FindPatternSIMD("40 53 56 57 41 54 41 55 41 56 41 57 48 81 EC ?? ?? ?? ?? 80 3D ?? ?? ?? ?? ??"); +#else + p_Miles_Initialize = g_GameDll.FindPatternSIMD("40 55 53 56 57 41 54 41 55 41 56 41 57 48 8D AC 24 ?? ?? ?? ?? 48 81 EC ?? ?? ?? ?? 80 3D ?? ?? ?? ?? ??"); +#endif // !(GAMEDLL_S0) || !(GAMEDLL_S1) || !(GAMEDLL_S2) v_Miles_Initialize = p_Miles_Initialize.RCast(); - // 0x14095A140 // E8 ? ? ? ? FF 0D ? ? ? ? C6 05 ? ? ? ? ? // p_MilesQueueEventRun = g_RadAudioSystemDll.GetExportedFunction("MilesQueueEventRun"); v_MilesQueueEventRun = p_MilesQueueEventRun.RCast(); diff --git a/r5dev/engine/client/client.h b/r5dev/engine/client/client.h index 96a95338..13b677fc 100644 --- a/r5dev/engine/client/client.h +++ b/r5dev/engine/client/client.h @@ -191,7 +191,7 @@ class VClient : public IDetour #endif p_CClient_Clear = g_GameDll.FindPatternSIMD("40 53 41 56 41 57 48 83 EC 20 48 8B D9 48 89 74"); #if defined (GAMEDLL_S0) || defined (GAMEDLL_S1) - p_CClient_ProcessStringCmd = g_GameDll.FindPatternSIMD("48 83 EC 28 4C 8B 42 20"); + p_CClient_ProcessStringCmd = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 55 48 81 EC ?? ?? ?? ?? 49 8B D8"); p_CClient_SendNetMsg = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 41 56 41 57 48 83 EC 30 48 8B 05 ?? ?? ?? ?? 45 0F B6 F1"); p_CClient_SendSnapshot = g_GameDll.FindPatternSIMD("44 89 44 24 ?? 48 89 4C 24 ?? 55 53 56 57 41 55"); #elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3) diff --git a/r5dev/engine/cmodel_bsp.h b/r5dev/engine/cmodel_bsp.h index 6a6b645a..f978cd25 100644 --- a/r5dev/engine/cmodel_bsp.h +++ b/r5dev/engine/cmodel_bsp.h @@ -59,8 +59,8 @@ class VModel_BSP : public IDetour virtual void GetFun(void) const { #if defined (GAMEDLL_S0) || defined (GAMEDLL_S1) - p_MOD_LoadPakForMap = g_GameDll.FindPatternSIMD("48 81 EC ?? ?? ?? ?? 4C 8B C1 48 8D 15 ?? ?? ?? ?? 48 8D 4C 24 ?? E8 ?? ?? ?? ?? 4C 8D 0D ?? ?? ?? ??"); - v_MOD_LoadPakForMap = p_MOD_LoadPakForMap.RCast(); /*48 81 EC ? ? ? ? 4C 8B C1 48 8D 15 ? ? ? ? 48 8D 4C 24 ? E8 ? ? ? ? 4C 8D 0D ? ? ? ?*/ + p_Mod_LoadPakForMap = g_GameDll.FindPatternSIMD("48 81 EC ?? ?? ?? ?? 4C 8B C1 48 8D 15 ?? ?? ?? ?? 48 8D 4C 24 ?? E8 ?? ?? ?? ?? 4C 8D 0D ?? ?? ?? ??"); + v_Mod_LoadPakForMap = p_Mod_LoadPakForMap.RCast(); /*48 81 EC ? ? ? ? 4C 8B C1 48 8D 15 ? ? ? ? 48 8D 4C 24 ? E8 ? ? ? ? 4C 8D 0D ? ? ? ?*/ #elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3) p_Mod_LoadPakForMap = g_GameDll.FindPatternSIMD("48 81 EC ?? ?? ?? ?? 0F B6 05 ?? ?? ?? ?? 4C 8D 05 ?? ?? ?? ?? 84 C0"); v_Mod_LoadPakForMap = p_Mod_LoadPakForMap.RCast(); /*48 81 EC ? ? ? ? 0F B6 05 ? ? ? ? 4C 8D 05 ? ? ? ? 84 C0*/ diff --git a/r5dev/engine/gl_matsysiface.h b/r5dev/engine/gl_matsysiface.h index 2867737c..45109eb7 100644 --- a/r5dev/engine/gl_matsysiface.h +++ b/r5dev/engine/gl_matsysiface.h @@ -3,7 +3,6 @@ /* ==== MATSYSIFACE ===================================================================================================================================================== */ inline CMemory p_InitMaterialSystem; inline auto v_InitMaterialSystem = p_InitMaterialSystem.RCast(); -// 0x14024B390 // 48 83 EC 28 48 8B 0D ? ? ? ? 48 8D 15 ? ? ? ? 48 8B 01 FF 90 ? ? ? ? 48 8B 0D ? ? ? ? 48 8D 15 ? ? ? ? 48 8B 01 FF 90 ? ? ? ? // /////////////////////////////////////////////////////////////////////////////// class VGL_MatSysIFace : public IDetour @@ -14,7 +13,11 @@ class VGL_MatSysIFace : public IDetour } virtual void GetFun(void) const { +#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1) + p_InitMaterialSystem = g_GameDll.FindPatternSIMD("40 53 48 83 EC 20 48 8B 0D ?? ?? ?? ?? 48 8D 1D ?? ?? ?? ?? 48 8D 15 ?? ?? ?? ??"); +#else p_InitMaterialSystem = g_GameDll.FindPatternSIMD("48 83 EC 28 48 8B 0D ?? ?? ?? ?? 48 8D 15 ?? ?? ?? ?? 48 8B 01 FF 90 ?? ?? ?? ?? 48 8B 0D ?? ?? ?? ?? 48 8D 15 ?? ?? ?? ?? 48 8B 01 FF 90 ?? ?? ?? ??"); +#endif // !(GAMEDLL_S0) || !(GAMEDLL_S1) v_InitMaterialSystem = p_InitMaterialSystem.RCast(); } virtual void GetVar(void) const { } diff --git a/r5dev/engine/host.h b/r5dev/engine/host.h index 6b4bb312..c3c164ee 100644 --- a/r5dev/engine/host.h +++ b/r5dev/engine/host.h @@ -57,15 +57,17 @@ class VHost : public IDetour g_bAbortServerSet = p_Host_Error.FindPattern("40 38 3D", CMemory::Direction::DOWN, 512, 2).ResolveRelativeAddress(3, 7).RCast(); host_abortserver = p_Host_Error.FindPattern("48 8D 0D", CMemory::Direction::DOWN, 512, 3).ResolveRelativeAddress(3, 7).RCast(); - static const int n_host_frametime_unbounded_search_offset = 0x430; + static const int n_host_frametime_unbounded_search_offset = 0x380; + static const int n_host_frametime_stddeviation_search_offset = 0x1200; #elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3) g_bAbortServerSet = p_Host_Error.FindPattern("40 38 3D", CMemory::Direction::DOWN, 512, 4).ResolveRelativeAddress(3, 7).RCast(); host_abortserver = p_Host_Error.FindPattern("48 8D 0D", CMemory::Direction::DOWN, 512, 5).ResolveRelativeAddress(3, 7).RCast(); static const int n_host_frametime_unbounded_search_offset = 0x330; + static const int n_host_frametime_stddeviation_search_offset = 0xFAA; #endif - host_frametime_unbounded = p_Host_RunFrame.Offset(n_host_frametime_unbounded_search_offset).FindPatternSelf("F3 0F 11 1D").ResolveRelativeAddressSelf(0x4, 0x8).RCast(); - host_frametime_stddeviation = p_Host_RunFrame.Offset(0xFAA).FindPatternSelf("F3 0F 11 05").ResolveRelativeAddressSelf(0x4, 0x8).RCast(); + host_frametime_unbounded = p_Host_RunFrame.Offset(n_host_frametime_unbounded_search_offset).FindPatternSelf("F3 0F 11").ResolveRelativeAddressSelf(0x4, 0x8).RCast(); + host_frametime_stddeviation = p_Host_RunFrame.Offset(n_host_frametime_stddeviation_search_offset).FindPatternSelf("F3 0F 11").ResolveRelativeAddressSelf(0x4, 0x8).RCast(); } virtual void GetCon(void) const { } virtual void Attach(void) const; diff --git a/r5dev/engine/host_cmd.cpp b/r5dev/engine/host_cmd.cpp index 666183ca..266d66da 100644 --- a/r5dev/engine/host_cmd.cpp +++ b/r5dev/engine/host_cmd.cpp @@ -4,6 +4,7 @@ #include "common.h" #include "client/client.h" +#if !defined (GAMEDLL_S0) && !defined (GAMEDLL_S1) && !defined (GAMEDLL_S2) /* ================== DFS_InitializeFeatureFlagDefinitions @@ -19,6 +20,7 @@ bool DFS_InitializeFeatureFlagDefinitions(const char* pszFeatureFlags) return v_DFS_InitializeFeatureFlagDefinitions(pszFeatureFlags); } +#endif // !(GAMEDLL_S0) || !(GAMEDLL_S1) || !(GAMEDLL_S2) /* ================== @@ -61,13 +63,17 @@ void Host_Status_PrintClient(CClient* client, bool bShowAddress, void (*print) ( /////////////////////////////////////////////////////////////////////////////// void VHostCmd::Attach() const { +#if !defined (GAMEDLL_S0) && !defined (GAMEDLL_S1) && !defined (GAMEDLL_S2) DetourAttach(&v_DFS_InitializeFeatureFlagDefinitions, &DFS_InitializeFeatureFlagDefinitions); +#endif // !(GAMEDLL_S0) || !(GAMEDLL_S1) || !(GAMEDLL_S2) DetourAttach(&v_Host_Status_PrintClient, &Host_Status_PrintClient); } void VHostCmd::Detach() const { +#if !defined (GAMEDLL_S0) && !defined (GAMEDLL_S1) && !defined (GAMEDLL_S2) DetourDetach(&v_DFS_InitializeFeatureFlagDefinitions, &DFS_InitializeFeatureFlagDefinitions); +#endif // !(GAMEDLL_S0) || !(GAMEDLL_S1) || !(GAMEDLL_S2) DetourDetach(&v_Host_Status_PrintClient, &Host_Status_PrintClient); } diff --git a/r5dev/engine/matsys_interface.h b/r5dev/engine/matsys_interface.h index af6b82a4..6d5f04ab 100644 --- a/r5dev/engine/matsys_interface.h +++ b/r5dev/engine/matsys_interface.h @@ -33,7 +33,7 @@ class VMatSys_Interface : public IDetour p_HandleConfigFile = g_GameDll.FindPatternSIMD("40 56 48 81 EC ?? ?? ?? ?? 8B F1"); p_ResetPreviousGameState = g_GameDll.FindPatternSIMD("E8 ?? ?? ?? ?? 44 89 3D ?? ?? ?? ?? ?? 8B ?? 24 ??").ResolveRelativeAddressSelf(0x1, 0x5); #if defined (GAMEDLL_S0) || defined (GAMEDLL_S1) || defined (GAMEDLL_S2) - LoadPlayerConfig = g_GameDll.FindPatternSIMD("48 81 EC ?? ?? ?? ?? 48 83 3D ?? ?? ?? ?? ?? 75 0C"); + p_LoadPlayerConfig = g_GameDll.FindPatternSIMD("48 81 EC ?? ?? ?? ?? 48 83 3D ?? ?? ?? ?? ?? 75 0C"); #elif defined (GAMEDLL_S3) p_LoadPlayerConfig = g_GameDll.FindPatternSIMD("89 4C 24 08 48 81 EC ?? ?? ?? ?? 48 83 3D ?? ?? ?? ?? ??"); #endif diff --git a/r5dev/engine/modelloader.h b/r5dev/engine/modelloader.h index 4c71049d..daa58c68 100644 --- a/r5dev/engine/modelloader.h +++ b/r5dev/engine/modelloader.h @@ -100,7 +100,7 @@ class VModelLoader : public IDetour p_CModelLoader__Studio_LoadModel = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 55 56 57 41 54 41 56 48 8D AC 24 ?? ?? ?? ??"); p_CModelLoader__Map_LoadModelGuts = g_GameDll.FindPatternSIMD("48 89 54 24 ?? 48 89 4C 24 ?? 55 53 41 54 41 55 48 8D AC 24 ?? ?? ?? ?? 48 81 EC ?? ?? ?? ?? FF 05 ?? ?? ?? ??"); // BSP. p_CModelLoader__Map_IsValid = g_GameDll.FindPatternSIMD("48 8B C4 53 48 81 EC ?? ?? ?? ?? 48 8B DA"); - p_GetSpriteInfo = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 41 54 41 55 41 56 41 57 48 83 EC 30 4C 8B AC 24 ?? ?? ?? ?? BE ?? ?? ?? ??"); + //p_GetSpriteInfo = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 41 54 41 55 41 56 41 57 48 83 EC 30 4C 8B AC 24 ?? ?? ?? ?? BE ?? ?? ?? ??"); #elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3) p_CModelLoader__FindModel = g_GameDll.FindPatternSIMD("40 55 41 57 48 83 EC 48 80 3A 2A"); p_CModelLoader__LoadModel = g_GameDll.FindPatternSIMD("40 53 57 41 57 48 81 EC ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ??"); diff --git a/r5dev/engine/server/server.h b/r5dev/engine/server/server.h index 7f428a52..8b0010eb 100644 --- a/r5dev/engine/server/server.h +++ b/r5dev/engine/server/server.h @@ -123,9 +123,9 @@ class VServer : public IDetour #ifndef CLIENT_DLL p_CServer_FrameJob = g_GameDll.FindPatternSIMD("48 89 6C 24 ?? 56 41 54 41 56"); #if defined (GAMEDLL_S0) || defined (GAMEDLL_S1) - p_CServer_Authenticate = g_GameDll.FindPatternSIMD("44 89 44 24 ?? 55 56 57 48 8D AC 24 ?? ?? ?? ??"); + p_CServer_ConnectClient = g_GameDll.FindPatternSIMD("44 89 44 24 ?? 55 56 57 48 8D AC 24 ?? ?? ?? ??"); #elif defined (GAMEDLL_S2) - p_CServer_Authenticate = g_GameDll.FindPatternSIMD("44 89 44 24 ?? 56 57 48 81 EC ?? ?? ?? ??"); + p_CServer_ConnectClient = g_GameDll.FindPatternSIMD("44 89 44 24 ?? 56 57 48 81 EC ?? ?? ?? ??"); #else p_CServer_ConnectClient = g_GameDll.FindPatternSIMD("40 55 57 41 55 41 57 48 8D AC 24 ?? ?? ?? ??"); #endif diff --git a/r5dev/engine/sys_dll2.cpp b/r5dev/engine/sys_dll2.cpp index 83381f2b..384f1747 100644 --- a/r5dev/engine/sys_dll2.cpp +++ b/r5dev/engine/sys_dll2.cpp @@ -107,6 +107,7 @@ bool CEngineAPI::VModInit(CEngineAPI* pEngineAPI, const char* pModName, const ch //----------------------------------------------------------------------------- void CEngineAPI::VSetStartupInfo(CEngineAPI* pEngineAPI, StartupInfo_t* pStartupInfo) { +#if !defined (GAMEDLL_S0) && !defined (GAMEDLL_S1) if (*g_bTextMode) { return; @@ -143,6 +144,10 @@ void CEngineAPI::VSetStartupInfo(CEngineAPI* pEngineAPI, StartupInfo_t* pStartup COM_InitFilesystem(pEngineAPI->m_StartupInfo.m_szInitialMod); *g_bTextMode = true; +#else + // !TODO: 'TRACEINIT' needs to be reimplemented in S0/S1 (inline). + v_CEngineAPI_SetStartupInfo(pEngineAPI, pStartupInfo); +#endif // !(GAMEDLL_S0) || !(GAMEDLL_S1) } /////////////////////////////////////////////////////////////////////////////// diff --git a/r5dev/game/server/gameinterface.h b/r5dev/game/server/gameinterface.h index 31f84075..0c4b6986 100644 --- a/r5dev/game/server/gameinterface.h +++ b/r5dev/game/server/gameinterface.h @@ -69,13 +69,15 @@ class VServerGameDLL : public IDetour } virtual void GetFun(void) const { -#if defined(GAMEDLL_S3) +#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1) + p_CServerGameDLL__OnReceivedSayTextMessage = g_GameDll.FindPatternSIMD("40 55 57 41 55 41 56 41 57 48 8D 6C 24 ?? 48 81 EC ?? ?? ?? ?? 4C 8B 15 ?? ?? ?? ??"); +#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3) p_CServerGameDLL__OnReceivedSayTextMessage = g_GameDll.FindPatternSIMD("85 D2 0F 8E ?? ?? ?? ?? 4C 8B DC"); +#endif CServerGameDLL__OnReceivedSayTextMessage = p_CServerGameDLL__OnReceivedSayTextMessage.RCast(); p_RunFrameServer = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 57 48 83 EC 30 0F 29 74 24 ?? 48 8D 0D ?? ?? ?? ??"); v_RunFrameServer = p_RunFrameServer.RCast(); -#endif } virtual void GetVar(void) const { diff --git a/r5dev/materialsystem/cmaterialsystem.h b/r5dev/materialsystem/cmaterialsystem.h index efd37a17..17e8035f 100644 --- a/r5dev/materialsystem/cmaterialsystem.h +++ b/r5dev/materialsystem/cmaterialsystem.h @@ -52,6 +52,8 @@ class VMaterialSystem : public IDetour LogConAdr("CMaterial::`vftable'", reinterpret_cast(g_pMaterialVFTable)); LogFunAdr("CMaterialSystem::Init", p_CMaterialSystem__Init.GetPtr()); #ifndef DEDICATED + LogFunAdr("CMaterialSystem::FindMaterialEx", p_CMaterialSystem__FindMaterialEx.GetPtr()); + LogFunAdr("CMaterialSystem::GetScreenSize", p_CMaterialSystem_GetScreenSize.GetPtr()); LogFunAdr("CMaterialSystem::DispatchDrawCall", p_DispatchDrawCall.GetPtr()); LogFunAdr("CMaterialSystem::DrawStreamOverlay", p_DrawStreamOverlay.GetPtr()); LogVarAdr("g_nTotalStreamingTextureMemory", reinterpret_cast(g_nTotalStreamingTextureMemory)); diff --git a/r5dev/public/imaterial.h b/r5dev/public/imaterial.h index 2f7c6e79..44c74244 100644 --- a/r5dev/public/imaterial.h +++ b/r5dev/public/imaterial.h @@ -95,8 +95,11 @@ private: virtual void stub_74() const = 0; virtual void stub_75() const = 0; virtual void stub_76() const = 0; + // s0 and s1 builds have a smaller vtable size (2 methods less). +#if !defined (GAMEDLL_S0) && !defined (GAMEDLL_S1) virtual void stub_77() const = 0; virtual void stub_78() const = 0; +#endif // !GAMEDLL_S0 && !GAMEDLL_S1 // STUB_138 should be GetShaderGlue. }; diff --git a/r5dev/rtech/rtech_game.h b/r5dev/rtech/rtech_game.h index 4472c324..73d02864 100644 --- a/r5dev/rtech/rtech_game.h +++ b/r5dev/rtech/rtech_game.h @@ -67,7 +67,7 @@ class V_RTechGame : public IDetour #endif #if defined (GAMEDLL_S0) || defined (GAMEDLL_S1) || defined (GAMEDLL_S2) p_CPakFile_LoadAsync = g_GameDll.FindPatternSIMD("40 53 48 83 EC 40 48 89 6C 24 ?? 41 8B E8"); - CPakFile_LoadAsync = p_CPakFile_LoadAsync.RCast(); /*40 53 48 83 EC 40 48 89 6C 24 ? 41 8B E8*/ + CPakFile_LoadAsync = p_CPakFile_LoadAsync.RCast(); /*40 53 48 83 EC 40 48 89 6C 24 ? 41 8B E8*/ #elif defined (GAMEDLL_S3) p_CPakFile_LoadAsync = g_GameDll.FindPatternSIMD("40 53 48 83 EC 40 48 89 6C 24 ?? 41 0F B6 E9"); CPakFile_LoadAsync = p_CPakFile_LoadAsync.RCast(); /*40 53 48 83 EC 40 48 89 6C 24 ? 41 0F B6 E9*/ diff --git a/r5dev/rtech/rtech_utils.cpp b/r5dev/rtech/rtech_utils.cpp index 5d5e1610..acfece85 100644 --- a/r5dev/rtech/rtech_utils.cpp +++ b/r5dev/rtech/rtech_utils.cpp @@ -734,14 +734,20 @@ const char* RTech::PakStatusToString(RPakStatus_t status) default: return "PAK_STATUS_UNKNOWN"; } } - +#ifdef GAMEDLL_S3 //----------------------------------------------------------------------------- // Purpose: process guid relations for asset //----------------------------------------------------------------------------- void RTech::PakProcessGuidRelationsForAsset(PakFile_t* pPak, RPakAssetEntry_t* pAsset) { +#if defined (GAMEDLL_S0) && defined (GAMEDLL_S1) && defined (GAMEDLL_S2) + static const int GLOBAL_MUL = 0x1D; +#else + static const int GLOBAL_MUL = 0x17; +#endif + RPakDescriptor_t* pGuidDescriptors = &pPak->m_pGuidDescriptors[pAsset->m_nUsesStartIdx]; - volatile uint32_t* v5 = reinterpret_cast(*(reinterpret_cast(g_pPakGlobals) + 0x17 * (pPak->qword578 & 0x1FF) + 0x160212)); + volatile uint32_t* v5 = reinterpret_cast(*(reinterpret_cast(g_pPakGlobals) + GLOBAL_MUL * (pPak->qword578 & 0x1FF) + 0x160212)); const bool bDebug = rtech_debug->GetBool(); if (bDebug) @@ -815,7 +821,7 @@ void RTech::PakProcessGuidRelationsForAsset(PakFile_t* pPak, RPakAssetEntry_t* p *pCurrentGuid = g_pPakGlobals->m_Assets[assetIdx].m_pHead; } } - +#endif // GAMEDLL_S3 void V_RTechUtils::Attach() const { DetourAttach(&RTech_OpenFile, &RTech::OpenFile); diff --git a/r5dev/rtech/rtech_utils.h b/r5dev/rtech/rtech_utils.h index 65e16ffc..4ba3de34 100644 --- a/r5dev/rtech/rtech_utils.h +++ b/r5dev/rtech/rtech_utils.h @@ -235,7 +235,7 @@ struct RPakVirtualSegment_t uint64_t m_nDataSize; }; -struct PakFile_t +struct PakFile_t // !TODO: Map out on S1 and S2! { int m_nDescCount; int m_nProcessedAssetCount; @@ -276,12 +276,27 @@ struct PakFile_t uint32_t* m_pFileRelations; char gap5E0[40]; RPakAssetEntry_t** m_ppAssetEntries; - char gap610[520]; + char gap610[256]; +#if !defined (GAMEDLL_S0) && !defined (GAMEDLL_S1) // TODO: needs to be checked. + char gap710[256]; +#if !defined (GAMEDLL_S2) + char gap810[8]; +#endif // !(GAMEDLL_S0) || !(GAMEDLL_S1) || !(GAMEDLL_S2) +#endif const char* m_pszFileName; RPakHeader_t m_PakHdr; }; -static_assert(sizeof(PakFile_t) == 2208); +#if !defined (GAMEDLL_S0) && !defined (GAMEDLL_S1) +#if !defined (GAMEDLL_S2) +static_assert(sizeof(PakFile_t) == 2208); // S3+ +#else +static_assert(sizeof(PakFile_t) == 2200); // S2 +#endif // !GAMEDLL_S2 +#else +static_assert(sizeof(PakFile_t) == 1944); // S0/S1 +#endif // !GAMEDLL_S0 && !GAMEDLL_S1 + static_assert(sizeof(RPakDecompState_t) == 136); static_assert(sizeof(RPakPatchCompressedHeader_t) == 16); @@ -337,11 +352,9 @@ public: const char* PakStatusToString(RPakStatus_t status); static int32_t OpenFile(const CHAR* szFilePath, void* unused, LONGLONG* fileSizeOut); - #ifdef GAMEDLL_S3 static void PakProcessGuidRelationsForAsset(PakFile_t* pak, RPakAssetEntry_t* asset); -#endif - +#endif // GAMEDLL_S3 #if not defined DEDICATED static void CreateDXTexture(TextureHeader_t* textureHeader, int64_t cpuArg); diff --git a/r5dev/server/persistence.cpp b/r5dev/server/persistence.cpp index a57dfe86..c7ec5459 100644 --- a/r5dev/server/persistence.cpp +++ b/r5dev/server/persistence.cpp @@ -5,7 +5,7 @@ #if defined (GAMEDLL_S0) || defined (GAMEDLL_S1) bool Persistence_SetXP(int a1, int* a2) { - HIVEngineServer__PersistenceAvailable(nullptr, a1); + g_pEngineServer->PersistenceAvailable(nullptr, a1); return v_Persistence_SetXP(a1, a2); } #endif diff --git a/r5dev/squirrel/sqscript.h b/r5dev/squirrel/sqscript.h index f111cf0c..fde4afab 100644 --- a/r5dev/squirrel/sqscript.h +++ b/r5dev/squirrel/sqscript.h @@ -197,7 +197,7 @@ class VSquirrelVM : public IDetour #if !defined (DEDICATED) p_Script_CreateUIVM = g_GameDll.FindPatternSIMD("40 53 48 83 EC 20 48 8B 1D ?? ?? ?? ?? C6 05 ?? ?? ?? ?? ??"); #endif // !DEDICATED - p_Script_DestroySignalEntryListHead = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 6C 24 ?? 56 57 41 56 48 83 EC 50 44 8B 42 78"); + p_Script_DestroySignalEntryListHead = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 6C 24 ?? 56 57 41 56 48 83 EC 50 44 8B 42"); p_Script_LoadRson = g_GameDll.FindPatternSIMD("4C 8B DC 49 89 5B 08 57 48 81 EC A0 ?? ?? ?? 33"); #if defined (GAMEDLL_S0) || defined (GAMEDLL_S1) p_Script_LoadScript = g_GameDll.FindPatternSIMD("48 89 5C 24 10 48 89 74 24 18 48 89 7C 24 20 48 89 4C 24 08 55 41 54 41 55 41 56 41 57 48 8D 6C"); diff --git a/r5dev/tier1/IConVar.cpp b/r5dev/tier1/IConVar.cpp index 2d07c789..3b5c5745 100644 --- a/r5dev/tier1/IConVar.cpp +++ b/r5dev/tier1/IConVar.cpp @@ -298,7 +298,9 @@ void ConVar::InitShipped(void) sv_forceChatToTeamOnly->AddFlags(FCVAR_REPLICATED); ai_script_nodes_draw->SetValue(-1); +#if !defined (GAMEDLL_S0) && !defined (GAMEDLL_S1) && !defined (GAMEDLL_S2) bhit_enable->SetValue(0); +#endif // !(GAMEDLL_S0) || !(GAMEDLL_S1) || !(GAMEDLL_S2) #endif // !CLIENT_DLL #ifndef DEDICATED cl_threaded_bone_setup->RemoveFlags(FCVAR_DEVELOPMENTONLY);