r5sdk/r5dev/filesystem/filesystem.h
Kawe Mazidjatari 092b7e9d43 Start of migration to IDetour interface
Migrating to this to initialize all patterns and prototypes in Systems_Init() instead.
This should make debugging missing/not found patterns easier and allow for opting out variable/constant search (some of these require other patterns to be found, thus resulting in seg faults..).

Also added check to detect if user has a eligible CPU to run this SDK.
The game requires SSE and SSE2 instruction sets. Our SDK requires this too due to the use of SSE intrinsics, so we cannot let the game handle this. We have to check it ourselves.
2022-04-11 01:44:30 +02:00

53 lines
2.1 KiB
C++

#ifndef FILESYSTEM_H
#define FILESYSTEM_H
#include "vpklib/packedstore.h"
typedef void* FileHandle_t;
enum class SearchPathAdd_t : int
{
PATH_ADD_TO_HEAD, // First path searched
PATH_ADD_TO_TAIL, // Last path searched
PATH_ADD_TO_TAIL_ATINDEX, // First path searched
};
enum class FileWarningLevel_t : int
{
FILESYSTEM_WARNING = -1, // A problem!
FILESYSTEM_WARNING_QUIET = 0, // Don't print anything
FILESYSTEM_WARNING_REPORTUNCLOSED, // On shutdown, report names of files left unclosed
FILESYSTEM_WARNING_REPORTUSAGE, // Report number of times a file was opened, closed
FILESYSTEM_WARNING_REPORTALLACCESSES, // Report all open/close events to console ( !slow! )
FILESYSTEM_WARNING_REPORTALLACCESSES_READ, // Report all open/close/read events to the console ( !slower! )
FILESYSTEM_WARNING_REPORTALLACCESSES_READWRITE, // Report all open/close/read/write events to the console ( !slower! )
FILESYSTEM_WARNING_REPORTALLACCESSES_ASYNC // Report all open/close/read/write events and all async I/O file events to the console ( !slower(est)! )
};
class CFileSystem_Stdio
{
public:
void AddSearchPath(const char* pPath, const char* pathID, SearchPathAdd_t addType);
bool ReadFromCache(const char* pPath, void* pResult);
VPKData_t* MountVPK(const char* vpkPath);
};
extern CFileSystem_Stdio* g_pFileSystem_Stdio;
///////////////////////////////////////////////////////////////////////////////
class HFileSystem_Stdio : public IDetour
{
virtual void GetAdr(void) const
{
std::cout << "| VAR: g_pFileSystem_Stdio : 0x" << std::hex << std::uppercase << g_pFileSystem_Stdio << std::setw(0) << " |" << std::endl;
std::cout << "+----------------------------------------------------------------+" << std::endl;
}
virtual void GetFun(void) const { }
virtual void GetVar(void) const { }
virtual void GetCon(void) const { }
virtual void Attach(void) const { }
virtual void Detach(void) const { }
};
///////////////////////////////////////////////////////////////////////////////
REGISTER(HFileSystem_Stdio);
#endif // !FILESYSTEM_H