synkro
0xdeadbeef
[Note]
THIS RELEASE IS NOT BACKWARDS COMPATIBLE TO OLDER RELASES!
[About Ratpak]
A simple tool to put all your assets (.WAVs, .BMPs, .XMLs or what ever you
use) into one file. It also provides example code to load files from ratpak
files or directly from memory (resident ratpak). If you are smart, then use
zlib instead
[Changes]
Files are now Huffman-compressed to get at least some compression (taken from
Basic Compression Library by Marcus Geelnard). The ratpak file format
changed, packed files are now identified by a name hash (saves some bytes
per asset). Complete package (including sources) released under the
beerware license.
[Usage of Ratpak]
You can create a pakfile by calling ratpak like this:
CODE
ratpak <folder_with_assets> <yourfile.pak>
This will add all files in the folder and its subfolders to the pakfile with
the given name. As an example, with the following command you can create a
test pakfile (in the folder this READ.ME is in).
CODE
ratpak assets test.rat
[Test Ratpak]
In the folder "catpak" is example code for reading from pakfiles or reading
from resident ratpaks. Catpak also works as a tester to check the crcs of all
files. Try catpak with the pakfile created above:
CODE
catpak test.rat test.dat
OR
CODE
catpak test.rat bump.wav
[API]
To get rid of asserts and other debug code compile the functions with the
-DNDEBUG flag. Well, there is no real API per se. To get a file from a
pakfile just use this function:
CODE
unsigned char *Ratpak_getFile(const char *ratpakFile, const char *asset, uint32_t *out_filesize)
This function takes the name of the pakfile and the name of the file in the
pakfile as parameter. it returns a pointer to a buffer containig that file or
NULL otherwise. You can directly access the file/data now or something like
SDL_Rwops. For resident ratpaks just use the following call, that is as easy
as the first one. You might want to use this, if your assets are store bin2c
style.
CODE
unsigned char *Ratpak_getFileFromMem(const unsigned char *ratpakInMem, const char* assetName, uint32_t *out_filesize);
Adding catpak.c, catpak.h, huffman.c and huffman.h to your project
should work in most cases. You can get details to the ratpak file format in
the file ratpakFormat.hpp. Extensions/bug fixes are welcome! Just contact me
via eMail or at #gp2xdev (EFNET).
[Known Issues]
There is still one TODO in catpak.c, I suspect that line in some cases
breaking alignment. It's upto the willing reader to check this matter
And thanks to StarG for the Windows binaries.
THIS RELEASE IS NOT BACKWARDS COMPATIBLE TO OLDER RELASES!
[About Ratpak]
A simple tool to put all your assets (.WAVs, .BMPs, .XMLs or what ever you
use) into one file. It also provides example code to load files from ratpak
files or directly from memory (resident ratpak). If you are smart, then use
zlib instead
[Changes]
Files are now Huffman-compressed to get at least some compression (taken from
Basic Compression Library by Marcus Geelnard). The ratpak file format
changed, packed files are now identified by a name hash (saves some bytes
per asset). Complete package (including sources) released under the
beerware license.
[Usage of Ratpak]
You can create a pakfile by calling ratpak like this:
CODE
ratpak <folder_with_assets> <yourfile.pak>
This will add all files in the folder and its subfolders to the pakfile with
the given name. As an example, with the following command you can create a
test pakfile (in the folder this READ.ME is in).
CODE
ratpak assets test.rat
[Test Ratpak]
In the folder "catpak" is example code for reading from pakfiles or reading
from resident ratpaks. Catpak also works as a tester to check the crcs of all
files. Try catpak with the pakfile created above:
CODE
catpak test.rat test.dat
OR
CODE
catpak test.rat bump.wav
[API]
To get rid of asserts and other debug code compile the functions with the
-DNDEBUG flag. Well, there is no real API per se. To get a file from a
pakfile just use this function:
CODE
unsigned char *Ratpak_getFile(const char *ratpakFile, const char *asset, uint32_t *out_filesize)
This function takes the name of the pakfile and the name of the file in the
pakfile as parameter. it returns a pointer to a buffer containig that file or
NULL otherwise. You can directly access the file/data now or something like
SDL_Rwops. For resident ratpaks just use the following call, that is as easy
as the first one. You might want to use this, if your assets are store bin2c
style.
CODE
unsigned char *Ratpak_getFileFromMem(const unsigned char *ratpakInMem, const char* assetName, uint32_t *out_filesize);
Adding catpak.c, catpak.h, huffman.c and huffman.h to your project
should work in most cases. You can get details to the ratpak file format in
the file ratpakFormat.hpp. Extensions/bug fixes are welcome! Just contact me
via eMail or at #gp2xdev (EFNET).
[Known Issues]
There is still one TODO in catpak.c, I suspect that line in some cases
breaking alignment. It's upto the willing reader to check this matter
And thanks to StarG for the Windows binaries.