Re: [AD] Custom packfiles

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


Peter Wang wrote:
nor can you use pack_fopen_chunk() on
vtable-packfiles.

Well, as has been mentioned before, I think Allegro's default pack_* functions should be implemented as a vtable that's always used for pack_fopen(). pack_fopen_chunk can simply check that the vtable is Allegro's, and fail if it isn't. Yeah, this would mean the pack_*_chunk would be "special", but since they're of limited use outside of Allegro's datafiles anyway, I can deal with that. People can easilly support zips or their own archive format anyway.

However, one thing I would like is for the vtable to contain pf_open and pf_close methods. That would potentially cut down on a lot of duplicate code. So the user could do, for instance:

struct mystruct data = {
   "myfile.wad", 0
};
PACKFILE *pf = pack_fopen_vtable(&my_vtable, &data);

Then the my_vtable.pf_fopen function would do the actual opening of the specified file "myfile.wad and could seek to a specific object (specified through an index 0 in this case) in the file.




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