mirror of https://github.com/snes9xgit/snes9x.git
Mac: Return hardware and software reset menu items
This commit is contained in:
parent
a893ad05e3
commit
c4cdc18068
|
@ -471,6 +471,11 @@ static NSWindowFrameAutosaveName const kMainWindowIdentifier = @"s9xMainWindow";
|
|||
|
||||
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
|
||||
{
|
||||
SEL action = menuItem.action;
|
||||
if (action == @selector(resume:) || action == @selector(softwareReset:) || action == @selector(hardwareReset:)) {
|
||||
return [self.s9xEngine isRunning] && [self.s9xEngine isPaused];
|
||||
}
|
||||
|
||||
return !self.isRunningEmulation;
|
||||
}
|
||||
|
||||
|
@ -520,6 +525,16 @@ static NSWindowFrameAutosaveName const kMainWindowIdentifier = @"s9xMainWindow";
|
|||
[self.s9xEngine resume];
|
||||
}
|
||||
|
||||
- (IBAction)softwareReset:(id)sender
|
||||
{
|
||||
[self.s9xEngine softwareReset];
|
||||
}
|
||||
|
||||
- (IBAction)hardwareReset:(id)sender
|
||||
{
|
||||
[self.s9xEngine hardwareReset];
|
||||
}
|
||||
|
||||
- (BOOL)handleInput:(S9xJoypadInput *)input fromJoypad:(S9xJoypad *)joypad
|
||||
{
|
||||
if (NSApp.keyWindow != nil && NSApp.keyWindow == self.prefsWindowController.window)
|
||||
|
|
|
@ -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"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
|
||||
|
@ -104,6 +104,18 @@
|
|||
<action selector="resume:" target="-1" id="jxw-ZM-JXi"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="wRV-3p-Ovs"/>
|
||||
<menuItem title="Software Reset" keyEquivalent="R" id="rpq-ak-IWU">
|
||||
<connections>
|
||||
<action selector="softwareReset:" target="-1" id="SCG-64-bMI"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Hardware Reset" keyEquivalent="r" id="tbk-CC-2si">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="hardwareReset:" target="-1" id="dRy-5Q-N2I"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
|
|
|
@ -168,6 +168,8 @@ extern id<S9xInputDelegate> inputDelegate;
|
|||
|
||||
- (void)start;
|
||||
- (void)stop;
|
||||
- (void)softwareReset;
|
||||
- (void)hardwareReset;
|
||||
|
||||
- (BOOL)isRunning;
|
||||
- (BOOL)isPaused;
|
||||
|
|
|
@ -1710,6 +1710,7 @@ int PromptFreezeDefrost (Boolean freezing)
|
|||
const char letters[] = "123456789ABC", *filename;
|
||||
|
||||
frzselecting = true;
|
||||
[s9xView updatePauseOverlay];
|
||||
oldInactiveMode = inactiveMode;
|
||||
if (inactiveMode == 3)
|
||||
inactiveMode = 2;
|
||||
|
@ -2036,7 +2037,7 @@ int PromptFreezeDefrost (Boolean freezing)
|
|||
usleep(30000);
|
||||
|
||||
UpdateFreezeDefrostScreen(current_selection, image, draw, ctx);
|
||||
} while (result == -2);
|
||||
} while (result == -2 && frzselecting);
|
||||
|
||||
CocoaPlayFreezeDefrostSound();
|
||||
|
||||
|
@ -2050,6 +2051,9 @@ int PromptFreezeDefrost (Boolean freezing)
|
|||
|
||||
inactiveMode = oldInactiveMode;
|
||||
frzselecting = false;
|
||||
pauseEmulation = false;
|
||||
|
||||
[s9xView updatePauseOverlay];
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
@ -2610,6 +2614,7 @@ static void Initialize (void)
|
|||
}
|
||||
|
||||
frzselecting = false;
|
||||
[s9xView updatePauseOverlay];
|
||||
|
||||
S9xSetControllerCrosshair(X_MOUSE1, 0, NULL, NULL);
|
||||
S9xSetControllerCrosshair(X_MOUSE2, 0, NULL, NULL);
|
||||
|
@ -2936,8 +2941,7 @@ void QuitWithFatalError ( NSString *message)
|
|||
- (void)updatePauseOverlay
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
NSLog(@"%d", pauseEmulation);
|
||||
self.subviews[0].hidden = !pauseEmulation;
|
||||
self.subviews[0].hidden = (frzselecting || !pauseEmulation);
|
||||
CGFloat scaleFactor = MAX(self.window.backingScaleFactor, 1.0);
|
||||
glScreenW = self.frame.size.width * scaleFactor;
|
||||
glScreenH = self.frame.size.height * scaleFactor;
|
||||
|
@ -3030,6 +3034,21 @@ void QuitWithFatalError ( NSString *message)
|
|||
S9xExit();
|
||||
}
|
||||
|
||||
- (void)softwareReset
|
||||
{
|
||||
SNES9X_SoftReset();
|
||||
SNES9X_Go();
|
||||
[self resume];
|
||||
}
|
||||
|
||||
|
||||
- (void)hardwareReset
|
||||
{
|
||||
SNES9X_Reset();
|
||||
SNES9X_Go();
|
||||
[self resume];
|
||||
}
|
||||
|
||||
- (BOOL)isRunning
|
||||
{
|
||||
return running;
|
||||
|
@ -3172,6 +3191,7 @@ void QuitWithFatalError ( NSString *message)
|
|||
- (BOOL)loadROM:(NSURL *)fileURL
|
||||
{
|
||||
running = false;
|
||||
frzselecting = false;
|
||||
|
||||
while (!Settings.StopEmulation)
|
||||
{
|
||||
|
@ -3183,6 +3203,12 @@ void QuitWithFatalError ( NSString *message)
|
|||
SNES9X_Go();
|
||||
s9xView.window.title = fileURL.lastPathComponent.stringByDeletingPathExtension;
|
||||
[s9xView.window makeKeyAndOrderFront:nil];
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^
|
||||
{
|
||||
[s9xView.window makeFirstResponder:s9xView];
|
||||
});
|
||||
|
||||
[self start];
|
||||
return YES;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue