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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
#ifndef RVL_SDK_ARC_H
#define RVL_SDK_ARC_H
#include "common.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* Modified from decompilation by riidefi in WiiCore
* https://github.com/riidefi/WiiCore/tree/master/source/rx
*/
typedef enum {
ARC_ENTRY_FILE,
ARC_ENTRY_FOLDER
} ARCEntryType;
typedef struct ARCNode {
union {
struct {
u32 is_folder : 8;
u32 name : 24;
};
u32 packed_type_name;
}; // at 0x0
union {
struct {
u32 offset;
u32 size;
} file;
struct {
u32 parent;
u32 sibling_next;
} folder;
}; // at 0x4
} ARCNode;
typedef struct ARCHeader {
u32 magic; // at 0x0
struct {
s32 offset; // at 0x4
s32 size; // at 0x8
} nodes;
struct {
s32 offset; // at 0xC
} files;
char UNK_0x10[0x10];
} ARCHeader;
typedef struct ARCHandle {
ARCHeader *header; // at 0x0
ARCNode *nodes; // at 0x4
u8 *file; // at 0x8
u32 count; // at 0xC
const char *strings; // at 0x10
u32 fstSize; // at 0x14
s32 entrynum; // at 0x18
} ARCHandle;
typedef struct ARCDir {
ARCHeader *handle; // at 0x0
u32 entryNum; // at 0x4
u32 location; // at 0x8
u32 next; // at 0xC
} ARCDir;
typedef struct ARCFileInfo {
ARCHandle *handle; // at 0x0
u32 offset; // at 0x4
u32 size; // at 0x8
} ARCFileInfo;
typedef struct ARCEntry {
ARCHandle *handle; // at 0x0
u32 path; // at 0x4
ARCEntryType type; // at 0x8
const char *name; // at 0xC
} ARCEntry;
typedef struct ARCDirEntry {
ARCHandle *handle; // at 0x0
u32 entryNum; // at 0x4
BOOL isDir; // at 0x8
const char *name; // at 0xC
} ARCDirEntry;
BOOL ARCGetCurrentDir(ARCHandle *handle, char *string, u32 maxlen);
BOOL ARCInitHandle(void *bin, ARCHandle *handle);
BOOL ARCOpen(ARCHandle *handle, const char *path, ARCFileInfo *info);
BOOL ARCFastOpen(ARCHandle *handle, s32 entrynum, ARCFileInfo *info);
s32 ARCConvertPathToEntrynum(ARCHandle *handle, const char *path);
void *ARCGetStartAddrInMem(ARCFileInfo *info);
s32 ARCGetStartOffset(ARCFileInfo *info);
u32 ARCGetLength(ARCFileInfo *info);
BOOL ARCClose(ARCFileInfo *info);
BOOL ARCChangeDir(ARCHandle *info, const char *path);
BOOL ARCOpenDir(ARCHandle *info, const char *path, ARCDir *dir);
BOOL ARCReadDir(ARCDir *dir, ARCDirEntry *entry);
BOOL ARCCloseDir(ARCDir *dir);
#ifdef __cplusplus
}
#endif
#endif
|