Skip to content

Commit 3100741

Browse files
committed
add HexFiend template
1 parent b91d2ec commit 3100741

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

Wherigo Cartridge.tcl

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Wherigo Cartridge (template for HexFiend - https://github.com/HexFiend/HexFiend)
2+
# created by Markus Birth (https://git.mbirth.uk)
3+
# .types = ( gwc );
4+
5+
requires 0 "02 0a 43 41 52 54 00"
6+
7+
little_endian
8+
9+
hex 2 "Signature"
10+
ascii 5 "Identifier"
11+
12+
set count [uint16 "Obj Count"]
13+
14+
set objAddrs [list]
15+
section -collapsed "Obj References" {
16+
for { set i 1 } { $i <= $count } { incr i } {
17+
set objId [uint16 "Obj #$i ID"]
18+
set objAddr [uint32 -hex "Obj #$i Addr"]
19+
lappend objAddrs $objId
20+
lappend objAddrs $objAddr
21+
}
22+
}
23+
24+
section "Header" {
25+
int32 "Length"
26+
27+
double "Latitude"
28+
double "Longitude"
29+
double "Altitude"
30+
31+
# Seconds since 2004-02-10 01:00:00
32+
set cTime [int64 "Creation Time"]
33+
incr cTime 1076378400
34+
entry "Decoded Time" [clock format $cTime]
35+
36+
int16 "Splash/Poster ID"
37+
int16 "Icon ID"
38+
39+
cstr "utf8" "Cart Type"
40+
cstr "utf8" "Player Name"
41+
int64 "Groundspeak Player ID"
42+
43+
cstr "utf8" "Cart Name"
44+
cstr "utf8" "Cart GUID"
45+
cstr "utf8" "Cart Description"
46+
cstr "utf8" "Start Loc Desc"
47+
cstr "utf8" "Version"
48+
cstr "utf8" "Author"
49+
cstr "utf8" "Company"
50+
cstr "utf8" "Recommended Device"
51+
52+
int32 "Completion Code Len"
53+
cstr "utf8" "Completion Code"
54+
}
55+
56+
foreach {objId objAddr} $objAddrs {
57+
section -collapsed "Obj $objId" {
58+
goto $objAddr
59+
if {$objId == 0} {
60+
# Obj 0 is always Lua
61+
set strLen [uint32 "Length"]
62+
sectionvalue "Lua / $strLen Bytes"
63+
hex $strLen "Lua Bytecode"
64+
} else {
65+
set valid [int8 "Is Valid?"]
66+
67+
if {$valid == 0} {
68+
sectionvalue "DELETED"
69+
} else {
70+
set type [int32 "Typecode"]
71+
set len [uint32 "Length"]
72+
73+
switch $type {
74+
-1 { sectionvalue "DELETED / $len Bytes" }
75+
1 { sectionvalue "BMP / $len Bytes" }
76+
2 { sectionvalue "PNG / $len Bytes" }
77+
3 { sectionvalue "JPG / $len Bytes" }
78+
4 { sectionvalue "GIF / $len Bytes" }
79+
17 { sectionvalue "WAV / $len Bytes" }
80+
18 { sectionvalue "MP3 / $len Bytes" }
81+
19 { sectionvalue "FDL / $len Bytes" }
82+
20 { sectionvalue "SND / $len Bytes" }
83+
21 { sectionvalue "OGG / $len Bytes" }
84+
33 { sectionvalue "SWF / $len Bytes" }
85+
49 { sectionvalue "TXT / $len Bytes" }
86+
default { sectionvalue "??? / $len Bytes" }
87+
}
88+
89+
bytes $len "Payload"
90+
}
91+
}
92+
}
93+
}

0 commit comments

Comments
 (0)