From eefd3033cd7745e3bb7773fc2bd4f6b8698b8cff Mon Sep 17 00:00:00 2001 From: Michael Buckley Date: Mon, 7 Sep 2020 13:59:39 -0700 Subject: [PATCH] Mac: Make escape key resume as well as pause --- macosx/Snes9x/S9xPrefsViewController.xib | 6 +++--- macosx/mac-os.mm | 21 +++++++++++++++------ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/macosx/Snes9x/S9xPrefsViewController.xib b/macosx/Snes9x/S9xPrefsViewController.xib index b7e176a2..9cbe4160 100644 --- a/macosx/Snes9x/S9xPrefsViewController.xib +++ b/macosx/Snes9x/S9xPrefsViewController.xib @@ -1,8 +1,8 @@ - + - + @@ -189,7 +189,7 @@ - + diff --git a/macosx/mac-os.mm b/macosx/mac-os.mm index 66a68f5e..64f7011c 100644 --- a/macosx/mac-os.mm +++ b/macosx/mac-os.mm @@ -295,6 +295,7 @@ struct GameViewInfo static volatile bool8 rejectinput = false; static bool8 pauseEmulation = false, + escKeyDown = false, frameAdvance = false; static int frameCount = 0; @@ -2245,14 +2246,22 @@ static void ProcessInput (void) if (ISpKeyIsPressed(keys, gamepadButtons, kISpEsc)) { - pauseEmulation = true; - [s9xView updatePauseOverlay]; + if (!escKeyDown) + { + escKeyDown = true; + pauseEmulation = !pauseEmulation; + [s9xView updatePauseOverlay]; - dispatch_async(dispatch_get_main_queue(), ^ - { - [s9xView setNeedsDisplay:YES]; - }); + dispatch_async(dispatch_get_main_queue(), ^ + { + [s9xView setNeedsDisplay:YES]; + }); + } } + else + { + escKeyDown = false; + } if (ISpKeyIsPressed(keys, gamepadButtons, kISpFreeze)) {