1 /***************************************************************************
2 * Copyright (C) 2007 Ryan Schultz, PCSX-df Team, PCSX team *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307 USA. *
18 ***************************************************************************/
21 * This file contains common definitions and includes for all parts of the
25 #ifndef __PSXCOMMON_H__
26 #define __PSXCOMMON_H__
44 #include <sys/types.h>
53 typedef intptr_t sptr;
59 typedef uintptr_t uptr;
61 typedef uint8_t boolean;
75 #define strnicmp strncasecmp
77 #define __inline inline
79 // Enables NLS/internationalization if active
85 #define _(String) gettext(String)
87 # define N_(String) gettext_noop (String)
89 # define N_(String) (String)
94 #define _(msgid) msgid
95 #define N_(msgid) msgid
102 void __Log(char *fmt, ...);
105 char Gpu[MAXPATHLEN];
106 char Spu[MAXPATHLEN];
107 char Cdr[MAXPATHLEN];
108 char Pad1[MAXPATHLEN];
109 char Pad2[MAXPATHLEN];
110 char Net[MAXPATHLEN];
111 char Sio1[MAXPATHLEN];
112 char Mcd1[MAXPATHLEN];
113 char Mcd2[MAXPATHLEN];
114 char Bios[MAXPATHLEN];
115 char BiosDir[MAXPATHLEN];
116 char PluginsDir[MAXPATHLEN];
117 char PatchesDir[MAXPATHLEN];
131 u8 Cpu; // CPU_DYNAREC or CPU_INTERPRETER
132 u8 PsxType; // PSX_TYPE_NTSC or PSX_TYPE_PAL
138 extern PcsxConfig Config;
139 extern boolean NetOpened;
141 struct PcsxSaveFuncs {
142 void *(*open)(const char *name, const char *mode);
143 int (*read)(void *file, void *buf, u32 len);
144 int (*write)(void *file, const void *buf, u32 len);
145 long (*seek)(void *file, long offs, int whence);
146 void (*close)(void *file);
148 extern struct PcsxSaveFuncs SaveFuncs;
150 #define gzfreeze(ptr, size) { \
151 if (Mode == 1) SaveFuncs.write(f, ptr, size); \
152 if (Mode == 0) SaveFuncs.read(f, ptr, size); \
155 // Make the timing events trigger faster as we are currently assuming everything
156 // takes one cycle, which is not the case on real hardware.
157 // FIXME: Count the proper cycle and get rid of this
159 #define PSXCLK 33868800 /* 33.8688 MHz */