diff options
| author | SND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2013-06-26 04:39:52 +0000 |
|---|---|---|
| committer | SND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2013-06-26 04:39:52 +0000 |
| commit | 14380119bf8571a421366c64a3732953f3b6a2d0 (patch) | |
| tree | 5f3f268580564000b96b84c13576b712039dd35c /macosx/plugins/DFNet/macsrc | |
| parent | a7f23657775ce54a5f2a92b4419c12b181d73b6d (diff) | |
| download | pcsxr-14380119bf8571a421366c64a3732953f3b6a2d0.tar.gz | |
Some work on OS X's net plug-in.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@85561 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx/plugins/DFNet/macsrc')
| -rwxr-xr-x | macosx/plugins/DFNet/macsrc/SockDialog.m | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/macosx/plugins/DFNet/macsrc/SockDialog.m b/macosx/plugins/DFNet/macsrc/SockDialog.m index e07b2386..feee77d8 100755 --- a/macosx/plugins/DFNet/macsrc/SockDialog.m +++ b/macosx/plugins/DFNet/macsrc/SockDialog.m @@ -9,6 +9,8 @@ #import "SockDialog.h" #include "dfnet.h" +#import "EmuThread.h" + void SysMessage(const char *fmt, ...) { va_list list; @@ -22,13 +24,18 @@ void SysMessage(const char *fmt, ...) //sprintf(cmd, "message %s\n", msg); NSString *errString = [NSString stringWithUTF8String:msg]; fprintf(stderr, "%s", msg); - NSAlert *alert = [NSAlert alertWithMessageText:nil defaultButton:@"Exit" alternateButton:nil otherButton:nil informativeTextWithFormat:@"%@", errString]; + NSAlert *alert = [NSAlert alertWithMessageText:@"Error" defaultButton:@"Exit" alternateButton:nil otherButton:nil informativeTextWithFormat:@"%@", errString]; [alert setAlertStyle:NSCriticalAlertStyle]; //NSInteger result = NSRunAlertPanel(errString, nil, @"Okay", nil, nil); NSInteger result = [alert runModal]; if (result == NSAlertDefaultReturn) { - //TODO: Handle closing the emulator, but not quitting the program. + Class theEmuClass = NSClassFromString(@"EmuThread"); + if (theEmuClass) { + [theEmuClass stop]; + } else { + NSLog(@"Unable to stop emulation because the Objective-C class \"EmuThreaed\" was not found. Are you using a different emulator than PCSXR?"); + } } } @@ -37,14 +44,15 @@ static SockDialog *globalSock = nil; void sockCreateWaitDlg() { - if (globalSock == nil) { - globalSock = [[SockDialog alloc] init]; - } - NSWindow *tempWindow = [globalSock window]; - [tempWindow center]; - [globalSock showWindow:nil]; - [tempWindow makeKeyAndOrderFront:nil]; - + dispatch_sync(dispatch_get_main_queue(), ^{ + if (globalSock == nil) { + globalSock = [[SockDialog alloc] init]; + } + NSWindow *tempWindow = [globalSock window]; + [tempWindow center]; + [globalSock showWindow:nil]; + [tempWindow makeKeyAndOrderFront:nil]; + }); } void sockDlgUpdate() @@ -61,26 +69,27 @@ long sockOpen() void sockDestroyWaitDlg() { - if (globalSock != nil) { - [globalSock close]; - [globalSock release]; - globalSock = nil; - } + dispatch_sync(dispatch_get_main_queue(), ^{ + if (globalSock != nil) { + [globalSock close]; + [globalSock release]; + globalSock = nil; + } + }); } @implementation SockDialog + - (IBAction)cancel:(id)sender { WaitCancel = 1; - } - (id)init { if ((self = [super initWithWindowNibName:@"SockDialog"])) { - return self; - } else { - return nil; + } + return self; } -(void)dealloc |
