2 * Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
4 * (c) Copyright 1996 - 2001 Gary Henderson (gary.henderson@ntlworld.com) and
5 * Jerremy Koot (jkoot@snes9x.com)
7 * Super FX C emulator code
8 * (c) Copyright 1997 - 1999 Ivar (ivar@snes9x.com) and
10 * Super FX assembler emulator code (c) Copyright 1998 zsKnight and _Demo_.
12 * DSP1 emulator code (c) Copyright 1998 Ivar, _Demo_ and Gary Henderson.
13 * C4 asm and some C emulation code (c) Copyright 2000 zsKnight and _Demo_.
14 * C4 C code (c) Copyright 2001 Gary Henderson (gary.henderson@ntlworld.com).
16 * DOS port code contains the works of other authors. See headers in
19 * Snes9x homepage: http://www.snes9x.com
21 * Permission to use, copy, modify and distribute Snes9x in both binary and
22 * source form, for non-commercial purposes, is hereby granted without fee,
23 * providing that this license information and copyright notice appear with
24 * all copies and any derived work.
26 * This software is provided 'as-is', without any express or implied
27 * warranty. In no event shall the authors be held liable for any damages
28 * arising from the use of this software.
30 * Snes9x is freeware for PERSONAL USE only. Commercial users should
31 * seek permission of the copyright holders first. Commercial use includes
32 * charging money for Snes9x or software derived from Snes9x.
34 * The copyright holders request that bug fixes and improvements to the code
35 * should be forwarded to them so everyone can benefit from the modifications
38 * Super NES and Super Nintendo Entertainment System are trademarks of
39 * Nintendo Co., Limited and its subsidiary companies.
45 This port.h is really a right-of-passage for anyone trying to port the emulator
46 to another platform. It must have started out as a set of defines for a
47 single platform, and instead of using define blocks as new platforms were
48 added, individual coders simply added exceptions and sprinkled #ifdef and #ifndef
49 statements throughout the original list.
51 I can't take it anymore, it's too convoluted. So I've commented out the entire
52 section, and preemptively rewritten the first #define segment the way god intended,
53 with a single define-block for each target platform.
57 #define TITLE "DrNokSnes"
67 typedef uint8_t bool8;
68 typedef uint8_t uint8;
69 typedef uint16_t uint16;
70 typedef uint32_t uint32;
72 typedef int16_t int16;
73 typedef int32_t int32;
74 typedef int64_t int64;
76 //For Debugging Purposes:
78 typedef uint8_t bool8_32;
79 typedef uint8_t uint8_32;
80 typedef uint16_t uint16_32;
81 typedef int8_t int8_32;
82 typedef int16_t int16_32;
84 //Defines for Extern C
86 #define EXTERN_C extern "C"
87 #define START_EXTERN_C EXTERN_C {
88 #define END_EXTERN_C }
90 #define EXTERN_C extern
91 #define START_EXTERN_C
96 #define _MAX_DIR PATH_MAX
98 #define _MAX_FNAME NAME_MAX
99 #define _MAX_EXT NAME_MAX
100 #define _MAX_PATH PATH_MAX
107 #if CONF_BUILD_ASM_SPC700
113 // Configuration defines I think I know what they're for
116 #define CPU_SHUTDOWN 1
117 //#define NETPLAY_SUPPORT 1
119 #define UNZIP_SUPPORT 1
120 #define NO_INLINE_SET_GET 1
124 //#define SPC700_SHUTDOWN
126 #define PIXEL_FORMAT RGB565
127 #define CHECK_SOUND()
128 #define ZeroMemory(a,b) memset((a),0,(b))
129 #define PACKING __attribute__ ((packed))
130 #define ALIGN_BY_ONE __attribute__ ((aligned (1), packed))
132 #undef FAST_LSB_WORD_ACCESS
134 // Language abstractions
136 #define STATIC static
137 #define INLINE inline
141 void PathMake(char *path, const char *drive, const char *dir,
142 const char *fname, const char *ext);
143 void PathSplit(const char *path, char *drive, char *dir, char *fname, char *ext);
144 /** A simplified basename function returning a pointer inside the src string */
145 const char * PathBasename(const char * path);
148 // Stream functions, used when opening ROMs and snapshots.
151 #define STREAM gzFile
152 #define READ_STREAM(p,l,s) gzread (s,p,l)
153 #define WRITE_STREAM(p,l,s) gzwrite (s,p,l)
154 #define GETS_STREAM(p,l,s) gzgets(s,p,l)
155 #define GETC_STREAM(s) gzgetc(s)
156 #define OPEN_STREAM(f,m) gzopen (f,m)
157 #define REOPEN_STREAM(f,m) gzdopen (f,m)
158 #define FIND_STREAM(f) gztell(f)
159 #define REVERT_STREAM(f,o,s) gzseek(f,o,s)
160 #define CLOSE_STREAM(s) gzclose (s)
162 #define STREAM FILE *
163 #define READ_STREAM(p,l,s) fread (p,1,l,s)
164 #define WRITE_STREAM(p,l,s) fwrite (p,1,l,s)
165 #define GETS_STREAM(p,l,s) fgets(p,l,s)
166 #define GETC_STREAM(s) fgetc(s)
167 #define OPEN_STREAM(f,m) fopen (f,m)
168 #define REOPEN_STREAM(f,m) fdopen (f,m)
169 #define FIND_STREAM(f) ftell(f)
170 #define REVERT_STREAM(f,o,s) fseek(f,o,s)
171 #define CLOSE_STREAM(s) fclose (s)