1 /* Pcsx - Pc Psx Emulator
2 * Copyright (C) 1999-2002 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 Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #import <CoreFoundation/CoreFoundation.h>
25 #include "psxcommon.h"
31 unsigned long gpuDisp;
33 long SPU__open(void) {
44 void PADhandleKey(int key) {
47 long PAD1__open(void) {
48 return PAD1_open(&gpuDisp);
51 long PAD2__open(void) {
52 return PAD2_open(&gpuDisp);
57 void SignalExit(int sig) {
64 #define PARSEPATH(dst, src) \
65 ptr = src + strlen(src); \
66 while (*ptr != '\\' && ptr != src) ptr--; \
72 static char path[1024];
76 //signal(SIGINT, SignalExit);
77 //signal(SIGPIPE, SignalExit);
79 GPU_clearDynarec(clearDynarec);
81 pathUrl = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("gpuPeopsSoftX.cfg"), NULL, NULL);
83 CFURLGetFileSystemRepresentation(pathUrl, true, path, 1024);
86 if (ret < 0) { SysMessage(_("Error Opening CDR Plugin")); return -1; }
88 if (ret < 0) { SysMessage(_("Error Opening SPU Plugin")); return -1; }
89 SPU_registerCallback(SPUirq);
90 ret = GPU_open(&gpuDisp, "PCSX", /*pathUrl ? path :*/ NULL);
91 if (ret < 0) { SysMessage(_("Error Opening GPU Plugin")); return -1; }
92 ret = PAD1_open(&gpuDisp);
93 if (ret < 0) { SysMessage(_("Error Opening PAD1 Plugin")); return -1; }
94 ret = PAD2_open(&gpuDisp);
95 if (ret < 0) { SysMessage(_("Error Opening PAD2 Plugin")); return -1; }
103 while ((ret = _OpenPlugins()) == -2) {
105 LoadMcds(Config.Mcd1, Config.Mcd2);
106 if (LoadPlugins() == -1) return -1;
111 void ClosePlugins() {
114 //signal(SIGINT, SIG_DFL);
115 //signal(SIGPIPE, SIG_DFL);
117 if (ret < 0) { SysMessage(_("Error Closing CDR Plugin")); return; }
119 if (ret < 0) { SysMessage(_("Error Closing SPU Plugin")); return; }
121 if (ret < 0) { SysMessage(_("Error Closing PAD1 Plugin")); return; }
123 if (ret < 0) { SysMessage(_("Error Closing PAD2 Plugin")); return; }
125 if (ret < 0) { SysMessage(_("Error Closing GPU Plugin")); return; }
128 void ResetPlugins() {
138 if (ret < 0) { SysMessage(_("CDRinit error: %d"), ret); return; }
140 if (ret < 0) { SysMessage(_("GPUinit error: %d"), ret); return; }
142 if (ret < 0) { SysMessage(_("SPUinit error: %d"), ret); return; }
144 if (ret < 0) { SysMessage(_("PAD1init error: %d"), ret); return; }
146 if (ret < 0) { SysMessage(_("PAD2init error: %d"), ret); return; }