view src/common/Util.h @ 140:aa5b5927e5fe

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