Re: [AD] Custom packfiles

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Chris wrote:

Peter Wang wrote:

Here's a patch that implements custom packfiles, i.e. PACKFILEs where the user supplies the methods for reading, writing, etc. No documentation yet. I think the changes are simple enough for 4.2.

The relevant API additions are summarised below:

[snip]


Mm.. I'm not sure, honestly. I think if we're going to do something like this, it should be as integrated as possible. The PACKFILE_VTABLE is a good idea, but I think it'd be better if the user could supply callbacks that'd effect the normal pack_* routines.


I don't understand.

So basically, if you had a PACKFILE_VTABLE to read from memory instead of disk, you could do:

SAMPLE *smp = load_sample((const char*)memptr);

and as long as the VTABLE is properly setup, it'd convert a wave/voc/etc in memory into an Allegro SAMPLE. Of course you'd need to be careful about the length of the memory, but that'd be up to the user to worry about.


Does this mean there is a global variable somewhere holding the current vtable, and pack_fopen()'s behaviour depends on that? I don't like that.

Whatever we do though, I think the current packfile routines should be fully implementable in a vtable (and be the default vtable used).


I think they are, mostly.

Peter

Note to self: pack_feof() and pack_ferror() are not done right so far.




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/