Victor Kasenda resource archive source code (c) 1998-2001 Victor Kasenda / gruv. Similar to a BZIP2 Tarball.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
3.4 KiB

Archive Structure Text file.
revision 1.0
Applicable for reSource v2.1 and above.
Last Modified: 11/December/2000
reSource (C) 1998-2001 Victor Kasenda / gruv
1.0: Final revision. Added more comments.
0.3: Added archive signature
0.2: Cleaned up and added several data
0.1: Initial version
Data types and definition:
byte - basic unit.
longint - 4 bytes. (Long Integer. Can take a negative value.)
string - variable length + null termination
... - variable size. Also used to indicate the data can be repeated as
many times as wanted.
General Format of a reSource Archive
The extension for a reSource archive is 'rS'. All archives have a signature to
confirm that it is a reSource archive.
An empty archive is one that has no files. It must have a valid signature and
a central directory end header.
A zero byte file is not a valid archive.
Generally, the reSource archive will have an archive header, as many data
blocks as needed, a central directory and a central directory end record.
Long integers are stored in groups of 4 bytes. The byte with the lsb goes
first. So the signatures values had to be reversed to allow them to be seen by
a hex editor.
The signatures are stored in ArchiveHeadersUnit.
Each header has a corresponding class.
For some headers, the actual size in bytes is required so it is stored in
a constant e.g. DATA_HEADER_SIZE is the size of a data header.
Data Header
Each data block has a data header.
first similarity index - first char to start with when restoring the block
virtual smallest char - it does not exist, so it is not output to the block.
when restoring, leave a space at this index to pretend it's there. used in
sada sort.
Overall reSource format:
[archive header]
[data header + data block] . . .
[central directory] end of central directory record
A. Archive Header
reSource Archive signature 4 bytes ('RSVK')
B. Data Header
Data header signature 4 bytes ('DATA')
crc 32 4 bytes
compressed size 4 bytes
first similarity index 4 bytes
virtual smallest char index 4 bytes
C. Central Director Structure:
[file header] . . . + end of central directory record
File Header:
Central file header signature 4 bytes ('CFHS')
compressed size 4 bytes
uncompressed size 4 bytes
number of blocks 4 bytes
offset of first local data header 4 bytes
time (dos date + time) 4 bytes
attr 4 bytes
file name string
End Of Central Directory Record:
Signature 4 bytes ('ECDR') End of Central Directory Record
Block Size 4 bytes
offset of first Central File Header 4 bytes