aboutsummaryrefslogtreecommitdiff
path: root/primedev/core/filesystem/filesystem.h
diff options
context:
space:
mode:
authorJack <66967891+ASpoonPlaysGames@users.noreply.github.com>2023-12-27 00:32:01 +0000
committerGitHub <noreply@github.com>2023-12-27 01:32:01 +0100
commitf5ab6fb5e8be7b73e6003d4145081d5e0c0ce287 (patch)
tree90f2c6a4885dbd181799e2325cf33588697674e1 /primedev/core/filesystem/filesystem.h
parentbb8ed59f6891b1196c5f5bbe7346cd171c8215fa (diff)
downloadNorthstarLauncher-f5ab6fb5e8be7b73e6003d4145081d5e0c0ce287.tar.gz
NorthstarLauncher-f5ab6fb5e8be7b73e6003d4145081d5e0c0ce287.zip
Folder restructuring from primedev (#624)v1.21.2-rc3v1.21.2
Copies of over the primedev folder structure for easier cherry-picking of further changes Co-authored-by: F1F7Y <filip.bartos07@proton.me>
Diffstat (limited to 'primedev/core/filesystem/filesystem.h')
-rw-r--r--primedev/core/filesystem/filesystem.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/primedev/core/filesystem/filesystem.h b/primedev/core/filesystem/filesystem.h
new file mode 100644
index 00000000..fcd1bb2f
--- /dev/null
+++ b/primedev/core/filesystem/filesystem.h
@@ -0,0 +1,69 @@
+#pragma once
+#include "core/sourceinterface.h"
+
+// taken from ttf2sdk
+typedef void* FileHandle_t;
+
+#pragma pack(push, 1)
+
+// clang-format off
+OFFSET_STRUCT(VPKFileEntry)
+{
+ STRUCT_SIZE(0x44);
+ FIELDS(0x0,
+ char* directory;
+ char* filename;
+ char* extension;
+ )
+};
+// clang-format on
+#pragma pack(pop)
+
+struct VPKData;
+
+enum SearchPathAdd_t
+{
+ PATH_ADD_TO_HEAD, // First path searched
+ PATH_ADD_TO_TAIL, // Last path searched
+};
+
+class CSearchPath
+{
+public:
+ unsigned char unknown[0x18];
+ const char* debugPath;
+};
+
+class IFileSystem
+{
+public:
+ struct VTable
+ {
+ void* unknown[10];
+ void (*AddSearchPath)(IFileSystem* fileSystem, const char* pPath, const char* pathID, SearchPathAdd_t addType);
+ void* unknown2[84];
+ bool (*ReadFromCache)(IFileSystem* fileSystem, const char* path, void* result);
+ void* unknown3[15];
+ VPKData* (*MountVPK)(IFileSystem* fileSystem, const char* vpkPath);
+ };
+
+ struct VTable2
+ {
+ int (*Read)(IFileSystem::VTable2** fileSystem, void* pOutput, int size, FileHandle_t file);
+ void* unknown[1];
+ FileHandle_t (*Open)(
+ IFileSystem::VTable2** fileSystem, const char* pFileName, const char* pOptions, const char* pathID, int64_t unknown);
+ void (*Close)(IFileSystem* fileSystem, FileHandle_t file);
+ long long (*Seek)(IFileSystem::VTable2** fileSystem, FileHandle_t file, long long offset, long long whence);
+ void* unknown2[5];
+ bool (*FileExists)(IFileSystem::VTable2** fileSystem, const char* pFileName, const char* pPathID);
+ };
+
+ VTable* m_vtable;
+ VTable2* m_vtable2;
+};
+
+extern SourceInterface<IFileSystem>* g_pFilesystem;
+
+std::string ReadVPKFile(const char* path);
+std::string ReadVPKOriginalFile(const char* path);