-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathFinder Icons.tcl
61 lines (49 loc) · 882 Bytes
/
Finder Icons.tcl
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
# Finder Icons File
# $ca $0000
little_endian
proc pstr { n name } {
set p [pos]
set len [uint8]
if { $len == 0 } {
move -1
entry $name "" $n
bytes $n
return ""
}
if { $len >= $n } { set len [expr $n - 1] }
set str [ascii $len]
goto $p
entry $name $str $n ;# [expr $len + 1]
bytes $n
return $str
}
proc icon { name } {
section $name {
uint16 "Type" ;# $8000 indicates color, $0000 is b/w
set size [uint16 "Size"]
uint16 "Height"
uint16 "Width"
if { $size > 0 } {
bytes $size "Image"
bytes $size "Mask"
}
}
}
# header
hex 4 "Block Next"
hex 2 "Block ID"
hex 4 "Path Handle"
pstr 16 "Name"
# list of icon records
while {![end]} {
section "Icon" {
set data_len [uint16 "Data Length"]
if { !$data_len } { break }
pstr 64 "Boss"
pstr 16 "Name"
uint16 -hex "File Type"
uint16 -hex "Aux Type"
icon "Big"
icon "Small"
}
}