RTech: move and rename texture streaming global state struct

More correct names.
This commit is contained in:
Kawe Mazidjatari 2025-01-06 00:53:54 +01:00
parent aefebd846e
commit 059f9fc82d
3 changed files with 39 additions and 41 deletions

View File

@ -24,7 +24,7 @@ static void StreamDB_Init(const char* const pszLevelName)
// If the requested STBSP file doesn't exist, then enable the GPU driven // If the requested STBSP file doesn't exist, then enable the GPU driven
// texture streaming system. // texture streaming system.
const bool gpuDriven = s_streamDataBase->fileHandle == FS_ASYNC_FILE_INVALID; const bool gpuDriven = s_textureStreamMgr->fileHandle == FS_ASYNC_FILE_INVALID;
gpu_driven_tex_stream->SetValue(gpuDriven); gpu_driven_tex_stream->SetValue(gpuDriven);
if (!gpuDriven) if (!gpuDriven)

View File

@ -4,7 +4,42 @@
inline void(*v_StreamDB_Init)(const char* const pszLevelName); inline void(*v_StreamDB_Init)(const char* const pszLevelName);
inline StreamDB_s* s_streamDataBase; struct TextureStreamMgr_s
{
bool initialised;
bool hasResidentPages;
char filePath[260]; // size=MAX_PATH.
char gap_105[2];
int fileHandle; // STBSP file handle.
char gap_10b[4];
char* stringBuffer;
StreamDBHeader_s header;
ST_ResidentPage* residentPages;
MaterialGlue_t** materials;
ST_Material* materialInfo;
int64 maxResidentPageSize;
StreamingDBPageState_s pageStates[4];
int picMip;
float streamBspBucketBias;
float streamBspDistScale;
__int64 unk_338;
uint32 streamBspCellX;
uint32 streamBspCellY;
int loadedLinkedTextureCount;
int totalMipLevelCount;
int loadedMipLevelCount;
int unk_34;
int64 usedStreamingMemory;
int64 totalStreamingMemory;
int unk_48;
int unk_50;
Vector3D streamBspCameraPos;
float streamBspHalfFovX;
float streamBspViewWidth;
TextureAsset_t* streamableTextures[4];
};
inline TextureStreamMgr_s* s_textureStreamMgr;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class VTextureStreaming : public IDetour class VTextureStreaming : public IDetour
@ -12,7 +47,7 @@ class VTextureStreaming : public IDetour
virtual void GetAdr(void) const virtual void GetAdr(void) const
{ {
LogFunAdr("StreamDB_Init", v_StreamDB_Init); LogFunAdr("StreamDB_Init", v_StreamDB_Init);
LogVarAdr("s_streamDataBase", s_streamDataBase); LogVarAdr("s_textureStreamMgr", s_textureStreamMgr);
} }
virtual void GetFun(void) const virtual void GetFun(void) const
{ {
@ -20,7 +55,7 @@ class VTextureStreaming : public IDetour
} }
virtual void GetVar(void) const virtual void GetVar(void) const
{ {
CMemory(v_StreamDB_Init).FindPattern("C6 05").ResolveRelativeAddressSelf(0x2, 0x7).GetPtr(s_streamDataBase); CMemory(v_StreamDB_Init).FindPattern("C6 05").ResolveRelativeAddressSelf(0x2, 0x7).GetPtr(s_textureStreamMgr);
} }
virtual void GetCon(void) const virtual void GetCon(void) const
{ } { }

View File

@ -59,41 +59,4 @@ struct ST_Material
char unk2[8]; char unk2[8];
}; };
// todo(amos): this is the texture streaming global state,
// rename it to TextureStreamMgr_s.
struct StreamDB_s
{
bool initialised;
bool hasResidentPages;
char filePath[260]; // size=MAX_PATH.
char gap_105[2];
int fileHandle; // STBSP file handle.
char gap_10b[4];
char* stringBuffer;
StreamDBHeader_s header;
ST_ResidentPage* residentPages;
MaterialGlue_t** materials;
ST_Material* materialInfo;
int64 maxResidentPageSize;
StreamingDBPageState_s pageStates[4];
int picMip;
float streamBspBucketBias;
float streamBspDistScale;
__int64 unk_338;
uint32 streamBspCellX;
uint32 streamBspCellY;
int loadedLinkedTextureCount;
int totalMipLevelCount;
int loadedMipLevelCount;
int unk_34;
int64 usedStreamingMemory;
int64 totalStreamingMemory;
int unk_48;
int unk_50;
Vector3D streamBspCameraPos;
float streamBspHalfFovX;
float streamBspViewWidth;
TextureAsset_t* streamableTextures[4];
};
#endif // RTECH_ISTREAMDB #endif // RTECH_ISTREAMDB