From 36c126b66581a154143eb789ae9bdf665bc50560 Mon Sep 17 00:00:00 2001 From: MrLavender Date: Tue, 27 Jun 2017 01:52:39 +0100 Subject: Add OSX files to gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index acc22675..d714b1c8 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ macosx/build xcuserdata macosx/Info.plistvers.plist +project.xcworkspace +.DS_Store -- cgit v1.2.3 From 72b90e1c61be53d99c61e15f9d2b60c807920a89 Mon Sep 17 00:00:00 2001 From: MrLavender Date: Tue, 27 Jun 2017 01:57:29 +0100 Subject: Fix OSX debug build --- libpcsxcore/gte.c | 2 +- libpcsxcore/pgxp_gte.h | 3 +++ macosx/Pcsxr.xcodeproj/project.pbxproj | 16 +--------------- .../xcshareddata/xcschemes/PCSXR.xcscheme | 17 +++++++++++------ 4 files changed, 16 insertions(+), 22 deletions(-) diff --git a/libpcsxcore/gte.c b/libpcsxcore/gte.c index 05cb74a6..7965a0e9 100755 --- a/libpcsxcore/gte.c +++ b/libpcsxcore/gte.c @@ -286,7 +286,7 @@ void gteSWC2() { psxMemWrite32(_oB_, val); } -inline s64 gte_shift(s64 a, int sf) { +static inline s64 gte_shift(s64 a, int sf) { if(sf > 0) return a >> 12; else if(sf < 0) diff --git a/libpcsxcore/pgxp_gte.h b/libpcsxcore/pgxp_gte.h index cc38ade1..de607c99 100644 --- a/libpcsxcore/pgxp_gte.h +++ b/libpcsxcore/pgxp_gte.h @@ -60,5 +60,8 @@ void PGXP_GTE_SWC2(u32 instr, u32 rtVal, u32 addr); // copy GTE reg to memory #ifndef max # define max(a, b) ((a) > (b) ? (a) : (b)) #endif +#ifndef min +# define min(a, b) ((a) < (b) ? (a) : (b)) +#endif #endif /* _PGXP_GTE_H_ */ diff --git a/macosx/Pcsxr.xcodeproj/project.pbxproj b/macosx/Pcsxr.xcodeproj/project.pbxproj index 70c38d02..cd385678 100644 --- a/macosx/Pcsxr.xcodeproj/project.pbxproj +++ b/macosx/Pcsxr.xcodeproj/project.pbxproj @@ -218,10 +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 */; }; - 6F5FF7191CE4D1D5005D8636 /* pgxp_gpu.c in Sources */ = {isa = PBXBuildFile; fileRef = 6F5FF7171CE4D1D5005D8636 /* pgxp_gpu.c */; }; 6F5FF71A1CE4D3B2005D8636 /* pgxp_gpu.c in Sources */ = {isa = PBXBuildFile; fileRef = 6F5FF7171CE4D1D5005D8636 /* pgxp_gpu.c */; }; - 6F5FF71B1CE4D3B2005D8636 /* pgxp_gpu.h in Sources */ = {isa = PBXBuildFile; fileRef = 6F5FF7181CE4D1D5005D8636 /* pgxp_gpu.h */; }; - 6F5FF71E1CE4D791005D8636 /* cfg.c in Sources */ = {isa = PBXBuildFile; fileRef = 6F5FF71C1CE4D791005D8636 /* cfg.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 */; }; 6FDBDA711D0DB58300313918 /* pgxp_cpu.c in Sources */ = {isa = PBXBuildFile; fileRef = 6FDBDA6A1D0DB58300313918 /* pgxp_cpu.c */; }; @@ -826,7 +823,6 @@ 6F5FF7201CE4DE68005D8636 /* pgxp_gte.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pgxp_gte.h; sourceTree = ""; }; 6FAC15E91D4CCA6C0028E89C /* pgxp_value.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pgxp_value.c; sourceTree = ""; }; 6FAC15EA1D4CCA6C0028E89C /* psxinterpreter_pgxp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = psxinterpreter_pgxp.h; sourceTree = ""; }; - 6FAC15EC1D4CCAC00028E89C /* pgxp_value.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pgxp_value.c; sourceTree = ""; }; 6FDBDA6A1D0DB58300313918 /* pgxp_cpu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pgxp_cpu.c; sourceTree = ""; }; 6FDBDA6B1D0DB58300313918 /* pgxp_cpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pgxp_cpu.h; sourceTree = ""; }; 6FDBDA6C1D0DB58300313918 /* pgxp_debug.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pgxp_debug.c; sourceTree = ""; }; @@ -834,9 +830,6 @@ 6FDBDA6E1D0DB58300313918 /* pgxp_mem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pgxp_mem.c; sourceTree = ""; }; 6FDBDA6F1D0DB58300313918 /* pgxp_mem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pgxp_mem.h; sourceTree = ""; }; 6FDBDA701D0DB58300313918 /* pgxp_value.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pgxp_value.h; sourceTree = ""; }; - 6FDBDA741D0DB63800313918 /* pgxp_cpu.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pgxp_cpu.c; sourceTree = ""; }; - 6FDBDA751D0DB63800313918 /* pgxp_debug.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pgxp_debug.c; sourceTree = ""; }; - 6FDBDA761D0DB63800313918 /* pgxp_mem.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pgxp_mem.c; sourceTree = ""; }; 712FD1E51093096F00575A92 /* debug.c */ = {isa = PBXFileReference; fileEncoding = 0; lastKnownFileType = sourcecode.c.c; path = debug.c; sourceTree = ""; }; 712FD1E61093096F00575A92 /* socket.c */ = {isa = PBXFileReference; fileEncoding = 0; lastKnownFileType = sourcecode.c.c; path = socket.c; sourceTree = ""; }; 712FD1E71093096F00575A92 /* socket.h */ = {isa = PBXFileReference; fileEncoding = 0; lastKnownFileType = sourcecode.c.h; path = socket.h; sourceTree = ""; }; @@ -1119,11 +1112,6 @@ 2BCE23B204C6B52C007C2DA3 /* libpcsxcore */ = { isa = PBXGroup; children = ( - 6FAC15EC1D4CCAC00028E89C /* pgxp_value.c */, - 6FDBDA741D0DB63800313918 /* pgxp_cpu.c */, - 6FDBDA751D0DB63800313918 /* pgxp_debug.c */, - 6FDBDA761D0DB63800313918 /* pgxp_mem.c */, - 6FAC15E91D4CCA6C0028E89C /* pgxp_value.c */, 6FAC15EA1D4CCA6C0028E89C /* psxinterpreter_pgxp.h */, 6FDBDA6A1D0DB58300313918 /* pgxp_cpu.c */, 6FDBDA6B1D0DB58300313918 /* pgxp_cpu.h */, @@ -1131,6 +1119,7 @@ 6FDBDA6D1D0DB58300313918 /* pgxp_debug.h */, 6FDBDA6E1D0DB58300313918 /* pgxp_mem.c */, 6FDBDA6F1D0DB58300313918 /* pgxp_mem.h */, + 6FAC15E91D4CCA6C0028E89C /* pgxp_value.c */, 6FDBDA701D0DB58300313918 /* pgxp_value.h */, 6F5FF71F1CE4DE68005D8636 /* pgxp_gte.c */, 6F5FF7201CE4DE68005D8636 /* pgxp_gte.h */, @@ -2301,7 +2290,6 @@ 6FDBDA731D0DB58300313918 /* pgxp_mem.c in Sources */, 2BB3D6BE05427FE200831ACB /* main.m in Sources */, 6F5FF7211CE4DE68005D8636 /* pgxp_gte.c in Sources */, - 6F5FF7191CE4D1D5005D8636 /* pgxp_gpu.c in Sources */, 2BB3D6BF05427FE200831ACB /* PcsxrController.m in Sources */, 2BB3D6C005427FE200831ACB /* ConfigurationController.m in Sources */, 2BB3D6C105427FE200831ACB /* PluginList.m in Sources */, @@ -2344,7 +2332,6 @@ 55BBA693149455E1003B2CEC /* PcsxrMemCardHandler.m in Sources */, 55BBA69614945628003B2CEC /* PcsxrPluginHandler.m in Sources */, 55BBA69914953887003B2CEC /* PcsxrDiscHandler.m in Sources */, - 6F5FF71E1CE4D791005D8636 /* cfg.c in Sources */, 55BBA69C1495839A003B2CEC /* PcsxrFreezeStateHandler.m in Sources */, 0280B7AD16764CC5007B8001 /* HotkeyController.m in Sources */, 02717968167884C9004AED62 /* hotkeys.m in Sources */, @@ -2478,7 +2465,6 @@ buildActionMask = 2147483647; files = ( 6F5FF71A1CE4D3B2005D8636 /* pgxp_gpu.c in Sources */, - 6F5FF71B1CE4D3B2005D8636 /* pgxp_gpu.h in Sources */, 551A775217869C8B0052D185 /* draw.c in Sources */, 551A775317869C8D0052D185 /* fps.c in Sources */, 551A775417869C900052D185 /* gpu.c in Sources */, diff --git a/macosx/Pcsxr.xcodeproj/xcshareddata/xcschemes/PCSXR.xcscheme b/macosx/Pcsxr.xcodeproj/xcshareddata/xcschemes/PCSXR.xcscheme index 3cfcd2c7..56c9ceab 100644 --- a/macosx/Pcsxr.xcodeproj/xcshareddata/xcschemes/PCSXR.xcscheme +++ b/macosx/Pcsxr.xcodeproj/xcshareddata/xcschemes/PCSXR.xcscheme @@ -23,10 +23,10 @@ + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -38,17 +38,21 @@ ReferencedContainer = "container:Pcsxr.xcodeproj"> + + - + - + Date: Tue, 27 Jun 2017 03:04:39 +0100 Subject: Fix PGXP support in 64bit dynarec on OSX/Linux --- libpcsxcore/ix86_64/iPGXP-64.h | 220 +++++++++++++++++++++++++-------------- libpcsxcore/ix86_64/iR3000A-64.c | 10 -- libpcsxcore/ix86_64/ix86-64.h | 2 + 3 files changed, 143 insertions(+), 89 deletions(-) diff --git a/libpcsxcore/ix86_64/iPGXP-64.h b/libpcsxcore/ix86_64/iPGXP-64.h index be69c650..c61190f0 100644 --- a/libpcsxcore/ix86_64/iPGXP-64.h +++ b/libpcsxcore/ix86_64/iPGXP-64.h @@ -1,6 +1,24 @@ #ifndef _I_PGXP_H_ #define _I_PGXP_H_ +// Microsoft Windows uses a different x86_64 calling convention than everyone +// else. I have not yet bothered implementing it here because; +// +// 1. Nobody cares about a Windows 64-bit build of PCSXR since that would mean +// dropping popular closed source 32-bit plugins like Pete's OpenGL2 +// 2. The Windows convention is annoying (only 4 register params, caller must +// reserve stack space for register spilling) and would require more +// extensive code changes (e.g. the PGXP_DBG_OP_E() macro would have to +// handle cases where the arg needs to go on the stack instead of in a +// register, and cleanup afterwards). +// +// See https://msdn.microsoft.com/en-us/library/ms235286.aspx +// and https://en.wikipedia.org/wiki/X86_calling_conventions#x86-64_calling_conventions +// +// MrLavender +#ifdef _MSC_VER +#error PGXP dynarec support is not implemented for Windows 64-bit +#endif ///////////////////////////////////////////// // PGXP wrapper functions @@ -8,13 +26,32 @@ void pgxpRecNULL() {} +// Debug wrappers for x86_64 (because eOp will be last) +#ifdef PGXP_CPU_DEBUG +static void PGXP64_psxTraceOp(u32 code, u32 eOp) { + PGXP_psxTraceOp(eOp, code); +} +static void PGXP64_psxTraceOp1(u32 code, u32 op1, u32 eOp) { + PGXP_psxTraceOp1(eOp, code, op1); +} +static void PGXP64_psxTraceOp2(u32 code, u32 op1, u32 op2, u32 eOp) { + PGXP_psxTraceOp2(eOp, code, op1, op2); +} +static void PGXP64_psxTraceOp3(u32 code, u32 op1, u32 op2, u32 op3, u32 eOp) { + PGXP_psxTraceOp3(eOp, code, op1, op2, op3); +} +static void PGXP64_psxTraceOp4(u32 code, u32 op1, u32 op2, u32 op3, u32 op4, u32 eOp) { + PGXP_psxTraceOp4(eOp, code, op1, op2, op3, op4); +} +#endif + // Choose between debug and direct function #ifdef PGXP_CPU_DEBUG -#define PGXP_REC_FUNC_OP(pu, op, nReg) PGXP_psxTraceOp##nReg -#define PGXP_DBG_OP_E(op) PUSH32I(DBG_E_##op); resp+=4; +#define PGXP_REC_FUNC_OP(pu, op, nReg) PGXP64_psxTraceOp##nReg +#define PGXP_DBG_OP_E(op, arg) MOV32ItoR(arg, DBG_E_##op); #else #define PGXP_REC_FUNC_OP(pu, op, nReg) PGXP_##pu##_##op -#define PGXP_DBG_OP_E(op) +#define PGXP_DBG_OP_E(op, arg) #endif #define PGXP_REC_FUNC_PASS(pu, op) \ @@ -24,45 +61,45 @@ static void pgxpRec##op() { \ #define PGXP_REC_FUNC(pu, op) \ static void pgxpRec##op() { \ - PUSH32I(psxRegs.code); \ - PGXP_DBG_OP_E(op) \ - CALLFunc((u32)PGXP_REC_FUNC_OP(pu, op, )); \ - resp += 4; \ + MOV32ItoR(X86ARG1, psxRegs.code); \ + PGXP_DBG_OP_E(op, X86ARG2) \ + CALLFunc((uptr)PGXP_REC_FUNC_OP(pu, op, )); \ rec##op();\ } #define PGXP_REC_FUNC_1(pu, op, reg1) \ static void pgxpRec##op() { \ reg1;\ - PUSH32I(psxRegs.code); \ - PGXP_DBG_OP_E(op) \ - CALLFunc((u32)PGXP_REC_FUNC_OP(pu, op, 1)); \ - resp += 8; \ + MOV32ItoR(X86ARG1, psxRegs.code); \ + POP64R(X86ARG2); \ + PGXP_DBG_OP_E(op, X86ARG3) \ + CALLFunc((uptr)PGXP_REC_FUNC_OP(pu, op, 1)); \ rec##op();\ } -#define PGXP_REC_FUNC_2_2(pu, op, test, nReg, reg1, reg2, reg3, reg4) \ -static void pgxpRec##op() { \ - if(test) { rec##op(); return; }\ - reg1;\ - reg2;\ - rec##op();\ - reg3;\ - reg4;\ - PUSH32I(psxRegs.code); \ - PGXP_DBG_OP_E(op) \ - CALLFunc((u32)PGXP_REC_FUNC_OP(pu, op, nReg)); \ - resp += (4 * nReg) + 4; \ -} +//#define PGXP_REC_FUNC_2_2(pu, op, test, nReg, reg1, reg2, reg3, reg4) \ +//static void pgxpRec##op() { \ +// if(test) { rec##op(); return; }\ +// reg1;\ +// reg2;\ +// rec##op();\ +// reg3;\ +// reg4;\ +// PUSH32I(psxRegs.code); \ +// PGXP_DBG_OP_E(op) \ +// CALLFunc((uptr)PGXP_REC_FUNC_OP(pu, op, nReg)); \ +// resp += (4 * nReg) + 4; \ +//} #define PGXP_REC_FUNC_2(pu, op, reg1, reg2) \ static void pgxpRec##op() { \ reg1;\ reg2;\ - PUSH32I(psxRegs.code); \ - PGXP_DBG_OP_E(op) \ - CALLFunc((u32)PGXP_REC_FUNC_OP(pu, op, 2)); \ - resp += 12; \ + MOV32ItoR(X86ARG1, psxRegs.code); \ + POP64R(X86ARG2); \ + POP64R(X86ARG3); \ + PGXP_DBG_OP_E(op, X86ARG4) \ + CALLFunc((uptr)PGXP_REC_FUNC_OP(pu, op, 2)); \ rec##op();\ } @@ -76,34 +113,34 @@ static void pgxpRec##op() \ } \ else\ {\ - MOV32MtoR(EAX, (u32)&psxRegs.GPR.r[_Rs_]);\ + MOV32MtoR(EAX, (uptr)&psxRegs.GPR.r[_Rs_]);\ if (_Imm_)\ {\ ADD32ItoR(EAX, _Imm_);\ }\ }\ - MOV32RtoM((u32)&gTempAddr, EAX);\ + MOV32RtoM((uptr)&gTempAddr, EAX);\ rec##op();\ - PUSH64M((u32)&gTempAddr);\ reg1;\ - PUSH32I(psxRegs.code); \ - PGXP_DBG_OP_E(op) \ - CALLFunc((u32)PGXP_REC_FUNC_OP(pu, op, 2)); \ - resp += 12; \ + MOV32ItoR(X86ARG1, psxRegs.code); \ + POP64R(X86ARG2); \ + MOV32MtoR(X86ARG3, (uptr)&gTempAddr); \ + PGXP_DBG_OP_E(op, X86ARG4) \ + CALLFunc((uptr)PGXP_REC_FUNC_OP(pu, op, 2)); \ } -#define CPU_REG_NC(idx) MOV32MtoR(EAX,(u32)&psxRegs.GPR.r[idx]) +#define CPU_REG_NC(idx) MOV32MtoR(EAX,(uptr)&psxRegs.GPR.r[idx]) #define CPU_REG(idx) \ if (IsConst(idx)) \ MOV32ItoR(EAX, iRegs[idx].k); \ else\ - MOV32MtoR(EAX, (u32)&psxRegs.GPR.r[idx]); + MOV32MtoR(EAX, (uptr)&psxRegs.GPR.r[idx]); -#define CP0_REG(idx) MOV32MtoR(EAX,(u32)&psxRegs.CP0.r[idx]) -#define GTE_DATA_REG(idx) MOV32MtoR(EAX,(u32)&psxRegs.CP2D.r[idx]) -#define GTE_CTRL_REG(idx) MOV32MtoR(EAX,(u32)&psxRegs.CP2C.r[idx]) +#define CP0_REG(idx) MOV32MtoR(EAX,(uptr)&psxRegs.CP0.r[idx]) +#define GTE_DATA_REG(idx) MOV32MtoR(EAX,(uptr)&psxRegs.CP2D.r[idx]) +#define GTE_CTRL_REG(idx) MOV32MtoR(EAX,(uptr)&psxRegs.CP2C.r[idx]) static u32 gTempInstr = 0; static u32 gTempReg1 = 0; @@ -113,14 +150,14 @@ static void pgxpRec##op() \ { \ if(test) { rec##op(); return; }\ reg1;\ - MOV32RtoM((u32)&gTempReg1, EAX);\ + MOV32RtoM((uptr)&gTempReg1, EAX);\ rec##op();\ - PUSH64M((u32)&gTempReg1);\ reg2;\ - PUSH32I(psxRegs.code); \ - PGXP_DBG_OP_E(op) \ - CALLFunc((u32)PGXP_REC_FUNC_OP(pu, op, 2)); \ - resp += 12; \ + MOV32ItoR(X86ARG1, psxRegs.code); \ + POP64R(X86ARG2); \ + MOV32MtoR(X86ARG3, (uptr)&gTempReg1); \ + PGXP_DBG_OP_E(op, X86ARG4) \ + CALLFunc((uptr)PGXP_REC_FUNC_OP(pu, op, 2)); \ } #define PGXP_REC_FUNC_R2_1(pu, op, test, reg1, reg2, reg3) \ @@ -128,17 +165,17 @@ static void pgxpRec##op() \ { \ if(test) { rec##op(); return; }\ reg1;\ - MOV32RtoM((u32)&gTempReg1, EAX);\ + MOV32RtoM((uptr)&gTempReg1, EAX);\ reg2;\ - MOV32RtoM((u32)&gTempReg2, EAX);\ + MOV32RtoM((uptr)&gTempReg2, EAX);\ rec##op();\ - PUSH64M((u32)&gTempReg1);\ - PUSH64M((u32)&gTempReg2);\ reg3;\ - PUSH32I(psxRegs.code); \ - PGXP_DBG_OP_E(op) \ - CALLFunc((u32)PGXP_REC_FUNC_OP(pu, op, 3)); \ - resp += 16; \ + MOV32ItoR(X86ARG1, psxRegs.code); \ + POP64R(X86ARG2); \ + MOV32MtoR(X86ARG3, (uptr)&gTempReg2); \ + MOV32MtoR(X86ARG4, (uptr)&gTempReg1); \ + PGXP_DBG_OP_E(op, X86ARG5) \ + CALLFunc((uptr)PGXP_REC_FUNC_OP(pu, op, 3)); \ } #define PGXP_REC_FUNC_R2_2(pu, op, test, reg1, reg2, reg3, reg4) \ @@ -146,18 +183,19 @@ static void pgxpRec##op() \ { \ if(test) { rec##op(); return; }\ reg1;\ - MOV32RtoM((u32)&gTempReg1, EAX);\ + MOV32RtoM((uptr)&gTempReg1, EAX);\ reg2;\ - MOV32RtoM((u32)&gTempReg2, EAX);\ + MOV32RtoM((uptr)&gTempReg2, EAX);\ rec##op();\ - PUSH64M((u32)&gTempReg1);\ - PUSH64M((u32)&gTempReg2);\ reg3;\ reg4;\ - PUSH32I(psxRegs.code); \ - PGXP_DBG_OP_E(op) \ - CALLFunc((u32)PGXP_REC_FUNC_OP(pu, op, 4)); \ - resp += 20; \ + MOV32ItoR(X86ARG1, psxRegs.code); \ + POP64R(X86ARG2); \ + POP64R(X86ARG3); \ + MOV32MtoR(X86ARG4, (uptr)&gTempReg2); \ + MOV32MtoR(X86ARG5, (uptr)&gTempReg1); \ + PGXP_DBG_OP_E(op, X86ARG6) \ + CALLFunc((uptr)PGXP_REC_FUNC_OP(pu, op, 4)); \ } //#define PGXP_REC_FUNC_R1i_1(pu, op, test, reg1, reg2) \ @@ -167,16 +205,29 @@ static void pgxpRec##op() \ // if (IsConst(reg1)) \ // MOV32ItoR(EAX, iRegs[reg1].k); \ // else\ -// MOV32MtoR(EAX, (u32)&psxRegs.GPR.r[reg1]);\ -// MOV32RtoM((u32)&gTempReg, EAX);\ +// MOV32MtoR(EAX, (uptr)&psxRegs.GPR.r[reg1]);\ +// MOV32RtoM((uptr)&gTempReg, EAX);\ // rec##op();\ -// PUSH64M((u32)&gTempReg);\ +// PUSH64M((uptr)&gTempReg);\ // reg2;\ // PUSH32I(psxRegs.code); \ -// CALLFunc((u32)PGXP_REC_FUNC_OP(pu, op, 2)); \ +// CALLFunc((uptr)PGXP_REC_FUNC_OP(pu, op, 2)); \ // resp += 12; \ //} +// Push m32 +#define PUSH32M(from) MOV32MtoR(EAX, from); PUSH64R(RAX); + +static void iPushReg(int reg) +{ + if (IsConst(reg)) { + PUSH32I(iRegs[reg].k); + } + else { + PUSH32M((uptr)&psxRegs.GPR.r[reg]); + } +} + // Rt = Rs op imm PGXP_REC_FUNC_R1_1(CPU, ADDI, !_Rt_, CPU_REG(_Rs_), iPushReg(_Rt_)) PGXP_REC_FUNC_R1_1(CPU, ADDIU, !_Rt_, CPU_REG(_Rs_), iPushReg(_Rt_)) @@ -187,7 +238,18 @@ PGXP_REC_FUNC_R1_1(CPU, SLTI, !_Rt_, CPU_REG(_Rs_), iPushReg(_Rt_)) PGXP_REC_FUNC_R1_1(CPU, SLTIU, !_Rt_, CPU_REG(_Rs_), iPushReg(_Rt_)) // Rt = imm -PGXP_REC_FUNC_2_2(CPU, LUI, !_Rt_, 1, , , iPushReg(_Rt_), ) +//PGXP_REC_FUNC_2_2(CPU, LUI, !_Rt_, 1, , , iPushReg(_Rt_), ) +//This macro is harder to implement for x86_64, and only used once, so... :) MrL +static void pgxpRecLUI() +{ + if (!_Rt_) { recLUI(); return; } + recLUI(); + iPushReg(_Rt_); + MOV32ItoR(X86ARG1, psxRegs.code); + POP64R(X86ARG2); + PGXP_DBG_OP_E(LUI, X86ARG3) + CALLFunc((uptr)PGXP_REC_FUNC_OP(CPU, LUI, 1)); +} // Rd = Rs op Rt PGXP_REC_FUNC_R2_1(CPU, ADD, !_Rd_, CPU_REG(_Rt_), CPU_REG(_Rs_), iPushReg(_Rd_)) @@ -202,10 +264,10 @@ PGXP_REC_FUNC_R2_1(CPU, SLT, !_Rd_, CPU_REG(_Rt_), CPU_REG(_Rs_), iPushReg(_Rd_) PGXP_REC_FUNC_R2_1(CPU, SLTU, !_Rd_, CPU_REG(_Rt_), CPU_REG(_Rs_), iPushReg(_Rd_)) // Hi/Lo = Rs op Rt -PGXP_REC_FUNC_R2_2(CPU, MULT, 0, CPU_REG(_Rt_), CPU_REG(_Rs_), PUSH64M((u32)&psxRegs.GPR.n.lo), PUSH64M((u32)&psxRegs.GPR.n.hi)) -PGXP_REC_FUNC_R2_2(CPU, MULTU, 0, CPU_REG(_Rt_), CPU_REG(_Rs_), PUSH64M((u32)&psxRegs.GPR.n.lo), PUSH64M((u32)&psxRegs.GPR.n.hi)) -PGXP_REC_FUNC_R2_2(CPU, DIV, 0, CPU_REG(_Rt_), CPU_REG(_Rs_), PUSH64M((u32)&psxRegs.GPR.n.lo), PUSH64M((u32)&psxRegs.GPR.n.hi)) -PGXP_REC_FUNC_R2_2(CPU, DIVU, 0, CPU_REG(_Rt_), CPU_REG(_Rs_), PUSH64M((u32)&psxRegs.GPR.n.lo), PUSH64M((u32)&psxRegs.GPR.n.hi)) +PGXP_REC_FUNC_R2_2(CPU, MULT, 0, CPU_REG(_Rt_), CPU_REG(_Rs_), PUSH32M((uptr)&psxRegs.GPR.n.lo), PUSH32M((uptr)&psxRegs.GPR.n.hi)) +PGXP_REC_FUNC_R2_2(CPU, MULTU, 0, CPU_REG(_Rt_), CPU_REG(_Rs_), PUSH32M((uptr)&psxRegs.GPR.n.lo), PUSH32M((uptr)&psxRegs.GPR.n.hi)) +PGXP_REC_FUNC_R2_2(CPU, DIV, 0, CPU_REG(_Rt_), CPU_REG(_Rs_), PUSH32M((uptr)&psxRegs.GPR.n.lo), PUSH32M((uptr)&psxRegs.GPR.n.hi)) +PGXP_REC_FUNC_R2_2(CPU, DIVU, 0, CPU_REG(_Rt_), CPU_REG(_Rs_), PUSH32M((uptr)&psxRegs.GPR.n.lo), PUSH32M((uptr)&psxRegs.GPR.n.hi)) PGXP_REC_FUNC_ADDR_1(CPU, SB, iPushReg(_Rt_)) PGXP_REC_FUNC_ADDR_1(CPU, SH, iPushReg(_Rt_)) @@ -232,24 +294,24 @@ PGXP_REC_FUNC_R2_1(CPU, SRLV, !_Rd_, CPU_REG(_Rs_), CPU_REG(_Rt_), iPushReg(_Rd_ PGXP_REC_FUNC_R2_1(CPU, SRAV, !_Rd_, CPU_REG(_Rs_), CPU_REG(_Rt_), iPushReg(_Rd_)) PGXP_REC_FUNC_R1_1(CPU, MFHI, !_Rd_, CPU_REG_NC(33), iPushReg(_Rd_)) -PGXP_REC_FUNC_R1_1(CPU, MTHI, 0, CPU_REG(_Rd_), PUSH64M((u32)&psxRegs.GPR.n.hi)) +PGXP_REC_FUNC_R1_1(CPU, MTHI, 0, CPU_REG(_Rd_), PUSH32M((uptr)&psxRegs.GPR.n.hi)) PGXP_REC_FUNC_R1_1(CPU, MFLO, !_Rd_, CPU_REG_NC(32), iPushReg(_Rd_)) -PGXP_REC_FUNC_R1_1(CPU, MTLO, 0, CPU_REG(_Rd_), PUSH64M((u32)&psxRegs.GPR.n.lo)) +PGXP_REC_FUNC_R1_1(CPU, MTLO, 0, CPU_REG(_Rd_), PUSH32M((uptr)&psxRegs.GPR.n.lo)) // COP2 (GTE) PGXP_REC_FUNC_R1_1(GTE, MFC2, !_Rt_, GTE_DATA_REG(_Rd_), iPushReg(_Rt_)) PGXP_REC_FUNC_R1_1(GTE, CFC2, !_Rt_, GTE_CTRL_REG(_Rd_), iPushReg(_Rt_)) -PGXP_REC_FUNC_R1_1(GTE, MTC2, 0, CPU_REG(_Rt_), PUSH64M((u32)&psxRegs.CP2D.r[_Rd_])) -PGXP_REC_FUNC_R1_1(GTE, CTC2, 0, CPU_REG(_Rt_), PUSH64M((u32)&psxRegs.CP2C.r[_Rd_])) +PGXP_REC_FUNC_R1_1(GTE, MTC2, 0, CPU_REG(_Rt_), PUSH32M((uptr)&psxRegs.CP2D.r[_Rd_])) +PGXP_REC_FUNC_R1_1(GTE, CTC2, 0, CPU_REG(_Rt_), PUSH32M((uptr)&psxRegs.CP2C.r[_Rd_])) -PGXP_REC_FUNC_ADDR_1(GTE, LWC2, PUSH64M((u32)&psxRegs.CP2D.r[_Rt_])) -PGXP_REC_FUNC_ADDR_1(GTE, SWC2, PUSH64M((u32)&psxRegs.CP2D.r[_Rt_])) +PGXP_REC_FUNC_ADDR_1(GTE, LWC2, PUSH32M((uptr)&psxRegs.CP2D.r[_Rt_])) +PGXP_REC_FUNC_ADDR_1(GTE, SWC2, PUSH32M((uptr)&psxRegs.CP2D.r[_Rt_])) // COP0 PGXP_REC_FUNC_R1_1(CP0, MFC0, !_Rd_, CP0_REG(_Rd_), iPushReg(_Rt_)) PGXP_REC_FUNC_R1_1(CP0, CFC0, !_Rd_, CP0_REG(_Rd_), iPushReg(_Rt_)) -PGXP_REC_FUNC_R1_1(CP0, MTC0, !_Rt_, CPU_REG(_Rt_), PUSH64M((u32)&psxRegs.CP0.r[_Rd_])) -PGXP_REC_FUNC_R1_1(CP0, CTC0, !_Rt_, CPU_REG(_Rt_), PUSH64M((u32)&psxRegs.CP0.r[_Rd_])) +PGXP_REC_FUNC_R1_1(CP0, MTC0, !_Rt_, CPU_REG(_Rt_), PUSH32M((uptr)&psxRegs.CP0.r[_Rd_])) +PGXP_REC_FUNC_R1_1(CP0, CTC0, !_Rt_, CPU_REG(_Rt_), PUSH32M((uptr)&psxRegs.CP0.r[_Rd_])) PGXP_REC_FUNC(CP0, RFE) #endif//_I_PGXP_H_ diff --git a/libpcsxcore/ix86_64/iR3000A-64.c b/libpcsxcore/ix86_64/iR3000A-64.c index e1245987..64d9c1d5 100755 --- a/libpcsxcore/ix86_64/iR3000A-64.c +++ b/libpcsxcore/ix86_64/iR3000A-64.c @@ -191,16 +191,6 @@ static void iFlushRegs() { } } -static void iPushReg(int reg) -{ - if (IsConst(reg)) { - PUSH32I(iRegs[reg].k); - } - else { - PUSH64M((uptr)&psxRegs.GPR.r[reg]); - } -} - static void iStoreCycle() { count = ((pc - pcold) / 4) * BIAS; ADD32ItoM((uptr)&psxRegs.cycle, count); diff --git a/libpcsxcore/ix86_64/ix86-64.h b/libpcsxcore/ix86_64/ix86-64.h index 009fa5a1..f0c84023 100755 --- a/libpcsxcore/ix86_64/ix86-64.h +++ b/libpcsxcore/ix86_64/ix86-64.h @@ -90,6 +90,8 @@ extern x86IntRegType g_x86non8bitregs[3]; #define X86ARG2 RSI #define X86ARG3 RDX #define X86ARG4 RCX +#define X86ARG5 R8 +#define X86ARG6 R9 #endif #else -- cgit v1.2.3 From 043615f45454632c8e71f115e4ab7355767231d2 Mon Sep 17 00:00:00 2001 From: MrLavender Date: Thu, 29 Jun 2017 18:58:09 +0100 Subject: Fix PeopsXgl exports on OSX --- macosx/plugins/PeopsXgl/PeopsXgl.exp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/macosx/plugins/PeopsXgl/PeopsXgl.exp b/macosx/plugins/PeopsXgl/PeopsXgl.exp index c069e22a..b71abb3c 100644 --- a/macosx/plugins/PeopsXgl/PeopsXgl.exp +++ b/macosx/plugins/PeopsXgl/PeopsXgl.exp @@ -36,3 +36,7 @@ _GPUcursor _GPUsetfix _GPUvisualVibration + +_GPUpgxpMemory +_GPUpgxpCacheVertex +_GPUtoggleDebug -- cgit v1.2.3 From 952b598739922ab206a57c717c234b2ac76bfc64 Mon Sep 17 00:00:00 2001 From: MrLavender Date: Fri, 30 Jun 2017 15:45:32 +0100 Subject: Add PGXP preferences UI for OS X --- macosx/Pcsxr.xcodeproj/project.pbxproj | 6 ++ macosx/Resources/Base.lproj/Configuration.xib | 107 +++++++++++++++++++++++++- macosx/Source/PcsxrController.m | 4 + macosx/Source/PgxpController.h | 24 ++++++ macosx/Source/PgxpController.m | 98 +++++++++++++++++++++++ macosx/Source/hotkeys.m | 6 +- 6 files changed, 241 insertions(+), 4 deletions(-) create mode 100644 macosx/Source/PgxpController.h create mode 100644 macosx/Source/PgxpController.m 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; -- cgit v1.2.3 From f38cec65e902896a440c535dd3682c8f2cefbbcf Mon Sep 17 00:00:00 2001 From: MrLavender Date: Sat, 1 Jul 2017 14:46:09 +0100 Subject: Add CPU Overclocking to preferences UI on OS X --- macosx/Resources/Base.lproj/Configuration.xib | 60 +++++++++++++++++++++++++++ macosx/Source/ConfigurationController.h | 4 ++ macosx/Source/ConfigurationController.m | 28 +++++++++++++ macosx/Source/PcsxrController.m | 10 ++++- 4 files changed, 100 insertions(+), 2 deletions(-) diff --git a/macosx/Resources/Base.lproj/Configuration.xib b/macosx/Resources/Base.lproj/Configuration.xib index 15030841..cd0e573d 100644 --- a/macosx/Resources/Base.lproj/Configuration.xib +++ b/macosx/Resources/Base.lproj/Configuration.xib @@ -10,6 +10,8 @@ + + @@ -31,6 +33,7 @@ + @@ -250,6 +253,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0.50 + 0.75 + 1.25 + 1.50 + 2.00 + 3.00 + 4.00 + 5.00 + + + + + + + + + + + diff --git a/macosx/Source/ConfigurationController.h b/macosx/Source/ConfigurationController.h index 90dde217..595b91f8 100644 --- a/macosx/Source/ConfigurationController.h +++ b/macosx/Source/ConfigurationController.h @@ -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; diff --git a/macosx/Source/ConfigurationController.m b/macosx/Source/ConfigurationController.m index c7b63335..7485e067 100644 --- a/macosx/Source/ConfigurationController.m +++ b/macosx/Source/ConfigurationController.m @@ -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 diff --git a/macosx/Source/PcsxrController.m b/macosx/Source/PcsxrController.m index 06fb1d55..2a7285b1 100644 --- a/macosx/Source/PcsxrController.m +++ b/macosx/Source/PcsxrController.m @@ -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]; -- cgit v1.2.3 From afe8c4acc66f4a73b012ffebf942db217540ecc6 Mon Sep 17 00:00:00 2001 From: MrLavender Date: Fri, 7 Jul 2017 22:06:16 +0100 Subject: Various fixes to PeopsOpenGL preferences UI on OSX - Fixed frame buffer effects options - Added frame buffer access options - Frame limit setting was being ignored - VSync setting was being ignored - Texture filtering was being restrained to a 0-2 range instead of 0-6 - Scanline color picker was not being enabled properly - Dithering is a boolean option so changed it to a checkbox - Minor layout problem with the windowWidth field on OS X 10.10+ --- .../PeopsXgl/Base.lproj/NetSfPeopsOpenGLConfig.xib | 467 +++++++++------------ .../NetSfPeopsOpenGLPluginConfigController.h | 4 +- .../NetSfPeopsOpenGLPluginConfigController.m | 31 +- 3 files changed, 220 insertions(+), 282 deletions(-) diff --git a/macosx/plugins/PeopsXgl/Base.lproj/NetSfPeopsOpenGLConfig.xib b/macosx/plugins/PeopsXgl/Base.lproj/NetSfPeopsOpenGLConfig.xib index 4ee1cde3..4923fa8c 100644 --- a/macosx/plugins/PeopsXgl/Base.lproj/NetSfPeopsOpenGLConfig.xib +++ b/macosx/plugins/PeopsXgl/Base.lproj/NetSfPeopsOpenGLConfig.xib @@ -1,8 +1,9 @@ - + - + + @@ -10,16 +11,18 @@ - + - + + + @@ -42,19 +45,19 @@ - + - - + + - + - - + + @@ -102,11 +105,8 @@ - - - - - + + @@ -123,27 +123,23 @@ - - - - - - + + - - -
- + + @@ -182,211 +178,17 @@
- - - - - - - - - - - - - - - - -
- - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -459,40 +261,177 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
@@ -553,7 +476,7 @@ Gw - + @@ -663,7 +586,7 @@ Gw - + diff --git a/macosx/plugins/PeopsXgl/macsrc/NetSfPeopsOpenGLPluginConfigController.h b/macosx/plugins/PeopsXgl/macsrc/NetSfPeopsOpenGLPluginConfigController.h index 918fe825..65b9a08f 100755 --- a/macosx/plugins/PeopsXgl/macsrc/NetSfPeopsOpenGLPluginConfigController.h +++ b/macosx/plugins/PeopsXgl/macsrc/NetSfPeopsOpenGLPluginConfigController.h @@ -9,7 +9,7 @@ @interface NetSfPeopsOpenGLPluginConfigController : NSWindowController @property (weak) IBOutlet NSCell *autoFullScreen; -@property (weak) IBOutlet NSPopUpButton *ditherMode; +@property (weak) IBOutlet NSCell *limitFrameRate; @property (weak) IBOutlet NSCell *fpsCounter; @property (weak) IBOutlet NSCell *frameSkipping; @property (weak) IBOutlet NSCell *vSync; @@ -22,6 +22,7 @@ @property (weak) IBOutlet NSSlider *texFiltering; @property (weak) IBOutlet NSSlider *texEnhancment; @property (weak) IBOutlet NSPopUpButton *frameBufferEffects; +@property (weak) IBOutlet NSPopUpButton *frameBufferAccess; @property (weak) IBOutlet NSCell *drawScanlines; @property (weak) IBOutlet NSCell *advancedBlending; @property (weak) IBOutlet NSCell *opaquePass; @@ -31,6 +32,7 @@ @property (weak) IBOutlet NSCell *mjpegDecoder; @property (weak) IBOutlet NSCell *mjpegDecoder15bit; @property (weak) IBOutlet NSCell *gteAccuracy; +@property (weak) IBOutlet NSCell *colorDithering; @property (weak) IBOutlet NSColorWell *scanlineColorWell; @property (weak) IBOutlet NSMatrix *hacksMatrix; @property (weak) IBOutlet NSControl *hackEnable; diff --git a/macosx/plugins/PeopsXgl/macsrc/NetSfPeopsOpenGLPluginConfigController.m b/macosx/plugins/PeopsXgl/macsrc/NetSfPeopsOpenGLPluginConfigController.m index c882c00b..f2ae0d38 100755 --- a/macosx/plugins/PeopsXgl/macsrc/NetSfPeopsOpenGLPluginConfigController.m +++ b/macosx/plugins/PeopsXgl/macsrc/NetSfPeopsOpenGLPluginConfigController.m @@ -162,6 +162,7 @@ void PrepFactoryDefaultPreferences(void) @"Texture Enhancement Level": @0, @"Texture Filter Level": @0, @"Frame Buffer Level": @0, + @"Frame Buffer Access": @0, kWindowSize: NSStringFromSize(NSMakeSize(800, 600)), @"Draw Scanlines": @NO, // nasty: @@ -199,7 +200,9 @@ void ReadConfig(void) iFrameLimit = 2; // required fFrameRate = 60; // required (some number, 60 seems ok) } - + + iForceVSync = [keyValues[kVSync] boolValue] ? 1 : 0; + // Dithering is either on or off in OpenGL plug, but hey bDrawDither = [keyValues[@"Dither Mode"] intValue]; @@ -241,13 +244,17 @@ void ReadConfig(void) if (iFrameTexType > 3) iFrameTexType = 3; if (iFrameTexType < 0) iFrameTexType = 0; + iFrameReadType = [keyValues[@"Frame Buffer Access"] intValue]; + if (iFrameReadType > 4) iFrameReadType = 4; + if (iFrameReadType < 0) iFrameReadType = 0; + iTexQuality = [keyValues[@"Texture Color Depth Level"] intValue]; if (iTexQuality > 4) iTexQuality = 4; if (iTexQuality < 0) iTexQuality = 0; // MAG_FILTER = LINEAR, etc. iFilterType = [keyValues[@"Texture Filter Level"] intValue]; - if (iFilterType > 2) iFilterType = 2; + if (iFilterType > 6) iFilterType = 6; if (iFilterType < 0) iFilterType = 0; // stretches textures (more detail). You'd think it would look great, but it's not massively better. NEEDS iFilterType to be of any use. @@ -294,7 +301,7 @@ void ReadConfig(void) @implementation NetSfPeopsOpenGLPluginConfigController @synthesize autoFullScreen; -@synthesize ditherMode; +@synthesize limitFrameRate; @synthesize fpsCounter; @synthesize frameSkipping; @synthesize vSync; @@ -307,6 +314,7 @@ void ReadConfig(void) @synthesize texFiltering; @synthesize texEnhancment; @synthesize frameBufferEffects; +@synthesize frameBufferAccess; @synthesize drawScanlines; @synthesize advancedBlending; @synthesize opaquePass; @@ -316,6 +324,7 @@ void ReadConfig(void) @synthesize mjpegDecoder; @synthesize mjpegDecoder15bit; @synthesize gteAccuracy; +@synthesize colorDithering; @synthesize scanlineColorWell; @synthesize hacksMatrix; @synthesize hackEnable; @@ -337,14 +346,14 @@ void ReadConfig(void) writeDic[@"Scanline Color"] = [NSArchiver archivedDataWithRootObject:[scanlineColorWell color]]; writeDic[kFrameSkipping] = ([frameSkipping integerValue] ? @YES : @NO); writeDic[kAutoFullScreen] = ([autoFullScreen integerValue] ? @YES : @NO); - //[writeDic setObject:([frameLimit integerValue] ? @YES : @NO) forKey:kFrameLimit]; + writeDic[kFrameLimit] = ([limitFrameRate integerValue] ? @YES : @NO); writeDic[@"Proportional Resize"] = ([proportionalResize integerValue] ? @YES : @NO); - writeDic[@"Dither Mode"] = @([ditherMode indexOfSelectedItem]); writeDic[@"Offscreen Drawing Level"] = @([offscreenDrawing indexOfSelectedItem]); writeDic[@"Texture Color Depth Level"] = @([texColorDepth indexOfSelectedItem]); writeDic[@"Texture Enhancement Level"] = @([texEnhancment integerValue]); writeDic[@"Texture Filter Level"] = @([texFiltering integerValue]); writeDic[@"Frame Buffer Level"] = @([frameBufferEffects indexOfSelectedItem]); + writeDic[@"Frame Buffer Access"] = @([frameBufferAccess indexOfSelectedItem]); writeDic[@"Draw Scanlines"] = ([drawScanlines integerValue] ? @YES : @NO); writeDic[@"Advanced Blending"] = ([advancedBlending integerValue] ? @YES : @NO); writeDic[@"Opaque Pass"] = ([opaquePass integerValue] ? @YES : @NO); @@ -354,6 +363,7 @@ void ReadConfig(void) writeDic[@"Emulate mjpeg decoder"] = ([mjpegDecoder integerValue] ? @YES : @NO); writeDic[@"Fast mjpeg decoder"] = ([mjpegDecoder15bit integerValue] ? @YES : @NO); writeDic[@"GteAccuracy"] = ([gteAccuracy integerValue] ? @YES : @NO); + writeDic[@"Dither Mode"] = @([colorDithering integerValue]); writeDic[kVSync] = ([vSync integerValue] ? @YES : @NO); writeDic[kWindowSize] = NSStringFromSize(NSMakeSize([windowWidth integerValue], [windowHeighth integerValue])); @@ -408,7 +418,7 @@ void ReadConfig(void) [self loadHacksValues]; [autoFullScreen setIntegerValue:[keyValues[kAutoFullScreen] boolValue]]; - [ditherMode selectItemAtIndex:[keyValues[@"Dither Mode"] integerValue]]; + [limitFrameRate setIntegerValue:[keyValues[kFrameLimit] boolValue]]; [fpsCounter setIntegerValue:[keyValues[kFPSCounter] boolValue]]; [scanlineColorWell setColor:[NSUnarchiver unarchiveObjectWithData: keyValues[@"Scanline Color"]]]; [frameSkipping setIntegerValue:[keyValues[kFrameSkipping] boolValue]]; @@ -426,8 +436,10 @@ void ReadConfig(void) [blurEffect setIntegerValue:[keyValues[@"Blur"] boolValue]]; [texColorDepth selectItemAtIndex:[keyValues[@"Texture Color Depth Level"] integerValue]]; [gteAccuracy setIntegerValue:[keyValues[@"GteAccuracy"] boolValue]]; + [colorDithering setIntegerValue:[keyValues[@"Dither Mode"] integerValue]]; [scanlineColorWell setEnabled:[keyValues[@"Draw Scanlines"] boolValue]]; [frameBufferEffects selectItemAtIndex:[keyValues[@"Frame Buffer Level"] integerValue]]; + [frameBufferAccess selectItemAtIndex:[keyValues[@"Frame Buffer Access"] integerValue]]; [vSync setIntegerValue:[keyValues[kVSync] boolValue]]; [proportionalResize setIntegerValue:[keyValues[@"Proportional Resize"] boolValue]]; NSSize winSize = NSSizeFromString(keyValues[kWindowSize]); @@ -438,6 +450,9 @@ void ReadConfig(void) - (void)awakeFromNib { [[NSColorPanel sharedColorPanel] setShowsAlpha:YES]; // eliminate dumb behavior! + + // Kludge fix for windowWidth field layout problem on OS X 10.10+ + windowWidth.titleWidth = windowWidth.titleWidth + FLT_MIN; } - (void)hacksSheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo @@ -475,9 +490,7 @@ void ReadConfig(void) - (IBAction)toggleCheck:(id)sender { - if([sender tag] == 1) { - [scanlineColorWell setEnabled: [sender intValue] ? YES : NO]; - } + scanlineColorWell.enabled = drawScanlines.integerValue; } @end -- cgit v1.2.3