annotate src/common/Util.h @ 266:c85549460218

script: got oak's parcel
author Robert McIntyre <rlm@mit.edu>
date Mon, 26 Mar 2012 23:04:12 -0500
parents f9f4f1b99eed
children
rev   line source
rlm@1 1 #ifndef VBA_UTIL_H
rlm@1 2 #define VBA_UTIL_H
rlm@1 3
rlm@1 4 #if _MSC_VER > 1000
rlm@1 5 #pragma once
rlm@1 6 #endif // _MSC_VER > 1000
rlm@1 7
rlm@1 8 #include "zlib.h"
rlm@1 9 #include "../Port.h"
rlm@1 10
rlm@1 11 enum IMAGE_TYPE
rlm@1 12 {
rlm@1 13 IMAGE_UNKNOWN = -1,
rlm@1 14 IMAGE_GBA = 0,
rlm@1 15 IMAGE_GB = 1
rlm@1 16 };
rlm@1 17
rlm@1 18 // save game
rlm@1 19
rlm@1 20 typedef struct
rlm@1 21 {
rlm@1 22 void *address;
rlm@1 23 int size;
rlm@1 24 } variable_desc;
rlm@1 25
rlm@1 26 extern void utilWriteBMP(u8 *out, int w, int h, int dstDepth, u8 *in);
rlm@1 27 extern bool utilWriteBMPFile(const char *, int, int, u8 *);
rlm@1 28 extern bool utilWritePNGFile(const char *, int, int, u8 *);
rlm@1 29 extern void utilApplyIPS(const char *ips, u8 * *rom, int *size);
rlm@1 30 extern bool utilIsGBAImage(const char *);
rlm@1 31 extern bool utilIsGBABios(const char *file);
rlm@1 32 extern bool utilIsELF(const char *file);
rlm@1 33 extern bool utilIsGBImage(const char *);
rlm@1 34 extern bool utilIsGBBios(const char *file);
rlm@1 35 extern bool utilIsZipFile(const char *);
rlm@1 36 extern bool utilIsGzipFile(const char *);
rlm@1 37 extern bool utilIsRarFile(const char *);
rlm@1 38 extern void utilGetBaseName(const char *, char *);
rlm@1 39 extern IMAGE_TYPE utilFindType(const char *);
rlm@1 40 extern u8 * utilLoad(const char *, bool (*)(const char *), u8 *, int &);
rlm@1 41 extern void utilPutDword(u8 *, u32);
rlm@1 42 extern void utilPutWord(u8 *, u16);
rlm@1 43 extern void utilWriteData(gzFile, variable_desc *);
rlm@1 44 extern void utilReadData(gzFile, variable_desc *);
rlm@1 45 extern int32 utilReadInt(gzFile);
rlm@1 46 extern void utilWriteInt(gzFile, int32);
rlm@1 47 extern gzFile utilGzOpen(const char *file, const char *mode);
rlm@1 48 extern gzFile utilGzReopen(int id, const char *mode);
rlm@1 49 extern gzFile utilMemGzOpen(char *memory, int available, char *mode);
rlm@1 50 extern int utilGzWrite(gzFile file, voidp buffer, unsigned int len);
rlm@1 51 extern int utilGzRead(gzFile file, voidp buffer, unsigned int len);
rlm@1 52 extern int utilGzClose(gzFile file);
rlm@1 53 extern z_off_t utilGzSeek(gzFile file, z_off_t offset, int whence);
rlm@1 54 extern z_off_t utilGzTell(gzFile file);
rlm@1 55 extern void utilGBAFindSave(const u8 *, const int);
rlm@1 56 extern void utilUpdateSystemColorMaps();
rlm@1 57 extern bool utilLoadBIOS(u8 *bios, const char *biosFileName, int systemType);
rlm@1 58 extern bool utilCheckBIOS(const char *biosFileName, int systemType);
rlm@1 59 extern u16 utilCalcBIOSChecksum(const u8 *bios, int systemType);
rlm@1 60 extern u16 utilCalcBIOSFileChecksum(const char *biosFileName, int systemType);
rlm@1 61
rlm@1 62 extern int gzWrite(gzFile file, void* buf, unsigned len);
rlm@1 63
rlm@1 64 #endif // VBA_UTIL_H