[physfs] Mounting Archive from within an archive
evilazrael at evilazrael.de
Mon Aug 30 15:54:26 EDT 2010
Am 30.08.2010 10:35, schrieb Ryan C. Gordon:
>> So now I wanted to add archive support. Many missions usually are
>> shipped as ZIP which contains the HOG-files and other info.
>> My idea is to mount such a ZIP to" missions/" and then open the HOG
>> whenever it's needed.
> The next major step after this is exposing PHYSFS_Archiver, and
> letting apps register their own file formats. PHYSFS_Io handles the
> transmission of data, PHYSFS_Archiver turns that data into some
> meaningful structure. I haven't started on this, but it should be a
> less traumatic change than this was.
I already started to work on this. It does not work yet and many things
are temporary files and functions to get a working proof of concept. I
preferred to make a new header for the archiver and platform stuff, as
this is far more advanced than the usual physfs behaviour. I chose to
make a malloc/freeArchiver pair which gives you an almost complete
prefilled archiver-structure, in that you only have to set your
functions. This should make it possible to link dynamically an new
physfs library with an expanded archiver structure against an older
binary application which uses the older smaller structure.
Instead of a linked list i use realloc, this is a little bit more
cumbersome but not much of the older code and api has to be changed.
The function openArchiveDirect(void *data) has been added to the
archiver structure, the necessary PHYSFS_mountDirect(archiver,
void*data) companion is in work. You have to pass in the archiver and
the necessary data, but you get a unified file access to whatever source
they may come from.
That's my approach.
The error stuff is almost complete, the header should be merged back
into the main header.
Oh, i find it easier to work on multiple file instead of a monolithic
one. especially when merging changes.
> Please note that these new APIs are still subject to change, and
> comments on them are welcome.
> (If I have another sleepless night, I really need to merge Christopher
> Nelles's patches, though. I haven't forgotten it, honest!)
Then your memory is better than mine :p I have no clue which ones you mean.
More information about the physfs