Merge pull request #670 from orsi/add-frameskip-ui

Adds frame skip stepper to preferences window
This commit is contained in:
Michael Buckley 2020-09-13 17:34:09 -07:00 committed by GitHub
commit c69170cb7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 166 additions and 19 deletions

View File

@ -41,6 +41,7 @@
- (BOOL)getValuesFromString:(NSString *)str cookie:(uint32 *)cookie value:(int32 *)value;
- (void)setVideoMode:(int)videoMode;
- (void)setMacFrameSkip:(int)_macFrameSkip;
- (void)setShowFPS:(BOOL)showFPS;
@end

View File

@ -119,7 +119,8 @@ static NSWindowFrameAutosaveName const kMainWindowIdentifier = @"s9xMainWindow";
@(kKeyTC).stringValue : @(kVK_ANSI_Comma)
},
kShowFPSPref: @(NO),
kVideoModePref:@(VIDEOMODE_BLOCKY)
kVideoModePref:@(VIDEOMODE_BLOCKY),
kMacFrameSkipPref:@(macFrameSkip)
};
[defaults registerDefaults:defaultSettings];
@ -513,6 +514,13 @@ static NSWindowFrameAutosaveName const kMainWindowIdentifier = @"s9xMainWindow";
[NSUserDefaults.standardUserDefaults synchronize];
}
- (void)setMacFrameSkip:(int)_macFrameSkip
{
[self.s9xEngine setMacFrameSkip:_macFrameSkip];
[NSUserDefaults.standardUserDefaults setObject:@(_macFrameSkip) forKey:kMacFrameSkipPref];
[NSUserDefaults.standardUserDefaults synchronize];
}
- (void)setShowFPS:(BOOL)showFPS
{
[self.s9xEngine setShowFPS:showFPS];

View File

@ -25,3 +25,4 @@ extern NSString * const kJoypadInputPrefs;
extern NSString * const kJoypadPlayerPrefs;
extern NSString * const kShowFPSPref;
extern NSString * const kVideoModePref;
extern NSString * const kMacFrameSkipPref;

View File

@ -25,3 +25,4 @@ NSString * const kJoypadInputPrefs = @"JoypadInputs";
NSString * const kJoypadPlayerPrefs = @"JoypadPlayers";
NSString * const kShowFPSPref = @"ShowFPS";
NSString * const kVideoModePref = @"VideoMode";
NSString * const kMacFrameSkipPref = @"FrameSkip";

View File

@ -30,6 +30,9 @@
@property (nonatomic, weak) IBOutlet NSButton *showFPSCheckbox;
@property (nonatomic, weak) IBOutlet NSPopUpButton *devicePopUp;
@property (nonatomic, weak) IBOutlet NSPopUpButton *playerPopUp;
@property (nonatomic, weak) IBOutlet NSTextField *macFrameSkipTextField;
@property (nonatomic, weak) IBOutlet NSStepper *macFrameSkipStepper;
@property (nonatomic, weak) IBOutlet NSButton *macFrameSkipAutomaticButton;
@end
@implementation S9xPrefsViewController
@ -103,6 +106,22 @@
{
NSUInteger index = MIN([NSUserDefaults.standardUserDefaults integerForKey:kVideoModePref], 1);
[self.videoModePopup selectItemAtIndex:index];
NSInteger macFrameSkipDefault = [NSUserDefaults.standardUserDefaults integerForKey:kMacFrameSkipPref];
// if macFrameSkip is equal to -1, set automatic checkbox
// to be checked, disable the ability to change frame skip values
// from stepper/text field, else leave automatic checkbox
// unchecked and set textfield to value
if (macFrameSkipDefault == -1) {
[self.macFrameSkipTextField setEnabled: false];
[self.macFrameSkipStepper setEnabled: false];
[self.macFrameSkipTextField setIntValue: 0]; // show something at least
[self.macFrameSkipAutomaticButton setIntValue: 1];
} else {
[self.macFrameSkipTextField setIntValue: (int)macFrameSkipDefault];
[self.macFrameSkipAutomaticButton setIntValue: 0];
}
self.showFPSCheckbox.state = [NSUserDefaults.standardUserDefaults boolForKey:kShowFPSPref];
if (self.devicePopUp.selectedItem.tag < 0)
@ -271,6 +290,12 @@
[appDelegate setVideoMode:(int)sender.selectedTag];
}
- (IBAction)setMacFrameSkip:(int)value
{
AppDelegate *appDelegate = (AppDelegate *)NSApp.delegate;
[appDelegate setMacFrameSkip:value];
}
- (BOOL)handleInput:(S9xJoypadInput *)input fromJoypad:(S9xJoypad *)joypad
{
id firstResponder = self.view.window.firstResponder;
@ -294,4 +319,43 @@
return NO;
}
- (IBAction) bumpMacFrameSkip:(NSStepper *)sender
{
int bumpValue = sender.intValue; // 1 or -1
int nextValue = self.macFrameSkipTextField.intValue + bumpValue;
// constrain value
if (nextValue < 0) {
nextValue = 0;
}
if (nextValue > 200) {
nextValue = 200;
}
[self.macFrameSkipTextField setIntValue: nextValue];
[sender setIntValue:0]; // reset stepper value
[self setMacFrameSkip:self.macFrameSkipTextField.intValue]; // execute setter
}
- (IBAction)onChangeMacFrameSkipTextField:(NSTextField *)sender
{
[self setMacFrameSkip:sender.intValue];
}
- (IBAction) onCheckMacFrameSkipAutomaticButton:(NSButton *)sender
{
if (sender.intValue == 1) {
// when automatic is checked, disable macFrameSkipTextField and
// macFrameSkipStepper, then set macFrameSkip to -1 (automatic)
[self.macFrameSkipTextField setEnabled:false];
[self.macFrameSkipStepper setEnabled:false];
[self setMacFrameSkip:-1];
} else {
// when automatic is unchecked, enable macFrameSkipTextField and
// macFrameSkipStepper, then set macFrameSkip to value of text field
[self.macFrameSkipTextField setEnabled:true];
[self.macFrameSkipStepper setEnabled:true];
[self setMacFrameSkip:self.macFrameSkipTextField.intValue];
}
}
@end

View File

@ -1,14 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="17154" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="16097.3" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17154"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="16097.3"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="S9xPrefsViewController">
<connections>
<outlet property="devicePopUp" destination="mJx-JF-xDg" id="jLF-8u-Xwv"/>
<outlet property="macFrameSkipAutomaticButton" destination="dm4-cc-JF5" id="sxP-dw-fAF"/>
<outlet property="macFrameSkipStepper" destination="IaD-Uw-dY2" id="cSX-pd-NH5"/>
<outlet property="macFrameSkipTextField" destination="Bsh-R9-Dlr" id="gMg-kh-IcX"/>
<outlet property="playerPopUp" destination="hfx-Lg-t9P" id="pJR-nP-Ajt"/>
<outlet property="showFPSCheckbox" destination="M0c-Sj-o1i" id="4YI-cQ-MCK"/>
<outlet property="videoModePopup" destination="qNi-B0-E49" id="X4h-CV-IgC"/>
@ -18,11 +21,11 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="Hz6-mo-xeY">
<rect key="frame" x="0.0" y="0.0" width="507" height="574"/>
<rect key="frame" x="0.0" y="0.0" width="507" height="607"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="rxW-aA-Bai">
<rect key="frame" x="18" y="538" width="191" height="16"/>
<rect key="frame" x="18" y="568" width="191" height="16"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Video Mode (Requires Restart)" id="XoT-95-aIF">
<font key="font" usesAppearanceFont="YES"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@ -30,10 +33,10 @@
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="qNi-B0-E49">
<rect key="frame" x="213" y="532" width="85" height="25"/>
<rect key="frame" x="213" y="562" width="85" height="25"/>
<popUpButtonCell key="cell" type="push" title="Blocky" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="Xg7-hz-RRs" id="IRO-Ia-Tlm">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<font key="font" metaFont="system"/>
<menu key="menu" id="VtI-7w-Yps">
<items>
<menuItem title="Blocky" state="on" id="Xg7-hz-RRs"/>
@ -49,7 +52,7 @@
<rect key="frame" x="18" y="503" width="472" height="25"/>
<popUpButtonCell key="cell" type="push" title="Player 1" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="Mes-ZE-LOG" id="3Oa-7I-2cH">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<font key="font" metaFont="system"/>
<menu key="menu" id="nds-U1-9Cm">
<items>
<menuItem title="Player 1" state="on" id="Mes-ZE-LOG"/>
@ -212,7 +215,7 @@
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="M0c-Sj-o1i">
<rect key="frame" x="406" y="537" width="83" height="18"/>
<rect key="frame" x="406" y="567" width="83" height="18"/>
<buttonCell key="cell" type="check" title="Show FPS" bezelStyle="regularSquare" imagePosition="left" inset="2" id="l8L-ZQ-K9n">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
@ -313,7 +316,7 @@
<rect key="frame" x="18" y="474" width="472" height="25"/>
<popUpButtonCell key="cell" type="push" title="Keyboard" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" tag="-1" imageScaling="proportionallyDown" inset="2" selectedItem="Cs2-1w-ccm" id="ui9-4e-0EL">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<font key="font" metaFont="system"/>
<menu key="menu" id="vSY-DD-mp3">
<items>
<menuItem title="Keyboard" state="on" tag="-1" id="Cs2-1w-ccm"/>
@ -649,6 +652,49 @@
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</searchFieldCell>
</searchField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="sOh-ed-25I">
<rect key="frame" x="18" y="539" width="72" height="17"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Frame Skip" id="0le-xb-KuF">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" tag="30" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Bsh-R9-Dlr">
<rect key="frame" x="96" y="537" width="92" height="21"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" allowsUndo="NO" state="on" borderStyle="bezel" userInterfaceLayoutDirection="rightToLeft" drawsBackground="YES" id="woe-Qv-FXl">
<numberFormatter key="formatter" formatterBehavior="default10_4" usesGroupingSeparator="NO" formatWidth="-1" groupingSize="0" minimumIntegerDigits="1" maximumIntegerDigits="42" id="BAb-Gt-XZ4">
<real key="minimum" value="0.0"/>
<real key="maximum" value="200"/>
</numberFormatter>
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<action selector="onChangeMacFrameSkipTextField:" target="-2" id="eES-eP-ieP"/>
</connections>
</textField>
<stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" tag="31" translatesAutoresizingMaskIntoConstraints="NO" id="IaD-Uw-dY2">
<rect key="frame" x="193" y="534" width="11" height="27"/>
<constraints>
<constraint firstAttribute="width" constant="5" id="u6x-r3-Jfe"/>
</constraints>
<stepperCell key="cell" continuous="YES" alignment="left" minValue="-1" maxValue="1" id="uMn-9w-wv4"/>
<connections>
<action selector="bumpMacFrameSkip:" target="-2" id="TvS-ra-49M"/>
</connections>
</stepper>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="dm4-cc-JF5">
<rect key="frame" x="213" y="538" width="84" height="18"/>
<buttonCell key="cell" type="check" title="Automatic" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="RnP-hr-tdm">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="onCheckMacFrameSkipAutomaticButton:" target="-2" id="NAV-8e-UQW"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstItem="lSq-25-AV2" firstAttribute="leading" secondItem="NeB-Rh-CKs" secondAttribute="trailing" constant="8" id="06f-oZ-gc9"/>
@ -662,26 +708,33 @@
<constraint firstItem="3Cb-Ht-JzJ" firstAttribute="width" secondItem="ISU-xt-cZa" secondAttribute="width" id="1ue-OI-XNP"/>
<constraint firstItem="qMp-14-9zW" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" id="2ef-fb-3h5"/>
<constraint firstItem="TIz-bI-n89" firstAttribute="leading" secondItem="R5Q-JF-7P7" secondAttribute="trailing" constant="8" id="2hW-Ue-Vsp"/>
<constraint firstItem="Bsh-R9-Dlr" firstAttribute="bottom" secondItem="IaD-Uw-dY2" secondAttribute="bottom" id="2yb-LM-3mU"/>
<constraint firstItem="GDm-WA-rkG" firstAttribute="firstBaseline" secondItem="TuE-fA-Shh" secondAttribute="firstBaseline" id="42O-Cs-57E"/>
<constraint firstItem="WcI-SC-fZV" firstAttribute="width" secondItem="atg-Fg-IgS" secondAttribute="width" id="4g4-85-hQA"/>
<constraint firstItem="ycZ-re-pMx" firstAttribute="leading" secondItem="3Cb-Ht-JzJ" secondAttribute="trailing" constant="8" id="4gJ-MX-zP2"/>
<constraint firstItem="eZA-Af-a2e" firstAttribute="top" secondItem="Lw1-zP-Vdy" secondAttribute="bottom" constant="8" id="5TI-QI-4q6"/>
<constraint firstItem="c4Z-r1-O38" firstAttribute="width" secondItem="Rsg-HQ-Cig" secondAttribute="width" id="5dc-cT-5xJ"/>
<constraint firstItem="sOh-ed-25I" firstAttribute="firstBaseline" secondItem="Bsh-R9-Dlr" secondAttribute="firstBaseline" id="5hQ-2D-1xD"/>
<constraint firstItem="yHT-3q-ctP" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" id="69R-sL-5SF"/>
<constraint firstItem="Lw1-zP-Vdy" firstAttribute="leading" secondItem="fG8-lF-YYW" secondAttribute="trailing" constant="8" id="76v-dF-nMk"/>
<constraint firstItem="fG8-lF-YYW" firstAttribute="leading" secondItem="eyk-QN-lkH" secondAttribute="leading" id="7v6-7P-4kI"/>
<constraint firstItem="5wn-WM-n7f" firstAttribute="firstBaseline" secondItem="2BM-Lt-WwR" secondAttribute="firstBaseline" id="8Aa-9s-wDv"/>
<constraint firstItem="HIj-cE-Twd" firstAttribute="firstBaseline" secondItem="jHT-Uw-MKM" secondAttribute="firstBaseline" id="8K4-J6-7Ln"/>
<constraint firstItem="Pdg-iO-Rlv" firstAttribute="top" secondItem="5wn-WM-n7f" secondAttribute="bottom" constant="8" id="94J-2J-YaO"/>
<constraint firstItem="qNi-B0-E49" firstAttribute="baseline" secondItem="M0c-Sj-o1i" secondAttribute="baseline" id="98L-P2-vZa"/>
<constraint firstItem="iZL-4Q-g2k" firstAttribute="firstBaseline" secondItem="Ymc-Xn-VtU" secondAttribute="firstBaseline" id="9It-Ku-20r"/>
<constraint firstItem="56u-eS-Y7s" firstAttribute="firstBaseline" secondItem="yHT-3q-ctP" secondAttribute="firstBaseline" id="9O2-n7-6FK"/>
<constraint firstItem="0FY-cv-M9B" firstAttribute="leading" secondItem="5DP-Qu-lS2" secondAttribute="trailing" constant="8" id="9Os-Qg-zY5"/>
<constraint firstItem="Bsh-R9-Dlr" firstAttribute="top" secondItem="IaD-Uw-dY2" secondAttribute="top" id="9cb-1R-Vf9"/>
<constraint firstItem="Bsh-R9-Dlr" firstAttribute="leading" secondItem="sOh-ed-25I" secondAttribute="trailing" constant="8" symbolic="YES" id="APW-1K-2qV"/>
<constraint firstItem="drA-2C-LPt" firstAttribute="leading" secondItem="i6K-Iu-xdk" secondAttribute="trailing" constant="20" id="Aeq-Py-t3S"/>
<constraint firstItem="Rsg-HQ-Cig" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" id="Aj6-EC-8k6"/>
<constraint firstItem="WCt-Ri-ndL" firstAttribute="leading" secondItem="jOm-aT-92f" secondAttribute="trailing" constant="8" id="BiA-bF-aa5"/>
<constraint firstItem="sOh-ed-25I" firstAttribute="leading" secondItem="hfx-Lg-t9P" secondAttribute="leading" id="Bul-5l-Xfm"/>
<constraint firstItem="S5E-xU-QAK" firstAttribute="firstBaseline" secondItem="0xy-5S-ffb" secondAttribute="firstBaseline" id="C8b-74-452"/>
<constraint firstItem="eZA-Af-a2e" firstAttribute="firstBaseline" secondItem="eyk-QN-lkH" secondAttribute="firstBaseline" id="CNE-YW-lQs"/>
<constraint firstItem="r5O-6f-xdH" firstAttribute="leading" secondItem="dL6-2Y-CIz" secondAttribute="trailing" constant="8" id="Cb7-fX-o5V"/>
<constraint firstItem="IaD-Uw-dY2" firstAttribute="leading" secondItem="Bsh-R9-Dlr" secondAttribute="trailing" constant="8" symbolic="YES" id="Czh-L6-hWs"/>
<constraint firstItem="VRq-kT-wkC" firstAttribute="firstBaseline" secondItem="O9g-UA-3gp" secondAttribute="firstBaseline" id="DNz-VN-dnq"/>
<constraint firstItem="SSJ-4e-Tc8" firstAttribute="firstBaseline" secondItem="c4Z-r1-O38" secondAttribute="firstBaseline" id="Dfe-L2-A5d"/>
<constraint firstItem="56u-eS-Y7s" firstAttribute="top" secondItem="W7s-0d-JNo" secondAttribute="bottom" constant="8" id="DgW-BJ-cTD"/>
@ -694,6 +747,7 @@
<constraint firstItem="VRq-kT-wkC" firstAttribute="top" secondItem="TIz-bI-n89" secondAttribute="bottom" constant="8" id="FAT-MC-j2R"/>
<constraint firstItem="5Ro-Ix-JD5" firstAttribute="top" secondItem="lSq-25-AV2" secondAttribute="bottom" constant="8" id="FTG-52-WZK"/>
<constraint firstAttribute="trailing" secondItem="mJx-JF-xDg" secondAttribute="trailing" constant="20" id="FjE-V8-WQf"/>
<constraint firstItem="rxW-aA-Bai" firstAttribute="baseline" secondItem="qNi-B0-E49" secondAttribute="baseline" id="Fmc-7y-tWe"/>
<constraint firstItem="0xy-5S-ffb" firstAttribute="leading" secondItem="jOm-aT-92f" secondAttribute="leading" id="FnI-WM-zIE"/>
<constraint firstItem="56u-eS-Y7s" firstAttribute="leading" secondItem="yHT-3q-ctP" secondAttribute="trailing" constant="8" id="FuE-hi-SKb"/>
<constraint firstItem="jOm-aT-92f" firstAttribute="width" secondItem="Ymc-Xn-VtU" secondAttribute="width" id="GAQ-Ss-XPz"/>
@ -704,6 +758,7 @@
<constraint firstItem="Ns3-zZ-EQY" firstAttribute="firstBaseline" secondItem="drA-2C-LPt" secondAttribute="firstBaseline" id="I5P-lB-vVE"/>
<constraint firstAttribute="trailing" secondItem="hfx-Lg-t9P" secondAttribute="trailing" constant="20" id="IUn-oP-elS"/>
<constraint firstItem="Pdg-iO-Rlv" firstAttribute="firstBaseline" secondItem="biW-Zy-9NZ" secondAttribute="firstBaseline" id="Iw8-MZ-gXl"/>
<constraint firstItem="dm4-cc-JF5" firstAttribute="leading" secondItem="IaD-Uw-dY2" secondAttribute="trailing" constant="14" id="JNr-OG-mHT"/>
<constraint firstItem="xib-ad-dgH" firstAttribute="firstBaseline" secondItem="atg-Fg-IgS" secondAttribute="firstBaseline" id="JUk-Fe-nnv"/>
<constraint firstItem="mJx-JF-xDg" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" id="KLG-ZJ-Qep"/>
<constraint firstItem="r5O-6f-xdH" firstAttribute="firstBaseline" secondItem="dL6-2Y-CIz" secondAttribute="firstBaseline" id="KwJ-iX-Lem"/>
@ -724,12 +779,11 @@
<constraint firstAttribute="trailing" secondItem="hfx-Lg-t9P" secondAttribute="trailing" constant="20" id="SUL-1F-PVw"/>
<constraint firstItem="lSq-25-AV2" firstAttribute="top" secondItem="xib-ad-dgH" secondAttribute="bottom" constant="8" id="Scm-FO-oTB"/>
<constraint firstItem="ISU-xt-cZa" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" id="Spb-nj-cDC"/>
<constraint firstItem="M0c-Sj-o1i" firstAttribute="firstBaseline" secondItem="qNi-B0-E49" secondAttribute="firstBaseline" id="T6e-qJ-gZ3"/>
<constraint firstItem="RXV-hd-YH8" firstAttribute="leading" secondItem="fG8-lF-YYW" secondAttribute="leading" id="TNu-0d-7hY"/>
<constraint firstItem="rX2-Wj-CDJ" firstAttribute="top" secondItem="SSJ-4e-Tc8" secondAttribute="bottom" constant="8" id="TVc-Gm-Z9C"/>
<constraint firstItem="Rz0-Kg-nHG" firstAttribute="width" secondItem="AiU-u8-z9t" secondAttribute="width" id="TuG-69-3ZZ"/>
<constraint firstItem="hfx-Lg-t9P" firstAttribute="top" secondItem="qNi-B0-E49" secondAttribute="bottom" constant="8" id="U1a-EU-qRX"/>
<constraint firstItem="S5E-xU-QAK" firstAttribute="leading" secondItem="0xy-5S-ffb" secondAttribute="trailing" constant="8" id="V45-bc-c8o"/>
<constraint firstItem="qNi-B0-E49" firstAttribute="leading" secondItem="rxW-aA-Bai" secondAttribute="trailing" constant="8" symbolic="YES" id="VUA-9F-t1Q"/>
<constraint firstItem="0FY-cv-M9B" firstAttribute="firstBaseline" secondItem="5DP-Qu-lS2" secondAttribute="firstBaseline" id="VjF-HO-8el"/>
<constraint firstItem="atg-Fg-IgS" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" id="W43-Jm-i2I"/>
<constraint firstItem="yHB-42-ebc" firstAttribute="leading" secondItem="vrB-v6-gvS" secondAttribute="trailing" constant="8" id="WC4-cY-SXd"/>
@ -744,19 +798,20 @@
<constraint firstItem="5Ro-Ix-JD5" firstAttribute="leading" secondItem="Rz0-Kg-nHG" secondAttribute="trailing" constant="8" id="ZT8-H1-D7g"/>
<constraint firstItem="vrB-v6-gvS" firstAttribute="leading" secondItem="RXV-hd-YH8" secondAttribute="leading" id="ZkV-M1-Yc3"/>
<constraint firstItem="2BM-Lt-WwR" firstAttribute="width" secondItem="biW-Zy-9NZ" secondAttribute="width" id="a8L-cO-AXv"/>
<constraint firstItem="qNi-B0-E49" firstAttribute="firstBaseline" secondItem="rxW-aA-Bai" secondAttribute="firstBaseline" id="aRI-Fh-eSE"/>
<constraint firstItem="Fve-dp-udd" firstAttribute="firstBaseline" secondItem="jQs-eL-Df4" secondAttribute="firstBaseline" id="aa9-Eu-wYV"/>
<constraint firstItem="lSq-25-AV2" firstAttribute="firstBaseline" secondItem="NeB-Rh-CKs" secondAttribute="firstBaseline" id="bGA-rb-hEr"/>
<constraint firstItem="sOh-ed-25I" firstAttribute="baseline" secondItem="dm4-cc-JF5" secondAttribute="baseline" id="cPa-4g-AnV"/>
<constraint firstItem="5DP-Qu-lS2" firstAttribute="leading" secondItem="jQs-eL-Df4" secondAttribute="leading" id="cST-Al-uuC"/>
<constraint firstItem="hLf-i4-NRV" firstAttribute="leading" secondItem="ISU-xt-cZa" secondAttribute="trailing" constant="8" id="dBX-fh-DCK"/>
<constraint firstItem="drA-2C-LPt" firstAttribute="width" secondItem="5DP-Qu-lS2" secondAttribute="width" id="dXn-LW-UPX"/>
<constraint firstItem="0xy-5S-ffb" firstAttribute="width" secondItem="jOm-aT-92f" secondAttribute="width" id="dYD-sh-m5R"/>
<constraint firstItem="TuE-fA-Shh" firstAttribute="width" secondItem="jHT-Uw-MKM" secondAttribute="width" id="dy3-xX-glM"/>
<constraint firstItem="M0c-Sj-o1i" firstAttribute="trailing" secondItem="hfx-Lg-t9P" secondAttribute="trailing" id="e7U-Si-Ehn"/>
<constraint firstItem="WCt-Ri-ndL" firstAttribute="firstBaseline" secondItem="jOm-aT-92f" secondAttribute="firstBaseline" id="eRT-n8-fY0"/>
<constraint firstItem="mJx-JF-xDg" firstAttribute="top" secondItem="hfx-Lg-t9P" secondAttribute="bottom" constant="8" id="erO-qQ-EkZ"/>
<constraint firstItem="Bsh-R9-Dlr" firstAttribute="top" secondItem="rxW-aA-Bai" secondAttribute="bottom" constant="10" id="ewA-58-PBF"/>
<constraint firstItem="3Cb-Ht-JzJ" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" id="f8t-7g-9tF"/>
<constraint firstItem="W7s-0d-JNo" firstAttribute="leading" secondItem="rsc-8R-cwh" secondAttribute="trailing" constant="8" id="ffY-aY-doh"/>
<constraint firstItem="qNi-B0-E49" firstAttribute="leading" secondItem="rxW-aA-Bai" secondAttribute="trailing" constant="8" id="fiq-A8-Zvj"/>
<constraint firstItem="rsc-8R-cwh" firstAttribute="width" secondItem="yHT-3q-ctP" secondAttribute="width" id="frA-S7-zPQ"/>
<constraint firstItem="E3S-mU-OmJ" firstAttribute="top" secondItem="yHB-42-ebc" secondAttribute="bottom" constant="8" id="fwb-mN-WZp"/>
<constraint firstItem="W7s-0d-JNo" firstAttribute="top" secondItem="Pdg-iO-Rlv" secondAttribute="bottom" constant="8" id="gsZ-9n-duu"/>
@ -767,11 +822,14 @@
<constraint firstItem="TuE-fA-Shh" firstAttribute="leading" secondItem="jHT-Uw-MKM" secondAttribute="leading" id="iuz-gv-oL8"/>
<constraint firstItem="i6K-Iu-xdk" firstAttribute="firstBaseline" secondItem="qMp-14-9zW" secondAttribute="firstBaseline" id="jOJ-6W-gyj"/>
<constraint firstItem="R5Q-JF-7P7" firstAttribute="leading" secondItem="O9g-UA-3gp" secondAttribute="leading" id="jvo-2N-1c6"/>
<constraint firstItem="sOh-ed-25I" firstAttribute="centerY" secondItem="Bsh-R9-Dlr" secondAttribute="centerY" id="jy2-Fd-oNO"/>
<constraint firstItem="hfx-Lg-t9P" firstAttribute="top" secondItem="Bsh-R9-Dlr" secondAttribute="bottom" constant="10" id="k3F-Ik-NiF"/>
<constraint firstItem="ISU-xt-cZa" firstAttribute="width" secondItem="c4Z-r1-O38" secondAttribute="width" id="k5K-QA-Kdy"/>
<constraint firstItem="hLf-i4-NRV" firstAttribute="firstBaseline" secondItem="ISU-xt-cZa" secondAttribute="firstBaseline" id="k6v-Nf-0Ns"/>
<constraint firstItem="Ns3-zZ-EQY" firstAttribute="centerY" secondItem="i6K-Iu-xdk" secondAttribute="centerY" id="k7c-VC-F2q"/>
<constraint firstItem="xib-ad-dgH" firstAttribute="leading" secondItem="atg-Fg-IgS" secondAttribute="trailing" constant="8" id="kJe-AZ-BHz"/>
<constraint firstItem="eZA-Af-a2e" firstAttribute="leading" secondItem="eyk-QN-lkH" secondAttribute="trailing" constant="8" id="kY5-nM-9bS"/>
<constraint firstItem="rxW-aA-Bai" firstAttribute="leading" secondItem="sOh-ed-25I" secondAttribute="leading" id="lSe-fb-XfO"/>
<constraint firstItem="Ns3-zZ-EQY" firstAttribute="leading" secondItem="drA-2C-LPt" secondAttribute="trailing" constant="8" id="lk5-8o-ywx"/>
<constraint firstItem="xib-ad-dgH" firstAttribute="top" secondItem="6dg-5z-gNX" secondAttribute="bottom" constant="8" id="lkr-rc-E9z"/>
<constraint firstItem="iZL-4Q-g2k" firstAttribute="top" secondItem="WCt-Ri-ndL" secondAttribute="bottom" constant="8" id="mqw-LZ-0G5"/>
@ -783,21 +841,19 @@
<constraint firstItem="yHB-42-ebc" firstAttribute="top" secondItem="VRq-kT-wkC" secondAttribute="bottom" constant="8" id="oeJ-JF-RKD"/>
<constraint firstItem="R5Q-JF-7P7" firstAttribute="width" secondItem="O9g-UA-3gp" secondAttribute="width" id="oxq-qE-PNY"/>
<constraint firstItem="5Ro-Ix-JD5" firstAttribute="firstBaseline" secondItem="Rz0-Kg-nHG" secondAttribute="firstBaseline" id="p1Y-oC-uPf"/>
<constraint firstItem="rxW-aA-Bai" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" id="p2O-K2-o1k"/>
<constraint firstItem="i6K-Iu-xdk" firstAttribute="leading" secondItem="qMp-14-9zW" secondAttribute="trailing" constant="8" id="pTv-cw-KOT"/>
<constraint firstItem="yHT-3q-ctP" firstAttribute="width" secondItem="WcI-SC-fZV" secondAttribute="width" id="py1-Eh-zaX"/>
<constraint firstItem="hLf-i4-NRV" firstAttribute="top" secondItem="ycZ-re-pMx" secondAttribute="bottom" constant="8" id="qXw-Lj-0TQ"/>
<constraint firstItem="dL6-2Y-CIz" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" id="qux-d1-Xew"/>
<constraint firstItem="WcI-SC-fZV" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" id="r1e-VI-uCi"/>
<constraint firstItem="GDm-WA-rkG" firstAttribute="top" secondItem="Fve-dp-udd" secondAttribute="bottom" constant="8" id="r8m-Lq-tOo"/>
<constraint firstItem="rxW-aA-Bai" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="20" id="sE3-LQ-suM"/>
<constraint firstItem="WCt-Ri-ndL" firstAttribute="top" secondItem="S5E-xU-QAK" secondAttribute="bottom" constant="8" id="sGu-iz-XWu"/>
<constraint firstItem="E3S-mU-OmJ" firstAttribute="leading" secondItem="RXV-hd-YH8" secondAttribute="trailing" constant="8" id="sJJ-wb-4ei"/>
<constraint firstItem="5wn-WM-n7f" firstAttribute="leading" secondItem="2BM-Lt-WwR" secondAttribute="trailing" constant="8" id="sri-x8-63C"/>
<constraint firstAttribute="trailing" secondItem="Ns3-zZ-EQY" secondAttribute="trailing" constant="20" id="tTK-hB-OcK"/>
<constraint firstItem="qNi-B0-E49" firstAttribute="leading" secondItem="dm4-cc-JF5" secondAttribute="leading" id="tXb-RF-2YJ"/>
<constraint firstItem="5DP-Qu-lS2" firstAttribute="width" secondItem="jQs-eL-Df4" secondAttribute="width" id="v4q-jw-tEN"/>
<constraint firstItem="vrB-v6-gvS" firstAttribute="width" secondItem="RXV-hd-YH8" secondAttribute="width" id="vOz-7q-3y1"/>
<constraint firstAttribute="trailing" secondItem="M0c-Sj-o1i" secondAttribute="trailing" constant="20" id="vSZ-0i-3xg"/>
<constraint firstItem="6dg-5z-gNX" firstAttribute="top" secondItem="56u-eS-Y7s" secondAttribute="bottom" constant="8" id="w60-xz-Iy3"/>
<constraint firstItem="iZL-4Q-g2k" firstAttribute="leading" secondItem="Ymc-Xn-VtU" secondAttribute="trailing" constant="8" id="wCh-Wh-Hlj"/>
<constraint firstItem="atg-Fg-IgS" firstAttribute="width" secondItem="NeB-Rh-CKs" secondAttribute="width" id="wHM-2M-Nn5"/>
@ -811,7 +867,7 @@
<constraint firstItem="fG8-lF-YYW" firstAttribute="width" secondItem="eyk-QN-lkH" secondAttribute="width" id="zN5-Ta-ZyL"/>
<constraint firstItem="AiU-u8-z9t" firstAttribute="width" secondItem="3Cb-Ht-JzJ" secondAttribute="width" id="zY2-nG-XLO"/>
</constraints>
<point key="canvasLocation" x="100.5" y="301.5"/>
<point key="canvasLocation" x="156" y="303"/>
</customView>
</objects>
</document>

View File

@ -192,6 +192,7 @@ extern id<S9xInputDelegate> inputDelegate;
- (BOOL)loadROM:(NSURL *)fileURL;
- (void)setVideoMode:(int)videoMode;
- (void)setMacFrameSkip:(int)_macFrameSkip;
- (void)setShowFPS:(BOOL)showFPS;
@end

View File

@ -3235,6 +3235,17 @@ void QuitWithFatalError ( NSString *message)
videoMode = mode;
}
- (void)setMacFrameSkip:(int)_macFrameSkip
{
macFrameSkip = _macFrameSkip;
// contrains to -1 to 200
if (macFrameSkip < -1)
macFrameSkip = -1;
if (macFrameSkip > 200)
macFrameSkip = 200;
}
@dynamic inputDelegate;
- (void)setInputDelegate:(id<S9xInputDelegate>)delegate
{

View File

@ -297,6 +297,10 @@ void S9xPutImage (int width, int height)
for (int i = 0; i < 60; i++)
frameCalc += drawnFrames[i];
// avoid dividing by 0
if (frameCalc == 0)
frameCalc = 1;
IPPU.DisplayedRenderedFrameCount = (Memory.ROMFramesPerSecond * 60) / frameCalc;
}