diff options
| author | SND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2012-12-20 23:04:58 +0000 |
|---|---|---|
| committer | SND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2012-12-20 23:04:58 +0000 |
| commit | 520a24fb83acd0bb98f8b364aa5ea1ceae43f76a (patch) | |
| tree | 2428c176eabe6fe62fd80ff3631b5ff36edd7a45 /macosx/hotkeys.m | |
| parent | 2bb5d0778664ab48097f80d212876263f604a747 (diff) | |
| download | pcsxr-520a24fb83acd0bb98f8b364aa5ea1ceae43f76a.tar.gz | |
Implement fast-forward in the display plug-ins for OS X.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@81907 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx/hotkeys.m')
| -rw-r--r-- | macosx/hotkeys.m | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/macosx/hotkeys.m b/macosx/hotkeys.m index 16d92fda..1c917439 100644 --- a/macosx/hotkeys.m +++ b/macosx/hotkeys.m @@ -16,6 +16,7 @@ #define HK_MAX_STATE 10 static id monitor; +static id gpuMonitor; static int currentState = 0; static NSMutableDictionary *hotkeys; enum { @@ -23,7 +24,8 @@ enum { HK_SAVE_STATE, HK_LOAD_STATE, HK_NEXT_STATE, - HK_PREV_STATE + HK_PREV_STATE, + HK_FRAME_LIMIT }; void nextState() { @@ -52,6 +54,12 @@ bool handleHotkey(NSString* keyCode) { GPU_keypressed(GPU_FAST_FORWARD); } break; + case HK_FRAME_LIMIT: + // Ignore FrameLimit requests if paused + if(![EmuThread isPaused]) { + GPU_keypressed(GPU_FRAME_LIMIT); + } + break; case HK_SAVE_STATE: [PcsxrController saveState:currentState]; break; @@ -90,11 +98,13 @@ void setupHotkeys() { setupHotkey(HK_LOAD_STATE, @"LoadState", [bindings objectForKey:@"LoadState"]); setupHotkey(HK_NEXT_STATE, @"NextState", [bindings objectForKey:@"NextState"]); setupHotkey(HK_PREV_STATE, @"PrevState", [bindings objectForKey:@"PrevState"]); + setupHotkey(HK_FRAME_LIMIT, @"FrameLimit", [bindings objectForKey:@"FrameLimit"]); currentState = 0; } void attachHotkeys() { + // Configurable hotkeys NSEvent* (^handler)(NSEvent*) = ^(NSEvent *event) { if(handleHotkey([NSString stringWithFormat:@"%d", [event keyCode]])) { return (NSEvent*)nil; // handled @@ -105,9 +115,19 @@ void attachHotkeys() { }; setupHotkeys(); monitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSKeyUpMask handler:handler]; + + // GPU key presses + NSEvent* (^gpuKeypress)(NSEvent*) = ^(NSEvent *event) { + GPU_keypressed([event keyCode]); + return (NSEvent*)nil; + }; + gpuMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:(NSKeyUpMask | NSControlKeyMask) handler:gpuKeypress]; } void detachHotkeys() { - if(hotkeys)[hotkeys release]; + [hotkeys release]; [NSEvent removeMonitor:monitor]; + [NSEvent removeMonitor:gpuMonitor]; + monitor = nil; + gpuMonitor = nil; } |
