Description
FilePack is simply a tool that can compress any kind of data. It typically perform a 50% compression ratio on code and graphics.
Utilisation
FilePack can compress files, but also restore files that have been compressed.
To compress a file:
%OSDK%\bin\FilePack -p source_file compressed_file
To decompress a file:
%OSDK%\bin\FilePack -u compressed_file destination file
Switches
-p0 => No header -p1 => Save with short header [default] -p2 => Save with long headerSee below for the explanation regarding how this switch changes the format.
-p0 => No header -p1 => Save with short header [default] -p2 => Save with long headerSee below for the explanation regarding how this switch changes the format.
-m0 => 0=copy bytes / 1=new byte [default] -m1 => 0=new byte / 1=copy bytesThis is just to allow code optimization, some platforms are more comfortable branching on true, some prefer to branch on false. Just make sure the code handles that when depacking.
Packed file format
The format of packed files is actually very simple, and is mostly based on a 8 bytes header followed by compressed data.
+0 'L' +1 'Z' +2 '7' +3 '7' +4 Unpacked size (low byte) +5 Unpacked size (high byte) +6 Packed size (low byte) +7 Packed size (high byte) +8 Compressed data starts here
Please note that this header is present only when packed in default mode (-p1), if you pack in -p0 mode the header is not present. In place of the header you will find a text file having the same name that your "program.s", looking like this:
#define run_adress $600 ; Come from original TAP executable #define unpacked_size $1000 ; Come from original TAP executable
Depacking
For depacking a file, you can simply use the corresponding library routine:
void file_unpack(void *ptr_dst,void *ptr_src);
Please note that this routine expect the data to get a header, so it will not work for files packed in -p0 mode. To unpack these files you need to use another routine.
Historic
Here is the list of all releases with a short description of things that changed:
Version 0.5
- Added the -mn and -p2 optionsVersion 0.4
- Added p0/p1 mode to pack a file without appending the header. Very usefull when you want to spare a maximum of bytes in a minigame compo...Version 0.1-0.3
- First released version