forked from difcareer/010templates
-
Notifications
You must be signed in to change notification settings - Fork 1
/
SONYCamFirmwareTemplate.bt
82 lines (75 loc) · 1.92 KB
/
SONYCamFirmwareTemplate.bt
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
//--------------------------------------
//--- 010 Editor v6.0beta1 Binary Template
//
// File: SONYCamFirmwareTemplate.bt
// Author: Tim Strazzere <[email protected]> <[email protected]>
// Revision: 0.2
// Purpose: A template for Sony Camera Firmware files.
//
// License: This file is released into the public domain. People may
// use it for any purpose, commercial or otherwise.
//--------------------------------------
LittleEndian();
// From FirmwareArchive::GetChunkType(uchar *)
typedef enum <uint32> {
DATV = 0x44415456, // Unknown as of right now
PROV = 0x50524F56,
UDID = 0x55444944,
FDAT = 0x46444154,
DEND = 0x44454E44, // End will follow with CRC
UDIC = 0x55444943 // Unknown what this should even be?
} chunk_type <format=hex>;
typedef struct {
// Chunk header
BigEndian();
uint32 chunk_length;
chunk_type type;
switch(type) {
case DATV:
char data[4];
break;
case PROV:
char data[4];
break;
case UDID:
// This properly gets all the data
// though no idea what it is
uint32 count;
uint64 data[count];
break;
case FDAT:
// Firmware DATa - encrypted
char data[chunk_length];
break;
case DEND:
// Data END - CRC32 of everything above this chunk
char crc[4];
break;
default:
return("Hit unknown chunk type!\n");
}
} chunk <read=ChunkRead, optimize=false>;
string ChunkRead(chunk &data) {
switch(data.type) {
case DATV:
return "DATV";
case PROV:
return "PROV";
case UDID:
return "UDID";
case FDAT:
return "FDAT";
case DEND:
return "DEND";
case UDIC:
return "UDIC";
default:
return("UNKNOWN");
}
}
struct {
char magic[8] <format=hex>;
while(FTell() != FileSize()) {
chunk chunk_data;
}
} firmware_data;