-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfilesystem.h
More file actions
52 lines (42 loc) · 1.06 KB
/
Copy pathfilesystem.h
File metadata and controls
52 lines (42 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#pragma once
//----------------------------------------------------------
#define FS_FILE_MAGIC 0x32414153 // "SAA2"
#define FS_BLOCK_SIZE 0x800 // 2kb
#define FS_INVALID_FILE 0xFFFFFFFF
#define FS_ENCKEY_VAR 37625
#define FS_ENC_CONST1 54825
#define FS_ENC_CONST2 91722
//----------------------------------------------------------
typedef struct _FS_HEADER
{
uint32_t dwSAAV;
uint32_t dwFileCount;
uint16_t wKey;
} FS_HEADER;
typedef struct _FS_FILE_ENTRY
{
uint32_t dwOffset;
uint32_t dwSize;
char szName[24];
uint32_t dwRealSize;
uint16_t wKey;
} FS_FILE_ENTRY;
//----------------------------------------------------------
class CFileSystem
{
private:
bool m_bLoaded;
uint32_t m_dwFileCount;
uint16_t m_wKey;
FS_FILE_ENTRY* m_pFileList;
uint8_t** m_pFileData;
public:
CFileSystem();
~CFileSystem();
void Load(char* szFileName, ...);
void Unload();
uint32_t GetFileIndex(char* szFileName);
uint32_t GetFileSize(uint32_t dwFileIndex);
uint8_t* GetFileData(uint32_t dwFileIndex);
void DecryptData(uint8_t* pData, uint32_t dwDataLen, uint16_t wKey);
};