sgdk
|
00001 00010 #ifndef _TOOLS_H_ 00011 #define _TOOLS_H_ 00012 00013 #include "bmp.h" 00014 #include "vdp_tile.h" 00015 #include "vdp_bg.h" 00016 #include "map.h" 00017 00018 00023 #define COMPRESSION_NONE 0 00024 00028 #define COMPRESSION_APLIB 1 00029 00033 #define COMPRESSION_LZ4W 2 00034 00035 00046 typedef s16 _comparatorCallback(void* o1, void* o2); 00047 00048 00053 void setRandomSeed(u16 seed); 00058 u16 random(void); 00059 00060 00085 u16 kprintf(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); 00086 00092 void KLog(char* text); 00093 void KLog_U1(char* t1, u32 v1); 00094 void KLog_U2(char* t1, u32 v1, char* t2, u32 v2); 00095 void KLog_U3(char* t1, u32 v1, char* t2, u32 v2, char* t3, u32 v3); 00096 void KLog_U4(char* t1, u32 v1, char* t2, u32 v2, char* t3, u32 v3, char* t4, u32 v4); 00097 void KLog_U1_(char* t1, u32 v1, char* t2); 00098 void KLog_U2_(char* t1, u32 v1, char* t2, u32 v2, char* t3); 00099 void KLog_U3_(char* t1, u32 v1, char* t2, u32 v2, char* t3, u32 v3, char* t4); 00100 void KLog_U4_(char* t1, u32 v1, char* t2, u32 v2, char* t3, u32 v3, char* t4, u32 v4, char* t5); 00101 void KLog_U1x(u16 minSize, char* t1, u32 v1); 00102 void KLog_U2x(u16 minSize, char* t1, u32 v1, char* t2, u32 v2); 00103 void KLog_U3x(u16 minSize, char* t1, u32 v1, char* t2, u32 v2, char* t3, u32 v3); 00104 void KLog_U4x(u16 minSize, char* t1, u32 v1, char* t2, u32 v2, char* t3, u32 v3, char* t4, u32 v4); 00105 void KLog_U1x_(u16 minSize, char* t1, u32 v1, char* t2); 00106 void KLog_U2x_(u16 minSize, char* t1, u32 v1, char* t2, u32 v2, char* t3); 00107 void KLog_U3x_(u16 minSize, char* t1, u32 v1, char* t2, u32 v2, char* t3, u32 v3, char* t4); 00108 void KLog_U4x_(u16 minSize, char* t1, u32 v1, char* t2, u32 v2, char* t3, u32 v3, char* t4, u32 v4, char* t5); 00109 void KLog_S1(char* t1, s32 v1); 00110 void KLog_S2(char* t1, s32 v1, char* t2, s32 v2); 00111 void KLog_S3(char* t1, s32 v1, char* t2, s32 v2, char* t3, s32 v3); 00112 void KLog_S4(char* t1, s32 v1, char* t2, s32 v2, char* t3, s32 v3, char* t4, s32 v4); 00113 void KLog_S1_(char* t1, s32 v1, char* t2); 00114 void KLog_S2_(char* t1, s32 v1, char* t2, s32 v2, char* t3); 00115 void KLog_S3_(char* t1, s32 v1, char* t2, s32 v2, char* t3, s32 v3, char* t4); 00116 void KLog_S4_(char* t1, s32 v1, char* t2, s32 v2, char* t3, s32 v3, char* t4, s32 v4, char* t5); 00117 void KLog_S1x(u16 minSize, char* t1, s32 v1); 00118 void KLog_S2x(u16 minSize, char* t1, s32 v1, char* t2, s32 v2); 00119 void KLog_S3x(u16 minSize, char* t1, s32 v1, char* t2, s32 v2, char* t3, s32 v3); 00120 void KLog_S4x(u16 minSize, char* t1, s32 v1, char* t2, s32 v2, char* t3, s32 v3, char* t4, s32 v4); 00121 void KLog_f1(char* t1, fix16 v1); 00122 void KLog_f2(char* t1, fix16 v1, char* t2, fix16 v2); 00123 void KLog_f3(char* t1, fix16 v1, char* t2, fix16 v2, char* t3, fix16 v3); 00124 void KLog_f4(char* t1, fix16 v1, char* t2, fix16 v2, char* t3, fix16 v3, char* t4, fix16 v4); 00125 void KLog_f1x(s16 numDec, char* t1, fix16 v1); 00126 void KLog_f2x(s16 numDec, char* t1, fix16 v1, char* t2, fix16 v2); 00127 void KLog_f3x(s16 numDec, char* t1, fix16 v1, char* t2, fix16 v2, char* t3, fix16 v3); 00128 void KLog_f4x(s16 numDec, char* t1, fix16 v1, char* t2, fix16 v2, char* t3, fix16 v3, char* t4, fix16 v4); 00129 void KLog_F1(char* t1, fix32 v1); 00130 void KLog_F2(char* t1, fix32 v1, char* t2, fix32 v2); 00131 void KLog_F3(char* t1, fix32 v1, char* t2, fix32 v2, char* t3, fix32 v3); 00132 void KLog_F4(char* t1, fix32 v1, char* t2, fix32 v2, char* t3, fix32 v3, char* t4, fix32 v4); 00133 void KLog_F1x(s16 numDec, char* t1, fix32 v1); 00134 void KLog_F2x(s16 numDec, char* t1, fix32 v1, char* t2, fix32 v2); 00135 void KLog_F3x(s16 numDec, char* t1, fix32 v1, char* t2, fix32 v2, char* t3, fix32 v3); 00136 void KLog_F4x(s16 numDec, char* t1, fix32 v1, char* t2, fix32 v2, char* t3, fix32 v3, char* t4, fix32 v4); 00137 00138 00151 Bitmap *allocateBitmap(const Bitmap *bitmap); 00166 Bitmap *allocateBitmapEx(u16 width, u16 heigth); 00178 TileSet *allocateTileSet(const TileSet *tileset); 00190 TileSet *allocateTileSetEx(u16 numTile); 00202 TileMap *allocateTileMap(const TileMap *tilemap); 00216 TileMap *allocateTileMapEx(u16 width, u16 heigth); 00229 Image *allocateImage(const Image *image); 00241 Map *allocateMap(const MapDefinition *mapDef); 00242 00257 Bitmap *unpackBitmap(const Bitmap *src, Bitmap *dest); 00272 TileSet *unpackTileSet(const TileSet *src, TileSet *dest); 00287 TileMap *unpackTileMap(const TileMap *src, TileMap *dest); 00302 Image *unpackImage(const Image *src, Image *dest); 00303 00320 u32 unpack(u16 compression, u8 *src, u8 *dest); 00321 00333 u32 aplib_unpack(u8 *src, u8 *dest); 00346 u32 lz4w_unpack(const u8 *src, u8 *dest); 00347 00348 00360 void qsort_u8(u8 *data, u16 left, u16 right); 00372 void qsort_s8(s8 *data, u16 left, u16 right); 00384 void qsort_u16(u16 *data, u16 left, u16 right); 00396 void qsort_s16(s16 *data, u16 left, u16 right); 00408 void qsort_u32(u32 *data, u16 left, u16 right); 00420 void qsort_s32(s32 *data, u16 left, u16 right); 00421 00433 void qsort(void** data, u16 len, _comparatorCallback* cb); 00434 00435 00436 00437 #endif // _TOOLS_H_