[AD] Loader and saver formats |
[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]
How about something along the lines of (very basic framework follows):
typedef enum {
IMAGE_FORMAT,
PALETTE_FORMAT,
SAMPLE_FORMAT,
FONT_FORMAT,
MUSIC_FORMAT,
} FILE_FORMAT;
void register_format(FILE_FORMAT, void (*loader)(...), void (*saver)(...), int (*is_of_type)(...));
void unregister_format(FILE_FORMAT, void (*loader)(...), void (*saver)(...), int (*is_of_type)(...));
This would work like the current bitmap format registration routines
and allow other formats to be overriden as well.
The is_of_type callback would get called either with a filename, handle, or
already loaded raw data, and would test that format, returning a boolean.
Quite some casts would have to be done, but that's what the datafile routines
already do anyway.
--
Vincent Penquerc'h
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |