00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef BULL_XTABDAT8_H
00021 #define BULL_XTABDAT8_H
00022
00023 #if (defined(MAIN_XTABDAT8)||defined(MAIN_XTABJTY))
00024 #define msgprintf printf
00025 #else
00026 #define msgprintf message_log
00027 #endif
00028
00029
00030
00031 #define XTABDAT8_COLOUR_LEAK 2
00032 #define XTABDAT8_ENDOFBUFFER 4
00033 #define XTABDAT8_NOMEMORY 8
00034 #define XTABDAT8_CANT_OPEN 9
00035 #define XTABDAT8_CANT_READ 10
00036 #define XTABDAT8_MALLOC_ERR 11
00037 #define XTABDAT8_INTERNAL 12
00038
00039
00040
00041 #define TABFILE_ENTRY_SIZE 6
00042 #define TABFILE_HEADER_SIZE 6
00043
00044
00045
00046 struct IMGTAB_ATTRIB {
00047 unsigned char unkn[10];
00048 };
00049
00050 struct TABFILE_ITEM {
00051 unsigned long offset;
00052 unsigned int width;
00053 unsigned int height;
00054
00055 };
00056
00057 struct TABFILE {
00058 long count;
00059 unsigned long filelength;
00060 struct TABFILE_ITEM *items;
00061 };
00062
00063 struct DATFILE {
00064 long count;
00065 unsigned long filelength;
00066 unsigned char *data;
00067 };
00068
00069
00070
00071 struct ENCIMAGEITEM {
00072 unsigned int width;
00073 unsigned int height;
00074 struct IMGTAB_ATTRIB attrib;
00075 unsigned char *data;
00076 unsigned int datsize;
00077 };
00078
00079 struct ENCIMAGELIST {
00080 unsigned long count;
00081 struct ENCIMAGEITEM *items;
00082 };
00083
00084
00085
00086 struct IMAGEITEM {
00087 unsigned int width;
00088 unsigned int height;
00089 unsigned char *data;
00090 unsigned char *alpha;
00091 };
00092
00093 struct IMAGELIST {
00094 unsigned long count;
00095 struct IMAGEITEM *items;
00096 };
00097
00098
00099
00100 DLLIMPORT int read_tabfile_data(struct TABFILE *tabf,const char *srcfname);
00101 DLLIMPORT short write_tabfile_data(const struct TABFILE *tabf,const char *dstfname);
00102 DLLIMPORT short free_tabfile_data(struct TABFILE *tabf);
00103
00104 DLLIMPORT short read_datfile_data(struct DATFILE *datf,const char *srcfname);
00105 DLLIMPORT short write_datfile_data(const struct DATFILE *datf,const char *dstfname);
00106 DLLIMPORT short alloc_datfile_data(struct DATFILE *datf,unsigned long filelength);
00107 DLLIMPORT short free_datfile_data(struct DATFILE *datf);
00108
00109 DLLIMPORT int read_dattab_images(struct IMAGELIST *images,unsigned long *readcount,struct TABFILE *tabf,struct DATFILE *datf,const int verbose);
00110 DLLIMPORT int free_dattab_images(struct IMAGELIST *images);
00111 DLLIMPORT int read_dat_image_idx(struct IMAGEITEM *image,unsigned long *readedsize,
00112 const struct DATFILE *datf,const unsigned long off,
00113 const unsigned int width,const unsigned int height);
00114
00115 DLLIMPORT int read_dattab_encimages(struct ENCIMAGELIST *images,unsigned long *readcount,
00116 const struct TABFILE *tabf,const struct DATFILE *datf,const int verbose);
00117 DLLIMPORT int write_encimages_dattab(const struct ENCIMAGELIST *images,unsigned long *writecount,
00118 struct TABFILE *tabf,struct DATFILE *datf);
00119
00120 DLLIMPORT short create_images_dattab_enc(struct ENCIMAGELIST *images,const char *datfname,
00121 const char *tabfname,const int verbose);
00122 DLLIMPORT short write_dattab_images_enc(const struct ENCIMAGELIST *images,const char *datfname,
00123 const char *tabfname,const int verbose);
00124
00125 DLLIMPORT int create_images_dattab_idx(struct IMAGELIST *images,const char *datfname,
00126 const char *tabfname,const int verbose);
00127
00128 #endif