2007-11-25 19:42:40 +00:00
|
|
|
/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */
|
2007-05-22 15:03:32 +00:00
|
|
|
|
2007-08-22 07:52:33 +00:00
|
|
|
/* raw datafile access */
|
|
|
|
typedef struct DATAFILE_t DATAFILE;
|
2007-05-22 15:03:32 +00:00
|
|
|
|
2007-08-22 07:52:33 +00:00
|
|
|
/* read access */
|
|
|
|
DATAFILE *datafile_load(const char *filename);
|
|
|
|
DATAFILE *datafile_load_old(const char *filename);
|
2007-09-09 18:21:14 +00:00
|
|
|
void *datafile_get_data(DATAFILE *df, int index);
|
2007-08-25 08:48:24 +00:00
|
|
|
int datafile_get_datasize(DATAFILE *df, int index);
|
|
|
|
void datafile_unload_data(DATAFILE *df, int index);
|
2007-08-22 07:52:33 +00:00
|
|
|
void *datafile_get_item(DATAFILE *df, int index, int *type, int *id);
|
2007-08-25 08:48:24 +00:00
|
|
|
int datafile_get_itemsize(DATAFILE *df, int index);
|
2007-08-22 07:52:33 +00:00
|
|
|
void datafile_get_type(DATAFILE *df, int type, int *start, int *num);
|
|
|
|
void *datafile_find_item(DATAFILE *df, int type, int id);
|
|
|
|
int datafile_num_items(DATAFILE *df);
|
2007-08-25 08:48:24 +00:00
|
|
|
int datafile_num_data(DATAFILE *df);
|
2007-08-22 07:52:33 +00:00
|
|
|
void datafile_unload(DATAFILE *df);
|
2007-05-22 15:03:32 +00:00
|
|
|
|
2007-12-03 18:47:29 +00:00
|
|
|
int datafile_crc(const char *filename);
|
|
|
|
|
2007-08-22 07:52:33 +00:00
|
|
|
/* write access */
|
|
|
|
typedef struct DATAFILE_OUT_t DATAFILE_OUT;
|
|
|
|
DATAFILE_OUT *datafile_create(const char *filename);
|
|
|
|
int datafile_add_data(DATAFILE_OUT *df, int size, void *data);
|
|
|
|
int datafile_add_item(DATAFILE_OUT *df, int type, int id, int size, void *data);
|
|
|
|
int datafile_finish(DATAFILE_OUT *df);
|