Add CPU Overclocking to preferences UI on OS X

This commit is contained in:
MrLavender 2017-07-01 14:46:09 +01:00
parent 952b598739
commit f38cec65e9
4 changed files with 100 additions and 2 deletions

View File

@ -10,6 +10,8 @@
<connections>
<outlet property="cdromPlugin" destination="397" id="401"/>
<outlet property="consoleOutputCell" destination="1278" id="1281"/>
<outlet property="cpuOverclocking" destination="03L-mr-xTn" id="lVg-X9-WHd"/>
<outlet property="cpuOverclockingValue" destination="vyM-WJ-sZf" id="5Sf-Nn-E1N"/>
<outlet property="enableNetPlayCell" destination="640" id="651"/>
<outlet property="graphicsPlugin" destination="384" id="402"/>
<outlet property="hkController" destination="656" id="832"/>
@ -31,6 +33,7 @@
<outlet property="vTypePALCell" destination="560" id="569"/>
<outlet property="widescreen" destination="652" id="653"/>
<outlet property="window" destination="21" id="345"/>
<outlet property="wipeoutMemHack" destination="Qij-Wg-2W0" id="Iyu-pP-Pk8"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
@ -250,6 +253,63 @@
<color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</box>
<box fixedFrame="YES" title="CPU Overclocking" borderType="line" translatesAutoresizingMaskIntoConstraints="NO" id="8gb-HW-f3X">
<rect key="frame" x="194" y="234" width="256" height="73"/>
<view key="contentView">
<rect key="frame" x="1" y="1" width="254" height="57"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<matrix verticalHuggingPriority="750" fixedFrame="YES" mode="highlight" allowsEmptySelection="NO" autosizesCells="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Uwn-ba-l80">
<rect key="frame" x="18" y="10" width="145" height="40"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
<size key="cellSize" width="145" height="18"/>
<size key="intercellSpacing" width="4" height="4"/>
<buttonCell key="prototype" type="check" title="Switch" bezelStyle="regularSquare" imagePosition="left" inset="2" id="opj-md-u7G">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<cells>
<column>
<buttonCell type="check" title="CPU Overclocking" bezelStyle="regularSquare" imagePosition="left" inset="2" id="03L-mr-xTn">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<buttonCell type="check" title="WipeOut MemHack" bezelStyle="regularSquare" imagePosition="left" inset="2" id="Qij-Wg-2W0">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</column>
</cells>
<connections>
<action selector="setCheckbox:" target="-2" id="mb4-BQ-gqt"/>
</connections>
</matrix>
<comboBox focusRingType="none" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="vyM-WJ-sZf">
<rect key="frame" x="170" y="26" width="69" height="26"/>
<comboBoxCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" focusRingType="none" title="1.50" drawsBackground="YES" completes="NO" numberOfVisibleItems="8" id="9wB-0E-Yoz">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
<objectValues>
<string>0.50</string>
<string>0.75</string>
<string>1.25</string>
<string>1.50</string>
<string>2.00</string>
<string>3.00</string>
<string>4.00</string>
<string>5.00</string>
</objectValues>
</comboBoxCell>
<connections>
<action selector="setOverclockValue:" target="-2" id="UxU-V7-Zr2"/>
</connections>
</comboBox>
</subviews>
</view>
<color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</box>
</subviews>
<constraints>
<constraint firstItem="502" firstAttribute="leading" secondItem="239" secondAttribute="leading" constant="20" symbolic="YES" id="2H1-We-aph"/>

View File

@ -39,10 +39,14 @@ extern NSString *const memCardChangeNumberKey;
@property (weak) IBOutlet NSButtonCell *noFastBootCell;
@property (weak) IBOutlet NSButtonCell *enableNetPlayCell;
@property (weak) IBOutlet NSButtonCell *widescreen;
@property (weak) IBOutlet NSButtonCell *cpuOverclocking;
@property (weak) IBOutlet NSButtonCell *wipeoutMemHack;
@property (weak) IBOutlet NSComboBox *cpuOverclockingValue;
- (IBAction)setCheckbox:(id)sender;
- (IBAction)setCheckboxInverse:(id)sender;
- (IBAction)setVideoType:(id)sender;
- (IBAction)setOverclockValue:(NSComboBox *)sender;
+ (void)setMemoryCard:(NSInteger)theCard toPath:(NSString *)theFile;
+ (void)setMemoryCard:(NSInteger)theCard toURL:(NSURL *)theURL;

