forked from Ithamar/awutils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimagewty.h
86 lines (78 loc) · 2.45 KB
/
imagewty.h
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
#ifndef IMAGEWTY_H
#define IMAGEWTY_H
#include <stdint.h>
#define IMAGEWTY_MAGIC "IMAGEWTY"
#define IMAGEWTY_MAGIC_LEN 8
#define IMAGEWTY_VERSION 0x100234
#define IMAGEWTY_FILEHDR_LEN 1024
struct imagewty_header {
char magic[IMAGEWTY_MAGIC_LEN];
uint32_t header_version; /* Image header version (seen values are 0x0100 / 0x0300) */
uint32_t header_size; /* Image header size (sizeof(struct imagewty_header)) */
uint32_t ram_base;
uint32_t version; /* format version (IMAGEWTY_VERSION) */
uint32_t image_size; /* total size of image file (rounded up to 256 bytes?) */
uint32_t image_header_size; /* image header size (including padding) */
union {
struct {
uint32_t pid; /* USB peripheral ID (from image.cfg) */
uint32_t vid; /* USB vendor ID (from image.cfg) */
uint32_t hardware_id; /* Hardware ID (from image.cfg) */
uint32_t firmware_id; /* Firmware ID (from image.cfg) */
uint32_t val1; /* */
uint32_t val1024; /* */
uint32_t num_files; /* Total number of files embedded */
uint32_t val1024_2; /* */
uint32_t val0; /* */
uint32_t val0_2; /* */
uint32_t val0_3; /* */
uint32_t val0_4; /* */
/* 0x0050 */
} v1;
struct {
uint32_t unknown;
uint32_t pid; /* USB peripheral ID (from image.cfg) */
uint32_t vid; /* USB vendor ID (from image.cfg) */
uint32_t hardware_id; /* Hardware ID (from image.cfg) */
uint32_t firmware_id; /* Firmware ID (from image.cfg) */
uint32_t val1; /* */
uint32_t val1024; /* */
uint32_t num_files; /* Total number of files embedded */
uint32_t val1024_2; /* */
uint32_t val0; /* */
uint32_t val0_2; /* */
uint32_t val0_3; /* */
uint32_t val0_4; /* */
/* 0x0060 */
} v3;
};
};
#define IMAGEWTY_FHDR_MAINTYPE_LEN 8
#define IMAGEWTY_FHDR_SUBTYPE_LEN 16
#define IMAGEWTY_FHDR_FILENAME_LEN 256
struct imagewty_file_header {
uint32_t filename_len;
uint32_t total_header_size;
const char maintype[IMAGEWTY_FHDR_MAINTYPE_LEN];
const char subtype[IMAGEWTY_FHDR_SUBTYPE_LEN];
union {
struct {
uint32_t unknown_3;
uint32_t stored_length;
uint32_t original_length;
uint32_t offset;
uint32_t unknown;
const char filename[IMAGEWTY_FHDR_FILENAME_LEN];
} v1;
struct {
uint32_t unknown_0;
const char filename[IMAGEWTY_FHDR_FILENAME_LEN];
uint32_t stored_length;
uint32_t pad1;
uint32_t original_length;
uint32_t pad2;
uint32_t offset;
} v3;
};
};
#endif /* IMAGEWTY_H */