From 8b4350fee747708ffd376744ef5dc1e239a87ba6 Mon Sep 17 00:00:00 2001 From: iCatButler Date: Wed, 30 Mar 2016 15:07:35 +0100 Subject: Bring up to date with PCSX-R master (97809) --- macosx/Source/PcsxrPlugin.m | 43 ++++++++++++++++++------------------------- 1 file changed, 18 insertions(+), 25 deletions(-) (limited to 'macosx/Source/PcsxrPlugin.m') diff --git a/macosx/Source/PcsxrPlugin.m b/macosx/Source/PcsxrPlugin.m index 09e3eecf..016aefff 100644 --- a/macosx/Source/PcsxrPlugin.m +++ b/macosx/Source/PcsxrPlugin.m @@ -242,20 +242,15 @@ #define PluginSymbolNameConfigure(type) PluginSymbolName(type, @"configure") #define PluginSymbolNameAbout(type) PluginSymbolName(type, @"about") -- (void)runCommand:(id)arg +- (void)runCommandNamed:(NSString*)arg { - @autoreleasepool { - NSString *funcName = arg[0]; - long (*func)(void); - - func = SysLoadSym(pluginRef, [funcName cStringUsingEncoding:NSASCIIStringEncoding]); - if (SysLibError() == NULL) { - func(); - } else { - NSBeep(); - } - - return; + long (*func)(void); + + func = SysLoadSym(pluginRef, [arg cStringUsingEncoding:NSASCIIStringEncoding]); + if (SysLibError() == NULL) { + func(); + } else { + NSBeep(); } } @@ -336,26 +331,24 @@ - (void)aboutAs:(int)aType { - NSArray *arg; - NSString *aboutSym = PluginSymbolNameAbout(aType); - arg = @[aboutSym, @0]; + //NSArray *arg = @[aboutSym, @0]; // detach a new thread - [NSThread detachNewThreadSelector:@selector(runCommand:) toTarget:self - withObject:arg]; + dispatch_async(dispatch_get_global_queue(0, 0), ^{ + [self runCommandNamed:aboutSym]; + }); } - (void)configureAs:(int)aType { - NSArray *arg; - NSString *configSym = PluginSymbolNameConfigure(aType); - arg = @[configSym, @1]; + //NSArray *arg = @[configSym, @1]; // detach a new thread - [NSThread detachNewThreadSelector:@selector(runCommand:) toTarget:self - withObject:arg]; + dispatch_async(dispatch_get_global_queue(0, 0), ^{ + [self runCommandNamed:configSym]; + }); } - (NSString *)displayVersion @@ -376,7 +369,7 @@ if (_name == nil) return [path lastPathComponent]; - return [NSString stringWithFormat:@"%@ %@ [%@]", self.name, [self displayVersion], [path lastPathComponent]]; + return [NSString stringWithFormat:@"%@ %@ [%@]", self.name, self.displayVersion, path.lastPathComponent]; } - (NSString*)debugDescription @@ -384,7 +377,7 @@ if (_name == nil) { return fullPlugPath; } - return [NSString stringWithFormat:@"%@, %@ [%@]", self.name, [self displayVersion], fullPlugPath]; + return [NSString stringWithFormat:@"%@, %@ [%@]", self.name, self.displayVersion, fullPlugPath]; } // the plugin will check if it's still valid and return the status -- cgit v1.2.3