wavelength 1.0.0
Loading...
Searching...
No Matches
archive.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4#include <vector>
5
6#include "os/arkhash.h"
7#include "os/string.h"
8
21
27class Archive {
28public:
36 explicit Archive(const char *pszBasename);
37
44 static void Init();
45
57 static bool
58 Locate(const char *pszFile, long long *pnOffset, int *pnSize, int *pnUncompressedSize);
59
71 bool
72 GetFileInfo(const char *pszFile, long long *pnOffset, int *pnSize, int *pnUncompressedSize);
73
80 void ReadHeader();
81
83 const std::vector<FileEntry> &GetFileEntries() const {
84 return mFileEntries;
85 }
86
88 const String &GetBasename() const {
89 return mBasename;
90 }
91
92private:
93 std::vector<FileEntry> mFileEntries;
94 ArkHash mHashTable;
95 String mBasename;
96 long long mArkfileStart;
97 int mReserved40; // +0x40, cleared by the constructor and otherwise unused
98};
99
106extern std::unique_ptr<Archive> TheArchive;
std::unique_ptr< Archive > TheArchive
The main archive, or null when the game does not run from the disc.
bool GetFileInfo(const char *pszFile, long long *pnOffset, int *pnSize, int *pnUncompressedSize)
Find a file in the archive.
static void Init()
Open the main archive when the game runs from the disc, and build the disc cache.
const std::vector< FileEntry > & GetFileEntries() const
Definition archive.h:83
const String & GetBasename() const
Definition archive.h:88
Archive(const char *pszBasename)
Find an archive on the disc and read its header from the host or disc file system.
static bool Locate(const char *pszFile, long long *pnOffset, int *pnSize, int *pnUncompressedSize)
Find a file in the main archive.
void ReadHeader()
Read the file records and the name table of the archive.
Hash table of the names of the files and directories of an archive.
Definition arkhash.h:12
Growable text buffer that is also a PrnStream.
Definition string.h:19
Record of one file of an archive.
Definition archive.h:14
int mOffset
Definition archive.h:15
int mSize
Definition archive.h:18
int mUncompressedSize
Definition archive.h:19
int mHashedName
Definition archive.h:16
int mHashedPath
Definition archive.h:17