2022-04-09 00:59:42 +02:00
|
|
|
#ifndef FILESYSTEM_H
|
|
|
|
#define FILESYSTEM_H
|
|
|
|
#include "vpklib/packedstore.h"
|
2022-06-12 12:14:31 +02:00
|
|
|
#include "filesystem/basefilesystem.h"
|
2022-04-09 00:59:42 +02:00
|
|
|
|
2022-05-28 02:05:54 +02:00
|
|
|
#define GAMEINFOPATH_TOKEN "|gameinfo_path|"
|
|
|
|
#define BASESOURCEPATHS_TOKEN "|all_source_engine_paths|"
|
|
|
|
|
2022-05-27 22:38:49 +02:00
|
|
|
class IFileSystem
|
2022-04-09 00:59:42 +02:00
|
|
|
{
|
|
|
|
public:
|
2022-06-12 12:14:31 +02:00
|
|
|
void AddSearchPath(const char* pPath, const char* pPathID, SearchPathAdd_t addType);
|
2022-05-28 02:05:54 +02:00
|
|
|
bool RemoveSearchPath(const char* pPath, const char* pPathID);
|
2022-04-09 00:59:42 +02:00
|
|
|
bool ReadFromCache(const char* pPath, void* pResult);
|
2022-06-12 12:14:31 +02:00
|
|
|
VPKData_t* MountVPK(const char* pVpkPath);
|
2022-04-09 00:59:42 +02:00
|
|
|
};
|
2022-06-12 12:14:31 +02:00
|
|
|
|
|
|
|
class CFileSystem_Stdio : public IFileSystem, public CBaseFileSystem
|
2022-05-27 22:38:49 +02:00
|
|
|
{
|
|
|
|
};
|
2022-06-12 12:14:31 +02:00
|
|
|
|
2022-06-16 21:19:04 +02:00
|
|
|
extern CFileSystem_Stdio** g_pFullFileSystem; // Ptr to g_pFileSystem_Stdio.
|
|
|
|
extern CFileSystem_Stdio* g_pFileSystem_Stdio;
|
2022-04-09 00:59:42 +02:00
|
|
|
|
2022-06-16 21:19:04 +02:00
|
|
|
CFileSystem_Stdio* FileSystem();
|
2022-04-09 00:59:42 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2022-05-13 14:53:25 +02:00
|
|
|
class VFileSystem_Stdio : public IDetour
|
2022-04-09 00:59:42 +02:00
|
|
|
{
|
2022-04-11 01:44:30 +02:00
|
|
|
virtual void GetAdr(void) const
|
2022-04-09 00:59:42 +02:00
|
|
|
{
|
2022-05-27 22:38:49 +02:00
|
|
|
spdlog::debug("| VAR: g_pFullFileSystem : {:#18x} |\n", reinterpret_cast<uintptr_t>(g_pFullFileSystem));
|
2022-05-13 14:53:25 +02:00
|
|
|
spdlog::debug("| VAR: g_pFileSystem_Stdio : {:#18x} |\n", reinterpret_cast<uintptr_t>(g_pFileSystem_Stdio));
|
|
|
|
spdlog::debug("+----------------------------------------------------------------+\n");
|
2022-04-09 00:59:42 +02:00
|
|
|
}
|
2022-04-11 01:44:30 +02:00
|
|
|
virtual void GetFun(void) const { }
|
2022-04-18 03:35:08 +02:00
|
|
|
virtual void GetVar(void) const
|
|
|
|
{
|
2022-05-27 22:38:49 +02:00
|
|
|
g_pFullFileSystem = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x48\x8B\x0D\x00\x00\x00\x00\x45\x33\xC0\x48\x83\xC1\x08\x48\x8B\x01"),
|
2022-06-16 21:19:04 +02:00
|
|
|
"xxx????xxxxxxxxxx").ResolveRelativeAddressSelf(0x3, 0x7).RCast<CFileSystem_Stdio**>();
|
2022-05-27 22:38:49 +02:00
|
|
|
|
|
|
|
g_pFileSystem_Stdio = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x48\x8D\x05\x00\x00\x00\x00\x48\x89\x05\x00\x00\x00\x00\x48\x8D\x0D\x00\x00\x00\x00\x48\x8D\x05\x00\x00\x00\x00\x48\x89\x05\x00\x00\x00\x00\xE9\x00\x00\x00\x00"),
|
|
|
|
"xxx????xxx????xxx????xxx????xxx????x????").FindPattern("48 89", CMemory::Direction::DOWN, 512, 1).ResolveRelativeAddressSelf(0x3, 0x7).RCast<CFileSystem_Stdio*>();
|
2022-04-18 03:35:08 +02:00
|
|
|
}
|
2022-04-11 01:44:30 +02:00
|
|
|
virtual void GetCon(void) const { }
|
|
|
|
virtual void Attach(void) const { }
|
|
|
|
virtual void Detach(void) const { }
|
2022-04-09 00:59:42 +02:00
|
|
|
};
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2022-05-13 14:53:25 +02:00
|
|
|
REGISTER(VFileSystem_Stdio);
|
2022-04-09 00:59:42 +02:00
|
|
|
#endif // !FILESYSTEM_H
|