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.
63 #define TITLE "Snes9x"
67 #include <zlib.h> //RC
68 //#include <windows.h>
72 typedef unsigned char bool8;
73 typedef unsigned char uint8;
74 typedef unsigned short uint16;
75 typedef unsigned int uint32;
76 typedef signed char int8;
79 typedef long long int64;
81 //CSNES Types for conversion to 32 bit
82 /*typedef unsigned long bool8_32;
83 typedef unsigned long uint8_32;
84 typedef unsigned long uint16_32;
86 typedef long int16_32;*/
88 //For Debugging Purposes:
90 typedef unsigned char bool8_32;
91 typedef unsigned char uint8_32;
92 typedef unsigned short uint16_32;
93 typedef signed char int8_32;
94 typedef short int16_32;
97 //Defines for Extern C
98 #define EXTERN_C extern
99 #define START_EXTERN_C extern "C" {
100 #define END_EXTERN_C }
104 #define _MAX_DIR PATH_MAX
106 #define _MAX_FNAME PATH_MAX
107 #define _MAX_EXT PATH_MAX
108 #define PATH_MAX 1024
109 #define _MAX_PATH (1024)
115 //Slash Char Definitions
116 #define SLASH_STR "\\"
117 #define SLASH_CHAR '\\'
121 //#define SPC700_SHUTDOWN
123 #define STATIC static
125 #define PIXEL_FORMAT RGB565
126 #define CHECK_SOUND()
129 #define UNZIP_SUPPORT
130 #define ZeroMemory(a,b) memset((a),0,(b))
131 #define PACKING __attribute__ ((packed))
132 #define ALIGN_BY_ONE __attribute__ ((aligned (1), packed))
134 #undef FAST_LSB_WORD_ACCESS
137 EXTERN_C void S9xGenerateSound ();
139 //Additional Items for _SNESPPC port
140 void _makepath (char *path, const char *drive, const char *dir,
141 const char *fname, const char *ext);
142 void _splitpath (const char *path, char *drive, char *dir, char *fname,
144 #define strcasecmp strcmp
145 #define strncasecmp strncmp
150 #define INLINE __inline
155 #define inline __inline
163 #define TITLE "Snes9x"
167 #include <zlib.h> //RC
168 //#include <windows.h>
172 typedef unsigned char bool8;
173 typedef unsigned char uint8;
174 typedef unsigned short uint16;
175 typedef unsigned int uint32;
176 typedef signed char int8;
179 typedef long long int64;
181 //CSNES Types for conversion to 32 bit
182 /*typedef unsigned long bool8_32;
183 typedef unsigned long uint8_32;
184 typedef unsigned long uint16_32;
185 typedef long int8_32;
186 typedef long int16_32;*/
188 //For Debugging Purposes:
190 typedef unsigned char bool8_32;
191 typedef unsigned char uint8_32;
192 typedef unsigned short uint16_32;
193 typedef signed char int8_32;
194 typedef short int16_32;
197 //Defines for Extern C
198 #define EXTERN_C extern
199 #define START_EXTERN_C extern "C" {
200 #define END_EXTERN_C }
204 #define _MAX_DIR PATH_MAX
206 #define _MAX_FNAME PATH_MAX
207 #define _MAX_EXT PATH_MAX
208 #define _MAX_PATH (1024)
214 //Slash Char Definitions
215 #define SLASH_STR "/"
216 #define SLASH_CHAR '/'
220 //#define SPC700_SHUTDOWN
222 #define STATIC static
224 #define PIXEL_FORMAT RGB565
225 #define CHECK_SOUND()
228 #define UNZIP_SUPPORT
229 #define ZeroMemory(a,b) memset((a),0,(b))
230 #define PACKING __attribute__ ((packed))
231 #define ALIGN_BY_ONE __attribute__ ((aligned (1), packed))
233 #undef FAST_LSB_WORD_ACCESS
237 EXTERN_C void S9xGenerateSound ();
239 //Additional Items for _SNESPPC port
240 void _makepath (char *path, const char *drive, const char *dir,
241 const char *fname, const char *ext);
242 void _splitpath (const char *path, char *drive, char *dir, char *fname,
244 #define strcasecmp strcmp
245 #define strncasecmp strncmp
250 #define INLINE inline
255 #define inline inline
278 #define inline __inline
279 #define INLINE __inline
292 //#include <strings.h>
293 //#include <clib/powerpc_protos.h>
296 #include <sys/types.h>
301 #define PIXEL_FORMAT RGB565
302 //#define GFX_MULTI_FORMAT
304 #if defined(TARGET_OS_MAC) && TARGET_OS_MAC
307 #include "zlib/zlib.h" //RC
313 #define EXECUTE_SUPERFX_PER_LINE
317 #define SPC700_SHUTDOWN
318 #define PIXEL_FORMAT RGB555
319 #define CHECK_SOUND()
320 #define M_PI 3.14159265359
323 #undef DEBUGGER // Apple Universal Headers sometimes #define DEBUGGER
324 #undef GFX_MULTI_FORMAT
326 int strncasecmp(const char *s1, const char *s2, unsigned n);
327 int strcasecmp(const char *s1, const char *s2 );
331 #ifndef snes9x_types_defined
332 #define snes9x_types_defined
336 typedef unsigned long bool8;
338 typedef unsigned char bool8;
342 typedef unsigned char uint8;
343 typedef unsigned short uint16;
344 typedef signed char int8;
346 //typedef long int32;
347 //typedef unsigned long uint32;
349 typedef unsigned int uint32;
351 typedef __int64 int64;
353 typedef unsigned long uint8_32;
354 typedef unsigned long uint16_32;
355 typedef long int8_32;
356 typedef long int16_32;
359 typedef long long int64;
364 //#include <systypes.h>
367 typedef unsigned char uint8;
368 typedef unsigned short uint16;
369 typedef signed char int8;
373 // winsock2.h typedefs int32 as well.
377 typedef unsigned int uint32;
379 #endif // __BORLANDC__
381 typedef __int64 int64;
384 #endif // snes9x_types_defined
397 #define START_EXTERN_C
400 #if defined(__cplusplus) || defined(c_plusplus)
401 #define EXTERN_C extern "C"
402 #define START_EXTERN_C extern "C" {
403 #define END_EXTERN_C }
405 #define EXTERN_C extern
406 #define START_EXTERN_C
414 #define PATH_MAX 1024
417 #define _MAX_DIR PATH_MAX
419 #define _MAX_FNAME PATH_MAX
420 #define _MAX_EXT PATH_MAX
422 #define _MAX_PATH PATH_MAX
426 #define strcasecmp strcmp
427 #define strncasecmp strncmp
431 #define _MAX_PATH (1024)
435 #define ZeroMemory(a,b) memset((a),0,(b))
437 void _makepath (char *path, const char *drive, const char *dir,
438 const char *fname, const char *ext);
439 void _splitpath (const char *path, char *drive, char *dir, char *fname,
442 #define strcasecmp stricmp
443 #define strncasecmp strnicmp
446 EXTERN_C void S9xGenerateSound ();
449 EXTERN_C int soundsignal;
450 EXTERN_C void MixSound(void);
451 //Yes, CHECK_SOUND is getting defined correctly!
452 #define CHECK_SOUND if (Settings.APUEnabled) if(SetSignalPPC(0L, soundsignal) & soundsignal) MixSound
454 #define CHECK_SOUND()
458 #define SLASH_STR "\\"
459 #define SLASH_CHAR '\\'
461 #define SLASH_STR "/"
462 #define SLASH_CHAR '/'
466 typedef void (*SignalHandler)(int);
467 #define SIG_PF SignalHandler
470 #if defined(__i386__) || defined(__i486__) || defined(__i586__) || \
471 defined(__WIN32__) || defined(__alpha__)
473 #define FAST_LSB_WORD_ACCESS
477 //NOPE! #define FAST_LSB_WORD_ACCESS //RC
484 #define TITLE "Snes9X: Solaris"
488 #define TITLE "Snes9X: Linux"
492 #define TITLE "Snes9x"
497 #define strncasecmp strnicmp
499 #define STATIC static