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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
|
This file documents the file formats used in Star Control 1.
The .pkg files are in the format described in the file "pkgformat".
The extracted files are described in this document.
The following describes the format used in the DOS version of SC1.
Resource types used in starcon.pkg:
1 - key config
2 - some graphics type (flags = 7)
3 - some graphics type (flags = 1)
4 - some graphics type (flags = 2) 5 - some graphics type (flags = 3)
6 - font
7 - scenario
8 - palette
9 - strtab
10 - ? (sound?)
Files of types 2, 3, 4, 5, 9, and 10 may be compressed; they have
a header of the following format: have the following format:
Uncompressed files:
off len
0x00 1 0 (means: not compressed)
0x01 1 flags, 0 in practice
0x04 2 Number of bytes that follow (MSB first)
0x06 start of data
Compressed files:
off len
0x00 1 6 (means: compressed)
0x01 1 flags
bit 0: unused
bit 1: (table2CodeLen)
if not set: table2 results are shifted by 6 bits.
if set: table2 results are shifted by 7 bits.
(never set in PC SC1 files)
bit 2: (litencoded) set if literal bytes are Huffman encoded
(never set in PC SC1 files)
rest: unused
0x02 4 uncompressed size (MSB first)
0x06 Huffman table 0 (8-bit codes) (only present if litencoded set)
used for encoding literal bytes
Huffman table 1 (6-bit codes)
used for encoding lengths
Huffman table 2 (6-bit codes)
used for the most significant table2CodeLen bits of an offset
Huffman table:
(numbers are in bits)
8 one less than the number of lengths of codes
in the table (lenCnt)
8 * lenCnt LONIBBLE: one less than one of the code lengths
HINIBBLE: one less than the number of codes with
this length
This is enough to construct the huffman table.
TODO: document the rest of the compression format; for now, look at the
code of sc1-decomp.
Resource type 1 (key config):
off len
0x00 1 bottom player special key ('n')
0x01 1 top player special key ('1')
0x02 1 bottom player left key ('m')
0x03 1 top player left key ('2')
0x04 1 bottom player right key (',')
0x05 1 top player right key ('3')
0x06 1 bottom player thrust key ('.')
0x07 1 top player thrust key ('4')
0x08 1 bottom player fire key ('/')
0x09 1 top player fire key ('5')
0x0a 1 ?
0x0b 1 ?
0x0c 1 ?
0x0d 1 ?
0x0e 1 ?
0x0f 1 ?
0x10 1 ?
0x11 1 ?
0x12 1 ?
0x13 1 ?
Resource types 2, 3, 4, and 5 (graphics):
The difference between those types is the flags parameter that is passed
to the load functions (see above in the table of resource types).
bit 0: ?
bit 1: probably indicates whether a palette is used
bit 2: ?
rest: unused
(after decompression/removing packing header)
off len
0x00 4 "IANM"
0x04 2 frame count (MSB first)
0x06 2 MSB first
LOBYTE: bits per pixel. All SC1 files are either 1 bpp or 4 bpp.
For every frame:
2 width (MSB first)
2 height (MSB first)
For every frame:
2 x hotspot
2 y hotspot
1 if not zero, the file includes palettes
1 transparant color
16 (optional) (CGA?) palette (16 entries of 1 byte)
16 (optional) (EGA/Tandy?) palette (16 entries of 1 byte)
16 (optional) (MCGA/VGA?) palette (16 entries of 1 byte)
? pixel data (indicees in palette)
Resource type 6 (font):
off len
0x00 1 ?
0x01 1 ?
0x02 1 LONIBBLE:
HINIBBLE:
0x03 48
The letters are actually readable if you do 'xxd -b'; it shouldn't be too
hard to RE this one.
Resource type 7 (scenario):
off len
0x00 16 Title (\0 terminated)
0x10 ? Short description (\0 terminated)
? ? Unknown (probably description of star systems, Space Spines,
fleets and bases (maybe random seeds?))
0x80 840(?) Long description (\0 terminated)
Resource type 8 (palette):
off len
0 768 palette data:
for each of the 256 entries (with index 0 through 255):
1 red value
1 green value
1 blue value
Resource type 9 (string):
off len
0x00 2 Number of strings (MSB first)
0x02 2 unknown (always 0x0000)
for each string s:
2 len[s]: length of the string (MSB first)
for each string s:
len[s] String data (not '\0'-terminated)
starcon.exe:
compressed using lzexe
(http://fabrice.bellard.free.fr/lzexe.html)
Using PLINK86 to load starcon.ovl as an overlay.
The Amiga version of SC1:
Resource types used in starcon.pkg:
1 - key config (presumed; different from the DOS version)
2 - graphics
3 - graphics
4 - graphics
5 - graphics
6 - font
7 - scenario (as with the DOS version)
8 - strings as on DOS, but also other data in the same format
(presumably including sound)
Files of types 2, 3, 4, 5, 8 may be compressed as in the DOS version.
Graphics files are in a different file format as on DOS. I haven't worked
on these files yet.
Initial version created on 2007-06-01 by Serge van den Boom.
|