Skip to content

Commit

Permalink
Mac: Make escape key resume as well as pause
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelBuckley committed Sep 7, 2020
1 parent c4cdc18 commit eefd303
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
6 changes: 3 additions & 3 deletions macosx/Snes9x/S9xPrefsViewController.xib
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="15400" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="17154" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15400"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17154"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Expand Down Expand Up @@ -189,7 +189,7 @@
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="drA-2C-LPt">
<rect key="frame" x="230" y="443" width="151" height="16"/>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="Escape" id="tle-rH-QLe">
<textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="Pause/Resume" id="tle-rH-QLe">
<font key="font" usesAppearanceFont="YES"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
Expand Down
21 changes: 15 additions & 6 deletions macosx/mac-os.mm
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ SNES9X for Mac OS (c) Copyright John Stiles
static volatile bool8 rejectinput = false;

static bool8 pauseEmulation = false,
escKeyDown = false,
frameAdvance = false;

static int frameCount = 0;
Expand Down Expand Up @@ -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))
{
Expand Down

0 comments on commit eefd303

Please sign in to comment.