diff --git a/Source/Core/AudioCommon/Src/SConscript b/Source/Core/AudioCommon/Src/SConscript index 82f141e495..d0b1bcefb8 100644 --- a/Source/Core/AudioCommon/Src/SConscript +++ b/Source/Core/AudioCommon/Src/SConscript @@ -28,6 +28,6 @@ if acenv['HAVE_PULSEAUDIO']: if sys.platform == 'darwin': files += [ 'CoreAudioSoundStream.cpp' ] - acenv['FRAMEWORKS'] = [ 'CoreAudio' ] + acenv['FRAMEWORKS'] = [ 'CoreAudio', 'AudioUnit' ] acenv.StaticLibrary(env['local_libs'] + 'audiocommon', files) diff --git a/Source/Core/DolphinWX/Src/MainNoGUI.cpp b/Source/Core/DolphinWX/Src/MainNoGUI.cpp index 6e487c721e..583470b16c 100644 --- a/Source/Core/DolphinWX/Src/MainNoGUI.cpp +++ b/Source/Core/DolphinWX/Src/MainNoGUI.cpp @@ -186,7 +186,11 @@ int main(int argc, char *argv[]) while(true) { event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ]; - cocoaSendEvent(event); + if(cocoaSendEvent(event)) + { + PowerPC::Shutdown(); + break; + } } diff --git a/Source/Core/DolphinWX/Src/cocoaApp.h b/Source/Core/DolphinWX/Src/cocoaApp.h index f79d5cd19a..81e3d17704 100644 --- a/Source/Core/DolphinWX/Src/cocoaApp.h +++ b/Source/Core/DolphinWX/Src/cocoaApp.h @@ -5,7 +5,7 @@ extern "C" { #endif -void cocoaSendEvent(NSEvent *event); +bool cocoaSendEvent(NSEvent *event); void cocoaCreateApp(); diff --git a/Source/Core/DolphinWX/Src/cocoaApp.m b/Source/Core/DolphinWX/Src/cocoaApp.m index 03d7018542..15ac8d3fc2 100644 --- a/Source/Core/DolphinWX/Src/cocoaApp.m +++ b/Source/Core/DolphinWX/Src/cocoaApp.m @@ -46,25 +46,44 @@ void cocoaCreateApp() } -void cocoaKeyCode(NSEvent *event) +bool cocoaKeyCode(NSEvent *event) { - + static bool CMDDown = false, QDown = false; + bool Return = false; NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSConnection *connec = [NSConnection defaultConnection]; - [connec setRootObject: event]; - if ([connec registerName: @"DolphinCocoaEvent"] == NO) - { - //printf("error creating nsconnection\n"); - } + [connec setRootObject: event]; + if ([connec registerName: @"DolphinCocoaEvent"] == NO) + { + //printf("error creating nsconnection\n"); + } + + if( [event type] != NSFlagsChanged ) + { + NSString *NewString = [event characters]; + char *Keys = [NewString UTF8String]; + + if( Keys[0] == 'q' && [event type] == NSKeyDown ) + QDown = true; + if( Keys[0] == 'q' && [event type] == NSKeyUp ) + QDown = false; + } + else + if( [event modifierFlags] & NSCommandKeyMask ) + CMDDown = true; + else + CMDDown = false; + + if( QDown && CMDDown ) + Return = true; [pool release]; - - + return Return; } -void cocoaSendEvent(NSEvent *event) +bool cocoaSendEvent(NSEvent *event) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; @@ -73,7 +92,8 @@ void cocoaSendEvent(NSEvent *event) switch ([event type]) { case NSKeyDown: case NSKeyUp: - cocoaKeyCode(event); + case NSFlagsChanged: // For Command + return cocoaKeyCode(event); break; default: [NSApp sendEvent:event]; @@ -83,6 +103,7 @@ void cocoaSendEvent(NSEvent *event) [pool release]; + return false; } diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/SConscript b/Source/Plugins/Plugin_DSP_HLE/Src/SConscript index 0763866e82..d965e01157 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/SConscript +++ b/Source/Plugins/Plugin_DSP_HLE/Src/SConscript @@ -43,6 +43,6 @@ dspenv.Append( LIBS = [ 'common', 'audiocommon' ], ) if sys.platform == 'darwin': - dspenv['FRAMEWORKS'] = [ 'CoreAudio', 'CoreServices' ] + dspenv['FRAMEWORKS'] = [ 'CoreAudio', 'CoreServices', 'AudioUnit' ] dspenv.SharedLibrary(env['plugin_dir']+name, files)