diff options
| author | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2009-06-09 11:34:52 +0000 |
|---|---|---|
| committer | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2009-06-09 11:34:52 +0000 |
| commit | 10eac4b4928e7dd9f79de454641889f2a0b77250 (patch) | |
| tree | 0f9c98f659552ed2406a6159bc123889ca46b919 /macosx | |
| parent | 568526e291e9743751d8632327b94e01e7181efc (diff) | |
| download | pcsxr-10eac4b4928e7dd9f79de454641889f2a0b77250.tar.gz | |
added prelimiary Mac OS X port (still not working)
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@23667 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx')
36 files changed, 3455 insertions, 0 deletions
diff --git a/macosx/ConfigurationController.h b/macosx/ConfigurationController.h new file mode 100644 index 00000000..a85c2579 --- /dev/null +++ b/macosx/ConfigurationController.h @@ -0,0 +1,36 @@ +/* ConfigurationController */ + +#import <Cocoa/Cocoa.h> +#import "PluginController.h" +#import "PluginList.h" + +@interface ConfigurationController : NSWindowController +{ + IBOutlet PluginController *cdromPlugin; + IBOutlet PluginController *graphicsPlugin; + IBOutlet PluginController *padPlugin; + IBOutlet PluginController *soundPlugin; + + IBOutlet id noXaAudioCell; + IBOutlet id sioIrqAlwaysCell; + IBOutlet id bwMdecCell; + IBOutlet id autoVTypeCell; + IBOutlet id vTypePALCell; + IBOutlet id noCDAudioCell; + IBOutlet id usesHleCell; + IBOutlet id usesDynarecCell; + IBOutlet id consoleOutputCell; + IBOutlet id spuIrqAlwaysCell; + IBOutlet id rCountFixCell; + IBOutlet id vSyncWAFixCell; + IBOutlet id noFastBootCell; + + NSMutableDictionary *checkBoxDefaults; +} +- (IBAction)setCheckbox:(id)sender; +- (IBAction)setCheckboxInverse:(id)sender; +- (IBAction)setVideoType:(id)sender; + +- (NSString *)keyForSender:(id)sender; + +@end diff --git a/macosx/ConfigurationController.m b/macosx/ConfigurationController.m new file mode 100644 index 00000000..d5e4cd8d --- /dev/null +++ b/macosx/ConfigurationController.m @@ -0,0 +1,144 @@ +#import "ConfigurationController.h" +#import "PcsxController.h" +#import "PluginList.h" +#import "PcsxPlugin.h" +#include "psxcommon.h" +#include "plugins.h" + +@implementation ConfigurationController + +- (IBAction)setCheckbox:(id)sender +{ + if ([sender isKindOfClass:[NSMatrix class]]) { + sender = [sender selectedCell]; + } + + NSString *key = [self keyForSender:sender]; + if (key) { + [[NSUserDefaults standardUserDefaults] setInteger:[sender intValue] forKey:key]; + [PcsxController setConfigFromDefaults]; + } +} + +- (IBAction)setCheckboxInverse:(id)sender +{ + if ([sender isKindOfClass:[NSMatrix class]]) { + sender = [sender selectedCell]; + } + + NSString *key = [self keyForSender:sender]; + if (key) { + [[NSUserDefaults standardUserDefaults] setInteger:![sender intValue] forKey:key]; + [PcsxController setConfigFromDefaults]; + } +} + +- (IBAction)setVideoType:(id)sender +{ + int tag = [[sender selectedItem] tag]; + + if (3 == tag) { + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"AutoDetectVideoType"]; + } else if (1 == tag || 2 == tag) { + [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"AutoDetectVideoType"]; + [[NSUserDefaults standardUserDefaults] setBool:tag==2 forKey:@"VideoTypePAL"]; + } else { + return; + } + [PcsxController setConfigFromDefaults]; + + if ([sender pullsDown]) { + NSArray *items = [sender itemArray]; + int i; + + for (i=0; i<[items count]; i++) + [[items objectAtIndex:i] setState:NSOffState]; + + [[sender selectedItem] setState:NSOnState]; + } +} + +- (void)awakeFromNib +{ + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + + [[self window] center]; + + // setup checkboxes + checkBoxDefaults = [[NSMutableDictionary alloc] init]; + + // check that the outlets are active before adding them + if (noXaAudioCell) [checkBoxDefaults setObject:noXaAudioCell forKey:@"NoXaAudio"]; + if (sioIrqAlwaysCell) [checkBoxDefaults setObject:sioIrqAlwaysCell forKey:@"SioIrqAlways"]; + if (bwMdecCell) [checkBoxDefaults setObject:bwMdecCell forKey:@"BlackAndWhiteMDECVideo"]; + if (autoVTypeCell) [checkBoxDefaults setObject:autoVTypeCell forKey:@"AutoDetectVideoType"]; + if (vTypePALCell) [checkBoxDefaults setObject:vTypePALCell forKey:@"VideoTypePAL"]; + if (noCDAudioCell) [checkBoxDefaults setObject:noCDAudioCell forKey:@"NoCDAudio"]; + if (usesHleCell) [checkBoxDefaults setObject:usesHleCell forKey:@"UseHLE"]; + if (usesDynarecCell) [checkBoxDefaults setObject:usesDynarecCell forKey:@"NoDynarec"]; + if (consoleOutputCell) [checkBoxDefaults setObject:consoleOutputCell forKey:@"ConsoleOutput"]; + if (spuIrqAlwaysCell) [checkBoxDefaults setObject:spuIrqAlwaysCell forKey:@"SpuIrqAlways"]; + if (rCountFixCell) [checkBoxDefaults setObject:rCountFixCell forKey:@"RootCounterFix"]; + if (vSyncWAFixCell) [checkBoxDefaults setObject:vSyncWAFixCell forKey:@"VideoSyncWAFix"]; + if (noFastBootCell) [checkBoxDefaults setObject:noFastBootCell forKey:@"NoFastBoot"]; + + // make the visuals match the defaults + NSEnumerator *enumerator= [checkBoxDefaults keyEnumerator]; + id key; + while ((key = [enumerator nextObject])) { + if ([defaults integerForKey:key]) { + [[checkBoxDefaults objectForKey:key] setNextState]; + } + } + + // special cases + if (![PcsxController biosAvailable]) { + // no bios means always use HLE + [usesHleCell setState:NSOnState]; + [usesHleCell setEnabled:NO]; + } + + int tag = [defaults integerForKey:@"AutoDetectVideoType"]; + if (tag) + tag = 3; + else { + tag = [defaults integerForKey:@"VideoTypePAL"]+1; + } + [vTypePALCell setAutoenablesItems:NO]; + if ([vTypePALCell pullsDown]) { + [[vTypePALCell itemAtIndex:[vTypePALCell indexOfItemWithTag:tag]] setState:NSOnState]; + } else { + [vTypePALCell selectItemAtIndex:[vTypePALCell indexOfItemWithTag:tag]]; + } + + // setup plugin lists + PluginList *list = [PluginList list]; + + [list refreshPlugins]; + [graphicsPlugin setPluginsTo:[list pluginsForType:PSE_LT_GPU] withType: PSE_LT_GPU]; + [soundPlugin setPluginsTo:[list pluginsForType:PSE_LT_SPU] withType: PSE_LT_SPU]; + [padPlugin setPluginsTo:[list pluginsForType:PSE_LT_PAD] withType: PSE_LT_PAD]; + [cdromPlugin setPluginsTo:[list pluginsForType:PSE_LT_CDR] withType: PSE_LT_CDR]; +} + +- (void)dealloc +{ + [checkBoxDefaults release]; + + [super dealloc]; +} + +- (NSString *)keyForSender:(id)sender +{ + NSEnumerator *enumerator= [checkBoxDefaults keyEnumerator]; + id key; + while ((key = [enumerator nextObject])) { + id object = [checkBoxDefaults objectForKey:key]; + if ([object isEqual:sender]) + return key; + } + + return nil; +} + +@end diff --git a/macosx/EmuThread.h b/macosx/EmuThread.h new file mode 100644 index 00000000..7a88c444 --- /dev/null +++ b/macosx/EmuThread.h @@ -0,0 +1,37 @@ +// +// EmuThread.h +// Pcsx +// +// Created by Gil Pedersen on Sun Sep 21 2003. +// Copyright (c) 2003 __MyCompanyName__. All rights reserved. +// + +#import <Foundation/Foundation.h> +#include <setjmp.h> + +@interface EmuThread : NSObject { + NSAutoreleasePool *pool; + jmp_buf restartJmp; + BOOL wasPaused; +} + +- (void)EmuThreadRun:(id)anObject; +- (void)handleEvents; + ++ (void)run; ++ (void)stop; ++ (BOOL)pause; ++ (BOOL)pauseSafe; ++ (void)resume; ++ (void)resetNow; ++ (void)reset; + ++ (BOOL)isPaused; ++ (BOOL)active; + ++ (void)freezeAt:(NSString *)path which:(int)num; ++ (BOOL)defrostAt:(NSString *)path; + +@end + +extern EmuThread *emuThread; diff --git a/macosx/EmuThread.m b/macosx/EmuThread.m new file mode 100644 index 00000000..dbe33864 --- /dev/null +++ b/macosx/EmuThread.m @@ -0,0 +1,330 @@ +// +// EmuThread.m +// Pcsx +// +// Created by Gil Pedersen on Sun Sep 21 2003. +// Copyright (c) 2003 __MyCompanyName__. All rights reserved. +// + +#import <ExceptionHandling/NSExceptionHandler.h> +#import <AppKit/NSApplication.h> +#include <pthread.h> +#include <setjmp.h> +#import "EmuThread.h" +#include "psxcommon.h" +#include "plugins.h" +#include "misc.h" + +EmuThread *emuThread; +NSString *defrostPath = nil; +static int safeEvent; +static int paused; + +static pthread_cond_t eventCond; +static pthread_mutex_t eventMutex; + +#define EMUEVENT_NONE 0 +#define EMUEVENT_PAUSE (1<<0) +#define EMUEVENT_RESET (1<<1) +#define EMUEVENT_STOP (1<<2) + +@implementation EmuThread + +- (void)EmuThreadRun:(id)anObject +{ + pool = [[NSAutoreleasePool alloc] init]; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(emuWindowDidClose:) + name:@"emuWindowDidClose" object:nil]; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(emuWindowWantPause:) + name:@"emuWindowWantPause" object:nil]; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(emuWindowWantResume:) + name:@"emuWindowWantResume" object:nil]; + + // we shouldn't change the priority, since we might depend on subthreads + //[NSThread setThreadPriority:1.0-((1.0-[NSThread threadPriority])/4.0)]; + + // Do processing here + if (OpenPlugins() == -1) + goto done; + + if (setjmp(restartJmp) == 0) { + psxReset(); + } + + int res = CheckCdrom(); + if (res == -1) { + ClosePlugins(); + SysMessage(_("Could not load Cdrom\n")); + goto done; + } + + if (LoadCdrom() == -1) { + ClosePlugins(); + SysMessage(_("Could not load Cdrom\n")); + goto done; + } + + if (defrostPath) { + LoadState([defrostPath fileSystemRepresentation]); + [defrostPath release]; defrostPath = nil; + } + + psxCpu->Execute(); + +done: + [pool release]; pool = nil; + emuThread = nil; + + return; +} + +- (void)dealloc +{ + // remove all registered observers + [[NSNotificationCenter defaultCenter] removeObserver:self name:nil object:nil]; + + if (pool) + [pool release]; + + [super dealloc]; +} + +- (void)emuWindowDidClose:(NSNotification *)aNotification +{ + [EmuThread stop]; +} + +- (void)emuWindowWantPause:(NSNotification *)aNotification +{ + wasPaused = [EmuThread pause]; +} + +- (void)emuWindowWantResume:(NSNotification *)aNotification +{ + if (!wasPaused) { + [EmuThread resume]; + } + wasPaused = NO; +} + +/* called periodically from the emulation thread */ +- (void)handleEvents +{ + /* only do a trylock here, since we're not interested in blocking, + and we can just handle events next time round */ + if (pthread_mutex_trylock(&eventMutex) == 0) { + while (safeEvent) { + if (safeEvent & EMUEVENT_STOP) { + /* signify that the emulation has stopped */ + [emuThread autorelease]; + emuThread = nil; + paused = NO; + + /* better unlock the mutex before killing ourself */ + pthread_mutex_unlock(&eventMutex); + + ClosePlugins(); + SysClose(); + + //[[NSThread currentThread] autorelease]; + [NSThread exit]; + return; + } + + if (safeEvent & EMUEVENT_RESET) { +#if 1 + /* signify that the emulation has stopped */ + [emuThread autorelease]; + emuThread = nil; + + /* better unlock the mutex before killing ourself */ + pthread_mutex_unlock(&eventMutex); + + ClosePlugins(); + + // start a new emulation thread + [EmuThread run]; + + //[[NSThread currentThread] autorelease]; + [NSThread exit]; + return; +#else + safeEvent &= ~EMUEVENT_RESET; + pthread_mutex_unlock(&eventMutex); + + psxCpu->Reset(); + + longjmp(restartJmp, 0); +#endif + } + + if (safeEvent & EMUEVENT_PAUSE) { + paused = 2; + /* wait until we're signalled */ + pthread_cond_wait(&eventCond, &eventMutex); + } + } + pthread_mutex_unlock(&eventMutex); + } +} + + ++ (void)run +{ + int err; + + if (emuThread) { + [EmuThread resume]; + return; + } + + if (pthread_mutex_lock(&eventMutex) != 0) { + err = pthread_cond_init(&eventCond, NULL); + if (err) return; + + err = pthread_mutex_init(&eventMutex, NULL); + if (err) return; + + pthread_mutex_lock(&eventMutex); + } + + safeEvent = EMUEVENT_NONE; + paused = NO; + + if (SysInit() != 0) { + pthread_mutex_unlock(&eventMutex); + return; + } + + emuThread = [[EmuThread alloc] init]; + + [NSThread detachNewThreadSelector:@selector(EmuThreadRun:) + toTarget:emuThread withObject:nil]; + + pthread_mutex_unlock(&eventMutex); +} + ++ (void)stop +{ + pthread_mutex_lock(&eventMutex); + safeEvent = EMUEVENT_STOP; + pthread_mutex_unlock(&eventMutex); + + // wake it if it's sleeping + pthread_cond_broadcast(&eventCond); +} + ++ (BOOL)pause +{ + if (paused || ![EmuThread active]) + return YES; + + pthread_mutex_lock(&eventMutex); + safeEvent |= EMUEVENT_PAUSE; + paused = 1; + pthread_mutex_unlock(&eventMutex); + + pthread_cond_broadcast(&eventCond); + + return NO; +} + ++ (BOOL)pauseSafe +{ + if ((paused == 2) || ![EmuThread active]) + return YES; + + [EmuThread pause]; + while ([EmuThread isPaused] != 2) [NSThread sleepUntilDate:[[NSDate date] addTimeInterval:0.05]]; + + return NO; +} + ++ (void)resume +{ + if (!paused || ![EmuThread active]) + return; + + pthread_mutex_lock(&eventMutex); + + safeEvent &= ~EMUEVENT_PAUSE; + paused = NO; + pthread_mutex_unlock(&eventMutex); + + pthread_cond_broadcast(&eventCond); +} + ++ (void)reset +{ + pthread_mutex_lock(&eventMutex); + safeEvent = EMUEVENT_RESET; + pthread_mutex_unlock(&eventMutex); + + pthread_cond_broadcast(&eventCond); +} + +// must only be called from within the emulation thread!!! ++ (void)resetNow +{ + /* signify that the emulation has stopped */ + [emuThread autorelease]; + emuThread = nil; + + ClosePlugins(); + + // start a new emulation thread + [EmuThread run]; + + //[[NSThread currentThread] autorelease]; + [NSThread exit]; + return; +} + ++ (BOOL)isPaused +{ + return paused; +} + ++ (BOOL)active +{ + return emuThread ? YES : NO; +} + ++ (void)freezeAt:(NSString *)path which:(int)num +{ + BOOL emuWasPaused = [EmuThread pauseSafe]; + char Text[256]; + + GPU_freeze(2, (GPUFreeze_t *)&num); + int ret = SaveState([path fileSystemRepresentation]); + if (ret == 0) sprintf (Text, _("*PCSX*: Saved State %d"), num+1); + else sprintf (Text, _("*PCSX*: Error Saving State %d"), num+1); + GPU_displayText(Text); + + if (!emuWasPaused) { + [EmuThread resume]; + } +} + ++ (BOOL)defrostAt:(NSString *)path +{ + const char *cPath = [path fileSystemRepresentation]; + if (CheckState(cPath) != 0) + return NO; + + defrostPath = [path retain]; + + [EmuThread reset]; + + GPU_displayText(_("*PCSX*: Loaded State")); + + return YES; +} + +@end diff --git a/macosx/English.lproj/AddPluginSheet.nib/classes.nib b/macosx/English.lproj/AddPluginSheet.nib/classes.nib new file mode 100644 index 00000000..ae53771c --- /dev/null +++ b/macosx/English.lproj/AddPluginSheet.nib/classes.nib @@ -0,0 +1,14 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {closeAddPluginSheet = id; }; + CLASS = PcsxPluginDocument; + LANGUAGE = ObjC; + OUTLETS = {addPluginSheet = NSWindow; pluginName = NSTextField; }; + SUPERCLASS = NSDocument; + }, + {CLASS = "java.lang.Object"; LANGUAGE = Java; } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/macosx/English.lproj/AddPluginSheet.nib/info.nib b/macosx/English.lproj/AddPluginSheet.nib/info.nib new file mode 100644 index 00000000..3af05e0c --- /dev/null +++ b/macosx/English.lproj/AddPluginSheet.nib/info.nib @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>69 10 356 240 0 0 1024 746 </string> + <key>IBFramework Version</key> + <string>364.0</string> + <key>IBOpenObjects</key> + <array> + <integer>10</integer> + </array> + <key>IBSystem Version</key> + <string>7H63</string> +</dict> +</plist> diff --git a/macosx/English.lproj/AddPluginSheet.nib/keyedobjects.nib b/macosx/English.lproj/AddPluginSheet.nib/keyedobjects.nib Binary files differnew file mode 100644 index 00000000..60ed72e0 --- /dev/null +++ b/macosx/English.lproj/AddPluginSheet.nib/keyedobjects.nib diff --git a/macosx/English.lproj/Configuration.nib/classes.nib b/macosx/English.lproj/Configuration.nib/classes.nib new file mode 100644 index 00000000..e7e543b4 --- /dev/null +++ b/macosx/English.lproj/Configuration.nib/classes.nib @@ -0,0 +1,41 @@ +{ + IBClasses = ( + { + ACTIONS = {setCheckbox = id; setCheckboxInverse = id; setVideoType = id; }; + CLASS = ConfigurationController; + LANGUAGE = ObjC; + OUTLETS = { + autoVTypeCell = id; + bwMdecCell = id; + cdromPlugin = PluginController; + consoleOutputCell = id; + graphicsPlugin = PluginController; + noCDAudioCell = id; + noXaAudioCell = id; + padPlugin = PluginController; + rCountFixCell = id; + sioIrqAlwaysCell = id; + soundPlugin = PluginController; + spuIrqAlwaysCell = id; + usesDynarecCell = id; + usesHleCell = id; + vSyncWAFixCell = id; + vTypePALCell = id; + }; + SUPERCLASS = NSWindowController; + }, + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {doAbout = id; doConfigure = id; selectPlugin = id; }; + CLASS = PluginController; + LANGUAGE = ObjC; + OUTLETS = { + aboutButton = NSButton; + configureButton = NSButton; + pluginMenu = NSPopUpButton; + }; + SUPERCLASS = NSObject; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/macosx/English.lproj/Configuration.nib/info.nib b/macosx/English.lproj/Configuration.nib/info.nib new file mode 100644 index 00000000..27b3f306 --- /dev/null +++ b/macosx/English.lproj/Configuration.nib/info.nib @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>79 74 486 240 0 0 1024 746 </string> + <key>IBFramework Version</key> + <string>364.0</string> + <key>IBLockedObjects</key> + <array/> + <key>IBOpenObjects</key> + <array> + <integer>21</integer> + </array> + <key>IBSystem Version</key> + <string>7S215</string> +</dict> +</plist> diff --git a/macosx/English.lproj/Configuration.nib/objects.nib b/macosx/English.lproj/Configuration.nib/objects.nib Binary files differnew file mode 100644 index 00000000..7d1aff12 --- /dev/null +++ b/macosx/English.lproj/Configuration.nib/objects.nib diff --git a/macosx/English.lproj/Credits.rtf b/macosx/English.lproj/Credits.rtf new file mode 100644 index 00000000..a7870f8a --- /dev/null +++ b/macosx/English.lproj/Credits.rtf @@ -0,0 +1,28 @@ +{\rtf1\mac\ansicpg10000\cocoartf102 +{\fonttbl\f0\fswiss\fcharset77 Helvetica-Bold;\f1\fswiss\fcharset77 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural + +\f0\b\fs24 \cf0 Macintosh Port: +\f1\b0 \ + Gil Pedersen\ +\ + +\f0\b Icon Design: +\f1\b0 \ + Romain Lafourcade\ +\ + +\f0\b Original Coders: +\f1\b0 \ + Linuzappz\ + Shadow\ + Pete Bernert\ + NoComp\ + Nik3d\ +\ + +\f0\b Macintosh Testing: +\f1\b0 \ + Richard Banister\ + Many others}
\ No newline at end of file diff --git a/macosx/English.lproj/InfoPlist.strings b/macosx/English.lproj/InfoPlist.strings new file mode 100644 index 00000000..39649ac1 --- /dev/null +++ b/macosx/English.lproj/InfoPlist.strings @@ -0,0 +1,6 @@ +/* Localized versions of Info.plist keys */ + +CFBundleName = "PCSX"; +CFBundleShortVersionString = "PCSX version 1.5 test 3"; +CFBundleGetInfoString = "PCSX Playstation Emulator version 1.5 test 3, Copyright © 2005 Gil Pedersen."; +NSHumanReadableCopyright = "Copyright © 2005 Gil Pedersen.\nhttp://home.macvaerk.dtu.dk/~gil/pcsx/"; diff --git a/macosx/English.lproj/PCSX.nib/classes.nib b/macosx/English.lproj/PCSX.nib/classes.nib new file mode 100644 index 00000000..62f942f4 --- /dev/null +++ b/macosx/English.lproj/PCSX.nib/classes.nib @@ -0,0 +1,25 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = { + defrost = id; + ejectCD = id; + freeze = id; + fullscreen = id; + memCardConfig = id; + pause = id; + preferences = id; + reset = id; + runBios = id; + runCD = id; + runExe = id; + }; + CLASS = PcsxController; + LANGUAGE = ObjC; + OUTLETS = {memCardWindow = NSWindow; preferenceWindow = NSWindow; }; + SUPERCLASS = NSObject; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/macosx/English.lproj/PCSX.nib/info.nib b/macosx/English.lproj/PCSX.nib/info.nib new file mode 100644 index 00000000..ff999e10 --- /dev/null +++ b/macosx/English.lproj/PCSX.nib/info.nib @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>46 15 492 320 0 0 1024 746 </string> + <key>IBEditorPositions</key> + <dict> + <key>29</key> + <string>79 658 251 44 0 0 1024 746 </string> + </dict> + <key>IBFramework Version</key> + <string>364.0</string> + <key>IBOpenObjects</key> + <array> + <integer>29</integer> + </array> + <key>IBSystem Version</key> + <string>7R28</string> +</dict> +</plist> diff --git a/macosx/English.lproj/PCSX.nib/objects.nib b/macosx/English.lproj/PCSX.nib/objects.nib Binary files differnew file mode 100644 index 00000000..4d6fa523 --- /dev/null +++ b/macosx/English.lproj/PCSX.nib/objects.nib diff --git a/macosx/ExtendedKeys.h b/macosx/ExtendedKeys.h new file mode 100644 index 00000000..1b6475b8 --- /dev/null +++ b/macosx/ExtendedKeys.h @@ -0,0 +1,23 @@ + +#ifndef __EXTENDED_KEYS_H__ +#define __EXTENDED_KEYS_H__ + +enum { + PSX_FREEZE_KEY = 0xFFBE/*XK_F1*/, + PSX_NEXT_FREEZE_SLOT_KEY = 0xFFBF/*XK_F2*/, + PSX_DEFROST_KEY = 0xFFC0/*XK_F3*/, + PSX_SHOW_FREEZE_PIC_KEY = 0xFFC1/*XK_F4*/, + PSX_SIO_ALWAYS_ON_KEY = 0xFFC2/*XK_F5*/, + PSX_BW_MDEC_KEY = 0xFFC3/*XK_F6*/, + PSX_XA_AUDIO_ON_KEY = 0xFFC4/*XK_F7*/, + PSX_SNAPSHOT_KEY = 0xFFC5/*XK_F8*/, + PSX_OPEN_SHELL_KEY = 0xFFC6/*XK_F9*/, + PSX_CLOSE_SHELL_KEY = 0xFFC7/*XK_F10*/, + + PSX_STOP_KEY = 0xFF1B/*XK_Escape*/, + + GPU_FULLSCREEN_KEY = 0x0100, + GPU_FPS_DISPLAY_KEY = 0xFFFF/*XK_Delete*/ +}; + +#endif //__EXTENDED_KEYS_H__ diff --git a/macosx/Info.plist b/macosx/Info.plist new file mode 100644 index 00000000..8ab880a5 --- /dev/null +++ b/macosx/Info.plist @@ -0,0 +1,107 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleDocumentTypes</key> + <array> + <dict> + <key>CFBundleTypeExtensions</key> + <array> + <string>psxplugin</string> + </array> + <key>CFBundleTypeIconFile</key> + <string>psxplugin.icns</string> + <key>CFBundleTypeName</key> + <string>Playstation Emulator Plug-in</string> + <key>CFBundleTypeOSTypes</key> + <array> + <string>PsxP</string> + </array> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + <key>LSTypeIsPackage</key> + <true/> + <key>NSDocumentClass</key> + <string>PcsxPluginDocument</string> + </dict> + <dict> + <key>CFBundleTypeExtensions</key> + <array> + <string>bin</string> + </array> + <key>CFBundleTypeIconFile</key> + <string>psxbios.icns</string> + <key>CFBundleTypeName</key> + <string>Playstation BIOS Image</string> + <key>CFBundleTypeOSTypes</key> + <array> + <string>PsxB</string> + </array> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + <key>LSTypeIsPackage</key> + <false/> + </dict> + <dict> + <key>CFBundleTypeExtensions</key> + <array> + <string>mcr</string> + </array> + <key>CFBundleTypeIconFile</key> + <string>pcsxmemcard</string> + <key>CFBundleTypeName</key> + <string>PCSX Memory Card</string> + <key>CFBundleTypeOSTypes</key> + <array> + <string>Pmcr</string> + </array> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + <key>LSTypeIsPackage</key> + <false/> + </dict> + <dict> + <key>CFBundleTypeExtensions</key> + <array> + <string>pcsxstate</string> + </array> + <key>CFBundleTypeIconFile</key> + <string>pcsxfreeze</string> + <key>CFBundleTypeName</key> + <string>PCSX Freeze State</string> + <key>CFBundleTypeOSTypes</key> + <array> + <string>Pfrz</string> + </array> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + <key>LSTypeIsPackage</key> + <false/> + </dict> + </array> + <key>CFBundleExecutable</key> + <string>PCSX</string> + <key>CFBundleIconFile</key> + <string>PCSX.icns</string> + <key>CFBundleIdentifier</key> + <string>net.pcsx.Pcsx</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>PCSX</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleShortVersionString</key> + <string>PCSX 1.5 test 3</string> + <key>CFBundleSignature</key> + <string>Pcsx</string> + <key>CFBundleVersion</key> + <string>1.5.0 test 3</string> + <key>NSMainNibFile</key> + <string>PCSX.nib</string> + <key>NSPrincipalClass</key> + <string>NSApplication</string> +</dict> +</plist> diff --git a/macosx/Pcsx.xcodeproj/project.pbxproj b/macosx/Pcsx.xcodeproj/project.pbxproj new file mode 100644 index 00000000..478fa664 --- /dev/null +++ b/macosx/Pcsx.xcodeproj/project.pbxproj @@ -0,0 +1,698 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 42; + objects = { + +/* Begin PBXBuildFile section */ + 2B143D06078A2CBD00AF745A /* PCSX.icns in Resources */ = {isa = PBXBuildFile; fileRef = 2B143D01078A2CBD00AF745A /* PCSX.icns */; }; + 2B143D07078A2CBD00AF745A /* pcsxfreeze.icns in Resources */ = {isa = PBXBuildFile; fileRef = 2B143D02078A2CBD00AF745A /* pcsxfreeze.icns */; }; + 2B143D08078A2CBD00AF745A /* pcsxmemcard.icns in Resources */ = {isa = PBXBuildFile; fileRef = 2B143D03078A2CBD00AF745A /* pcsxmemcard.icns */; }; + 2B143D09078A2CBD00AF745A /* psxbios.icns in Resources */ = {isa = PBXBuildFile; fileRef = 2B143D04078A2CBD00AF745A /* psxbios.icns */; }; + 2B143D0A078A2CBD00AF745A /* psxplugin.icns in Resources */ = {isa = PBXBuildFile; fileRef = 2B143D05078A2CBD00AF745A /* psxplugin.icns */; }; + 2B3E356C06937D1C00763C7D /* PcsxPluginDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B3E356A06937D1C00763C7D /* PcsxPluginDocument.h */; }; + 2B3E356D06937D1C00763C7D /* PcsxPluginDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B3E356B06937D1C00763C7D /* PcsxPluginDocument.m */; }; + 2B3E35BC069384D100763C7D /* AddPluginSheet.nib in Resources */ = {isa = PBXBuildFile; fileRef = 2B3E35BA069384D100763C7D /* AddPluginSheet.nib */; }; + 2B400D910789F58A00BA271E /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2B02C04304E145D000880C5B /* Carbon.framework */; }; + 2B4DE99105FF9307003EFEF0 /* PluginController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B4DE98D05FF9307003EFEF0 /* PluginController.h */; }; + 2B4DE99205FF9307003EFEF0 /* PluginController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B4DE98E05FF9307003EFEF0 /* PluginController.m */; }; + 2BB3D69D05427FE200831ACB /* PcsxController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B75FD3C051C56D200D12034 /* PcsxController.h */; }; + 2BB3D69E05427FE200831ACB /* ConfigurationController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B75FD4A051C8A7400D12034 /* ConfigurationController.h */; }; + 2BB3D69F05427FE200831ACB /* PluginList.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BBB1126051DC00500B84448 /* PluginList.h */; }; + 2BB3D6A005427FE200831ACB /* EmuThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BBB1791051E113B00B84448 /* EmuThread.h */; }; + 2BB3D6A105427FE200831ACB /* PcsxPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BA44360052DB2EA00E21DDD /* PcsxPlugin.h */; }; + 2BB3D6A305427FE200831ACB /* Configuration.nib in Resources */ = {isa = PBXBuildFile; fileRef = 2BA178B00514CE260026D74D /* Configuration.nib */; }; + 2BB3D6A405427FE200831ACB /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 2BA178B20514CE260026D74D /* InfoPlist.strings */; }; + 2BB3D6A505427FE200831ACB /* PCSX.nib in Resources */ = {isa = PBXBuildFile; fileRef = 2BA178B40514CE260026D74D /* PCSX.nib */; }; + 2BB3D6A705427FE200831ACB /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 2BBB1786051E0D9700B84448 /* Credits.rtf */; }; + 2BB3D6BE05427FE200831ACB /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BA178A505148D9D0026D74D /* main.m */; }; + 2BB3D6BF05427FE200831ACB /* PcsxController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B75FD3D051C56D200D12034 /* PcsxController.m */; }; + 2BB3D6C005427FE200831ACB /* ConfigurationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B75FD4B051C8A7400D12034 /* ConfigurationController.m */; }; + 2BB3D6C105427FE200831ACB /* PluginList.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BBB1127051DC00500B84448 /* PluginList.m */; }; + 2BB3D6C205427FE200831ACB /* EmuThread.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BBB1792051E113B00B84448 /* EmuThread.m */; }; + 2BB3D6C305427FE200831ACB /* Plugin.c in Sources */ = {isa = PBXBuildFile; fileRef = 2BBB17DA051E4D0F00B84448 /* Plugin.c */; }; + 2BB3D6C405427FE200831ACB /* PcsxPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BA44361052DB2EA00E21DDD /* PcsxPlugin.m */; }; + 2BB3D6C605427FE200831ACB /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BC4786204C7FD3600CAB520 /* Cocoa.framework */; }; + 2BB3D6C705427FE200831ACB /* System.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2B6E8AAE04C832040017A3B1 /* System.framework */; }; + 2BB3D6C805427FE200831ACB /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2B6E8AB404C8327C0017A3B1 /* IOKit.framework */; }; + 7161C2820FDED6D000225F97 /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = 7161C2810FDED6D000225F97 /* config.h */; }; + 7161C2980FDED75300225F97 /* ExtendedKeys.h in Headers */ = {isa = PBXBuildFile; fileRef = 7161C2970FDED75300225F97 /* ExtendedKeys.h */; }; + 71F4C5890FDED12800529849 /* cdriso.c in Sources */ = {isa = PBXBuildFile; fileRef = 71F4C5600FDED12800529849 /* cdriso.c */; }; + 71F4C58A0FDED12800529849 /* cdriso.h in Headers */ = {isa = PBXBuildFile; fileRef = 71F4C5610FDED12800529849 /* cdriso.h */; }; + 71F4C58B0FDED12800529849 /* cdrom.c in Sources */ = {isa = PBXBuildFile; fileRef = 71F4C5620FDED12800529849 /* cdrom.c */; }; + 71F4C58C0FDED12800529849 /* cdrom.h in Headers */ = {isa = PBXBuildFile; fileRef = 71F4C5630FDED12800529849 /* cdrom.h */; }; + 71F4C58D0FDED12800529849 /* cheat.c in Sources */ = {isa = PBXBuildFile; fileRef = 71F4C5640FDED12800529849 /* cheat.c */; }; + 71F4C58E0FDED12800529849 /* cheat.h in Headers */ = {isa = PBXBuildFile; fileRef = 71F4C5650FDED12800529849 /* cheat.h */; }; + 71F4C58F0FDED12800529849 /* coff.h in Headers */ = {isa = PBXBuildFile; fileRef = 71F4C5660FDED12800529849 /* coff.h */; }; + 71F4C5900FDED12800529849 /* debug.h in Headers */ = {isa = PBXBuildFile; fileRef = 71F4C5670FDED12800529849 /* debug.h */; }; + 71F4C5910FDED12800529849 /* decode_xa.c in Sources */ = {isa = PBXBuildFile; fileRef = 71F4C5680FDED12800529849 /* decode_xa.c */; }; + 71F4C5920FDED12800529849 /* decode_xa.h in Headers */ = {isa = PBXBuildFile; fileRef = 71F4C5690FDED12800529849 /* decode_xa.h */; }; + 71F4C5930FDED12800529849 /* disr3000a.c in Sources */ = {isa = PBXBuildFile; fileRef = 71F4C56A0FDED12800529849 /* disr3000a.c */; }; + 71F4C5940FDED12800529849 /* gte.c in Sources */ = {isa = PBXBuildFile; fileRef = 71F4C56B0FDED12800529849 /* gte.c */; }; + 71F4C5950FDED12800529849 /* gte.h in Headers */ = {isa = PBXBuildFile; fileRef = 71F4C56C0FDED12800529849 /* gte.h */; }; + 71F4C5960FDED12800529849 /* mdec.c in Sources */ = {isa = PBXBuildFile; fileRef = 71F4C56D0FDED12800529849 /* mdec.c */; }; + 71F4C5970FDED12800529849 /* mdec.h in Headers */ = {isa = PBXBuildFile; fileRef = 71F4C56E0FDED12800529849 /* mdec.h */; }; + 71F4C5980FDED12800529849 /* misc.c in Sources */ = {isa = PBXBuildFile; fileRef = 71F4C56F0FDED12800529849 /* misc.c */; }; + 71F4C5990FDED12800529849 /* misc.h in Headers */ = {isa = PBXBuildFile; fileRef = 71F4C5700FDED12800529849 /* misc.h */; }; + 71F4C59A0FDED12800529849 /* plugins.c in Sources */ = {isa = PBXBuildFile; fileRef = 71F4C5710FDED12800529849 /* plugins.c */; }; + 71F4C59B0FDED12800529849 /* plugins.h in Headers */ = {isa = PBXBuildFile; fileRef = 71F4C5720FDED12800529849 /* plugins.h */; }; + 71F4C59C0FDED12800529849 /* psemu_plugin_defs.h in Headers */ = {isa = PBXBuildFile; fileRef = 71F4C5730FDED12800529849 /* psemu_plugin_defs.h */; }; + 71F4C59D0FDED12800529849 /* psxbios.c in Sources */ = {isa = PBXBuildFile; fileRef = 71F4C5740FDED12800529849 /* psxbios.c */; }; + 71F4C59E0FDED12800529849 /* psxbios.h in Headers */ = {isa = PBXBuildFile; fileRef = 71F4C5750FDED12800529849 /* psxbios.h */; }; + 71F4C59F0FDED12800529849 /* psxcommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 71F4C5760FDED12800529849 /* psxcommon.h */; }; + 71F4C5A00FDED12800529849 /* psxcounters.c in Sources */ = {isa = PBXBuildFile; fileRef = 71F4C5770FDED12800529849 /* psxcounters.c */; }; + 71F4C5A10FDED12800529849 /* psxcounters.h in Headers */ = {isa = PBXBuildFile; fileRef = 71F4C5780FDED12800529849 /* psxcounters.h */; }; + 71F4C5A20FDED12800529849 /* psxdma.c in Sources */ = {isa = PBXBuildFile; fileRef = 71F4C5790FDED12800529849 /* psxdma.c */; }; + 71F4C5A30FDED12800529849 /* psxdma.h in Headers */ = {isa = PBXBuildFile; fileRef = 71F4C57A0FDED12800529849 /* psxdma.h */; }; + 71F4C5A40FDED12800529849 /* psxhle.c in Sources */ = {isa = PBXBuildFile; fileRef = 71F4C57B0FDED12800529849 /* psxhle.c */; }; + 71F4C5A50FDED12800529849 /* psxhle.h in Headers */ = {isa = PBXBuildFile; fileRef = 71F4C57C0FDED12800529849 /* psxhle.h */; }; + 71F4C5A60FDED12800529849 /* psxhw.c in Sources */ = {isa = PBXBuildFile; fileRef = 71F4C57D0FDED12800529849 /* psxhw.c */; }; + 71F4C5A70FDED12800529849 /* psxhw.h in Headers */ = {isa = PBXBuildFile; fileRef = 71F4C57E0FDED12800529849 /* psxhw.h */; }; + 71F4C5A80FDED12800529849 /* psxinterpreter.c in Sources */ = {isa = PBXBuildFile; fileRef = 71F4C57F0FDED12800529849 /* psxinterpreter.c */; }; + 71F4C5A90FDED12800529849 /* psxmem.c in Sources */ = {isa = PBXBuildFile; fileRef = 71F4C5800FDED12800529849 /* psxmem.c */; }; + 71F4C5AA0FDED12800529849 /* psxmem.h in Headers */ = {isa = PBXBuildFile; fileRef = 71F4C5810FDED12800529849 /* psxmem.h */; }; + 71F4C5AB0FDED12800529849 /* r3000a.c in Sources */ = {isa = PBXBuildFile; fileRef = 71F4C5820FDED12800529849 /* r3000a.c */; }; + 71F4C5AC0FDED12800529849 /* r3000a.h in Headers */ = {isa = PBXBuildFile; fileRef = 71F4C5830FDED12800529849 /* r3000a.h */; }; + 71F4C5AD0FDED12800529849 /* sio.c in Sources */ = {isa = PBXBuildFile; fileRef = 71F4C5840FDED12800529849 /* sio.c */; }; + 71F4C5AE0FDED12800529849 /* sio.h in Headers */ = {isa = PBXBuildFile; fileRef = 71F4C5850FDED12800529849 /* sio.h */; }; + 71F4C5AF0FDED12800529849 /* spu.c in Sources */ = {isa = PBXBuildFile; fileRef = 71F4C5860FDED12800529849 /* spu.c */; }; + 71F4C5B00FDED12800529849 /* spu.h in Headers */ = {isa = PBXBuildFile; fileRef = 71F4C5870FDED12800529849 /* spu.h */; }; + 71F4C5B10FDED12800529849 /* system.h in Headers */ = {isa = PBXBuildFile; fileRef = 71F4C5880FDED12800529849 /* system.h */; }; + 71F4C5B80FDED16D00529849 /* iGte.h in Headers */ = {isa = PBXBuildFile; fileRef = 71F4C5B40FDED16D00529849 /* iGte.h */; }; + 71F4C5B90FDED16D00529849 /* iR3000A.c in Sources */ = {isa = PBXBuildFile; fileRef = 71F4C5B50FDED16D00529849 /* iR3000A.c */; }; + 71F4C5BA0FDED16D00529849 /* ix86.c in Sources */ = {isa = PBXBuildFile; fileRef = 71F4C5B60FDED16D00529849 /* ix86.c */; }; + 71F4C5BB0FDED16D00529849 /* ix86.h in Headers */ = {isa = PBXBuildFile; fileRef = 71F4C5B70FDED16D00529849 /* ix86.h */; }; +/* End PBXBuildFile section */ + +/* Begin PBXBuildRule section */ + 2BB3D6D005427FE200831ACB /* PBXBuildRule */ = { + isa = PBXBuildRule; + compilerSpec = com.apple.compilers.gcc; + fileType = sourcecode.c; + isEditable = 1; + outputFiles = ( + ); + }; + 2BD707B705559AE300CB5D9B /* PBXBuildRule */ = { + isa = PBXBuildRule; + compilerSpec = com.apple.compilers.gcc; + filePatterns = pasm.s; + fileType = sourcecode.asm; + isEditable = 1; + outputFiles = ( + "$(DERIVED_FILES_DIR)/$(INPUT_FILE_BASE).o", + ); + script = "as -o $(DERIVED_FILES_DIR)/$(INPUT_FILE_BASE).o $(INPUT_FILE_PATH)"; + }; +/* End PBXBuildRule section */ + +/* Begin PBXFileReference section */ + 2B02C04304E145D000880C5B /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; }; + 2B143D01078A2CBD00AF745A /* PCSX.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = PCSX.icns; sourceTree = "<group>"; }; + 2B143D02078A2CBD00AF745A /* pcsxfreeze.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = pcsxfreeze.icns; sourceTree = "<group>"; }; + 2B143D03078A2CBD00AF745A /* pcsxmemcard.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = pcsxmemcard.icns; sourceTree = "<group>"; }; + 2B143D04078A2CBD00AF745A /* psxbios.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = psxbios.icns; sourceTree = "<group>"; }; + 2B143D05078A2CBD00AF745A /* psxplugin.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = psxplugin.icns; sourceTree = "<group>"; }; + 2B2189D204D96C7A00179945 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; }; + 2B3E356A06937D1C00763C7D /* PcsxPluginDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PcsxPluginDocument.h; sourceTree = "<group>"; }; + 2B3E356B06937D1C00763C7D /* PcsxPluginDocument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PcsxPluginDocument.m; sourceTree = "<group>"; }; + 2B3E35BB069384D100763C7D /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = AddPluginSheet.nib; sourceTree = "<group>"; }; + 2B4DE98D05FF9307003EFEF0 /* PluginController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PluginController.h; sourceTree = "<group>"; }; + 2B4DE98E05FF9307003EFEF0 /* PluginController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = PluginController.m; sourceTree = "<group>"; }; + 2B690C760635C65C00CDA575 /* ExceptionHandling.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ExceptionHandling.framework; path = /System/Library/Frameworks/ExceptionHandling.framework; sourceTree = "<absolute>"; }; + 2B6E8AAE04C832040017A3B1 /* System.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = System.framework; path = /System/Library/Frameworks/System.framework; sourceTree = "<absolute>"; }; + 2B6E8AB404C8327C0017A3B1 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = "<absolute>"; }; + 2B75FD3C051C56D200D12034 /* PcsxController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PcsxController.h; sourceTree = "<group>"; }; + 2B75FD3D051C56D200D12034 /* PcsxController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = PcsxController.m; sourceTree = "<group>"; }; + 2B75FD4A051C8A7400D12034 /* ConfigurationController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ConfigurationController.h; sourceTree = "<group>"; }; + 2B75FD4B051C8A7400D12034 /* ConfigurationController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = ConfigurationController.m; sourceTree = "<group>"; }; + 2B976C00074C14B4007C050A /* Kernel.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Kernel.framework; path = /System/Library/Frameworks/Kernel.framework; sourceTree = "<absolute>"; }; + 2BA178A505148D9D0026D74D /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; + 2BA178B10514CE260026D74D /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = Configuration.nib; sourceTree = "<group>"; }; + 2BA178B30514CE260026D74D /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = InfoPlist.strings; sourceTree = "<group>"; }; + 2BA178B50514CE260026D74D /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = PCSX.nib; sourceTree = "<group>"; }; + 2BA44360052DB2EA00E21DDD /* PcsxPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PcsxPlugin.h; sourceTree = "<group>"; }; + 2BA44361052DB2EA00E21DDD /* PcsxPlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = PcsxPlugin.m; sourceTree = "<group>"; tabWidth = 4; usesTabs = 0; }; + 2BB3D6CF05427FE200831ACB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; }; + 2BB3D6D105427FE200831ACB /* PCSX.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PCSX.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 2BBB1126051DC00500B84448 /* PluginList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginList.h; sourceTree = "<group>"; }; + 2BBB1127051DC00500B84448 /* PluginList.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PluginList.m; sourceTree = "<group>"; }; + 2BBB1787051E0D9700B84448 /* English */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = English; path = Credits.rtf; sourceTree = "<group>"; }; + 2BBB1791051E113B00B84448 /* EmuThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EmuThread.h; sourceTree = "<group>"; }; + 2BBB1792051E113B00B84448 /* EmuThread.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EmuThread.m; sourceTree = "<group>"; }; + 2BBB17DA051E4D0F00B84448 /* Plugin.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = Plugin.c; sourceTree = SOURCE_ROOT; }; + 2BC4786204C7FD3600CAB520 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; }; + 7161C2810FDED6D000225F97 /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; }; + 7161C2970FDED75300225F97 /* ExtendedKeys.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExtendedKeys.h; sourceTree = "<group>"; }; + 71F4C5600FDED12800529849 /* cdriso.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cdriso.c; path = ../libpcsxcore/cdriso.c; sourceTree = SOURCE_ROOT; }; + 71F4C5610FDED12800529849 /* cdriso.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cdriso.h; path = ../libpcsxcore/cdriso.h; sourceTree = SOURCE_ROOT; }; + 71F4C5620FDED12800529849 /* cdrom.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cdrom.c; path = ../libpcsxcore/cdrom.c; sourceTree = SOURCE_ROOT; }; + 71F4C5630FDED12800529849 /* cdrom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cdrom.h; path = ../libpcsxcore/cdrom.h; sourceTree = SOURCE_ROOT; }; + 71F4C5640FDED12800529849 /* cheat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cheat.c; path = ../libpcsxcore/cheat.c; sourceTree = SOURCE_ROOT; }; + 71F4C5650FDED12800529849 /* cheat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cheat.h; path = ../libpcsxcore/cheat.h; sourceTree = SOURCE_ROOT; }; + 71F4C5660FDED12800529849 /* coff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = coff.h; path = ../libpcsxcore/coff.h; sourceTree = SOURCE_ROOT; }; + 71F4C5670FDED12800529849 /* debug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = debug.h; path = ../libpcsxcore/debug.h; sourceTree = SOURCE_ROOT; }; + 71F4C5680FDED12800529849 /* decode_xa.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = decode_xa.c; path = ../libpcsxcore/decode_xa.c; sourceTree = SOURCE_ROOT; }; + 71F4C5690FDED12800529849 /* decode_xa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = decode_xa.h; path = ../libpcsxcore/decode_xa.h; sourceTree = SOURCE_ROOT; }; + 71F4C56A0FDED12800529849 /* disr3000a.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = disr3000a.c; path = ../libpcsxcore/disr3000a.c; sourceTree = SOURCE_ROOT; }; + 71F4C56B0FDED12800529849 /* gte.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = gte.c; path = ../libpcsxcore/gte.c; sourceTree = SOURCE_ROOT; }; + 71F4C56C0FDED12800529849 /* gte.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = gte.h; path = ../libpcsxcore/gte.h; sourceTree = SOURCE_ROOT; }; + 71F4C56D0FDED12800529849 /* mdec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mdec.c; path = ../libpcsxcore/mdec.c; sourceTree = SOURCE_ROOT; }; + 71F4C56E0FDED12800529849 /* mdec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mdec.h; path = ../libpcsxcore/mdec.h; sourceTree = SOURCE_ROOT; }; + 71F4C56F0FDED12800529849 /* misc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = misc.c; path = ../libpcsxcore/misc.c; sourceTree = SOURCE_ROOT; }; + 71F4C5700FDED12800529849 /* misc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = misc.h; path = ../libpcsxcore/misc.h; sourceTree = SOURCE_ROOT; }; + 71F4C5710FDED12800529849 /* plugins.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = plugins.c; path = ../libpcsxcore/plugins.c; sourceTree = SOURCE_ROOT; }; + 71F4C5720FDED12800529849 /* plugins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = plugins.h; path = ../libpcsxcore/plugins.h; sourceTree = SOURCE_ROOT; }; + 71F4C5730FDED12800529849 /* psemu_plugin_defs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = psemu_plugin_defs.h; path = ../libpcsxcore/psemu_plugin_defs.h; sourceTree = SOURCE_ROOT; }; + 71F4C5740FDED12800529849 /* psxbios.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = psxbios.c; path = ../libpcsxcore/psxbios.c; sourceTree = SOURCE_ROOT; }; + 71F4C5750FDED12800529849 /* psxbios.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = psxbios.h; path = ../libpcsxcore/psxbios.h; sourceTree = SOURCE_ROOT; }; + 71F4C5760FDED12800529849 /* psxcommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = psxcommon.h; path = ../libpcsxcore/psxcommon.h; sourceTree = SOURCE_ROOT; }; + 71F4C5770FDED12800529849 /* psxcounters.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = psxcounters.c; path = ../libpcsxcore/psxcounters.c; sourceTree = SOURCE_ROOT; }; + 71F4C5780FDED12800529849 /* psxcounters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = psxcounters.h; path = ../libpcsxcore/psxcounters.h; sourceTree = SOURCE_ROOT; }; + 71F4C5790FDED12800529849 /* psxdma.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = psxdma.c; path = ../libpcsxcore/psxdma.c; sourceTree = SOURCE_ROOT; }; + 71F4C57A0FDED12800529849 /* psxdma.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = psxdma.h; path = ../libpcsxcore/psxdma.h; sourceTree = SOURCE_ROOT; }; + 71F4C57B0FDED12800529849 /* psxhle.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = psxhle.c; path = ../libpcsxcore/psxhle.c; sourceTree = SOURCE_ROOT; }; + 71F4C57C0FDED12800529849 /* psxhle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = psxhle.h; path = ../libpcsxcore/psxhle.h; sourceTree = SOURCE_ROOT; }; + 71F4C57D0FDED12800529849 /* psxhw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = psxhw.c; path = ../libpcsxcore/psxhw.c; sourceTree = SOURCE_ROOT; }; + 71F4C57E0FDED12800529849 /* psxhw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = psxhw.h; path = ../libpcsxcore/psxhw.h; sourceTree = SOURCE_ROOT; }; + 71F4C57F0FDED12800529849 /* psxinterpreter.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = psxinterpreter.c; path = ../libpcsxcore/psxinterpreter.c; sourceTree = SOURCE_ROOT; }; + 71F4C5800FDED12800529849 /* psxmem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = psxmem.c; path = ../libpcsxcore/psxmem.c; sourceTree = SOURCE_ROOT; }; + 71F4C5810FDED12800529849 /* psxmem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = psxmem.h; path = ../libpcsxcore/psxmem.h; sourceTree = SOURCE_ROOT; }; + 71F4C5820FDED12800529849 /* r3000a.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = r3000a.c; path = ../libpcsxcore/r3000a.c; sourceTree = SOURCE_ROOT; }; + 71F4C5830FDED12800529849 /* r3000a.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = r3000a.h; path = ../libpcsxcore/r3000a.h; sourceTree = SOURCE_ROOT; }; + 71F4C5840FDED12800529849 /* sio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sio.c; path = ../libpcsxcore/sio.c; sourceTree = SOURCE_ROOT; }; + 71F4C5850FDED12800529849 /* sio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sio.h; path = ../libpcsxcore/sio.h; sourceTree = SOURCE_ROOT; }; + 71F4C5860FDED12800529849 /* spu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = spu.c; path = ../libpcsxcore/spu.c; sourceTree = SOURCE_ROOT; }; + 71F4C5870FDED12800529849 /* spu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = spu.h; path = ../libpcsxcore/spu.h; sourceTree = SOURCE_ROOT; }; + 71F4C5880FDED12800529849 /* system.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = system.h; path = ../libpcsxcore/system.h; sourceTree = SOURCE_ROOT; }; + 71F4C5B40FDED16D00529849 /* iGte.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = iGte.h; path = ../libpcsxcore/ix86/iGte.h; sourceTree = SOURCE_ROOT; }; + 71F4C5B50FDED16D00529849 /* iR3000A.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = iR3000A.c; path = ../libpcsxcore/ix86/iR3000A.c; sourceTree = SOURCE_ROOT; }; + 71F4C5B60FDED16D00529849 /* ix86.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ix86.c; path = ../libpcsxcore/ix86/ix86.c; sourceTree = SOURCE_ROOT; }; + 71F4C5B70FDED16D00529849 /* ix86.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ix86.h; path = ../libpcsxcore/ix86/ix86.h; sourceTree = SOURCE_ROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 2BB3D6C505427FE200831ACB /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 2BB3D6C605427FE200831ACB /* Cocoa.framework in Frameworks */, + 2BB3D6C705427FE200831ACB /* System.framework in Frameworks */, + 2BB3D6C805427FE200831ACB /* IOKit.framework in Frameworks */, + 2B400D910789F58A00BA271E /* Carbon.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 0249A662FF388D9811CA2CEA /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + 2B976C00074C14B4007C050A /* Kernel.framework */, + 2B02C04304E145D000880C5B /* Carbon.framework */, + 2BC4786204C7FD3600CAB520 /* Cocoa.framework */, + 2B6E8AAE04C832040017A3B1 /* System.framework */, + 2B6E8AB404C8327C0017A3B1 /* IOKit.framework */, + 2B2189D204D96C7A00179945 /* CoreFoundation.framework */, + 2B690C760635C65C00CDA575 /* ExceptionHandling.framework */, + ); + name = "External Frameworks and Libraries"; + sourceTree = "<group>"; + }; + 08FB7794FE84155DC02AAC07 /* Pcsx */ = { + isa = PBXGroup; + children = ( + 08FB7795FE84155DC02AAC07 /* Source */, + 0249A662FF388D9811CA2CEA /* External Frameworks and Libraries */, + 1AB674ADFE9D54B511CA2CBB /* Products */, + 2BB3D6CF05427FE200831ACB /* Info.plist */, + ); + name = Pcsx; + sourceTree = "<group>"; + }; + 08FB7795FE84155DC02AAC07 /* Source */ = { + isa = PBXGroup; + children = ( + 2BCE23B204C6B52C007C2DA3 /* libpcsxcore */, + 2BC4787804C7FDBD00CAB520 /* MacOSX */, + ); + name = Source; + sourceTree = "<group>"; + }; + 1AB674ADFE9D54B511CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 2BBD6C1D04C893F500A83E33 /* Plugin */, + 2BB3D6D105427FE200831ACB /* PCSX.app */, + ); + name = Products; + sourceTree = "<group>"; + }; + 2B143D00078A2CBD00AF745A /* icons */ = { + isa = PBXGroup; + children = ( + 2B143D01078A2CBD00AF745A /* PCSX.icns */, + 2B143D02078A2CBD00AF745A /* pcsxfreeze.icns */, + 2B143D03078A2CBD00AF745A /* pcsxmemcard.icns */, + 2B143D04078A2CBD00AF745A /* psxbios.icns */, + 2B143D05078A2CBD00AF745A /* psxplugin.icns */, + ); + path = icons; + sourceTree = "<group>"; + }; + 2BA178AD0514CE260026D74D /* English.lproj */ = { + isa = PBXGroup; + children = ( + 2BBB1786051E0D9700B84448 /* Credits.rtf */, + 2BA178B00514CE260026D74D /* Configuration.nib */, + 2BA178B20514CE260026D74D /* InfoPlist.strings */, + 2BA178B40514CE260026D74D /* PCSX.nib */, + 2B3E35BA069384D100763C7D /* AddPluginSheet.nib */, + ); + path = English.lproj; + sourceTree = "<group>"; + }; + 2BBD6C1D04C893F500A83E33 /* Plugin */ = { + isa = PBXGroup; + children = ( + ); + name = Plugin; + sourceTree = "<group>"; + }; + 2BC4787804C7FDBD00CAB520 /* MacOSX */ = { + isa = PBXGroup; + children = ( + 2BA178AD0514CE260026D74D /* English.lproj */, + 2B143D00078A2CBD00AF745A /* icons */, + 7161C2810FDED6D000225F97 /* config.h */, + 2BA178A505148D9D0026D74D /* main.m */, + 2BBB17DA051E4D0F00B84448 /* Plugin.c */, + 2B75FD3C051C56D200D12034 /* PcsxController.h */, + 2B75FD3D051C56D200D12034 /* PcsxController.m */, + 2B75FD4A051C8A7400D12034 /* ConfigurationController.h */, + 2B75FD4B051C8A7400D12034 /* ConfigurationController.m */, + 2B4DE98D05FF9307003EFEF0 /* PluginController.h */, + 2B4DE98E05FF9307003EFEF0 /* PluginController.m */, + 2BBB1791051E113B00B84448 /* EmuThread.h */, + 2BBB1792051E113B00B84448 /* EmuThread.m */, + 7161C2970FDED75300225F97 /* ExtendedKeys.h */, + 2BBB1126051DC00500B84448 /* PluginList.h */, + 2BBB1127051DC00500B84448 /* PluginList.m */, + 2BA44360052DB2EA00E21DDD /* PcsxPlugin.h */, + 2BA44361052DB2EA00E21DDD /* PcsxPlugin.m */, + 2B3E356A06937D1C00763C7D /* PcsxPluginDocument.h */, + 2B3E356B06937D1C00763C7D /* PcsxPluginDocument.m */, + ); + name = MacOSX; + sourceTree = "<group>"; + }; + 2BCE23B204C6B52C007C2DA3 /* libpcsxcore */ = { + isa = PBXGroup; + children = ( + 71F4C5B30FDED15800529849 /* ix86 */, + 71F4C5600FDED12800529849 /* cdriso.c */, + 71F4C5610FDED12800529849 /* cdriso.h */, + 71F4C5620FDED12800529849 /* cdrom.c */, + 71F4C5630FDED12800529849 /* cdrom.h */, + 71F4C5640FDED12800529849 /* cheat.c */, + 71F4C5650FDED12800529849 /* cheat.h */, + 71F4C5660FDED12800529849 /* coff.h */, + 71F4C5670FDED12800529849 /* debug.h */, + 71F4C5680FDED12800529849 /* decode_xa.c */, + 71F4C5690FDED12800529849 /* decode_xa.h */, + 71F4C56A0FDED12800529849 /* disr3000a.c */, + 71F4C56B0FDED12800529849 /* gte.c */, + 71F4C56C0FDED12800529849 /* gte.h */, + 71F4C56D0FDED12800529849 /* mdec.c */, + 71F4C56E0FDED12800529849 /* mdec.h */, + 71F4C56F0FDED12800529849 /* misc.c */, + 71F4C5700FDED12800529849 /* misc.h */, + 71F4C5710FDED12800529849 /* plugins.c */, + 71F4C5720FDED12800529849 /* plugins.h */, + 71F4C5730FDED12800529849 /* psemu_plugin_defs.h */, + 71F4C5740FDED12800529849 /* psxbios.c */, + 71F4C5750FDED12800529849 /* psxbios.h */, + 71F4C5760FDED12800529849 /* psxcommon.h */, + 71F4C5770FDED12800529849 /* psxcounters.c */, + 71F4C5780FDED12800529849 /* psxcounters.h */, + 71F4C5790FDED12800529849 /* psxdma.c */, + 71F4C57A0FDED12800529849 /* psxdma.h */, + 71F4C57B0FDED12800529849 /* psxhle.c */, + 71F4C57C0FDED12800529849 /* psxhle.h */, + 71F4C57D0FDED12800529849 /* psxhw.c */, + 71F4C57E0FDED12800529849 /* psxhw.h */, + 71F4C57F0FDED12800529849 /* psxinterpreter.c */, + 71F4C5800FDED12800529849 /* psxmem.c */, + 71F4C5810FDED12800529849 /* psxmem.h */, + 71F4C5820FDED12800529849 /* r3000a.c */, + 71F4C5830FDED12800529849 /* r3000a.h */, + 71F4C5840FDED12800529849 /* sio.c */, + 71F4C5850FDED12800529849 /* sio.h */, + 71F4C5860FDED12800529849 /* spu.c */, + 71F4C5870FDED12800529849 /* spu.h */, + 71F4C5880FDED12800529849 /* system.h */, + ); + name = libpcsxcore; + sourceTree = "<group>"; + }; + 71F4C5B30FDED15800529849 /* ix86 */ = { + isa = PBXGroup; + children = ( + 71F4C5B40FDED16D00529849 /* iGte.h */, + 71F4C5B50FDED16D00529849 /* iR3000A.c */, + 71F4C5B60FDED16D00529849 /* ix86.c */, + 71F4C5B70FDED16D00529849 /* ix86.h */, + ); + name = ix86; + sourceTree = "<group>"; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 2BB3D68305427FE200831ACB /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 2BB3D69D05427FE200831ACB /* PcsxController.h in Headers */, + 2BB3D69E05427FE200831ACB /* ConfigurationController.h in Headers */, + 2BB3D69F05427FE200831ACB /* PluginList.h in Headers */, + 2BB3D6A005427FE200831ACB /* EmuThread.h in Headers */, + 2BB3D6A105427FE200831ACB /* PcsxPlugin.h in Headers */, + 2B4DE99105FF9307003EFEF0 /* PluginController.h in Headers */, + 2B3E356C06937D1C00763C7D /* PcsxPluginDocument.h in Headers */, + 71F4C58A0FDED12800529849 /* cdriso.h in Headers */, + 71F4C58C0FDED12800529849 /* cdrom.h in Headers */, + 71F4C58E0FDED12800529849 /* cheat.h in Headers */, + 71F4C58F0FDED12800529849 /* coff.h in Headers */, + 71F4C5900FDED12800529849 /* debug.h in Headers */, + 71F4C5920FDED12800529849 /* decode_xa.h in Headers */, + 71F4C5950FDED12800529849 /* gte.h in Headers */, + 71F4C5970FDED12800529849 /* mdec.h in Headers */, + 71F4C5990FDED12800529849 /* misc.h in Headers */, + 71F4C59B0FDED12800529849 /* plugins.h in Headers */, + 71F4C59C0FDED12800529849 /* psemu_plugin_defs.h in Headers */, + 71F4C59E0FDED12800529849 /* psxbios.h in Headers */, + 71F4C59F0FDED12800529849 /* psxcommon.h in Headers */, + 71F4C5A10FDED12800529849 /* psxcounters.h in Headers */, + 71F4C5A30FDED12800529849 /* psxdma.h in Headers */, + 71F4C5A50FDED12800529849 /* psxhle.h in Headers */, + 71F4C5A70FDED12800529849 /* psxhw.h in Headers */, + 71F4C5AA0FDED12800529849 /* psxmem.h in Headers */, + 71F4C5AC0FDED12800529849 /* r3000a.h in Headers */, + 71F4C5AE0FDED12800529849 /* sio.h in Headers */, + 71F4C5B00FDED12800529849 /* spu.h in Headers */, + 71F4C5B10FDED12800529849 /* system.h in Headers */, + 71F4C5B80FDED16D00529849 /* iGte.h in Headers */, + 71F4C5BB0FDED16D00529849 /* ix86.h in Headers */, + 7161C2820FDED6D000225F97 /* config.h in Headers */, + 7161C2980FDED75300225F97 /* ExtendedKeys.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 2BB3D68205427FE200831ACB /* PCSX */ = { + isa = PBXNativeTarget; + buildConfigurationList = 71F353F30FD98DFE00CBEC28 /* Build configuration list for PBXNativeTarget "PCSX" */; + buildPhases = ( + 2BB3D68305427FE200831ACB /* Headers */, + 2BB3D6A205427FE200831ACB /* Resources */, + 2BB3D6A805427FE200831ACB /* Sources */, + 2BB3D6C505427FE200831ACB /* Frameworks */, + 2BB3D6CD05427FE200831ACB /* Rez */, + ); + buildRules = ( + 2BD707B705559AE300CB5D9B /* PBXBuildRule */, + 2BB3D6D005427FE200831ACB /* PBXBuildRule */, + ); + dependencies = ( + ); + name = PCSX; + productInstallPath = "$(USER_APPS_DIR)"; + productName = "Pcsx-MacOSX"; + productReference = 2BB3D6D105427FE200831ACB /* PCSX.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 08FB7793FE84155DC02AAC07 /* Project object */ = { + isa = PBXProject; + buildConfigurationList = 71F353F80FD98DFE00CBEC28 /* Build configuration list for PBXProject "Pcsx" */; + hasScannedForEncodings = 1; + mainGroup = 08FB7794FE84155DC02AAC07 /* Pcsx */; + projectDirPath = ""; + targets = ( + 2BB3D68205427FE200831ACB /* PCSX */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 2BB3D6A205427FE200831ACB /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2BB3D6A305427FE200831ACB /* Configuration.nib in Resources */, + 2BB3D6A405427FE200831ACB /* InfoPlist.strings in Resources */, + 2BB3D6A505427FE200831ACB /* PCSX.nib in Resources */, + 2BB3D6A705427FE200831ACB /* Credits.rtf in Resources */, + 2B3E35BC069384D100763C7D /* AddPluginSheet.nib in Resources */, + 2B143D06078A2CBD00AF745A /* PCSX.icns in Resources */, + 2B143D07078A2CBD00AF745A /* pcsxfreeze.icns in Resources */, + 2B143D08078A2CBD00AF745A /* pcsxmemcard.icns in Resources */, + 2B143D09078A2CBD00AF745A /* psxbios.icns in Resources */, + 2B143D0A078A2CBD00AF745A /* psxplugin.icns in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXRezBuildPhase section */ + 2BB3D6CD05427FE200831ACB /* Rez */ = { + isa = PBXRezBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXRezBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 2BB3D6A805427FE200831ACB /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2BB3D6BE05427FE200831ACB /* main.m in Sources */, + 2BB3D6BF05427FE200831ACB /* PcsxController.m in Sources */, + 2BB3D6C005427FE200831ACB /* ConfigurationController.m in Sources */, + 2BB3D6C105427FE200831ACB /* PluginList.m in Sources */, + 2BB3D6C205427FE200831ACB /* EmuThread.m in Sources */, + 2BB3D6C305427FE200831ACB /* Plugin.c in Sources */, + 2BB3D6C405427FE200831ACB /* PcsxPlugin.m in Sources */, + 2B4DE99205FF9307003EFEF0 /* PluginController.m in Sources */, + 2B3E356D06937D1C00763C7D /* PcsxPluginDocument.m in Sources */, + 71F4C5890FDED12800529849 /* cdriso.c in Sources */, + 71F4C58B0FDED12800529849 /* cdrom.c in Sources */, + 71F4C58D0FDED12800529849 /* cheat.c in Sources */, + 71F4C5910FDED12800529849 /* decode_xa.c in Sources */, + 71F4C5930FDED12800529849 /* disr3000a.c in Sources */, + 71F4C5940FDED12800529849 /* gte.c in Sources */, + 71F4C5960FDED12800529849 /* mdec.c in Sources */, + 71F4C5980FDED12800529849 /* misc.c in Sources */, + 71F4C59A0FDED12800529849 /* plugins.c in Sources */, + 71F4C59D0FDED12800529849 /* psxbios.c in Sources */, + 71F4C5A00FDED12800529849 /* psxcounters.c in Sources */, + 71F4C5A20FDED12800529849 /* psxdma.c in Sources */, + 71F4C5A40FDED12800529849 /* psxhle.c in Sources */, + 71F4C5A60FDED12800529849 /* psxhw.c in Sources */, + 71F4C5A80FDED12800529849 /* psxinterpreter.c in Sources */, + 71F4C5A90FDED12800529849 /* psxmem.c in Sources */, + 71F4C5AB0FDED12800529849 /* r3000a.c in Sources */, + 71F4C5AD0FDED12800529849 /* sio.c in Sources */, + 71F4C5AF0FDED12800529849 /* spu.c in Sources */, + 71F4C5B90FDED16D00529849 /* iR3000A.c in Sources */, + 71F4C5BA0FDED16D00529849 /* ix86.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 2B3E35BA069384D100763C7D /* AddPluginSheet.nib */ = { + isa = PBXVariantGroup; + children = ( + 2B3E35BB069384D100763C7D /* English */, + ); + name = AddPluginSheet.nib; + sourceTree = "<group>"; + }; + 2BA178B00514CE260026D74D /* Configuration.nib */ = { + isa = PBXVariantGroup; + children = ( + 2BA178B10514CE260026D74D /* English */, + ); + name = Configuration.nib; + sourceTree = "<group>"; + }; + 2BA178B20514CE260026D74D /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 2BA178B30514CE260026D74D /* English */, + ); + name = InfoPlist.strings; + sourceTree = "<group>"; + }; + 2BA178B40514CE260026D74D /* PCSX.nib */ = { + isa = PBXVariantGroup; + children = ( + 2BA178B50514CE260026D74D /* English */, + ); + name = PCSX.nib; + sourceTree = "<group>"; + }; + 2BBB1786051E0D9700B84448 /* Credits.rtf */ = { + isa = PBXVariantGroup; + children = ( + 2BBB1787051E0D9700B84448 /* English */, + ); + name = Credits.rtf; + sourceTree = "<group>"; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 71F353F40FD98DFE00CBEC28 /* Development */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + DEBUGGING_SYMBOLS = YES; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_ASM_KEYWORD = YES; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_MODEL_CPU = G3; + GCC_MODEL_TUNING = G3; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_1)", + __MACOSX__, + ); + GCC_PREPROCESSOR_DEFINITIONS_QUOTED_1 = "PCSX_VERSION=\\\"1.5\\\""; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; + GCC_WARN_UNKNOWN_PRAGMAS = NO; + INFOPLIST_FILE = Info.plist; + OTHER_CFLAGS = ( + "-fomit-frame-pointer", + "-funroll-loops", + "-falign-loops=16", + ); + OTHER_REZFLAGS = ""; + PRODUCT_NAME = PCSX; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = "-Wmost"; + WRAPPER_EXTENSION = app; + ZERO_LINK = NO; + }; + name = Development; + }; + 71F353F50FD98DFE00CBEC28 /* Deployment */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + DEBUGGING_SYMBOLS = NO; + GCC_DYNAMIC_NO_PIC = YES; + GCC_ENABLE_ASM_KEYWORD = YES; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_MODEL_CPU = G3; + GCC_MODEL_TUNING = G3; + GCC_OPTIMIZATION_LEVEL = 3; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_1)", + __MACOSX__, + ); + GCC_PREPROCESSOR_DEFINITIONS_QUOTED_1 = "PCSX_VERSION=\\\"1.5\\\""; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; + GCC_WARN_UNKNOWN_PRAGMAS = NO; + INFOPLIST_FILE = Info.plist; + OTHER_CFLAGS = ( + "-fomit-frame-pointer", + "-funroll-loops", + "-falign-loops=16", + ); + OTHER_REZFLAGS = ""; + PRODUCT_NAME = PCSX; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = "-Wmost"; + WRAPPER_EXTENSION = app; + ZERO_LINK = NO; + }; + name = Deployment; + }; + 71F353F90FD98DFE00CBEC28 /* Development */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = i386; + GCC_MODEL_TUNING = ""; + HEADER_SEARCH_PATHS = ( + ../include, + ../libpcsxcore, + ../macosx, + ); + OTHER_LDFLAGS = ( + "-lz", + "-lSystemStubs", + ); + }; + name = Development; + }; + 71F353FA0FD98DFE00CBEC28 /* Deployment */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = i386; + GCC_MODEL_TUNING = ""; + GCC_OPTIMIZATION_LEVEL = 2; + HEADER_SEARCH_PATHS = ( + ../include, + ../libpcsxcore, + ../macosx, + ); + OTHER_LDFLAGS = ( + "-lz", + "-lSystemStubs", + ); + }; + name = Deployment; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 71F353F30FD98DFE00CBEC28 /* Build configuration list for PBXNativeTarget "PCSX" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 71F353F40FD98DFE00CBEC28 /* Development */, + 71F353F50FD98DFE00CBEC28 /* Deployment */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Development; + }; + 71F353F80FD98DFE00CBEC28 /* Build configuration list for PBXProject "Pcsx" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 71F353F90FD98DFE00CBEC28 /* Development */, + 71F353FA0FD98DFE00CBEC28 /* Deployment */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Development; + }; +/* End XCConfigurationList section */ + }; + rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; +} diff --git a/macosx/PcsxController.h b/macosx/PcsxController.h new file mode 100644 index 00000000..1e83aa81 --- /dev/null +++ b/macosx/PcsxController.h @@ -0,0 +1,35 @@ +/* PcsxController */ + +#import <Cocoa/Cocoa.h> +#import "EmuThread.h" +#import "PluginList.h" + +@interface PcsxController : NSObject +{ + NSWindowController *preferencesController; + NSWindowController *memCardController; + PluginList *pluginList; + + IBOutlet NSWindow *memCardWindow; + IBOutlet NSWindow *preferenceWindow; + + BOOL sleepInBackground; + BOOL wasPausedBeforeBGSwitch; +} +- (IBAction)ejectCD:(id)sender; +- (IBAction)memCardConfig:(id)sender; +- (IBAction)pause:(id)sender; +- (IBAction)preferences:(id)sender; +- (IBAction)reset:(id)sender; +- (IBAction)runCD:(id)sender; +- (IBAction)runBios:(id)sender; +- (IBAction)runExe:(id)sender; +- (IBAction)freeze:(id)sender; +- (IBAction)defrost:(id)sender; +- (IBAction)fullscreen:(id)sender; + ++ (void)setConfigFromDefaults; ++ (void)setDefaultFromConfig:(NSString *)defaultKey; ++ (BOOL)biosAvailable; + +@end diff --git a/macosx/PcsxController.m b/macosx/PcsxController.m new file mode 100644 index 00000000..b1502761 --- /dev/null +++ b/macosx/PcsxController.m @@ -0,0 +1,387 @@ +#import <Cocoa/Cocoa.h> +#import "PcsxController.h" +#import "ConfigurationController.h" +#import "EmuThread.h" +#include "psxcommon.h" +#include "plugins.h" +#include "misc.h" +#include "ExtendedKeys.h" + +NSDictionary *prefStringKeys; +NSDictionary *prefLongKeys; +NSMutableArray *biosList; +NSString *saveStatePath; + +@implementation PcsxController + +- (IBAction)ejectCD:(id)sender +{ + NSMutableString *deviceName; + NSTask *ejectTask; + NSRange rdiskRange; + + BOOL wasPaused = [EmuThread pauseSafe]; + + /* close connection to current cd */ + if ([EmuThread active]) + CDR_close(); + + if (CDR_getDriveLetter() != nil) { + deviceName = [NSMutableString stringWithCString:CDR_getDriveLetter()]; + + // delete the 'r' in 'rdisk' + rdiskRange = [deviceName rangeOfString:@"rdisk"]; + if (rdiskRange.length != 0) { + rdiskRange.length = 1; + [deviceName deleteCharactersInRange:rdiskRange]; + } + // execute hdiutil to eject the device + ejectTask = [NSTask launchedTaskWithLaunchPath:@"/usr/bin/hdiutil" arguments:[NSArray arrayWithObjects:@"eject", deviceName, nil]]; + [ejectTask waitUntilExit]; + } + + /* and open new cd */ + if ([EmuThread active]) + CDR_open(); + + if (!wasPaused) { + [EmuThread resume]; + } +} + +- (IBAction)memCardConfig:(id)sender +{ + NSRunAlertPanel(NSLocalizedString(@"Unimplemented feature", nil), + NSLocalizedString(@"Configuration of memory cards has not yet been implemented, but will be available in the future.", nil), + nil, nil, nil); +} + +- (IBAction)pause:(id)sender +{ + if ([EmuThread isPaused]) { + //[sender setState:NSOffState]; + [EmuThread resume]; + } + else { + //[sender setState:NSOnState]; + [EmuThread pause]; + } +} + +- (IBAction)preferences:(id)sender +{ + /* load the nib if it hasn't yet */ + if (preferenceWindow == nil) { + if (preferencesController == nil) { + preferencesController = [[ConfigurationController alloc] initWithWindowNibName:@"Configuration"]; + } + preferenceWindow = [preferencesController window]; + } + + /* show the window */ + [preferenceWindow makeKeyAndOrderFront:self]; + [preferencesController showWindow:self]; +} + +- (IBAction)reset:(id)sender +{ + [EmuThread reset]; +} + +- (IBAction)runCD:(id)sender +{ +// LoadCdBios = 0; + [EmuThread run]; +} + +- (IBAction)runBios:(id)sender +{ +// LoadCdBios = 1; + [EmuThread run]; +} + +- (IBAction)runExe:(id)sender +{ +} + +- (IBAction)freeze:(id)sender +{ + int num = [sender tag]; + NSString *path = [NSString stringWithFormat:@"%@/%s-%3.3d.pcsxstate", saveStatePath, CdromId, num]; + + [EmuThread freezeAt:path which:num-1]; +} + +- (IBAction)defrost:(id)sender +{ + NSString *path = [NSString stringWithFormat:@"%@/%s-%3.3d.pcsxstate", saveStatePath, CdromId, [sender tag]]; + [EmuThread defrostAt:path]; +} + +- (IBAction)fullscreen:(id)sender +{ + GPU_keypressed(GPU_FULLSCREEN_KEY); +} + + +- (BOOL)validateMenuItem:(id <NSMenuItem>)menuItem +{ + if ([menuItem action] == @selector(pause:)) { + [menuItem setState:([EmuThread isPaused] ? NSOnState : NSOffState)]; + } else if ([menuItem action] == @selector(runBios:)) { + return [PcsxController biosAvailable]; + } + + if ([menuItem action] == @selector(reset:) || [menuItem action] == @selector(pause:) || + [menuItem action] == @selector(ejectCD:) || [menuItem action] == @selector(freeze:) || + [menuItem action] == @selector(fullscreen:)) + return [EmuThread active]; + + if ([menuItem action] == @selector(defrost:)) { + if (![EmuThread active]) + return NO; + + NSString *path = [NSString stringWithFormat:@"%@/%s-%3.3d.pcsxstate", saveStatePath, CdromId, [menuItem tag]]; + return (CheckState([path fileSystemRepresentation]) == 0); + } + + return YES; +} + +- (void)applicationWillResignActive:(NSNotification *)aNotification +{ + wasPausedBeforeBGSwitch = [EmuThread isPaused]; + + if (sleepInBackground) { + [EmuThread pause]; + } +} + +- (void)applicationDidBecomeActive:(NSNotification *)aNotification +{ + if (sleepInBackground && !wasPausedBeforeBGSwitch) { + [EmuThread resume]; + } +} + +- (void)awakeFromNib +{ + pluginList = [[PluginList alloc] init]; + if (![pluginList configured] /*!Config.Gpu[0] || !Config.Spu[0] || !Config.Pad1[0] || !Config.Cdr[0]*/) { + // configure plugins + [self preferences:nil]; + + NSRunCriticalAlertPanel(NSLocalizedString(@"Missing plugins!", nil), + NSLocalizedString(@"Pcsx is missing one or more critical plugins. You will need to install these in order to play games.", nil), + nil, nil, nil); + } + + if (![PcsxController biosAvailable]) { + NSRunInformationalAlertPanel(NSLocalizedString(@"Missing BIOS!", nil), + NSLocalizedString(@"Pcsx wasn't able to locate any Playstation BIOS ROM files. This means that it will run in BIOS simulation mode which is less stable and compatible than using a real Playstation BIOS.\n" + @"If you have a BIOS available, please copy it to\n~/Library/Application Support/Pcsx/Bios/", nil), + nil, nil, nil); + } + + sleepInBackground = YES; +} + +- (void)dealloc +{ + [pluginList release]; + + [super dealloc]; +} + ++ (void)setConfigFromDefaults +{ + NSEnumerator *enumerator; + const char *str; + NSString *key; + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + + /* + enumerator = [prefStringKeys keyEnumerator]; + while ((key = [enumerator nextObject])) { + str = [[defaults stringForKey:key] fileSystemRepresentation]; + char *dst = (char *)[[prefStringKeys objectForKey:key] pointerValue]; + if (str != nil && dst != nil) strncpy(dst, str, 255); + }*/ + + enumerator = [prefLongKeys keyEnumerator]; + while ((key = [enumerator nextObject])) { + long *dst = (long *)[[prefLongKeys objectForKey:key] pointerValue]; + if (dst != nil) *dst = [defaults integerForKey:key]; + } + + // special cases + //str = [[defaults stringForKey:@"PluginPAD"] fileSystemRepresentation]; + //if (str != nil) strncpy(Config.Pad2, str, 255); + + str = [[defaults stringForKey:@"Bios"] fileSystemRepresentation]; + if (str) { + NSString *path = [defaults stringForKey:@"Bios"]; + int index = [biosList indexOfObject:path]; + + if (-1 == index) { + [biosList insertObject:path atIndex:0]; + } else if (0 < index) { + [biosList exchangeObjectAtIndex:index withObjectAtIndex:0]; + } + } + + if ([defaults boolForKey:@"UseHLE"] || 0 == [biosList count]) { + strcpy(Config.Bios, "HLE"); + } else { + str = [(NSString *)[biosList objectAtIndex:0] fileSystemRepresentation]; + if (str != nil) strncpy(Config.Bios, str, 255); + else strcpy(Config.Bios, "HLE"); + } + + // FIXME: hack + strcpy(Config.Net, "Disabled"); +} + ++ (void)setDefaultFromConfig:(NSString *)defaultKey +{ + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + + char *str = (char *)[[prefStringKeys objectForKey:defaultKey] pointerValue]; + if (str) { + [defaults setObject:[NSString stringWithCString:str] forKey:defaultKey]; + return; + } + + long *val = (long *)[[prefLongKeys objectForKey:defaultKey] pointerValue]; + if (val) { + [defaults setInteger:*val forKey:defaultKey]; + return; + } +} + ++ (BOOL)biosAvailable +{ + return ([biosList count] > 0); +} + +// called when class is initialized ++ (void)initialize +{ + NSString *path; + const char *str; + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys: + @"Disabled", @"PluginNET", + [NSNumber numberWithInt:0], @"NoDynarec", + [NSNumber numberWithInt:1], @"AutoDetectVideoType", +// @"HLE", @"Bios", + [NSNumber numberWithInt:0], @"UseHLE", + [NSNumber numberWithInt:1], @"CpuBiasShift", + nil]; + + [defaults registerDefaults:appDefaults]; + + prefStringKeys = [[NSDictionary alloc] initWithObjectsAndKeys: + [NSValue valueWithPointer:Config.Gpu], @"PluginGPU", + [NSValue valueWithPointer:Config.Spu], @"PluginSPU", + [NSValue valueWithPointer:Config.Pad1], @"PluginPAD", + [NSValue valueWithPointer:Config.Cdr], @"PluginCDR", + [NSValue valueWithPointer:Config.Net], @"PluginNET", +// [NSValue valueWithPointer:Config.Bios], @"Bios", + nil]; + + prefLongKeys = [[NSDictionary alloc] initWithObjectsAndKeys: + [NSValue valueWithPointer:&Config.Xa], @"NoXaAudio", + [NSValue valueWithPointer:&Config.Sio], @"SioIrqAlways", + [NSValue valueWithPointer:&Config.Mdec], @"BlackAndWhiteMDECVideo", + [NSValue valueWithPointer:&Config.PsxAuto], @"AutoDetectVideoType", + [NSValue valueWithPointer:&Config.PsxType], @"VideoTypePAL", + [NSValue valueWithPointer:&Config.Cdda], @"NoCDAudio", + [NSValue valueWithPointer:&Config.Cpu], @"NoDynarec", + [NSValue valueWithPointer:&Config.PsxOut], @"ConsoleOutput", + [NSValue valueWithPointer:&Config.SpuIrq], @"SpuIrqAlways", + [NSValue valueWithPointer:&Config.RCntFix], @"RootCounterFix", + [NSValue valueWithPointer:&Config.VSyncWA], @"VideoSyncWAFix", + nil]; + + // setup application support paths + NSArray *libPaths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES); + if ([libPaths count] > 0) { + NSString *path; + BOOL dir; + + // create them if needed + NSFileManager *dfm = [NSFileManager defaultManager]; + NSString *supportPath = [NSString stringWithFormat:@"%@/Application Support", [libPaths objectAtIndex:0]]; + if (![dfm fileExistsAtPath:supportPath isDirectory:&dir]) + [dfm createDirectoryAtPath:supportPath attributes:nil]; + + path = [NSString stringWithFormat:@"%@/Pcsx", supportPath]; + if (![dfm fileExistsAtPath:path isDirectory:&dir]) + [dfm createDirectoryAtPath:path attributes:nil]; + + path = [NSString stringWithFormat:@"%@/Pcsx/Bios", supportPath]; + if (![dfm fileExistsAtPath:path isDirectory:&dir]) + [dfm createDirectoryAtPath:path attributes:nil]; + + path = [NSString stringWithFormat:@"%@/Pcsx/Memory Cards", supportPath]; + if (![dfm fileExistsAtPath:path isDirectory:&dir]) + [dfm createDirectoryAtPath:path attributes:nil]; + + saveStatePath = [[NSString stringWithFormat:@"%@/Pcsx/Save States", supportPath] retain]; + if (![dfm fileExistsAtPath:saveStatePath isDirectory:&dir]) + [dfm createDirectoryAtPath:saveStatePath attributes:nil]; + + + path = [NSString stringWithFormat:@"%@/Pcsx/Memory Cards/Mcd001.mcr", supportPath]; + str = [path fileSystemRepresentation]; + if (str != nil) strncpy(Config.Mcd1, str, 255); + + path = [NSString stringWithFormat:@"%@/Pcsx/Memory Cards/Mcd002.mcr", supportPath]; + str = [path fileSystemRepresentation]; + if (str != nil) strncpy(Config.Mcd2, str, 255); + + path = [NSString stringWithFormat:@"%@/Pcsx/Bios/", supportPath]; + str = [path fileSystemRepresentation]; + if (str != nil) strncpy(Config.BiosDir, str, 255); + } else { + strcpy(Config.BiosDir, "Bios/"); + + saveStatePath = @"sstates"; + [saveStatePath retain]; + } + + // set plugin path + path = [[[NSBundle mainBundle] builtInPlugInsPath] stringByAppendingString:@"/"]; + str = [path fileSystemRepresentation]; + if (str != nil) strncpy(Config.PluginsDir, str, 255); + + // set font location +// path = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/GONZN16X.TLF"]; +// str = [path fileSystemRepresentation]; +// if (str != nil) strncpy(Config.BiosFont, str, 255); + + // locate a bios + biosList = [[NSMutableArray alloc] init]; + NSFileManager *manager = [NSFileManager defaultManager]; + NSArray *bioses = [manager directoryContentsAtPath:[NSString stringWithCString:Config.BiosDir]]; + if (bioses) { + int i; + for (i=0; i<[bioses count]; i++) { + NSString *file = [bioses objectAtIndex:i]; + NSDictionary *attrib = [manager fileAttributesAtPath:[NSString stringWithFormat:@"%s%@", Config.BiosDir, file] traverseLink:YES]; + + if ([[attrib fileType] isEqualToString:NSFileTypeRegular]) { + unsigned long long size = [attrib fileSize]; + if (([attrib fileSize] % (256*1024)) == 0 && size > 0) { + [biosList addObject:file]; + } + } + } + } + + [PcsxController setConfigFromDefaults]; +} + + +@end diff --git a/macosx/PcsxPlugin.h b/macosx/PcsxPlugin.h new file mode 100644 index 00000000..c8d47679 --- /dev/null +++ b/macosx/PcsxPlugin.h @@ -0,0 +1,41 @@ +// +// PcsxPlugin.h +// Pcsx +// +// Created by Gil Pedersen on Fri Oct 03 2003. +// Copyright (c) 2003 __MyCompanyName__. All rights reserved. +// + +#import <Foundation/Foundation.h> + + +@interface PcsxPlugin : NSObject { + CFBundleRef pluginRef; + + NSString *path; + NSDate *modDate; + NSString *name; + long version; + int type; + int active; +} + ++ (NSString *)getPrefixForType:(int)type; ++ (NSString *)getDefaultKeyForType:(int)type; ++ (char **)getConfigEntriesForType:(int)type; + +- (id)initWithPath:(NSString *)aPath; + +- (NSString *)getDisplayVersion; +- (int)getType; +- (NSString *)path; +- (NSString *)description; +- (BOOL)hasAboutAs:(int)type; +- (BOOL)hasConfigureAs:(int)type; +- (long)initAs:(int)aType; +- (long)shutdownAs:(int)aType; +- (void)aboutAs:(int)type; +- (void)configureAs:(int)type; +- (BOOL)verifyOK; + +@end diff --git a/macosx/PcsxPlugin.m b/macosx/PcsxPlugin.m new file mode 100644 index 00000000..9ee31112 --- /dev/null +++ b/macosx/PcsxPlugin.m @@ -0,0 +1,303 @@ +// +// PcsxPlugin.m +// Pcsx +// +// Created by Gil Pedersen on Fri Oct 03 2003. +// Copyright (c) 2003 __MyCompanyName__. All rights reserved. +// + +#import <Cocoa/Cocoa.h> +#import "PcsxPlugin.h" +#include "psxcommon.h" +#include "plugins.h" + +@implementation PcsxPlugin + ++ (NSString *)getPrefixForType:(int)aType +{ + switch (aType) { + case PSE_LT_GPU: return @"GPU"; + case PSE_LT_CDR: return @"CDR"; + case PSE_LT_SPU: return @"SPU"; + case PSE_LT_PAD: return @"PAD"; + case PSE_LT_NET: return @"NET"; + } + + return @""; +} + ++ (NSString *)getDefaultKeyForType:(int)aType +{ + //return @"Plugin" [PcsxPlugin getPrefixForType:aType]; + switch (aType) { + case PSE_LT_GPU: return @"PluginGPU"; + case PSE_LT_CDR: return @"PluginCDR"; + case PSE_LT_SPU: return @"PluginSPU"; + case PSE_LT_PAD: return @"PluginPAD"; + case PSE_LT_NET: return @"PluginNET"; + } + + return @""; +} + ++ (char **)getConfigEntriesForType:(int)aType +{ + static char *gpu[2] = {(char *)&Config.Gpu, NULL}; + static char *cdr[2] = {(char *)&Config.Cdr, NULL}; + static char *spu[2] = {(char *)&Config.Spu, NULL}; + static char *pad[3] = {(char *)&Config.Pad1, (char *)&Config.Pad2, NULL}; + static char *net[2] = {(char *)&Config.Net, NULL}; + + switch (aType) { + case PSE_LT_GPU: return (char **)gpu; + case PSE_LT_CDR: return (char **)cdr; + case PSE_LT_SPU: return (char **)spu; + case PSE_LT_PAD: return (char **)pad; + case PSE_LT_NET: return (char **)net; + } + + return nil; +} + +- (id)initWithPath:(NSString *)aPath +{ + if (!(self = [super init])) { + return nil; + } + + PSEgetLibType PSE_getLibType = NULL; + PSEgetLibVersion PSE_getLibVersion = NULL; + PSEgetLibName PSE_getLibName = NULL; + + pluginRef = nil; + name = nil; + path = [aPath retain]; + NSString *fullPath = [[NSString stringWithCString:Config.PluginsDir] stringByAppendingPathComponent:path]; + + pluginRef = SysLoadLibrary([fullPath fileSystemRepresentation]); + if (pluginRef == nil) { + [self release]; + return nil; + } + + // TODO: add support for plugins with multiple functionalities??? + PSE_getLibType = (PSEgetLibType) SysLoadSym(pluginRef, "PSEgetLibType"); + if (SysLibError() != nil) { + if (([path rangeOfString: @"gpu" options:NSCaseInsensitiveSearch]).length != 0) + type = PSE_LT_GPU; + else if (([path rangeOfString: @"cdr" options:NSCaseInsensitiveSearch]).length != 0) + type = PSE_LT_CDR; + else if (([path rangeOfString: @"spu" options:NSCaseInsensitiveSearch]).length != 0) + type = PSE_LT_SPU; + else if (([path rangeOfString: @"pad" options:NSCaseInsensitiveSearch]).length != 0) + type = PSE_LT_PAD; + else { + [self release]; + return nil; + } + } else { + type = (int)PSE_getLibType(); + if (type != PSE_LT_GPU && type != PSE_LT_CDR && type != PSE_LT_SPU && type != PSE_LT_PAD) { + [self release]; + return nil; + } + } + + PSE_getLibName = (PSEgetLibName) SysLoadSym(pluginRef, "PSEgetLibName"); + if (SysLibError() == nil) { + name = [[NSString alloc] initWithCString:PSE_getLibName()]; + } + + PSE_getLibVersion = (PSEgetLibVersion) SysLoadSym(pluginRef, "PSEgetLibVersion"); + if (SysLibError() == nil) { + version = PSE_getLibVersion(); + } + else { + version = -1; + } + + // save the current modification date + NSDictionary *fattrs = [[NSFileManager defaultManager] fileAttributesAtPath:fullPath traverseLink:YES]; + modDate = [[fattrs fileModificationDate] retain]; + + active = 0; + + return self; +} + +- (void)dealloc +{ + int i; + + // shutdown if we had previously been inited + for (i=0; i<32; i++) { + if (active & (1 << i)) { + [self shutdownAs:(1 << i)]; + } + } + + if (pluginRef) SysCloseLibrary(pluginRef); + + [path release]; + [name release]; + + [super dealloc]; +} + +- (void)runCommand:(id)arg +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + NSString *funcName = [arg objectAtIndex:0]; + long (*func)(void); + + func = SysLoadSym(pluginRef, [funcName lossyCString]); + if (SysLibError() == nil) { + func(); + } else { + NSBeep(); + } + + [arg release]; + [pool release]; + return; +} + +- (long)initAs:(int)aType +{ + char symbol[255]; + long (*init)(void); + long (*initArg)(long arg); + int res = PSE_ERR_FATAL; + + if ((active & aType) == aType) { + return 0; + } + + sprintf(symbol, "%sinit", [[PcsxPlugin getPrefixForType:aType] lossyCString]); + init = initArg = SysLoadSym(pluginRef, symbol); + if (SysLibError() == nil) { + if (aType != PSE_LT_PAD) + res = init(); + else + res = initArg(1|2); + } + + if (0 == res) { + active |= aType; + } else { + NSRunCriticalAlertPanel(NSLocalizedString(@"Plugin Initialization Failed!", nil), + [NSString stringWithFormat:NSLocalizedString(@"Pcsx failed to initialize the selected %s plugin (error=%i).\nThe plugin might not work with your system.", nil), [PcsxPlugin getPrefixForType:aType], res], + nil, nil, nil); + } + + return res; +} + +- (long)shutdownAs:(int)aType +{ + char symbol[255]; + long (*shutdown)(void); + + sprintf(symbol, "%sshutdown", [[PcsxPlugin getPrefixForType:aType] lossyCString]); + shutdown = SysLoadSym(pluginRef, symbol); + if (SysLibError() == nil) { + active &= ~aType; + return shutdown(); + } + + return PSE_ERR_FATAL; +} + +- (BOOL)hasAboutAs:(int)aType +{ + char symbol[255]; + + sprintf(symbol, "%sabout", [[PcsxPlugin getPrefixForType:aType] lossyCString]); + SysLoadSym(pluginRef, symbol); + + return (SysLibError() == nil); +} + +- (BOOL)hasConfigureAs:(int)aType +{ + char symbol[255]; + + sprintf(symbol, "%sconfigure", [[PcsxPlugin getPrefixForType:aType] lossyCString]); + SysLoadSym(pluginRef, symbol); + + return (SysLibError() == nil); +} + +- (void)aboutAs:(int)aType +{ + NSArray *arg; + char symbol[255]; + + sprintf(symbol, "%sabout", [[PcsxPlugin getPrefixForType:aType] lossyCString]); + arg = [[NSArray alloc] initWithObjects:[NSString stringWithCString:symbol], + [NSNumber numberWithInt:0], nil]; + + // detach a new thread + [NSThread detachNewThreadSelector:@selector(runCommand:) toTarget:self + withObject:arg]; +} + +- (void)configureAs:(int)aType +{ + NSArray *arg; + char symbol[255]; + + sprintf(symbol, "%sconfigure", [[PcsxPlugin getPrefixForType:aType] lossyCString]); + arg = [[NSArray alloc] initWithObjects:[NSString stringWithCString:symbol], + [NSNumber numberWithInt:1], nil]; + + // detach a new thread + [NSThread detachNewThreadSelector:@selector(runCommand:) toTarget:self + withObject:arg]; +} + +- (NSString *)getDisplayVersion +{ + if (version == -1) + return @""; + + return [NSString stringWithFormat:@"v%ld.%ld.%ld", version>>16,(version>>8)&0xff,version&0xff]; +} + +- (int)getType +{ + return type; +} + +- (NSString *)path +{ + return path; +} + +- (unsigned)hash +{ + return [path hash]; +} + +- (NSString *)description +{ + if (name == nil) + return [path lastPathComponent]; + + return [NSString stringWithFormat:@"%@ %@ [%@]", name, [self getDisplayVersion], [path lastPathComponent]]; +} + +// the plugin will check if it's still valid and return the status +- (BOOL)verifyOK +{ + // check that the file is still there with the same modification date + NSFileManager *dfm = [NSFileManager defaultManager]; + NSString *fullPath = [[NSString stringWithCString:Config.PluginsDir] stringByAppendingPathComponent:path]; + if (![dfm fileExistsAtPath:fullPath]) + return NO; + + NSDictionary *fattrs = [dfm fileAttributesAtPath:fullPath traverseLink:YES]; + return [[fattrs fileModificationDate] isEqualToDate:modDate]; +} + +@end diff --git a/macosx/PcsxPluginDocument.h b/macosx/PcsxPluginDocument.h new file mode 100644 index 00000000..bf4f8028 --- /dev/null +++ b/macosx/PcsxPluginDocument.h @@ -0,0 +1,20 @@ +// +// PcsxPluginDocument.h +// Pcsx +// +// Created by Gil Pedersen on Thu Jul 01 2004. +// Copyright (c) 2004 __MyCompanyName__. All rights reserved. +// + +#import <AppKit/AppKit.h> + + +@interface PcsxPluginDocument : NSDocument { + IBOutlet NSWindow *addPluginSheet; + IBOutlet NSTextField *pluginName; + + BOOL moveOK; +} +- (IBAction)closeAddPluginSheet:(id)sender; + +@end diff --git a/macosx/PcsxPluginDocument.m b/macosx/PcsxPluginDocument.m new file mode 100644 index 00000000..6cbe0fae --- /dev/null +++ b/macosx/PcsxPluginDocument.m @@ -0,0 +1,95 @@ +// +// PcsxPluginDocument.m +// Pcsx +// +// Created by Gil Pedersen on Thu Jul 01 2004. +// Copyright (c) 2004 __MyCompanyName__. All rights reserved. +// + +#import "PcsxPluginDocument.h" + + +@implementation PcsxPluginDocument + +- (BOOL)showAddPluginSheet:(NSWindow *)window forName:(NSString *)name +// User has asked to see the custom display. Display it. +{ + if (!addPluginSheet) + [NSBundle loadNibNamed:@"AddPluginSheet" owner:self]; + + [pluginName setObjectValue:name]; + + [NSApp beginSheet:addPluginSheet + modalForWindow:window + modalDelegate:nil + didEndSelector:nil + contextInfo:nil]; + [NSApp runModalForWindow:addPluginSheet]; + // Sheet is up here. + [NSApp endSheet:addPluginSheet]; + [addPluginSheet orderOut:self]; + + return moveOK; +} + +- (IBAction)closeAddPluginSheet:(id)sender +{ + if ([[sender keyEquivalent] isEqualToString:@"\r"]) { + moveOK = YES; + } else { + moveOK = NO; + } + [NSApp stopModal]; +} + +- (BOOL)loadDataRepresentation:(NSData *)docData ofType:(NSString *)docType +{ + //NSLog(@"loadDataRepresentation"); + return NO; +} + +- (BOOL)loadFileWrapperRepresentation:(NSFileWrapper *)wrapper ofType:(NSString *)docType +{ + if ([self showAddPluginSheet:nil forName:[wrapper filename]]) { + NSString *dst = [NSString stringWithFormat:@"%@/%@", + [[NSBundle mainBundle] builtInPlugInsPath], + [wrapper filename]]; + + if ([wrapper writeToFile:dst atomically:NO updateFilenames:NO]) { + [[NSWorkspace sharedWorkspace] noteFileSystemChanged:[[NSBundle mainBundle] builtInPlugInsPath]]; + NSRunInformationalAlertPanel(NSLocalizedString(@"Installation Succesfull", nil), + NSLocalizedString(@"The installation of the specified plugin was succesfull. In order to use it, please restart the application.", nil), + nil, nil, nil); + } else { + NSRunAlertPanel(NSLocalizedString(@"Installation Failed!", nil), + NSLocalizedString(@"The installation of the specified plugin failed. Please try again, or make a manual install.", nil), + nil, nil, nil); + } + } + + // Tell the NSDocument that we can't handle the file, since we are already done with it + return NO; +} + +- (id)openDocumentWithContentsOfFile:(NSString *)fileName display:(BOOL)flag +{ + + return nil; +} + +- (NSString *)windowNibName { + // Implement this to return a nib to load OR implement -makeWindowControllers to manually create your controllers. + return @"PcsxPluginDocument"; +} + +- (NSData *)dataRepresentationOfType:(NSString *)type { + // Implement to provide a persistent data representation of your document OR remove this and implement the file-wrapper or file path based save methods. + return nil; +} +/* +- (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)type { + // Implement to load a persistent data representation of your document OR remove this and implement the file-wrapper or file path based load methods. + return YES; +}*/ + +@end diff --git a/macosx/Plugin.c b/macosx/Plugin.c new file mode 100644 index 00000000..3d7f0f73 --- /dev/null +++ b/macosx/Plugin.c @@ -0,0 +1,287 @@ +/* Pcsx - Pc Psx Emulator + * Copyright (C) 1999-2002 Pcsx Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#import <CoreFoundation/CoreFoundation.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <signal.h> + +#include "psxcommon.h" +#include "plugins.h" +#include "spu.h" + +void OnFile_Exit(); + +unsigned long gpuDisp; + +long SPU__open(void) { + return SPU_open(); +} + +int StatesC = 0; +extern int UseGui; +int ShowPic=0; + +void gpuShowPic() { +} + +void PADhandleKey(int key) { +/* char Text[255]; + int ret; + + switch (key) { + case 0: break; + case XK_F1: + sprintf(Text, "sstates/%10.10s.%3.3d", CdromLabel, StatesC); + GPU_freeze(2, (GPUFreeze_t *)&StatesC); + ret = SaveState(Text); + if (ret == 0) + sprintf(Text, _("*PCSX*: Saved State %d"), StatesC+1); + else sprintf(Text, _("*PCSX*: Error Saving State %d"), StatesC+1); + GPU_displayText(Text); + if (ShowPic) { ShowPic = 0; gpuShowPic(); } + break; + case XK_F2: + if (StatesC < 4) StatesC++; + else StatesC = 0; + GPU_freeze(2, (GPUFreeze_t *)&StatesC); + if (ShowPic) { ShowPic = 0; gpuShowPic(); } + break; + case XK_F3: + sprintf (Text, "sstates/%10.10s.%3.3d", CdromLabel, StatesC); + ret = LoadState(Text); + if (ret == 0) + sprintf(Text, _("*PCSX*: Loaded State %d"), StatesC+1); + else sprintf(Text, _("*PCSX*: Error Loading State %d"), StatesC+1); + GPU_displayText(Text); + break; + case XK_F4: + gpuShowPic(); + break; + case XK_F5: + Config.Sio ^= 0x1; + if (Config.Sio) + sprintf(Text, _("*PCSX*: Sio Irq Always Enabled")); + else sprintf(Text, _("*PCSX*: Sio Irq Not Always Enabled")); + GPU_displayText(Text); + break; + case XK_F6: + Config.Mdec ^= 0x1; + if (Config.Mdec) + sprintf(Text, _("*PCSX*: Black&White Mdecs Only Enabled")); + else sprintf(Text, _("*PCSX*: Black&White Mdecs Only Disabled")); + GPU_displayText(Text); + break; + case XK_F7: + Config.Xa ^= 0x1; + if (Config.Xa == 0) + sprintf (Text, _("*PCSX*: Xa Enabled")); + else sprintf (Text, _("*PCSX*: Xa Disabled")); + GPU_displayText(Text); + break; + case XK_F8: + GPU_makeSnapshot(); + break; + case XK_F9: + cdOpenCase = 1; + break; + case XK_F10: + cdOpenCase = 0; + break; + case XK_Escape: + ClosePlugins(); + UpdateMenuSlots(); + if (!UseGui) OnFile_Exit(); + RunGui(); + break; + default: + GPU_keypressed(key); + if (Config.UseNet) NET_keypressed(key); + }*/ +} + +long PAD1__open(void) { + return PAD1_open(&gpuDisp); +} + +long PAD2__open(void) { + return PAD2_open(&gpuDisp); +} + +void OnFile_Exit(); + +void SignalExit(int sig) { + ClosePlugins(); + OnFile_Exit(); +} + +void SPUirq(void); + +int NetOpened = 0; + +#define PARSEPATH(dst, src) \ + ptr = src + strlen(src); \ + while (*ptr != '\\' && ptr != src) ptr--; \ + if (ptr != src) { \ + strcpy(dst, ptr+1); \ + } + +int _OpenPlugins() { + static char path[1024]; + CFURLRef pathUrl; + int ret; + + //signal(SIGINT, SignalExit); + //signal(SIGPIPE, SignalExit); + + GPU_clearDynarec(clearDynarec); + + pathUrl = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("gpuPeopsSoftX.cfg"), NULL, NULL); + if (pathUrl) + CFURLGetFileSystemRepresentation(pathUrl, true, path, 1024); + + ret = CDR_open(); + if (ret < 0) { SysMessage(_("Error Opening CDR Plugin")); return -1; } + ret = SPU_open(); + if (ret < 0) { SysMessage(_("Error Opening SPU Plugin")); return -1; } + SPU_registerCallback(SPUirq); + ret = GPU_open(&gpuDisp, "PCSX", /*pathUrl ? path :*/ NULL); + if (ret < 0) { SysMessage(_("Error Opening GPU Plugin")); return -1; } + ret = PAD1_open(&gpuDisp); + if (ret < 0) { SysMessage(_("Error Opening PAD1 Plugin")); return -1; } + ret = PAD2_open(&gpuDisp); + if (ret < 0) { SysMessage(_("Error Opening PAD2 Plugin")); return -1; } + +/* if (Config.UseNet && NetOpened == 0) { + netInfo info; + char path[256]; + + strcpy(info.EmuName, "PCSX v" PCSX_VERSION); + strncpy(info.CdromID, CdromId, 9); + strncpy(info.CdromLabel, CdromLabel, 9); + info.psxMem = psxM; + info.GPU_showScreenPic = GPU_showScreenPic; + info.GPU_displayText = GPU_displayText; + info.GPU_showScreenPic = GPU_showScreenPic; + info.PAD_setSensitive = PAD1_setSensitive; + sprintf(path, "%s%s", Config.BiosDir, Config.Bios); + strcpy(info.BIOSpath, path); + strcpy(info.MCD1path, Config.Mcd1); + strcpy(info.MCD2path, Config.Mcd2); + sprintf(path, "%s%s", Config.PluginsDir, Config.Gpu); + strcpy(info.GPUpath, path); + sprintf(path, "%s%s", Config.PluginsDir, Config.Spu); + strcpy(info.SPUpath, path); + sprintf(path, "%s%s", Config.PluginsDir, Config.Cdr); + strcpy(info.CDRpath, path); + NET_setInfo(&info); + + ret = NET_open(&gpuDisp); + if (ret < 0) { + if (ret == -2) { + // -2 is returned when something in the info + // changed and needs to be synced + char *ptr; + + PARSEPATH(Config.Bios, info.BIOSpath); + PARSEPATH(Config.Gpu, info.GPUpath); + PARSEPATH(Config.Spu, info.SPUpath); + PARSEPATH(Config.Cdr, info.CDRpath); + + strcpy(Config.Mcd1, info.MCD1path); + strcpy(Config.Mcd2, info.MCD2path); + return -2; + } else { + Config.UseNet = 0; + } + } else { + if (NET_queryPlayer() == 1) { + if (SendPcsxInfo() == -1) Config.UseNet = 0; + } else { + if (RecvPcsxInfo() == -1) Config.UseNet = 0; + } + } + NetOpened = 1; + } else if (Config.UseNet) { + NET_resume(); + } +*/ + return 0; +} + +int OpenPlugins() { + int ret; + + while ((ret = _OpenPlugins()) == -2) { + ReleasePlugins(); + LoadMcds(Config.Mcd1, Config.Mcd2); + if (LoadPlugins() == -1) return -1; + } + return ret; +} + +void ClosePlugins() { + int ret; + + //signal(SIGINT, SIG_DFL); + //signal(SIGPIPE, SIG_DFL); + ret = CDR_close(); + if (ret < 0) { SysMessage(_("Error Closing CDR Plugin")); return; } + ret = SPU_close(); + if (ret < 0) { SysMessage(_("Error Closing SPU Plugin")); return; } + ret = PAD1_close(); + if (ret < 0) { SysMessage(_("Error Closing PAD1 Plugin")); return; } + ret = PAD2_close(); + if (ret < 0) { SysMessage(_("Error Closing PAD2 Plugin")); return; } + ret = GPU_close(); + if (ret < 0) { SysMessage(_("Error Closing GPU Plugin")); return; } + + /*if (Config.UseNet) { + NET_pause(); + }*/ +} + +void ResetPlugins() { + int ret; + + CDR_shutdown(); + GPU_shutdown(); + SPU_shutdown(); + PAD1_shutdown(); + PAD2_shutdown(); + //if (Config.UseNet) NET_shutdown(); + + ret = CDR_init(); + if (ret < 0) { SysMessage(_("CDRinit error: %d"), ret); return; } + ret = GPU_init(); + if (ret < 0) { SysMessage(_("GPUinit error: %d"), ret); return; } + ret = SPU_init(); + if (ret < 0) { SysMessage(_("SPUinit error: %d"), ret); return; } + ret = PAD1_init(1); + if (ret < 0) { SysMessage(_("PAD1init error: %d"), ret); return; } + ret = PAD2_init(2); + if (ret < 0) { SysMessage(_("PAD2init error: %d"), ret); return; } + /*if (Config.UseNet) { + ret = NET_init(); + if (ret < 0) { SysMessage(_("NETinit error: %d"), ret); return; } + }*/ + + NetOpened = 0; +} + diff --git a/macosx/PluginController.h b/macosx/PluginController.h new file mode 100644 index 00000000..e04f1525 --- /dev/null +++ b/macosx/PluginController.h @@ -0,0 +1,22 @@ +/* PluginController */ + +#import <Cocoa/Cocoa.h> +#import "PluginList.h" + +@interface PluginController : NSObject +{ + IBOutlet NSButton *aboutButton; + IBOutlet NSButton *configureButton; + IBOutlet NSPopUpButton *pluginMenu; + + int pluginType; + NSArray *plugins; + NSString *defaultKey; +} +- (IBAction)doAbout:(id)sender; +- (IBAction)doConfigure:(id)sender; +- (IBAction)selectPlugin:(id)sender; + +- (void)setPluginsTo:(NSArray *)list withType:(int)type; + +@end diff --git a/macosx/PluginController.m b/macosx/PluginController.m new file mode 100644 index 00000000..958cad3a --- /dev/null +++ b/macosx/PluginController.m @@ -0,0 +1,80 @@ +#import "PluginController.h" +#import "PcsxPlugin.h" + +@implementation PluginController + +- (IBAction)doAbout:(id)sender +{ + PcsxPlugin *plugin = [plugins objectAtIndex:[pluginMenu indexOfSelectedItem]]; + [plugin aboutAs:pluginType]; +} + +- (IBAction)doConfigure:(id)sender +{ + PcsxPlugin *plugin = [plugins objectAtIndex:[pluginMenu indexOfSelectedItem]]; + + [plugin configureAs:pluginType]; +} + +- (IBAction)selectPlugin:(id)sender +{ + if (sender==pluginMenu) { + int index = [pluginMenu indexOfSelectedItem]; + if (index != -1) { + PcsxPlugin *plugin = [plugins objectAtIndex:index]; + + if (![[PluginList list] setActivePlugin:plugin forType:pluginType]) { + /* plugin won't initialize */ + } + + // write selection to defaults + [[NSUserDefaults standardUserDefaults] setObject:[plugin path] forKey:defaultKey]; + + // set button states + [aboutButton setEnabled:[plugin hasAboutAs:pluginType]]; + [configureButton setEnabled:[plugin hasConfigureAs:pluginType]]; + } else { + // set button states + [aboutButton setEnabled:NO]; + [configureButton setEnabled:NO]; + } + } +} + +// must be called before anything else +- (void)setPluginsTo:(NSArray *)list withType:(int)type +{ + NSString *sel; + int i; + + // remember the list + pluginType = type; + plugins = [list retain]; + defaultKey = [[PcsxPlugin getDefaultKeyForType:pluginType] retain]; + + // clear the previous menu items + [pluginMenu removeAllItems]; + + // load the currently selected plugin + sel = [[NSUserDefaults standardUserDefaults] stringForKey:defaultKey]; + + // add the menu entries + for (i=0; i<[plugins count]; i++) { + [pluginMenu addItemWithTitle:[[plugins objectAtIndex:i] description]]; + + // make sure the currently selected is set as such + if ([sel isEqualToString:[[plugins objectAtIndex:i] path]]) { + [pluginMenu selectItemAtIndex:i]; + } + } + + [self selectPlugin:pluginMenu]; +} + +- (void)dealloc +{ + if (plugins) [plugins release]; + if (defaultKey) [defaultKey release]; +} + +@end diff --git a/macosx/PluginList.h b/macosx/PluginList.h new file mode 100644 index 00000000..fecc4b13 --- /dev/null +++ b/macosx/PluginList.h @@ -0,0 +1,36 @@ +// +// PluginList.h +// Pcsx +// +// Created by Gil Pedersen on Sun Sep 21 2003. +// Copyright (c) 2003 __MyCompanyName__. All rights reserved. +// + +#import <Cocoa/Cocoa.h> +#import "PcsxPlugin.h" + +//extern NSMutableArray *plugins; + +@interface PluginList : NSObject { + + @private + NSMutableArray *pluginList; + + PcsxPlugin *activeGpuPlugin; + PcsxPlugin *activeSpuPlugin; + PcsxPlugin *activeCdrPlugin; + PcsxPlugin *activePadPlugin; + + BOOL missingPlugins; +} + ++ (PluginList *)list; + +- (void)refreshPlugins; +- (NSArray *)pluginsForType:(int)typeMask; +- (BOOL)hasPluginAtPath:(NSString *)path; +- (BOOL)configured; +- (PcsxPlugin *)activePluginForType:(int)type; +- (BOOL)setActivePlugin:(PcsxPlugin *)plugin forType:(int)type; + +@end diff --git a/macosx/PluginList.m b/macosx/PluginList.m new file mode 100644 index 00000000..62c877c1 --- /dev/null +++ b/macosx/PluginList.m @@ -0,0 +1,324 @@ +// +// PluginList.m +// Pcsx +// +// Created by Gil Pedersen on Sun Sep 21 2003. +// Copyright (c) 2003 __MyCompanyName__. All rights reserved. +// + +#import "EmuThread.h" +#import "PluginList.h" +#import "PcsxPlugin.h" +#include "psxcommon.h" +#include "plugins.h" + +//NSMutableArray *plugins; +static PluginList *sPluginList = nil; +const static int typeList[4] = {PSE_LT_GPU, PSE_LT_SPU, PSE_LT_CDR, PSE_LT_PAD}; + +@implementation PluginList + ++ (PluginList *)list +{ + return sPluginList; +} + +#if 0 ++ (void)loadPlugins +{ + NSDirectoryEnumerator *dirEnum; + NSString *pname, *dir; + + // Make sure we only load the plugins once + if (plugins != nil) + return; + + plugins = [[NSMutableArray alloc] initWithCapacity: 20]; + + dir = [NSString stringWithCString:Config.PluginsDir]; + dirEnum = [[NSFileManager defaultManager] enumeratorAtPath:dir]; + + while (pname = [dirEnum nextObject]) { + if ([[pname pathExtension] isEqualToString:@"psxplugin"] || + [[pname pathExtension] isEqualToString:@"so"]) { + [dirEnum skipDescendents]; /* don't enumerate this + directory */ + + PcsxPlugin *plugin = [[PcsxPlugin alloc] initWithPath:pname]; + if (plugin != nil) { + [plugins addObject:plugin]; + } + } + } +} + +- (id)initWithType:(int)typeMask +{ + unsigned int i; + + self = [super init]; + + [PluginList loadPlugins]; + list = [[NSMutableArray alloc] initWithCapacity: 5]; + + type = typeMask; + for (i=0; i<[plugins count]; i++) { + PcsxPlugin *plugin = [plugins objectAtIndex:i]; + if ([plugin getType] == type) { + [list addObject:plugin]; + } + } + + return self; +} + +- (int)numberOfItems +{ + return [list count]; +} + +- (id)objectAtIndex:(unsigned)index +{ + return [list objectAtIndex:index]; +} +#endif + + + +- (id)init +{ + int i; + + if (!(self = [super init])) + return nil; + + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + pluginList = [[NSMutableArray alloc] initWithCapacity:20]; + + activeGpuPlugin = activeSpuPlugin = activeCdrPlugin = activePadPlugin = nil; + + missingPlugins = NO; + for (i=0; i<sizeof(*typeList); i++) { + NSString *path = [defaults stringForKey:[PcsxPlugin getDefaultKeyForType:typeList[i]]]; + if (nil == path) { + missingPlugins = YES; + continue; + } + if ([path isEqualToString:@"Disabled"]) + continue; + + if (![self hasPluginAtPath:path]) { + PcsxPlugin *plugin = [[PcsxPlugin alloc] initWithPath:path]; + if (plugin) { + [pluginList addObject:plugin]; + if (![self setActivePlugin:plugin forType:typeList[i]]) + missingPlugins = YES; + } else { + missingPlugins = YES; + } + } + } + + if (missingPlugins) { + [self refreshPlugins]; + } + + sPluginList = self; + + return self; +} + +- (void)dealloc +{ + [activeGpuPlugin release]; + [activeSpuPlugin release]; + [activeCdrPlugin release]; + [activePadPlugin release]; + + [pluginList release]; + + if (sPluginList == self) + sPluginList = nil; + + [super dealloc]; +} + +- (void)refreshPlugins +{ + NSDirectoryEnumerator *dirEnum; + NSString *pname, *dir; + int i; + + // verify that the ones that are in list still works + for (i=0; i<[pluginList count]; i++) { + if (![[pluginList objectAtIndex:i] verifyOK]) { + [pluginList removeObjectAtIndex:i]; i--; + } + } + + // look for new ones in the plugin directory + dir = [NSString stringWithCString:Config.PluginsDir]; + dirEnum = [[NSFileManager defaultManager] enumeratorAtPath:dir]; + + while (pname = [dirEnum nextObject]) { + if ([[pname pathExtension] isEqualToString:@"psxplugin"] || + [[pname pathExtension] isEqualToString:@"so"]) { + [dirEnum skipDescendents]; /* don't enumerate this + directory */ + + if (![self hasPluginAtPath:pname]) { + PcsxPlugin *plugin = [[PcsxPlugin alloc] initWithPath:pname]; + if (plugin != nil) { + [pluginList addObject:plugin]; + } + } + } + } + + // check the we have the needed plugins + missingPlugins = NO; + for (i=0; i<sizeof(*typeList); i++) { + PcsxPlugin *plugin = [self activePluginForType:typeList[i]]; + if (nil == plugin) { + NSArray *list = [self pluginsForType:typeList[i]]; + int j; + + for (j=0; j<[list count]; j++) { + if ([self setActivePlugin:[list objectAtIndex:j] forType:typeList[i]]) + break; + } + if (j == [list count]) + missingPlugins = YES; + } + } +} + +- (NSArray *)pluginsForType:(int)typeMask +{ + NSMutableArray *types = [NSMutableArray array]; + int i; + + for (i=0; i<[pluginList count]; i++) { + PcsxPlugin *plugin = [pluginList objectAtIndex:i]; + + if ([plugin getType] & typeMask) { + [types addObject:plugin]; + } + } + + return types; +} + +- (BOOL)hasPluginAtPath:(NSString *)path +{ + if (nil == path) + return NO; + + int i; + for (i=0; i<[pluginList count]; i++) { + if ([[[pluginList objectAtIndex:i] path] isEqualToString:path]) + return YES; + } + + return NO; +} + +// returns if all the required plugins are available +- (BOOL)configured +{ + return !missingPlugins; +} + +- (BOOL)doInitPlugins +{ + BOOL bad = NO; + + if ([activeGpuPlugin initAs:PSE_LT_GPU] != 0) bad = YES; + if ([activeSpuPlugin initAs:PSE_LT_SPU] != 0) bad = YES; + if ([activeCdrPlugin initAs:PSE_LT_CDR] != 0) bad = YES; + if ([activePadPlugin initAs:PSE_LT_PAD] != 0) bad = YES; + + return !bad; +} + +- (PcsxPlugin *)activePluginForType:(int)type +{ + switch (type) { + case PSE_LT_GPU: return activeGpuPlugin; + case PSE_LT_CDR: return activeCdrPlugin; + case PSE_LT_SPU: return activeSpuPlugin; + case PSE_LT_PAD: return activePadPlugin; +// case PSE_LT_NET: return activeNetPlugin; + } + + return nil; +} + +- (BOOL)setActivePlugin:(PcsxPlugin *)plugin forType:(int)type +{ + PcsxPlugin **pluginPtr; + switch (type) { + case PSE_LT_GPU: pluginPtr = &activeGpuPlugin; break; + case PSE_LT_CDR: pluginPtr = &activeCdrPlugin; break; + case PSE_LT_SPU: pluginPtr = &activeSpuPlugin; break; + case PSE_LT_PAD: pluginPtr = &activePadPlugin; break; +// case PSE_LT_NET: pluginPtr = &activeNetPlugin; break; + default: return NO; + } + + if (plugin == *pluginPtr) + return YES; + + BOOL active = (*pluginPtr) && [EmuThread active]; + BOOL wasPaused = NO; + if (active) { + // TODO: temporary freeze? + wasPaused = [EmuThread pauseSafe]; + ClosePlugins(); + ReleasePlugins(); + } + + // stop the old plugin and start the new one + if (*pluginPtr) { + [*pluginPtr shutdownAs:type]; + + [*pluginPtr release]; + } + *pluginPtr = [plugin retain]; + if (*pluginPtr) { + if ([*pluginPtr initAs:type] != 0) { + [*pluginPtr release]; + *pluginPtr = nil; + } + } + + // write path to the correct config entry + const char *str; + if (*pluginPtr != nil) { + str = [[plugin path] fileSystemRepresentation]; + if (str == nil) { + str = "Invalid Plugin"; + } + } else { + str = "Invalid Plugin"; + } + + char **dst = [PcsxPlugin getConfigEntriesForType:type]; + while (*dst) { + strncpy(*dst, str, 255); + dst++; + } + + if (active) { + LoadPlugins(); + OpenPlugins(); + + if (!wasPaused) { + [EmuThread resume]; + } + } + + return *pluginPtr != nil; +} + +@end diff --git a/macosx/config.h b/macosx/config.h new file mode 100644 index 00000000..483c79b1 --- /dev/null +++ b/macosx/config.h @@ -0,0 +1,31 @@ +// +// Copyright (c) 2008, Wei Mingzhi. All rights reserved. +// +// Use, redistribution and modification of this code is unrestricted as long as this +// notice is preserved. +// + +#ifndef CONFIG_H +#define CONFIG_H + +#ifndef MAXPATHLEN +#define MAXPATHLEN 256 +#endif + +#ifndef PACKAGE_VERSION +#define PACKAGE_VERSION "1.9" +#endif + +#ifndef PREFIX +#define PREFIX "./" +#endif + +#ifndef inline +#ifdef _DEBUG +#define inline /* */ +#else +#define inline __inline__ +#endif +#endif + +#endif diff --git a/macosx/icons/PCSX.icns b/macosx/icons/PCSX.icns Binary files differnew file mode 100644 index 00000000..3f57a340 --- /dev/null +++ b/macosx/icons/PCSX.icns diff --git a/macosx/icons/pcsxfreeze.icns b/macosx/icons/pcsxfreeze.icns Binary files differnew file mode 100644 index 00000000..bcb21e60 --- /dev/null +++ b/macosx/icons/pcsxfreeze.icns diff --git a/macosx/icons/pcsxmemcard.icns b/macosx/icons/pcsxmemcard.icns Binary files differnew file mode 100644 index 00000000..f3e47b9b --- /dev/null +++ b/macosx/icons/pcsxmemcard.icns diff --git a/macosx/icons/psxbios.icns b/macosx/icons/psxbios.icns Binary files differnew file mode 100644 index 00000000..47baf9fe --- /dev/null +++ b/macosx/icons/psxbios.icns diff --git a/macosx/icons/psxplugin.icns b/macosx/icons/psxplugin.icns Binary files differnew file mode 100644 index 00000000..01a3c933 --- /dev/null +++ b/macosx/icons/psxplugin.icns diff --git a/macosx/main.m b/macosx/main.m new file mode 100644 index 00000000..472ba4a0 --- /dev/null +++ b/macosx/main.m @@ -0,0 +1,250 @@ +// +// main.m +// +// Created by Gil Pedersen on Fri Jun 06 2003. +// Copyright (c) 2003 SoftWorkz. All rights reserved. +// + +#import <Cocoa/Cocoa.h> +#import <Carbon/Carbon.h> +#import "EmuThread.h" +#include <dlfcn.h> +//#import <sys/param.h> +#import <unistd.h> +#include "psxcommon.h" +#include "sio.h" + +int sysInited = 0; +long LoadCdBios; + +//#define EMU_LOG + +int main(int argc, const char *argv[]) +{ + if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) { + char parentdir[MAXPATHLEN]; + char *c; + + strncpy ( parentdir, argv[0], sizeof(parentdir) ); + c = (char*) parentdir; + + while (*c != '\0') /* go to end */ + c++; + + while (*c != '/') /* back up to parent */ + c--; + + *c++ = '\0'; /* cut off last part (binary name) */ + + assert ( chdir (parentdir) == 0 ); /* chdir to the binary app's parent */ + assert ( chdir ("../../../") == 0 ); /* chdir to the .app's parent */ + } + + // TODO: make this redundant + strcpy(Config.BiosDir, "Bios/"); + + // Setup the X11 window + if (getenv("DISPLAY") == NULL) + setenv("DISPLAY", ":0.0", 0); // Default to first local display + + return NSApplicationMain(argc, argv); +} + + +int SysInit() +{ + if (sysInited) + return 0; + +#ifdef GTE_DUMP + gteLog = fopen("gteLog.txt","wb"); + setvbuf(gteLog, NULL, _IONBF, 0); +#endif + +#ifdef EMU_LOG +#ifndef LOG_STDOUT + emuLog = fopen("emuLog.txt","wb"); +#else + emuLog = stdout; +#endif + setvbuf(emuLog, NULL, _IONBF, 0); +#endif + + if (psxInit() != 0) + return -1; + + while (LoadPlugins() == -1) { + return -1; + //CancelQuit = 1; + //ConfigurePlugins(); + //CancelQuit = 0; + } + + LoadMcds(Config.Mcd1, Config.Mcd2); + + sysInited = 1; + + return 0; +} + +void SysReset() { + [EmuThread resetNow]; + //psxReset(); +} + +void SysPrintf(char *fmt, ...) +{ + va_list list; + char msg[512]; + + va_start(list, fmt); + vsprintf(msg, fmt, list); + va_end(list); + + if (Config.PsxOut) printf ("%s", msg); +#ifdef EMU_LOG +#ifndef LOG_STDOUT + fprintf(emuLog, "%s", msg); +#endif +#endif +} + +void SysMessage(char *fmt, ...) +{ + va_list list; + char msg[512]; + + NSString *locFmtString = NSLocalizedString([NSString stringWithCString:fmt], nil); + + va_start(list, fmt); + vsprintf(msg, [locFmtString lossyCString], list); + va_end(list); + + NSRunAlertPanel(NSLocalizedString(@"Error!", nil), + [NSString stringWithCString:msg], + nil, nil, nil); +} + +#if 1 +void *SysLoadLibrary(char *lib) { + NSBundle *bundle = [NSBundle bundleWithPath:[NSString stringWithCString:lib]]; + if (bundle != nil) { + return dlopen([[bundle executablePath] fileSystemRepresentation], RTLD_LAZY /*RTLD_NOW*/); + } + return dlopen(lib, RTLD_LAZY); +} + +void *SysLoadSym(void *lib, char *sym) { + return dlsym(lib, sym); +} + +const char *SysLibError() { + return dlerror(); +} + +void SysCloseLibrary(void *lib) { + //dlclose(lib); +} +#else +static int LoadResult = 0; +void *SysLoadLibrary(char *lib) +{ + CFBundleRef myBundle; + CFURLRef bundleURL; + CFStringRef path; + + path = CFStringCreateWithCString(kCFAllocatorDefault, lib, CFStringGetSystemEncoding()); + if (!path) + goto error; + + bundleURL = CFURLCreateWithFileSystemPath( + kCFAllocatorDefault, + path, + kCFURLPOSIXPathStyle, + true ); + if (!bundleURL) + goto error; + + myBundle = CFBundleCreate( kCFAllocatorDefault, bundleURL ); + + if (!CFBundleLoadExecutable(myBundle)) + goto error; + +good: + if (path) CFRelease(path); + if (bundleURL) CFRelease(bundleURL); + + return myBundle; + +error: + if (LoadResult == 0) LoadResult = -1; + myBundle = NULL; + goto good; +} + +void *SysLoadSym(void *lib, char *sym) +{ + CFStringRef funcName; + void *func; + + funcName = CFStringCreateWithCString(kCFAllocatorDefault, sym, CFStringGetSystemEncoding()); + func = CFBundleGetFunctionPointerForName((CFBundleRef)lib, funcName); + if (func == nil) { + LoadResult = -2; + } + + CFRelease(funcName); + return func; +} + +const char *SysLibError() +{ + char *result = NULL; + + if (LoadResult != 0) + result = "Error loading code"; + + LoadResult = 0; + return result; +} +void SysCloseLibrary(void *lib) +{ + if (lib) { + CFBundleUnloadExecutable((CFBundleRef)lib); + CFRelease((CFBundleRef)lib); + } +} +#endif + +void PADhandleKey(int key); + +// Called periodically from the emu thread +void SysUpdate() +{ + UpdateSystemActivity(UsrActivity); + + PADhandleKey(PAD1_keypressed()); + //PADhandleKey(PAD2_keypressed()); + + [emuThread handleEvents]; +} + +void SysRunGui() // Returns to the Gui +{ + +} +void SysClose() // Close mem and plugins +{ + psxShutdown(); + ReleasePlugins(); + + if (emuLog != NULL) fclose(emuLog); + + sysInited = false; +} + +void OnFile_Exit() +{ + SysClose(); + exit(0); +}
\ No newline at end of file |
