Loads a DataPak file from disk for reading.
Creates a DataPak file from scratch.
A destructor is present on this object, but not explicitly documented in the source.
Selects between checksums. Please note that the more bytes the checksum needs, the less will be left for the filename. Values between 32-63 can be used for custom implementations.
Default compression methods for the file.
Adds a file to be compressed later. Returns the created index for it.
Checks the integrity of a file.
Compresses a single file into the stream.
Decompresses a given amount from the file from the current position.
Begins compression into file.
Returns a given index.
Returns the next file as an ubyte[] array.
Returns the index of next file.
Initializes compression.
Initializes decompression.
Stores the length of each checksum result
Every DataPak file begins with this. The dot will be replaced with numbers if I ever decide to make any upgrades to the format
Doesn't throw on errors, returns data regardless of error
Sets the read buffer size of all instances (default is 32kB)
Stores important informations about the file.
Index representing data for a file.
Current position of data; position of all currently decompressed data
Only used during compression
0 if no data left from previous decompression
Called to inform host on decompression process (will be replaced with something more useful in the future)
DataPak (*.dpk) is mainly intended as a compression method for application assets. Technically it can store folder info, but the fixed filename length is shorter to save some extra space. There's some support for expanding the path, but currently unimplemented.
General layout of a file: <ul> <li>DataPak signature</li> <li>Header</li> <li>Extension area. Ignored by default, handling must be implemented by whoever wants to use it. Can be compressed alongside with the main data to save some space (not recommended if it's needed for compression, e.g. dictionaries), but only if the index field is also compressed.</li> <li>Array of DataPak indexes. Each entry can have some extension. Can be compressed alongside with the main data to save some space.</li> <li>CRC32 checksum at the begining of compressed block or at the end of file information description table.</li> <li>Data</li> </ul>