/[projet1]/public/pc/tools/osdk/main/Osdk/_final_/documentation/doc_filepack.htm
Defence Force logotype

Contents of /public/pc/tools/osdk/main/Osdk/_final_/documentation/doc_filepack.htm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1527 - (show annotations)
Sat Sep 7 09:16:40 2019 UTC (2 months, 1 week ago) by dbug
File MIME type: text/html
File size: 3773 byte(s)
OSDK 1.15

1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
2
3 <HTML lang=fr dir=ltr>
4 <HEAD>
5 <meta name="robots" content="noindex">
6 <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
7 <title>OSDK - FilePack</title>
8 <link href="documentation.css" rel="stylesheet" type="text/css">
9 </HEAD>
10
11 <BODY>
12
13 <hr>
14 <A href="documentation.htm"><img src="arrow_back.gif"></A>
15 <img src="pics/osdk_logo_small.png">
16 <hr>
17
18 <h1>FilePack</h1>
19
20 <p id=chapter>Description</p>
21
22 <p>FilePack is simply a tool that can compress any kind of data.
23 It typically perform a 50% compression ratio on code and graphics.
24 </p>
25
26
27 <p id=chapter>Utilisation</p>
28
29 <p>FilePack can compress files, but also restore files that have been compressed.
30 </p>
31 <p>To compress a file:
32 </p>
33 <pre>
34 %OSDK%\bin\FilePack -p source_file compressed_file
35 </pre>
36 <p>To decompress a file:
37 </p>
38 <pre>
39 %OSDK%\bin\FilePack -u compressed_file destination file
40 </pre>
41
42
43 <p id=chapter>Switches</p>
44 <ul>
45
46 <li>The -u switch is used to decompress a file: Note that only files packed with a header (-p1 or -p2) can be unpacked (and you need to pass the correct -m0/-m1 values matching the one used when compressing the data)
47
48 <p>
49 <pre>
50 -p0 => No header
51 -p1 => Save with short header [default]
52 -p2 => Save with long header</pre>
53 See below for the explanation regarding how this switch changes the format.
54 </p>
55 </li>
56
57 <li>The -p switch defines the packing mode:
58 <p>
59 <pre>
60 -p0 => No header
61 -p1 => Save with short header [default]
62 -p2 => Save with long header</pre>
63 See below for the explanation regarding how this switch changes the format.
64 </p>
65 </li>
66
67
68 <li>The -m switch selects the meaning of the bits in the encoding mask
69 <pre>
70 -m0 => 0=copy bytes / 1=new byte [default]
71 -m1 => 0=new byte / 1=copy bytes</pre>
72 This 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.
73 </li>
74
75 </ul>
76
77 <p id=chapter>Packed file format</p>
78
79 <p>The format of packed files is actually very simple, and is mostly based on a 8 bytes header
80 followed by compressed data.
81 </p>
82
83 <pre>
84 +0 'L'
85 +1 'Z'
86 +2 '7'
87 +3 '7'
88 +4 Unpacked size (low byte)
89 +5 Unpacked size (high byte)
90 +6 Packed size (low byte)
91 +7 Packed size (high byte)
92 +8 Compressed data starts here
93 </pre>
94
95 <p>Please note that this header is present only when packed in default mode (-p1), if you pack in -p0 mode
96 the header is not present. In place of the header you will find a text file having the same name that your
97 "program.s", looking like this:
98 </p>
99
100 <pre>
101 #define run_adress $600 ; Come from original TAP executable
102 #define unpacked_size $1000 ; Come from original TAP executable
103 </pre>
104
105
106 <p id=chapter>Depacking</p>
107
108 <p>For depacking a file, you can simply use the corresponding library routine:
109 </p>
110
111 <pre>
112 void file_unpack(void *ptr_dst,void *ptr_src);
113 </pre>
114
115 <p>Please note that this routine expect the data to get a header, so it will not work for files packed in -p0 mode.
116 To unpack these files you need to use another routine.
117 </p>
118
119
120
121 <p id=chapter>Historic</p>
122
123 <p>Here is the list of all releases with a short description of things that changed:
124 </p>
125
126 <p id=dateentry>Version 0.5</p>
127 - Added the -mn and -p2 options
128
129
130 <p id=dateentry>Version 0.4</p>
131 - Added p0/p1 mode to pack a file without appending the header.
132 Very usefull when you want to spare a maximum of bytes in a minigame compo...
133
134 <p id=dateentry>Version 0.1-0.3</p>
135 - First released version
136
137
138 <hr>
139 <A href="documentation.htm"><img src="arrow_back.gif"></A>
140 <img src="pics/osdk_logo_small.png">
141 <hr>
142
143 </BODY>
144 </HTML>
145
146

  ViewVC Help
Powered by ViewVC 1.1.26