bool CFileSystem::addZipFileArchive(const c8* filename, bool ignoreCase, bool ignorePaths)
{
IReadFile* file = createReadFile(filename);
if (file)
{
CZipReader* zr = new CZipReader(file, ignoreCase, ignorePaths);
if (zr)
ZipFileSystems.push_back(zr);
[color=blue]Store the index of zr and the filename here[/color]
rest of method
}
[color=blue]CFileSystem::removeZipFileArchive(const c8* filename, bool ignoreCase, bool ignorePaths) { find the index of the zip archive in ZipFileSystems and remove it } [/color]
This would be more useful. Considering if a 'level' consists of a zip containing models and a texture directory there may be ambiguity between levels(assuming the same textures would be used across several related levels), resulting in conflicts/errors. Although it isn't a major problem it would be nice
Maybe a feature like specifying where to check for the file first would be good. Like, you open Zip1 and Zip2, and they both contain data\TheTex.jpg, and you address it like data\TheTex.jpg@Zip1.zip, or something like that. Or just adding a function to switch the top-priority source, like FS->setTopPrio("default") (to unselect zip's) or FS->setTopPrio("Zip1"). sortof.
If you don't have anything nice to say, don't say anything at all.
i think using zip files as folders would be the best idea, so it's file.zip/tex.png.
also, an interface for any kind of custom folders including pak/zip would be nice too. then we can just have addArchive, removeArchive, and addArchiveLoader to add external types.
not really very high up on the development priorities though i'm afraid. perhaps one of you guys would like to attempt it?
I already implemented this for a game. I added a u32 pointer parameter that returned the index of the zip file in the list. Its by no means a full system, but it works for now...
we need to decide the best way to remove the system. Maybe map file names to 'zip files' and remove them by name rather than index.
Also... a system to shut down any read files that are accessing the system first, before deallocating memory.
Basically, it needs some thought and work to get it working perfectly.