diff src/common/Util.h @ 1:f9f4f1b99eed

importing src directory
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:31:27 -0600
parents
children
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/common/Util.h	Sat Mar 03 10:31:27 2012 -0600
     1.3 @@ -0,0 +1,64 @@
     1.4 +#ifndef VBA_UTIL_H
     1.5 +#define VBA_UTIL_H
     1.6 +
     1.7 +#if _MSC_VER > 1000
     1.8 +#pragma once
     1.9 +#endif // _MSC_VER > 1000
    1.10 +
    1.11 +#include "zlib.h"
    1.12 +#include "../Port.h"
    1.13 +
    1.14 +enum IMAGE_TYPE
    1.15 +{
    1.16 +	IMAGE_UNKNOWN = -1,
    1.17 +	IMAGE_GBA	  = 0,
    1.18 +	IMAGE_GB	  = 1
    1.19 +};
    1.20 +
    1.21 +// save game
    1.22 +
    1.23 +typedef struct
    1.24 +{
    1.25 +	void *address;
    1.26 +	int	  size;
    1.27 +} variable_desc;
    1.28 +
    1.29 +extern void utilWriteBMP(u8 *out, int w, int h, int dstDepth, u8 *in);
    1.30 +extern bool utilWriteBMPFile(const char *, int, int, u8 *);
    1.31 +extern bool utilWritePNGFile(const char *, int, int, u8 *);
    1.32 +extern void utilApplyIPS(const char *ips, u8 * *rom, int *size);
    1.33 +extern bool utilIsGBAImage(const char *);
    1.34 +extern bool utilIsGBABios(const char *file);
    1.35 +extern bool utilIsELF(const char *file);
    1.36 +extern bool utilIsGBImage(const char *);
    1.37 +extern bool utilIsGBBios(const char *file);
    1.38 +extern bool utilIsZipFile(const char *);
    1.39 +extern bool utilIsGzipFile(const char *);
    1.40 +extern bool utilIsRarFile(const char *);
    1.41 +extern void utilGetBaseName(const char *, char *);
    1.42 +extern IMAGE_TYPE utilFindType(const char *);
    1.43 +extern u8 *	 utilLoad(const char *, bool (*)(const char *), u8 *, int &);
    1.44 +extern void	 utilPutDword(u8 *, u32);
    1.45 +extern void	 utilPutWord(u8 *, u16);
    1.46 +extern void	 utilWriteData(gzFile, variable_desc *);
    1.47 +extern void	 utilReadData(gzFile, variable_desc *);
    1.48 +extern int32 utilReadInt(gzFile);
    1.49 +extern void	 utilWriteInt(gzFile, int32);
    1.50 +extern gzFile utilGzOpen(const char *file, const char *mode);
    1.51 +extern gzFile utilGzReopen(int id, const char *mode);
    1.52 +extern gzFile utilMemGzOpen(char *memory, int available, char *mode);
    1.53 +extern int utilGzWrite(gzFile file, voidp buffer, unsigned int len);
    1.54 +extern int utilGzRead(gzFile file, voidp buffer, unsigned int len);
    1.55 +extern int utilGzClose(gzFile file);
    1.56 +extern z_off_t utilGzSeek(gzFile file, z_off_t offset, int whence);
    1.57 +extern z_off_t utilGzTell(gzFile file);
    1.58 +extern void utilGBAFindSave(const u8 *, const int);
    1.59 +extern void utilUpdateSystemColorMaps();
    1.60 +extern bool utilLoadBIOS(u8 *bios, const char *biosFileName, int systemType);
    1.61 +extern bool utilCheckBIOS(const char *biosFileName, int systemType);
    1.62 +extern u16 utilCalcBIOSChecksum(const u8 *bios, int systemType);
    1.63 +extern u16 utilCalcBIOSFileChecksum(const char *biosFileName, int systemType);
    1.64 +
    1.65 +extern int gzWrite(gzFile file, void* buf, unsigned len);
    1.66 +
    1.67 +#endif // VBA_UTIL_H