Hi all,
Here's a quickly written zip resource type handler that I'm using in all my current projects.
It's based on Rich Geldreich's miniz that I actually embedded directly orxArchive.c for convenience (this way there's really only one file to copy around in your projects and minimizes the integration steps).
It's pretty simple to use, there are two steps:
- include the file from your "game.cpp" where your init function lies:
#include "orxArchive.c"
- Calls it first thing from your game's init function so that the support for zip resource will be enabled before any resource is actually loaded (beside the main config file that gets loaded right at the beginning):
orxSTATUS orxFASTCALL GameInit()
{
orxSTATUS eResult;
eResult = orxArchive_Init();
// Inits everything else below
}
That's about it. =)
Now you can put all your resources inside one or more zip files (no matter the actual extension, however encrypted zip files are not supported by miniz).
In your main config file you can then add your zip files to the resource paths, so that they get searched first when a resource is requested. If not found, it'll then look into your dev folders for the original resources. Something like this:
[Resource]
Config = data/MyGameArchive.zip # data/config
Texture = data/MyGameArchive.zip # data/texture
Sound = data/MyGameArchive.zip # data/sound
This way your release build will look into data/MyGameArchive.zip and, in dev mode when this file doesn't exist, orx will then look into the data/config, data/texture and data/sound folders.
Lemme know if you have any questions/suggestions! =)
Cheers,
Rom