diff options
| author | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2009-11-04 02:46:27 +0000 |
|---|---|---|
| committer | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2009-11-04 02:46:27 +0000 |
| commit | 559fd026bb57e0d71615b237c37a31f287af5940 (patch) | |
| tree | ab44f09ca16f2e840c6a544a2fba787577c99960 | |
| parent | a2da60aec08bb90c8e55f9ff5178701a309dbb9c (diff) | |
| download | pcsxr-559fd026bb57e0d71615b237c37a31f287af5940.tar.gz | |
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@35397 e17a0e51-4ae3-4d35-97c3-1a29b211df97
| -rw-r--r-- | ChangeLog | 7 | ||||
| -rw-r--r-- | macosx/EmuThread.h | 2 | ||||
| -rw-r--r-- | macosx/EmuThread.m | 94 | ||||
| -rw-r--r-- | macosx/English.lproj/PCSX.nib/classes.nib | 1 | ||||
| -rw-r--r-- | macosx/English.lproj/PCSX.nib/info.nib | 4 | ||||
| -rw-r--r-- | macosx/English.lproj/PCSX.nib/objects.nib | bin | 3402 -> 3484 bytes | |||
| -rw-r--r-- | macosx/Pcsx.xcodeproj/project.pbxproj | 2 | ||||
| -rw-r--r-- | macosx/PcsxController.h | 2 | ||||
| -rw-r--r-- | macosx/PcsxController.m | 17 |
9 files changed, 107 insertions, 22 deletions
@@ -2,6 +2,13 @@ November 4, 2009 Wei Mingzhi <weimingzhi@gmail.com> * libpcsxcore/sio.c: Fixed the format of new memory card file, which solves the saving problem with Final Fantasy 6. + * macosx/EmuThread.h: Added "Run BIOS" menu item. + * macosx/PcsxController.h: Likewise. + * macosx/EmuThread.m: Likewise. + * macosx/PcsxController.m: Likewise. + * macosx/English.lproj/PCSX.nib/objects.nib: Likewise. + * macosx/English.lproj/PCSX.nib/info.nib: Likewise. + * macosx/English.lproj/PCSX.nib/classes.nib: Likewise. November 3, 2009 Wei Mingzhi <weimingzhi@gmail.com> diff --git a/macosx/EmuThread.h b/macosx/EmuThread.h index 7a88c444..7a20ea64 100644 --- a/macosx/EmuThread.h +++ b/macosx/EmuThread.h @@ -16,9 +16,11 @@ } - (void)EmuThreadRun:(id)anObject; +- (void)EmuThreadRunBios:(id)anObject; - (void)handleEvents; + (void)run; ++ (void)runBios; + (void)stop; + (BOOL)pause; + (BOOL)pauseSafe; diff --git a/macosx/EmuThread.m b/macosx/EmuThread.m index cb4ef8fb..f8be4338 100644 --- a/macosx/EmuThread.m +++ b/macosx/EmuThread.m @@ -33,7 +33,7 @@ static pthread_mutex_t eventMutex; - (void)EmuThreadRun:(id)anObject { pool = [[NSAutoreleasePool alloc] init]; - + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(emuWindowDidClose:) name:@"emuWindowDidClose" object:nil]; @@ -45,14 +45,14 @@ static pthread_mutex_t eventMutex; [[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(); } @@ -80,6 +80,42 @@ done: return; } +- (void)EmuThreadRunBios:(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(); + } + + psxCpu->Execute(); + +done: + [pool release]; pool = nil; + emuThread = nil; + + return; +} + - (void)dealloc { // remove all registered observers @@ -170,39 +206,73 @@ done: } } - + (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]; + + emuThread = [[EmuThread alloc] init]; [NSThread detachNewThreadSelector:@selector(EmuThreadRun:) toTarget:emuThread withObject:nil]; - + + pthread_mutex_unlock(&eventMutex); +} + ++ (void)runBios +{ + 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(EmuThreadRunBios:) + toTarget:emuThread withObject:nil]; + pthread_mutex_unlock(&eventMutex); } diff --git a/macosx/English.lproj/PCSX.nib/classes.nib b/macosx/English.lproj/PCSX.nib/classes.nib index 1bd6e1b8..2aaff676 100644 --- a/macosx/English.lproj/PCSX.nib/classes.nib +++ b/macosx/English.lproj/PCSX.nib/classes.nib @@ -11,6 +11,7 @@ pause = id; preferences = id; reset = id; + runBios = id; runCD = id; runExe = id; runIso = id; diff --git a/macosx/English.lproj/PCSX.nib/info.nib b/macosx/English.lproj/PCSX.nib/info.nib index adce8580..8c74e8a3 100644 --- a/macosx/English.lproj/PCSX.nib/info.nib +++ b/macosx/English.lproj/PCSX.nib/info.nib @@ -3,11 +3,11 @@ <plist version="1.0"> <dict> <key>IBDocumentLocation</key> - <string>273 288 492 320 0 0 1024 746 </string> + <string>343 376 492 320 0 0 1024 746 </string> <key>IBEditorPositions</key> <dict> <key>29</key> - <string>79 658 219 44 0 0 1024 746 </string> + <string>162 512 219 44 0 0 1024 746 </string> </dict> <key>IBFramework Version</key> <string>446.1</string> diff --git a/macosx/English.lproj/PCSX.nib/objects.nib b/macosx/English.lproj/PCSX.nib/objects.nib Binary files differindex b4ceb493..adcfe385 100644 --- a/macosx/English.lproj/PCSX.nib/objects.nib +++ b/macosx/English.lproj/PCSX.nib/objects.nib diff --git a/macosx/Pcsx.xcodeproj/project.pbxproj b/macosx/Pcsx.xcodeproj/project.pbxproj index 5d282123..71dd2a2a 100644 --- a/macosx/Pcsx.xcodeproj/project.pbxproj +++ b/macosx/Pcsx.xcodeproj/project.pbxproj @@ -139,7 +139,7 @@ 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; }; + 2BB3D6D105427FE200831ACB /* PCSX.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; 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>"; }; diff --git a/macosx/PcsxController.h b/macosx/PcsxController.h index 13738469..7c716c3b 100644 --- a/macosx/PcsxController.h +++ b/macosx/PcsxController.h @@ -23,7 +23,7 @@ - (IBAction)reset:(id)sender; - (IBAction)runCD:(id)sender; - (IBAction)runIso:(id)sender; -- (IBAction)runExe:(id)sender; +- (IBAction)runBios:(id)sender; - (IBAction)freeze:(id)sender; - (IBAction)defrost:(id)sender; - (IBAction)fullscreen:(id)sender; diff --git a/macosx/PcsxController.m b/macosx/PcsxController.m index 98792f9f..d4e82b13 100644 --- a/macosx/PcsxController.m +++ b/macosx/PcsxController.m @@ -123,8 +123,10 @@ NSString *saveStatePath; } } -- (IBAction)runExe:(id)sender +- (IBAction)runBios:(id)sender { + cdrfilename[0] = '\0'; + [EmuThread runBios]; } - (IBAction)freeze:(id)sender @@ -157,12 +159,15 @@ NSString *saveStatePath; [menuItem action] == @selector(fullscreen:)) return [EmuThread active]; - if ([menuItem action] == @selector(runCD:) || [menuItem action] == @selector(runIso:)) { - if (preferenceWindow != nil) { - if ([preferenceWindow isVisible]) { + if ([menuItem action] == @selector(runCD:) || [menuItem action] == @selector(runIso:) || + [menuItem action] == @selector(runBios:)) { + if (preferenceWindow != nil) + if ([preferenceWindow isVisible]) return NO; - } - } + + if ([menuItem action] == @selector(runBios:) && strcmp(Config.Bios, "HLE") == 0) + return NO; + return ![EmuThread active]; } |
