Mac: Make escape key resume as well as pause

This commit is contained in:
Michael Buckley 2020-09-07 13:59:39 -07:00
parent c4cdc18068
commit eefd3033cd
2 changed files with 18 additions and 9 deletions

View File

@ -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>
@ -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"/>

View File

@ -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))
{