-
Notifications
You must be signed in to change notification settings - Fork 269
Expand file tree
/
Copy pathmirax-index.hexpat
More file actions
73 lines (60 loc) · 1.6 KB
/
Copy pathmirax-index.hexpat
File metadata and controls
73 lines (60 loc) · 1.6 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#pragma description MIRAX Index.dat
import std.io;
import std.mem;
#pragma endian little
#pragma eval_depth 1024
// configured by the user in the Settings tab.
// only the Slidedat knows how many records we have.
u32 hier_record_count in;
u32 nonhier_record_count in;
struct HierEntry {
u32 image;
u32 offset;
u32 length;
u32 file;
} [[format_read("format_hier_entry"), static]];
fn format_hier_entry(HierEntry e) {
return std::format("[{}. {}, {}, {}]", e.image, e.offset, e.length, e.file);
};
struct NonHierEntry {
u32 padding1;
u32 padding2;
u32 offset;
u32 length;
u32 file;
} [[format_read("format_nonhier_entry"), static]];
fn format_nonhier_entry(NonHierEntry e) {
return std::format("[{}, {}, {}]", e.offset, e.length, e.file);
};
u32 cur_page = 0;
struct Page<Entry> {
u32 page_num = cur_page;
u32 count;
u32 next;
Entry entries[count];
} [[format_read("format_page"), name(std::format("[{}]", page_num))]];
fn format_page(auto p) {
return std::format("[{} entries]", p.count);
};
struct Pages<Entry> {
Page<Entry> page;
if (page.next != 0) {
cur_page = cur_page + 1;
Pages<Entry> next_page @ page.next [[inline]];
}
} [[inline]];
struct Record<Entry> {
if (std::mem::read_unsigned($, 4) != 0) {
cur_page = 0;
Pages<Entry> *pages : u32;
} else {
padding[4];
}
};
struct File {
char version[5];
char slide_id[32];
Record<HierEntry> *hier_records[hier_record_count] : u32;
Record<NonHierEntry> *nonhier_records[nonhier_record_count] : u32;
} [[inline]];
File file @ 0;