workaround a problem with the harmattan gcc
[drnoksnes] / port.h
diff --git a/port.h b/port.h
index c5b1e2c..5ffb924 100644 (file)
--- a/port.h
+++ b/port.h
@@ -73,14 +73,6 @@ typedef int16_t                      int16;
 typedef int32_t                        int32;
 typedef int64_t                        int64;
 
-//For Debugging Purposes:
-
-typedef uint8_t                        bool8_32;
-typedef uint8_t                        uint8_32;
-typedef uint16_t               uint16_32;
-typedef int8_t                 int8_32;
-typedef int16_t                        int16_32;
-
 //Defines for Extern C
 #ifdef __cplusplus
 #define EXTERN_C extern "C"
@@ -99,43 +91,88 @@ typedef int16_t                     int16_32;
 #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
+#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
 // 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 same string */
+/** A simplified basename function returning a pointer inside the src string */
 const char * PathBasename(const char * path);
 END_EXTERN_C
 
+// Input / output functions
+START_EXTERN_C
+uint32 S9xReadJoypad(int which1_0_to_4);
+bool8 S9xReadMousePosition(int which1_0_to_1, int *x, int *y, uint32 *buttons);
+bool8 S9xReadSuperScopePosition(int *x, int *y, uint32 *buttons);
+END_EXTERN_C
+
+// Stream functions, used when opening ROMs and snapshots.
+#ifdef ZLIB
+#include <zlib.h>
+#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