summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMrLavender <mrlavender@f2s.com>2017-06-30 15:45:32 +0100
committerMrLavender <mrlavender@f2s.com>2017-07-01 14:22:16 +0100
commit952b598739922ab206a57c717c234b2ac76bfc64 (patch)
treee5a95bb8476e38da5f0794304251c954df1399ee
parent043615f45454632c8e71f115e4ab7355767231d2 (diff)
downloadpcsxr-952b598739922ab206a57c717c234b2ac76bfc64.tar.gz
Add PGXP preferences UI for OS X
-rw-r--r--macosx/Pcsxr.xcodeproj/project.pbxproj6
-rw-r--r--macosx/Resources/Base.lproj/Configuration.xib107
-rw-r--r--macosx/Source/PcsxrController.m4
-rw-r--r--macosx/Source/PgxpController.h24
-rw-r--r--macosx/Source/PgxpController.m98
-rw-r--r--macosx/Source/hotkeys.m6
6 files changed, 241 insertions, 4 deletions
diff --git a/macosx/Pcsxr.xcodeproj/project.pbxproj b/macosx/Pcsxr.xcodeproj/project.pbxproj
index cd385678..82807a83 100644
--- a/macosx/Pcsxr.xcodeproj/project.pbxproj
+++ b/macosx/Pcsxr.xcodeproj/project.pbxproj
@@ -218,6 +218,7 @@
55E0ACE0178B69620005C945 /* LaunchArg.m in Sources */ = {isa = PBXBuildFile; fileRef = 55E0ACDF178B69600005C945 /* LaunchArg.m */; };
55EC05FB1788B1230053AC23 /* PcsxrMemCardArray.m in Sources */ = {isa = PBXBuildFile; fileRef = 55EC05FA1788B1230053AC23 /* PcsxrMemCardArray.m */; };
55EC05FE178916E80053AC23 /* MemBadgeView.m in Sources */ = {isa = PBXBuildFile; fileRef = 55EC05FD178916E70053AC23 /* MemBadgeView.m */; };
+ 662A3D691F05E8D500232572 /* PgxpController.m in Sources */ = {isa = PBXBuildFile; fileRef = 662A3D681F05E8D500232572 /* PgxpController.m */; };
6F5FF71A1CE4D3B2005D8636 /* pgxp_gpu.c in Sources */ = {isa = PBXBuildFile; fileRef = 6F5FF7171CE4D1D5005D8636 /* pgxp_gpu.c */; };
6F5FF7211CE4DE68005D8636 /* pgxp_gte.c in Sources */ = {isa = PBXBuildFile; fileRef = 6F5FF71F1CE4DE68005D8636 /* pgxp_gte.c */; };
6FAC15EB1D4CCA6C0028E89C /* pgxp_value.c in Sources */ = {isa = PBXBuildFile; fileRef = 6FAC15E91D4CCA6C0028E89C /* pgxp_value.c */; };
@@ -814,6 +815,8 @@
55EE2D9017E2323400FED42A /* ecm.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ecm.h; sourceTree = "<group>"; };
55F41A2017EF774500605DF8 /* version.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = version.sh; sourceTree = "<group>"; };
55F41A2117EF7A3300605DF8 /* Info.plistvers.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plistvers.plist; path = ../Info.plistvers.plist; sourceTree = "<group>"; };
+ 662A3D671F05E8D500232572 /* PgxpController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PgxpController.h; sourceTree = "<group>"; };
+ 662A3D681F05E8D500232572 /* PgxpController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PgxpController.m; sourceTree = "<group>"; };
6F4B24AB1D54D67E000B7071 /* iPGXP-64.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "iPGXP-64.h"; sourceTree = "<group>"; };
6F5FF7171CE4D1D5005D8636 /* pgxp_gpu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pgxp_gpu.c; sourceTree = "<group>"; };
6F5FF7181CE4D1D5005D8636 /* pgxp_gpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pgxp_gpu.h; sourceTree = "<group>"; };
@@ -1770,6 +1773,8 @@
D422E67916DC495800526DCF /* CheatController.m */,
0280B7AB16764CC3007B8001 /* HotkeyController.h */,
0280B7AC16764CC3007B8001 /* HotkeyController.m */,
+ 662A3D671F05E8D500232572 /* PgxpController.h */,
+ 662A3D681F05E8D500232572 /* PgxpController.m */,
);
name = Controllers;
sourceTree = "<group>";
@@ -2336,6 +2341,7 @@
0280B7AD16764CC5007B8001 /* HotkeyController.m in Sources */,
02717968167884C9004AED62 /* hotkeys.m in Sources */,
5529EA11169CBE3400BAA2A5 /* RecentItemsMenu.m in Sources */,
+ 662A3D691F05E8D500232572 /* PgxpController.m in Sources */,
D422E67A16DC495800526DCF /* CheatController.m in Sources */,
55EC05FB1788B1230053AC23 /* PcsxrMemCardArray.m in Sources */,
55EC05FE178916E80053AC23 /* MemBadgeView.m in Sources */,
diff --git a/macosx/Resources/Base.lproj/Configuration.xib b/macosx/Resources/Base.lproj/Configuration.xib
index 5c9fdac0..15030841 100644
--- a/macosx/Resources/Base.lproj/Configuration.xib
+++ b/macosx/Resources/Base.lproj/Configuration.xib
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6250" systemVersion="14A389" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9532" systemVersion="14F2411" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6250"/>
+ <development version="6300" identifier="xcode"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9532"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="ConfigurationController">
@@ -37,7 +38,7 @@
<window title="PCSXR Preferences" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" visibleAtLaunch="NO" animationBehavior="documentWindow" id="21">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
<rect key="contentRect" x="55" y="345" width="513" height="473"/>
- <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1057"/>
+ <rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
<view key="contentView" id="2">
<rect key="frame" x="0.0" y="0.0" width="513" height="473"/>
<autoresizingMask key="autoresizingMask"/>
@@ -1120,6 +1121,96 @@
</connections>
</view>
</tabViewItem>
+ <tabViewItem label="PGXP" identifier="5" id="ItE-eF-wNU">
+ <view key="view" id="uj1-Je-S5K">
+ <rect key="frame" x="10" y="33" width="467" height="411"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <box fixedFrame="YES" title="Options" borderType="line" translatesAutoresizingMaskIntoConstraints="NO" id="Rt6-IS-wqH">
+ <rect key="frame" x="6" y="271" width="455" height="120"/>
+ <view key="contentView">
+ <rect key="frame" x="1" y="1" width="453" height="104"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="tsJ-kM-vyh">
+ <rect key="frame" x="16" y="78" width="421" height="18"/>
+ <buttonCell key="cell" type="check" title="Enable PGXP GTE Vertex Creation" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="UNI-6T-hmi">
+ <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+ <font key="font" metaFont="system"/>
+ </buttonCell>
+ <connections>
+ <action selector="onOptionChange:" target="UdY-FQ-YOS" id="15S-hO-egW"/>
+ </connections>
+ </button>
+ <button fixedFrame="YES" tag="1" translatesAutoresizingMaskIntoConstraints="NO" id="Wdx-wr-geL">
+ <rect key="frame" x="16" y="45" width="421" height="18"/>
+ <buttonCell key="cell" type="check" title="Enable Vertex Caching" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="kLH-VO-dOD">
+ <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+ <font key="font" metaFont="system"/>
+ </buttonCell>
+ <connections>
+ <action selector="onOptionChange:" target="UdY-FQ-YOS" id="VDM-Oe-3Dk"/>
+ </connections>
+ </button>
+ <button fixedFrame="YES" tag="2" translatesAutoresizingMaskIntoConstraints="NO" id="Tkd-qg-5M6">
+ <rect key="frame" x="16" y="12" width="421" height="18"/>
+ <buttonCell key="cell" type="check" title="Enable Perspective Correct Texturing" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="IvO-v3-jAg">
+ <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+ <font key="font" metaFont="system"/>
+ </buttonCell>
+ <connections>
+ <action selector="onOptionChange:" target="UdY-FQ-YOS" id="azW-yM-Zed"/>
+ </connections>
+ </button>
+ </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>
+ <box fixedFrame="YES" title="PGXP Mode" borderType="line" translatesAutoresizingMaskIntoConstraints="NO" id="7QK-TQ-CUh">
+ <rect key="frame" x="6" y="65" width="455" height="192"/>
+ <view key="contentView">
+ <rect key="frame" x="1" y="1" width="453" height="176"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <popUpButton verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="2dk-sa-eo0">
+ <rect key="frame" x="127" y="142" width="200" height="26"/>
+ <popUpButtonCell key="cell" type="push" title="Memory + CPU Logic" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="TUy-0G-7uN" id="kbY-zW-v7U">
+ <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="menu"/>
+ <menu key="menu" id="nNG-em-hU1">
+ <items>
+ <menuItem title="Disabled" id="fAx-O9-gEO"/>
+ <menuItem title="Memory only" id="sgV-aX-jWN"/>
+ <menuItem title="Memory + CPU Logic" state="on" id="TUy-0G-7uN"/>
+ </items>
+ </menu>
+ </popUpButtonCell>
+ <connections>
+ <action selector="onModeChange:" target="UdY-FQ-YOS" id="H4c-zg-rOQ"/>
+ </connections>
+ </popUpButton>
+ <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" preferredMaxLayoutWidth="0.0" translatesAutoresizingMaskIntoConstraints="NO" id="hf8-BH-ZfI">
+ <rect key="frame" x="18" y="14" width="419" height="119"/>
+ <textFieldCell key="cell" sendsActionOnEndEditing="YES" id="EFJ-3O-jnA">
+ <font key="font" metaFont="system"/>
+ <string key="title">Memory and CPU arithmetic operations
+
+PGXP is mirroring load, store and transfer operations of the CPU and GTE and arithmetic/logic functions of the PSX CPU.
+
+(WARNING: This mode is currently unfinished and may cause incorrect behaviour in some games)</string>
+ <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ </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>
+ </view>
+ </tabViewItem>
</tabViewItems>
<connections>
<outlet property="delegate" destination="-2" id="780"/>
@@ -1136,6 +1227,7 @@
<connections>
<outlet property="delegate" destination="-2" id="478"/>
</connections>
+ <point key="canvasLocation" x="232.5" y="363.5"/>
</window>
<view id="957" userLabel="MemCardObjectView">
<rect key="frame" x="0.0" y="0.0" width="180" height="107"/>
@@ -1329,6 +1421,15 @@
<outlet property="view" destination="580" id="993"/>
</connections>
</viewController>
+ <viewController id="UdY-FQ-YOS" customClass="PgxpController">
+ <connections>
+ <outlet property="perspectiveCorrect" destination="Tkd-qg-5M6" id="4nW-Sp-e4F"/>
+ <outlet property="pgxpModeButton" destination="2dk-sa-eo0" id="JXH-gN-MI4"/>
+ <outlet property="pgxpModeLabel" destination="hf8-BH-ZfI" id="EFr-NH-bnq"/>
+ <outlet property="vertexCaching" destination="Wdx-wr-geL" id="NFe-s6-ajV"/>
+ <outlet property="vertexCreation" destination="tsJ-kM-vyh" id="WPB-EW-N0e"/>
+ </connections>
+ </viewController>
</objects>
<resources>
<image name="NSAdvanced" width="32" height="32"/>
diff --git a/macosx/Source/PcsxrController.m b/macosx/Source/PcsxrController.m
index a9c61523..06fb1d55 100644
--- a/macosx/Source/PcsxrController.m
+++ b/macosx/Source/PcsxrController.m
@@ -1,6 +1,7 @@
#import <Cocoa/Cocoa.h>
#import "PcsxrController.h"
#import "ConfigurationController.h"
+#import "PgxpController.h"
#import "CheatController.h"
#import "EmuThread.h"
#import "PcsxrMemCardHandler.h"
@@ -767,6 +768,9 @@ otherblock();\
else {
strcpy(Config.Net, "Disabled");
}
+
+ // PGXP settings
+ [PgxpController loadPgxpSettings];
}
+ (void)setDefaultFromConfig:(NSString *)defaultKey
diff --git a/macosx/Source/PgxpController.h b/macosx/Source/PgxpController.h
new file mode 100644
index 00000000..fee659ef
--- /dev/null
+++ b/macosx/Source/PgxpController.h
@@ -0,0 +1,24 @@
+//
+// PgxpController.h
+// Pcsxr
+//
+// Created by MrLavender on 29/06/2017.
+//
+
+#import <Cocoa/Cocoa.h>
+
+@interface PgxpController : NSViewController
+
+@property (weak) IBOutlet NSButton *vertexCreation;
+@property (weak) IBOutlet NSButton *vertexCaching;
+@property (weak) IBOutlet NSButton *perspectiveCorrect;
+@property (weak) IBOutlet NSPopUpButton *pgxpModeButton;
+@property (weak) IBOutlet NSTextField *pgxpModeLabel;
+
+- (IBAction)onOptionChange:(NSButton*)sender;
+- (IBAction)onModeChange:(NSPopUpButton*)sender;
+
++ (void)loadPgxpSettings;
++ (void)savePgxpSettings;
+
+@end
diff --git a/macosx/Source/PgxpController.m b/macosx/Source/PgxpController.m
new file mode 100644
index 00000000..19c09b2a
--- /dev/null
+++ b/macosx/Source/PgxpController.m
@@ -0,0 +1,98 @@
+//
+// PgxpController.m
+// Pcsxr
+//
+// Created by MrLavender on 29/06/2017.
+//
+
+#import "PgxpController.h"
+#include "psxcommon.h"
+
+#define kPGXP_GTE 0
+#define kPGXP_Cache 1
+#define kPGXP_Texture 2
+
+NSString* kPGXP_GTE_Key = @"PGXP_GTE";
+NSString* kPGXP_Cache_Key = @"PGXP_Cache";
+NSString* kPGXP_Texture_Key = @"PGXP_Texture";
+NSString* kPGXP_Mode_Key = @"PGXP_Mode";
+
+NSString* infoText[] = {
+ @"Disabled\n\nPGXP is no longer mirroring any functions.",
+ @"Memory operations only\n\nPGXP is mirroring load, store and processor transfer operations of the CPU and GTE.",
+ @"Memory and CPU arithmetic operations\n\nPGXP is mirroring load, store and transfer operations of the CPU and GTE and arithmetic/logic functions of the PSX CPU.\n\n(WARNING: This mode is currently unfinished and may cause incorrect behaviour in some games)"
+};
+
+@interface PgxpController ()
+@end
+
+@implementation PgxpController
+
+- (void)awakeFromNib
+{
+ self.vertexCreation.state = Config.PGXP_GTE;
+ self.vertexCaching.state = Config.PGXP_Cache;
+ self.perspectiveCorrect.state = Config.PGXP_Texture;
+
+ [self.pgxpModeButton selectItemAtIndex:Config.PGXP_Mode];
+ [self setInfoTextForPgxpMode];
+}
+
+- (IBAction)onOptionChange:(NSButton*)sender
+{
+ switch (sender.tag) {
+ case kPGXP_GTE:
+ Config.PGXP_GTE = sender.state;
+ break;
+ case kPGXP_Cache:
+ Config.PGXP_Cache = sender.state;
+ break;
+ case kPGXP_Texture:
+ Config.PGXP_Texture = sender.state;
+ break;
+ default:
+ break;
+ }
+ [PgxpController savePgxpSettings];
+}
+
+- (IBAction)onModeChange:(NSPopUpButton*)sender
+{
+ Config.PGXP_Mode = (u32)sender.indexOfSelectedItem;
+ [self setInfoTextForPgxpMode];
+ [PgxpController savePgxpSettings];
+}
+
+- (void)setInfoTextForPgxpMode
+{
+ self.pgxpModeLabel.stringValue = infoText[Config.PGXP_Mode];
+}
+
++ (void)loadPgxpSettings
+{
+ NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults];
+
+ [userDefaults registerDefaults:@{
+ kPGXP_GTE_Key: @YES,
+ kPGXP_Cache_Key: @YES,
+ kPGXP_Texture_Key: @YES,
+ kPGXP_Mode_Key: @0
+ }];
+
+ Config.PGXP_GTE = [userDefaults boolForKey:kPGXP_GTE_Key];
+ Config.PGXP_Cache = [userDefaults boolForKey:kPGXP_Cache_Key];
+ Config.PGXP_Texture = [userDefaults boolForKey:kPGXP_Texture_Key];
+ Config.PGXP_Mode = (u32)[userDefaults integerForKey:kPGXP_Mode_Key];
+}
+
++ (void)savePgxpSettings
+{
+ NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults];
+
+ [userDefaults setBool:Config.PGXP_GTE forKey:kPGXP_GTE_Key];
+ [userDefaults setBool:Config.PGXP_Cache forKey:kPGXP_Cache_Key];
+ [userDefaults setBool:Config.PGXP_Texture forKey:kPGXP_Texture_Key];
+ [userDefaults setInteger:Config.PGXP_Mode forKey:kPGXP_Mode_Key];
+}
+
+@end
diff --git a/macosx/Source/hotkeys.m b/macosx/Source/hotkeys.m
index 96d89e8b..9945ea29 100644
--- a/macosx/Source/hotkeys.m
+++ b/macosx/Source/hotkeys.m
@@ -127,7 +127,11 @@ void attachHotkeys() {
// GPU key presses
NSEvent* (^gpuKeypress)(NSEvent*) = ^(NSEvent *event) {
if (event.modifierFlags & NSControlKeyMask) {
- GPU_keypressed([event keyCode]);
+ if ([event keyCode] == 0x67) { // F11
+ GPU_toggleDebug();
+ } else {
+ GPU_keypressed([event keyCode]);
+ }
return (NSEvent*)nil;
} else {
return event;