X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=port.h;h=b24a6e234c07c8bdaf26c02f991ffab15dd724c0;hb=7063fa1313ce7996c13ccd1f10dd0b10a4898d7b;hp=e10cc8a44c20c164c743a157d83d59d83421fb10;hpb=909f5635bffc4c3516ddbba4f9c63c2a7333afc7;p=drnoksnes diff --git a/port.h b/port.h index e10cc8a..b24a6e2 100644 --- a/port.h +++ b/port.h @@ -82,61 +82,98 @@ typedef int8_t int8_32; typedef int16_t int16_32; //Defines for Extern C -#define EXTERN_C extern "C" #ifdef __cplusplus +#define EXTERN_C extern "C" #define START_EXTERN_C EXTERN_C { #define END_EXTERN_C } #else +#define EXTERN_C extern #define START_EXTERN_C #define END_EXTERN_C #endif //Path Defines -#undef _MAX_PATH #define _MAX_DIR PATH_MAX #define _MAX_DRIVE 1 -#define _MAX_FNAME PATH_MAX -#define _MAX_EXT PATH_MAX -#define _MAX_PATH (PATH_MAX) +#define _MAX_FNAME NAME_MAX +#define _MAX_EXT NAME_MAX +#define _MAX_PATH PATH_MAX -//True/False Defines +// Boolean constants (may already be defined) +#ifndef TRUE #define TRUE 1 +#endif +#ifndef FALSE #define FALSE 0 +#endif -// Configuration defines I think I know what they're for +// Config -> Defines +#if CONF_BUILD_ASM_SPC700 #define ASM_SPC700 1 -//#define SUPER_FX 1 +#else +#undef ASM_SPC700 +#endif + +// Configuration defines I think I know what they're for +#define SUPER_FX 1 +#define USE_SA1 1 #define CPU_SHUTDOWN 1 +//#define NETPLAY_SUPPORT 1 +#define ZLIB 1 +#define UNZIP_SUPPORT 1 +#define NO_INLINE_SET_GET 1 //Misc Items #define VAR_CYCLES //#define SPC700_SHUTDOWN #define LSB_FIRST -#define STATIC static -#define FASTCALL #define PIXEL_FORMAT RGB565 #define CHECK_SOUND() -#define UNZIP_SUPPORT #define ZeroMemory(a,b) memset((a),0,(b)) #define PACKING __attribute__ ((packed)) #define ALIGN_BY_ONE __attribute__ ((aligned (1), packed)) #define LSB_FIRST #undef FAST_LSB_WORD_ACCESS -#ifndef INLINE +// Language abstractions +#define FASTCALL +#define STATIC static #define INLINE inline -#endif START_EXTERN_C - -void S9xGenerateSound (); - -void _makepath (char *path, const char *drive, const char *dir, - const char *fname, const char *ext); -void _splitpath (const char *path, char *drive, char *dir, char *fname, - char *ext); - +// Path functions +void PathMake(char *path, const char *drive, const char *dir, + const char *fname, const char *ext); +void PathSplit(const char *path, char *drive, char *dir, char *fname, char *ext); +/** A simplified basename function returning a pointer inside the src string */ +const char * PathBasename(const char * path); END_EXTERN_C +// Stream functions, used when opening ROMs and snapshots. +#ifdef ZLIB +#include +#define STREAM gzFile +#define READ_STREAM(p,l,s) gzread (s,p,l) +#define WRITE_STREAM(p,l,s) gzwrite (s,p,l) +#define GETS_STREAM(p,l,s) gzgets(s,p,l) +#define GETC_STREAM(s) gzgetc(s) +#define OPEN_STREAM(f,m) gzopen (f,m) +#define REOPEN_STREAM(f,m) gzdopen (f,m) +#define FIND_STREAM(f) gztell(f) +#define REVERT_STREAM(f,o,s) gzseek(f,o,s) +#define CLOSE_STREAM(s) gzclose (s) +#else +#define STREAM FILE * +#define READ_STREAM(p,l,s) fread (p,1,l,s) +#define WRITE_STREAM(p,l,s) fwrite (p,1,l,s) +#define GETS_STREAM(p,l,s) fgets(p,l,s) +#define GETC_STREAM(s) fgetc(s) +#define OPEN_STREAM(f,m) fopen (f,m) +#define REOPEN_STREAM(f,m) fdopen (f,m) +#define FIND_STREAM(f) ftell(f) +#define REVERT_STREAM(f,o,s) fseek(f,o,s) +#define CLOSE_STREAM(s) fclose (s) +#endif + #endif