Quote Originally Posted by SilverWarior View Post
So why not use some different package/archive format instead of Tar which indeed does not support random read. You do know that Tar was initially developed to be used for storing data to magnetic tapes which by themselves also did not support random access.

(...)

There are numerous package systems that do allow you to read any of the contained file individually at any time. It isn't even so hard to make a custom one by yourself.
I like this.

Quote Originally Posted by SilverWarior View Post
Wasn't there an extension for Allegro game library which added support for working with various packages? Or do I perhaps just remember some game developers to make one for their own game?
Yes, there is: The PhysicsFS add-on but I have no idea how to use it. I suppose PhysicsFS is a library you install in your Windows/Linux system then it calls it or something.

I'm used to the "old" API (Allegro 4.x) and I'm still a bit confused with some parts of the new one (5.x), it is mostly designed as a state machine now but the file IO looks like a state machine mixed with other stuff. Not sure how to use it.

Quote Originally Posted by SilverWarior View Post
Well the problem of the IFF is that it still requires sequential reading since the file is divided into multiple chunks of various sizes. And in order to determine the size of first chunk you need to read its "header". In order to read the size of the second chunk you first need to know where it starts in order to read its "header" and that means the need to read the size of the first chink first.

Now what you would want is a package which has some sort of map (like file allocation table on disk drive) from which you can quickly read where certain file data begins and how big it is.
Yes, I know about that IFF limitation, but I have two solutions:
  • Include a chunk at the begginning with the map of the file telling where each file is, in a similar way Ken Silverman's GRP files does.
  • Scan the whole file when opening building the map in memory.


Quote Originally Posted by Chebmaster View Post
What is IFF ?
It is a standard container file format developed by Electronic Arts and Commodore/Amiga inspired by some old Apple MacOS API widely used by AmigaOS. It's still in use by a few formats like Apple's AIFF and Microsoft's WAV (this one using a modified version called RIFF though). PNG file format uses a similar approach too.

You can read the complete description in this paper.

Quote Originally Posted by Chebmaster View Post
Classes are *simpler* than procedural programming because they allow for *much* easier modifications.
I've never looked at Allegro, so I cannot tell how hard coupling them would be.

Ok, here is my conversion of the unzip.pp straight from Free Pascal RTL.

(...)
Thanks for sharing this.

Didn't know ZIP files allows random access to files. May be I'll rethink this.