View File

@ -41,6 +41,9 @@ NSString *const memCardChangeNumberKey = @"PcsxrMemoryCardThatChangedKey";
@synthesize memCardEdit;
@synthesize hkController;
@synthesize hkTab;
@synthesize cpuOverclocking;
@synthesize wipeoutMemHack;
@synthesize cpuOverclockingValue;
+ (void)setMemoryCard:(NSInteger)theCard toURL:(NSURL *)theURL;
{
@ -178,6 +181,26 @@ NSString *const memCardChangeNumberKey = @"PcsxrMemoryCardThatChangedKey";
}
}
- (IBAction)setOverclockValue:(NSComboBox *)sender
{
float value = sender.floatValue;
if (value < 0.5) value = 0.5;
if (value > 5.0) value = 5.0;
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setFloat:value forKey:@"CpuOverclockingValue"];
[PcsxrController setConfigFromDefaults];
[self setOverclockValueText];
}
- (void)setOverclockValueText
{
NSString *value = [NSString stringWithFormat:@"%.2f", Config.PsxClock];
[cpuOverclockingValue setStringValue:value];
[cpuOverclockingValue selectItemWithObjectValue:value];
}
- (void)awakeFromNib
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
@ -218,6 +241,10 @@ NSString *const memCardChangeNumberKey = @"PcsxrMemoryCardThatChangedKey";
_checkBoxDefaults[@"NoFastBoot"] = noFastBootCell;
if (widescreen)
_checkBoxDefaults[@"Widescreen"] = widescreen;
if (cpuOverclocking)
_checkBoxDefaults[@"CpuOverclocking"] = cpuOverclocking;
if (wipeoutMemHack)
_checkBoxDefaults[@"WipeoutMemHack"] = wipeoutMemHack;
// make the visuals match the defaults
@ -234,6 +261,7 @@ NSString *const memCardChangeNumberKey = @"PcsxrMemoryCardThatChangedKey";
[usesHleCell setEnabled:NO];
}
[self setOverclockValueText];
// setup labels

View File

@ -691,6 +691,7 @@ otherblock();\
// special cases
//str = [[defaults stringForKey:@"PluginPAD"] fileSystemRepresentation];
//if (str != nil) strncpy(Config.Pad2, str, 255);
Config.PsxClock = [defaults floatForKey:@"CpuOverclockingValue"];
str = [[defaults stringForKey:@"Bios"] fileSystemRepresentation];
if (str) {
@ -823,7 +824,10 @@ otherblock();\
@"Widescreen": @NO,
@"NetPlay": @NO,
@"DidMoveMemoryObjects": @NO,
@"NoFastBoot": @NO};
@"NoFastBoot": @NO,
@"CpuOverclocking": @NO,
@"CpuOverclockingValue": @1.5f,
@"WipeoutMemHack": @NO};
[defaults registerDefaults:appDefaults];
@ -849,7 +853,9 @@ otherblock();\
@"RootCounterFix": [NSValue valueWithPointer:&Config.RCntFix],
@"VideoSyncWAFix": [NSValue valueWithPointer:&Config.VSyncWA],
@"Widescreen": [NSValue valueWithPointer:&Config.Widescreen],
@"NoFastBoot": [NSValue valueWithPointer:&Config.SlowBoot]};
@"NoFastBoot": [NSValue valueWithPointer:&Config.SlowBoot],
@"CpuOverclocking": [NSValue valueWithPointer:&Config.OverClock],
@"WipeoutMemHack": [NSValue valueWithPointer:&Config.MemHack]};
// setup application support paths
NSFileManager *manager = [NSFileManager defaultManager];