r5sdk/r5dev/rtech/pak/pakstream.h
Kawe Mazidjatari 6e7bfab4bd RTech: major cleanup of pak globals and improvement
Add missing types to fully mapped out PakGlobals_s struct, which is a 13MiB+ structure! This covers the vast majority of the pakfile system which is why we had to change a bunch of stuff for this patch. This patch also comes with:

- Reversed 'JobFifoLock_s' structure
- Reversed 'PakTracker_s' structure
- Reversed 'PakAssetTracker_s' structure

Many globals have been dropped as they were covered by the large PakGlobals_s singleton.

The pak decoder logic has been changed up as well, we now use a decode mode enumerant which will make it easier to add in more decoders for the pak files in the future.
2024-04-05 18:13:31 +02:00

43 lines
1.8 KiB
C++

#ifndef RTECH_PAKSTREAM_H
#define RTECH_PAKSTREAM_H
#include "rtech/ipakfile.h"
#include "pakstate.h"
extern void Pak_OpenAssociatedStreamingFiles(PakLoadedInfo_t* const loadedInfo, PakLoadedInfo_t::StreamingInfo_t& streamInfo,
const uint16_t fileNamesBufSize, const EPakStreamSet set);
extern void Pak_EnableEmbeddedStreamingData(PakLoadedInfo_t* const loadedInfo, PakLoadedInfo_t::StreamingInfo_t& streamInfo);
extern void Pak_LoadStreamingData(PakLoadedInfo_t* const loadedInfo);
// the current download progress of optional streaming assets
inline float* g_pStreamingDownloadProgress = nullptr;
// NOTE: must use these when incrementing asset counts !!!
inline void Pak_IncrementStreamingAssetCount() { ThreadInterlockedIncrement64(&g_pakGlobals->numStreamableAssets); }
inline void Pak_DecrementStreamingAssetCount() { ThreadInterlockedDecrement64(&g_pakGlobals->numStreamableAssets); }
inline int64_t Pak_GetNumStreamableAssets() { return g_pakGlobals->numStreamableAssets; }
inline float Pak_GetStreamingDownloadProgress() { return *g_pStreamingDownloadProgress; }
inline bool Pak_StreamingDownloadFinished() { return Pak_GetStreamingDownloadProgress() == 1.0f; }
inline bool Pak_StreamingEnabled() { return g_pakGlobals->useStreamingSystem != NULL; }
class V_PakStream : public IDetour
{
virtual void GetAdr(void) const
{
LogVarAdr("g_streamingDownloadProgress", g_pStreamingDownloadProgress);
}
virtual void GetFun(void) const { }
virtual void GetVar(void) const
{
g_GameDll.FindPatternSIMD("F3 0F 10 05 ?? ?? ?? ?? C3 CC CC CC CC CC CC CC 48 89 5C 24 ?? 57 48 81 EC ?? ?? ?? ??")
.ResolveRelativeAddress(0x4, 0x8).GetPtr(g_pStreamingDownloadProgress);
}
virtual void GetCon(void) const { }
virtual void Detour(const bool bAttach) const { };
};
#endif // RTECH_PAKSTREAM_H