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 = ""; }; 55F41A2017EF774500605DF8 /* version.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = version.sh; sourceTree = ""; }; 55F41A2117EF7A3300605DF8 /* Info.plistvers.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plistvers.plist; path = ../Info.plistvers.plist; sourceTree = ""; }; + 662A3D671F05E8D500232572 /* PgxpController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PgxpController.h; sourceTree = ""; }; + 662A3D681F05E8D500232572 /* PgxpController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PgxpController.m; sourceTree = ""; }; 6F4B24AB1D54D67E000B7071 /* iPGXP-64.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "iPGXP-64.h"; sourceTree = ""; }; 6F5FF7171CE4D1D5005D8636 /* pgxp_gpu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pgxp_gpu.c; sourceTree = ""; }; 6F5FF7181CE4D1D5005D8636 /* pgxp_gpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pgxp_gpu.h; sourceTree = ""; }; @@ -1770,6 +1773,8 @@ D422E67916DC495800526DCF /* CheatController.m */, 0280B7AB16764CC3007B8001 /* HotkeyController.h */, 0280B7AC16764CC3007B8001 /* HotkeyController.m */, + 662A3D671F05E8D500232572 /* PgxpController.h */, + 662A3D681F05E8D500232572 /* PgxpController.m */, ); name = Controllers; sourceTree = ""; @@ -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 @@ - + - + + @@ -37,7 +38,7 @@ - + @@ -1120,6 +1121,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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) + + + + + + + + + + + + @@ -1136,6 +1227,7 @@ + @@ -1329,6 +1421,15 @@ + + + + + + + + + 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 #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 + +@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;