ddnet/src/engine/e_datafile.h

30 lines
1.3 KiB
C
Raw Normal View History

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
/* raw datafile access */
typedef struct DATAFILE_t DATAFILE;
2007-05-22 15:03:32 +00:00
/* read access */
DATAFILE *datafile_load(const char *filename);
DATAFILE *datafile_load_old(const char *filename);
void *datafile_get_data(DATAFILE *df, int index);
2008-01-12 12:27:55 +00:00
void *datafile_get_data_swapped(DATAFILE *df, int index); /* makes sure that the data is 32bit LE ints when saved */
int datafile_get_datasize(DATAFILE *df, int index);
void datafile_unload_data(DATAFILE *df, int index);
void *datafile_get_item(DATAFILE *df, int index, int *type, int *id);
int datafile_get_itemsize(DATAFILE *df, int index);
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);
int datafile_num_data(DATAFILE *df);
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);
/* 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);
2008-01-12 12:27:55 +00:00
int datafile_add_data_swapped(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);