First version.
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@130 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -0,0 +1,106 @@
|
|||||||
|
The .pkg/.ndx format as used for Starcon.pkg on the 3DO cd.
|
||||||
|
Acquired directly from the source.
|
||||||
|
|
||||||
|
Everything is stored LSB first.
|
||||||
|
|
||||||
|
Main header: (resinit.c, _GetResFileData())
|
||||||
|
position length meaning
|
||||||
|
0x00 2 Whether or not the file is packaged (res_flags)
|
||||||
|
(has all files in the .pkg file itself)
|
||||||
|
0 - the .pkg file is not packaged
|
||||||
|
else - the .pkg file is packaged
|
||||||
|
0x02 4 offset from the beginning of the file where the list
|
||||||
|
of package information is stored (packmem_list_offs)
|
||||||
|
0x06 4 offset from the beginning of the file where the list
|
||||||
|
of pathnames is stored (path_list_offs)
|
||||||
|
0x0a 4 offset from the beginning of the file where the list
|
||||||
|
of filenames is stored (file_list_offs)
|
||||||
|
0x0e 2 number of packages in the file (num_packages)
|
||||||
|
0x10 2 number of types of packages present in the file (num_types)
|
||||||
|
0x12 4 length of this header. (index_info.header_len)
|
||||||
|
(unused if the .pkg file is not packaged)
|
||||||
|
0x16 8*num_packages:
|
||||||
|
On position i the information for package i + 1 is
|
||||||
|
stored. There is no package 0.
|
||||||
|
4 p.packmem_info
|
||||||
|
bits 0-7: number of resource types
|
||||||
|
bits 8-20: number of resource instances
|
||||||
|
bits 21-31: index in file_list_offs of the file name for
|
||||||
|
this resource (only for packaged files)
|
||||||
|
4 p.flags_and_data_loc
|
||||||
|
(MSB is flags, rest is data_loc,
|
||||||
|
if MSB == 0, then of the data_loc only the low 16 bits
|
||||||
|
are used as a MEM_HANDLE (only in memory),
|
||||||
|
if MSB == 0xff, then the data_loc is an offset in the
|
||||||
|
file)
|
||||||
|
0x16+8*num_packages Type information
|
||||||
|
2*num_types
|
||||||
|
t.instance_count
|
||||||
|
The number of instances there are of this type.
|
||||||
|
On position i the instance count for type i + 1 is
|
||||||
|
stored. There's no type 0.
|
||||||
|
packmem_list_offs (should be directly after the index info):
|
||||||
|
for each of the num_packages packages:
|
||||||
|
for each of the resource types for this package
|
||||||
|
(as in p.packmem_info):
|
||||||
|
4 bits 0-7: The type number for this type. What that
|
||||||
|
number means isn't specified, and may
|
||||||
|
vary per .pkg file.
|
||||||
|
For the 3DO SC2 starcon.pkg file these are:
|
||||||
|
0 - not a type
|
||||||
|
1 - Graphics data (GFXRES)
|
||||||
|
2 - String data (STRTAB)
|
||||||
|
3 - Music data (MUSICRES)
|
||||||
|
4 - Resource index (RES_INDEX)
|
||||||
|
5 - Code (CODE)
|
||||||
|
bits 8-20: The instance number of the first instance
|
||||||
|
of this type in this package. Every
|
||||||
|
following instance has a number 1 higher
|
||||||
|
than the one before.
|
||||||
|
bits 21-31: number of resources of this type in the
|
||||||
|
package
|
||||||
|
for each of the resource instances for this package
|
||||||
|
(as in p.packmem_info):
|
||||||
|
2 if this is a packaged file: multiply by 4 to get
|
||||||
|
the length of this package.
|
||||||
|
if this is a file that is not packaged:
|
||||||
|
(the same position is in memory used as a
|
||||||
|
MEM_HANDLE to the actual data)
|
||||||
|
path_list_offs (should be directly after the packmem list)
|
||||||
|
? null terminated path strings, indexed from the file list
|
||||||
|
table
|
||||||
|
file_list_offs (should be directly after the path list)
|
||||||
|
? A number of file info structures. For packaged files,
|
||||||
|
these are indexed from the p.packmem_info (so (at most)
|
||||||
|
one per package). For non-packaged files, these are
|
||||||
|
indexed from an entry for an instance from
|
||||||
|
p.packmem_list (so possibly more per package)
|
||||||
|
These structures are in this form:
|
||||||
|
13 file info:
|
||||||
|
2 location relative to path_list_offs of the
|
||||||
|
the path to this file, or 0xffff if no path.
|
||||||
|
8 filename (8 chars or null-terminated)
|
||||||
|
3 extension (3 chars or null-terminated)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Resources with type 'resource index' (type 4 in the 3DO sc2 starcon.pkg file)
|
||||||
|
are files with the same format as this .pkg file itself.
|
||||||
|
|
||||||
|
|
||||||
|
For music resources: (type 3 in the 3DO sc2 starcon.pkg file)
|
||||||
|
If the first 3 characters are 'CDA', from the next character to the first
|
||||||
|
nul char, or 3 characters after the first period (whatever comes first) is
|
||||||
|
used as a filename with aif audio data to play. (CDA stands for CD-audio.
|
||||||
|
The source code mentions 'red book', but it's not (red book is the standard
|
||||||
|
for audio CD's)). The rest of the file (just a few more chars) seems to be
|
||||||
|
garbage.
|
||||||
|
If the first 3 characters are something else, the entire file (including the
|
||||||
|
first 3 characters) are used as a MOD file. (As the mod file uses those char
|
||||||
|
as the title of the song, a mod file with the title beginning with 'CDA'
|
||||||
|
will go wrong).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Initial version of this file 2002-10-10 by Serge van den Boom.
|
||||||
|
|
||||||
Reference in New Issue
Block a user