mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
DataCache: enable old gather props in proper location
Fix hack and handle this properly.
This commit is contained in:
parent
5b5effa964
commit
8aa8323ea4
@ -190,6 +190,11 @@ studiohdr_t* CMDLCache::FindUncachedMDL(CMDLCache* const cache, const MDLHandle_
|
|||||||
return studioHdr;
|
return studioHdr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: gets the model cache by handle
|
||||||
|
// Input : handle -
|
||||||
|
// Output : a pointer to the studiomodelcache_t object
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
studiomodelcache_t* CMDLCache::GetModelCache(const MDLHandle_t handle)
|
studiomodelcache_t* CMDLCache::GetModelCache(const MDLHandle_t handle)
|
||||||
{
|
{
|
||||||
if (handle == MDLHANDLE_INVALID)
|
if (handle == MDLHANDLE_INVALID)
|
||||||
@ -318,11 +323,6 @@ studiohwdata_t* CMDLCache::GetHardwareData(CMDLCache* const cache, const MDLHand
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
studiohdr_t* CMDLCache::GetErrorModel(void)
|
studiohdr_t* CMDLCache::GetErrorModel(void)
|
||||||
{
|
{
|
||||||
// NOTE: must enable the old gather props logic for fallback models to draw !!!
|
|
||||||
// The new one won't call GetHardwareData on bad model handles.
|
|
||||||
// TODO[ AMOS ]: move this elsewhere; correct place is GatherStaticPropsSecondPass().
|
|
||||||
g_StudioMdlFallbackHandler.EnableLegacyGatherProps();
|
|
||||||
|
|
||||||
return g_StudioMdlFallbackHandler.GetFallbackModelHeader();
|
return g_StudioMdlFallbackHandler.GetFallbackModelHeader();
|
||||||
}
|
}
|
||||||
const char* CMDLCache::GetErrorModelName(void)
|
const char* CMDLCache::GetErrorModelName(void)
|
||||||
|
@ -22,9 +22,32 @@ void* CStaticProp::Init(CStaticProp* thisptr, int64_t a2, unsigned int idx, unsi
|
|||||||
return CStaticProp__Init(thisptr, a2, idx, a4, lump, a6, a7);
|
return CStaticProp__Init(thisptr, a2, idx, a4, lump, a6, a7);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// NOTE: the following gather props functions have been hooked as we must
|
||||||
|
// enable the old gather props logic for fall back models to draw !!! The
|
||||||
|
// new solution won't call CMDLCache::GetHardwareData() on bad model handles.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
void* GatherStaticPropsSecondPass_PreInit(GatherProps_t* gather)
|
||||||
|
{
|
||||||
|
if (g_StudioMdlFallbackHandler.HasInvalidModelHandles())
|
||||||
|
g_StudioMdlFallbackHandler.EnableLegacyGatherProps();
|
||||||
|
|
||||||
|
return v_GatherStaticPropsSecondPass_PreInit(gather);
|
||||||
|
}
|
||||||
|
void* GatherStaticPropsSecondPass_PostInit(GatherProps_t* gather)
|
||||||
|
{
|
||||||
|
if (g_StudioMdlFallbackHandler.HasInvalidModelHandles())
|
||||||
|
g_StudioMdlFallbackHandler.EnableLegacyGatherProps();
|
||||||
|
|
||||||
|
return v_GatherStaticPropsSecondPass_PostInit(gather);
|
||||||
|
}
|
||||||
|
|
||||||
void VStaticPropMgr::Detour(const bool bAttach) const
|
void VStaticPropMgr::Detour(const bool bAttach) const
|
||||||
{
|
{
|
||||||
#ifndef DEDICATED
|
#ifndef DEDICATED
|
||||||
DetourSetup(&CStaticProp__Init, &CStaticProp::Init, bAttach);
|
DetourSetup(&CStaticProp__Init, &CStaticProp::Init, bAttach);
|
||||||
#endif // !DEDICATED
|
#endif // !DEDICATED
|
||||||
|
|
||||||
|
DetourSetup(&v_GatherStaticPropsSecondPass_PreInit, &GatherStaticPropsSecondPass_PreInit, bAttach);
|
||||||
|
DetourSetup(&v_GatherStaticPropsSecondPass_PostInit, &GatherStaticPropsSecondPass_PostInit, bAttach);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,25 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "public/gamebspfile.h"
|
#include "public/gamebspfile.h"
|
||||||
|
|
||||||
|
struct GatherProps_t
|
||||||
|
{
|
||||||
|
// TODO: reverse structure.
|
||||||
|
int field_0;
|
||||||
|
int field_4;
|
||||||
|
int field_8;
|
||||||
|
int field_C;
|
||||||
|
_BYTE gap10[8];
|
||||||
|
int field_18;
|
||||||
|
int field_1C;
|
||||||
|
int field_20;
|
||||||
|
int field_24;
|
||||||
|
int field_28;
|
||||||
|
__int64 field_30;
|
||||||
|
int field_38;
|
||||||
|
int field_3C;
|
||||||
|
__int64 field_40;
|
||||||
|
};
|
||||||
|
|
||||||
class CStaticProp
|
class CStaticProp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -10,6 +29,8 @@ private: // TODO: reverse structure.
|
|||||||
};
|
};
|
||||||
|
|
||||||
inline void*(*CStaticProp__Init)(CStaticProp* thisptr, int64_t a2, unsigned int idx, unsigned int a4, StaticPropLump_t* lump, int64_t a6, int64_t a7);
|
inline void*(*CStaticProp__Init)(CStaticProp* thisptr, int64_t a2, unsigned int idx, unsigned int a4, StaticPropLump_t* lump, int64_t a6, int64_t a7);
|
||||||
|
inline void*(*v_GatherStaticPropsSecondPass_PreInit)(GatherProps_t* gather);
|
||||||
|
inline void* (*v_GatherStaticPropsSecondPass_PostInit)(GatherProps_t* gather);
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
class VStaticPropMgr : public IDetour
|
class VStaticPropMgr : public IDetour
|
||||||
@ -22,6 +43,8 @@ class VStaticPropMgr : public IDetour
|
|||||||
virtual void GetFun(void) const
|
virtual void GetFun(void) const
|
||||||
{
|
{
|
||||||
g_GameDll.FindPatternSIMD("48 8B C4 44 89 40 18 48 89 50 10 55").GetPtr(CStaticProp__Init);
|
g_GameDll.FindPatternSIMD("48 8B C4 44 89 40 18 48 89 50 10 55").GetPtr(CStaticProp__Init);
|
||||||
|
g_GameDll.FindPatternSIMD("48 89 4C 24 ?? 55 56 57 41 54 41 55 41 56 41 57 B8 ?? ?? ?? ?? E8 ?? ?? ?? ?? 48 2B E0 48 8D 6C 24 ?? 48 8B 05 ?? ?? ?? ?? 4C 8B F9").GetPtr(v_GatherStaticPropsSecondPass_PreInit);
|
||||||
|
g_GameDll.FindPatternSIMD("48 89 4C 24 ?? 55 56 57 41 54 41 55 41 56 41 57 B8 ?? ?? ?? ?? E8 ?? ?? ?? ?? 48 2B E0 48 8D 6C 24 ?? 48 8B 05 ?? ?? ?? ?? 4C 8B F1").GetPtr(v_GatherStaticPropsSecondPass_PostInit);
|
||||||
}
|
}
|
||||||
virtual void GetVar(void) const
|
virtual void GetVar(void) const
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user