-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDPC.hexpat
162 lines (141 loc) · 3.45 KB
/
DPC.hexpat
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
// Adapted from
// https://github.com/amrshaheen61/APT_DPC_Tool/blob/master/APT%20DPC%20Tool/Core/DpcHelper.cs
#include <zouna.hexpat>
enum CompressionType : u8 {
NONE = 0,
Zlib = 4,
};
struct DataResource {
u64 class_name;
u64 name;
u64 link_name;
u32 size;
u32 link_header_size;
u32 decompressed_body_size;
u32 compressed_body_size;
u16 padding_size;
CompressionType compression_type;
std::assert(std::core::is_valid_enum(compression_type), "!std::core::is_valid_enum(compression_type)");
u8 link_header[link_header_size];
u8 pad[padding_size];
if (compressed_body_size != 0) {
u8 compressed_data[compressed_body_size];
} else {
u8 decompressed_data[decompressed_body_size];
}
};
struct Resource {
u64 name;
u64 class_name;
u32 offset;
u32 compressed_size;
u32;
u32 decompressed_size;
u16;
u16;
if (parent.parent.parent.parent.parent.header.resources_block_size != 0 &&
parent.parent.parent.parent.parent.header.resources_block_offset != 0 &&
parent.parent.parent.parent.parent.header.map_size == 0 &&
parent.parent.parent.parent.parent.header.map_offset == 0) {
DataResource data_resource @ offset * 16;
}
};
struct DataDescription {
u32 resource_count;
u64 padded_size;
u64 size;
u64 working_buffer_offset;
};
struct Data {
DataResource datas[parent.data_descriptions[std::core::array_index()].resource_count];
std::mem::AlignTo<16>;
};
struct Updated {
Name_Z64 name;
u32 index1;
u32 index2;
};
struct Updated2 {
Name_Z64 name1;
Name_Z64 name2;
};
struct UpdatedData {
u8 data[0x24];
};
enum BigFileType : u8 {
RTC = 0,
NORMAL = 1,
COMMON = 2,
UPDATED1 = 4,
};
struct Resources {
u32 data_count;
u32 data_offset;
u32 working_buffer_offset;
u32;
u64;
u64 padded_size;
u64 padding_size;
DataDescription data_descriptions[data_count];
DataDescription unused_data_descriptions[52 - data_count];
DynArray_Z<Resource> resources;
DynArray_Z<UpdatedData> zero;
DynArray_Z<Updated2> rename;
DynArray_Z<Updated> updateds;
DynArray_Z<u32> updateds_indices;
DynArray_Z<Resource> resources2;
std::mem::AlignTo<16>;
if (data_offset != 0) {
Data datas[data_count] @ data_offset * 16;
}
};
struct BlockDescription {
u64;
u64;
u64;
u32 resources_map_offset;
u32 data_resources_map_offset;
Resources resources @ resources_map_offset * 16;
};
struct BlockDescriptions {
u32 block_count;
BlockDescription block_descriptions[block_count];
};
struct Header {
char version[256];
BigFileType big_file_type;
u32;
u32 block_description_offset;
u32 resources_block_size;
u32 resources_block_offset;
u32 map_size;
u32 map_offset;
std::mem::AlignTo<4096>;
};
struct MapResource {
Name_Z64 class_name;
Name_Z64 name;
Name_Z64 link_name;
u32 offset;
u32 compressed_size;
u64;
u32 decompressed_size;
u64;
u64;
};
struct MapEntry {
};
struct Map {
DynArray_Z<MapResource> map_resources;
DynArray_Z<MapEntry> map_entries;
};
struct AptrBigFile {
Header header;
if (header.block_description_offset != 0) {
BlockDescriptions block_descriptions @ header.block_description_offset * 16;
}
if (header.map_offset != 0) {
Map map @ header.map_offset * 16;
}
};
AptrBigFile aptr_big_file @ 0x0;