From ca3eacab2710e69febe969843d4d12e685448d74 Mon Sep 17 00:00:00 2001 From: purplemarshmallow Date: Sun, 20 Mar 2016 17:12:13 +0100 Subject: [PATCH 1/4] add new per-game settings to the PJ64 RSP mfc0 exit count and semaphore exit --- Source/RSP/Cpu.c | 1 + Source/RSP/Cpu.h | 2 ++ Source/RSP/Interpreter Ops.c | 5 +++-- Source/RSP/Main.cpp | 6 +++++- Source/RSP/Recompiler Ops.c | 11 +++++++---- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Source/RSP/Cpu.c b/Source/RSP/Cpu.c index 3a7c63376..cb82ff8e0 100644 --- a/Source/RSP/Cpu.c +++ b/Source/RSP/Cpu.c @@ -57,6 +57,7 @@ void BuildInterpreterCPU(void); void BuildRecompilerCPU(void); extern HANDLE hMutex; +DWORD Mfc0Count, SemaphoreExit = 0; void SetCPU(DWORD core) { diff --git a/Source/RSP/Cpu.h b/Source/RSP/Cpu.h index d5c409598..15540df32 100644 --- a/Source/RSP/Cpu.h +++ b/Source/RSP/Cpu.h @@ -41,3 +41,5 @@ extern OPCODE RSPOpC; void SetCPU(DWORD core); void Build_RSP (void); + +extern DWORD Mfc0Count, SemaphoreExit; diff --git a/Source/RSP/Interpreter Ops.c b/Source/RSP/Interpreter Ops.c index 572e47f26..54d922a6c 100644 --- a/Source/RSP/Interpreter Ops.c +++ b/Source/RSP/Interpreter Ops.c @@ -310,7 +310,7 @@ void RSP_Cop0_MF (void) { case 4: RSP_MfStatusCount += 1; RSP_GPR[RSPOpC.rt].UW = *RSPInfo.SP_STATUS_REG; - if (RSP_MfStatusCount > 10) + if (Mfc0Count != 0 && RSP_MfStatusCount > Mfc0Count) { RSP_Running = FALSE; } @@ -324,7 +324,8 @@ void RSP_Cop0_MF (void) { } else { RSP_GPR[RSPOpC.rt].W = *RSPInfo.SP_SEMAPHORE_REG; *RSPInfo.SP_SEMAPHORE_REG = 1; - RSP_Running = FALSE; + if (SemaphoreExit != 0) + RSP_Running = FALSE; } break; case 8: RSP_GPR[RSPOpC.rt].UW = *RSPInfo.DPC_START_REG ; break; diff --git a/Source/RSP/Main.cpp b/Source/RSP/Main.cpp index af638938e..07f006428 100644 --- a/Source/RSP/Main.cpp +++ b/Source/RSP/Main.cpp @@ -81,7 +81,7 @@ enum { Set_ReOrdering, Set_GPRConstants, Set_Flags, Set_AlignVector, //Game Settings - Set_JumpTableSize + Set_JumpTableSize, Set_Mfc0Count, Set_SemaphoreExit }; short Set_AudioHle = 0, Set_GraphicsHle = 0; @@ -544,6 +544,8 @@ __declspec(dllexport) void RomOpen (void) EnableDebugging(true); } JumpTableSize = GetSetting(Set_JumpTableSize); + Mfc0Count = GetSetting(Set_Mfc0Count); + SemaphoreExit = GetSetting(Set_SemaphoreExit); } /****************************************************************** @@ -787,6 +789,8 @@ __declspec(dllexport) void PluginLoaded (void) RegisterSetting(Set_AlignVector, Data_DWORD_General,"Assume Vector loads align", NULL,Compiler.bAlignVector,NULL); RegisterSetting(Set_JumpTableSize, Data_DWORD_Game,"JumpTableSize",NULL,0x800,NULL); + RegisterSetting(Set_Mfc0Count, Data_DWORD_Game, "Mfc0Count", NULL, 0x0, NULL); + RegisterSetting(Set_SemaphoreExit, Data_DWORD_Game, "SemaphoreExit", NULL, 0x0, NULL); AudioHle = Set_AudioHle != 0 ? GetSystemSetting(Set_AudioHle) : false; GraphicsHle = Set_GraphicsHle != 0 ? GetSystemSetting(Set_GraphicsHle) : true; diff --git a/Source/RSP/Recompiler Ops.c b/Source/RSP/Recompiler Ops.c index 448d2d3f3..d1ddbd68f 100644 --- a/Source/RSP/Recompiler Ops.c +++ b/Source/RSP/Recompiler Ops.c @@ -1681,9 +1681,11 @@ void Compile_Cop0_MF ( void ) { case 4: MoveVariableToX86reg(&RSP_MfStatusCount, "RSP_MfStatusCount", x86_ECX); MoveVariableToX86reg(RSPInfo.SP_STATUS_REG, "SP_STATUS_REG", x86_EAX); - CompConstToX86reg(x86_ECX, 10); - JbLabel8("label", 10); - MoveConstToVariable(0, &RSP_Running, "RSP_Running"); + if (Mfc0Count != 0) { + CompConstToX86reg(x86_ECX, Mfc0Count); + JbLabel8("label", Mfc0Count); + MoveConstToVariable(0, &RSP_Running, "RSP_Running"); + } IncX86reg(x86_ECX); MoveX86regToVariable(x86_EAX, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt)); MoveX86regToVariable(x86_ECX, &RSP_MfStatusCount, "RSP_MfStatusCount"); @@ -1705,7 +1707,8 @@ void Compile_Cop0_MF ( void ) { MoveConstToVariable(0, &RSP_GPR[RSPOpC.rt].W, GPR_Name(RSPOpC.rt)); } else { MoveVariableToX86reg(RSPInfo.SP_SEMAPHORE_REG, "SP_SEMAPHORE_REG", x86_EAX); - MoveConstToVariable(0, &RSP_Running, "RSP_Running"); + if (SemaphoreExit != 0) + MoveConstToVariable(0, &RSP_Running, "RSP_Running"); MoveConstToVariable(1, RSPInfo.SP_SEMAPHORE_REG, "SP_SEMAPHORE_REG"); MoveX86regToVariable(x86_EAX, &RSP_GPR[RSPOpC.rt].W, GPR_Name(RSPOpC.rt)); if (NextInstruction == NORMAL) From e09569e9da12b0b7fe11cf9b633d3bb72f49eae9 Mon Sep 17 00:00:00 2001 From: purplemarshmallow Date: Sun, 20 Mar 2016 17:31:31 +0100 Subject: [PATCH 2/4] [RDB] add settings --- Config/Project64.rdb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Config/Project64.rdb b/Config/Project64.rdb index 9f0f04654..bd5d848c3 100644 --- a/Config/Project64.rdb +++ b/Config/Project64.rdb @@ -1,4 +1,4 @@ -// ============ RDB for PJ64 v2.2. GoodN64 v321 ===================================== +// ============ RDB for PJ64 v2.2. GoodN64 v321 ===================================== // PJ64 v2.2 Official RDB // Not for use with PJ64 v1.6 or previous //---- START OF RDB FILE HEADER --------------------------------------------------------- @@ -2041,6 +2041,7 @@ Internal Name=GAUNTLET LEGENDS Status=Issues (mixed) Plugin Note=[Glide64] missing:various RDRAM Size=8 +RSP-Mfc0Count=10 [70B0260E-6716D04C-C:4A] Good Name=Gauntlet Legends (J) @@ -2048,6 +2049,7 @@ Internal Name=GAUNTLET LEGENDS Status=Issues (mixed) Plugin Note=[Glide64] missing:various RDRAM Size=8 +RSP-Mfc0Count=10 [729B5E32-B728D980-C:45] Good Name=Gauntlet Legends (U) @@ -2056,6 +2058,7 @@ Status=Issues (mixed) Plugin Note=[Glide64] missing:various Culling=1 RDRAM Size=8 +RSP-Mfc0Count=10 [489C84E6-4C6E49F9-C:4A] Good Name=Getter Love!! - Cho Ren-ai Party Game (J) @@ -3274,6 +3277,7 @@ Internal Name=ÏصÉÌ«ÄËß° Status=Issues (plugin) Plugin Note=[video] HLE not supported; errors:various HLE GFX=No +RSP-SemaphoreExit=1 [9C663069-80F24A80-C:50] Good Name=Mario Party (E) (M3) @@ -5480,6 +5484,7 @@ AudioResetOnLoad=Yes HLE GFX=No Fixed Audio=0 RDRAM Size=8 +RSP-Mfc0Count=10 [F4646B69-C5751095-C:4A] Good Name=Super B-Daman - Battle Phoenix 64 (J) @@ -6786,6 +6791,7 @@ Plugin Note=[video] HLE not supported [audio] needs audio plugin AudioResetOnLoad=Yes Fixed Audio=0 HLE GFX=No +RSP-Mfc0Count=10 [308DFEC8-CE2EB5F6-C:45] Good Name=World Driver Championship (U) @@ -6796,6 +6802,7 @@ Plugin Note=[video] HLE not supported [audio] needs audio plugin AudioResetOnLoad=Yes Fixed Audio=0 HLE GFX=No +RSP-Mfc0Count=10 [2D21C57B-8FE4C58C-C:50] Good Name=Worms - Armageddon (E) (M6) From d46a9bc55a0223cffbd067fb12dafa2a18730e9f Mon Sep 17 00:00:00 2001 From: purplemarshmallow Date: Sun, 20 Mar 2016 20:06:39 +0100 Subject: [PATCH 3/4] correct SemaphoreExit --- Source/RSP/Interpreter Ops.c | 5 ++--- Source/RSP/Recompiler Ops.c | 7 +++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Source/RSP/Interpreter Ops.c b/Source/RSP/Interpreter Ops.c index 54d922a6c..bc09df2d4 100644 --- a/Source/RSP/Interpreter Ops.c +++ b/Source/RSP/Interpreter Ops.c @@ -318,14 +318,13 @@ void RSP_Cop0_MF (void) { case 5: RSP_GPR[RSPOpC.rt].UW = *RSPInfo.SP_DMA_FULL_REG; break; case 6: RSP_GPR[RSPOpC.rt].UW = *RSPInfo.SP_DMA_BUSY_REG; break; case 7: - if (AudioHle || GraphicsHle) + if (AudioHle || GraphicsHle || SemaphoreExit == 0) { RSP_GPR[RSPOpC.rt].W = 0; } else { RSP_GPR[RSPOpC.rt].W = *RSPInfo.SP_SEMAPHORE_REG; *RSPInfo.SP_SEMAPHORE_REG = 1; - if (SemaphoreExit != 0) - RSP_Running = FALSE; + RSP_Running = FALSE; } break; case 8: RSP_GPR[RSPOpC.rt].UW = *RSPInfo.DPC_START_REG ; break; diff --git a/Source/RSP/Recompiler Ops.c b/Source/RSP/Recompiler Ops.c index d1ddbd68f..fd653f45a 100644 --- a/Source/RSP/Recompiler Ops.c +++ b/Source/RSP/Recompiler Ops.c @@ -1683,7 +1683,7 @@ void Compile_Cop0_MF ( void ) { MoveVariableToX86reg(RSPInfo.SP_STATUS_REG, "SP_STATUS_REG", x86_EAX); if (Mfc0Count != 0) { CompConstToX86reg(x86_ECX, Mfc0Count); - JbLabel8("label", Mfc0Count); + JbLabel8("label", 10); MoveConstToVariable(0, &RSP_Running, "RSP_Running"); } IncX86reg(x86_ECX); @@ -1702,13 +1702,12 @@ void Compile_Cop0_MF ( void ) { } break; case 7: - if (AudioHle || GraphicsHle) + if (AudioHle || GraphicsHle || SemaphoreExit == 0) { MoveConstToVariable(0, &RSP_GPR[RSPOpC.rt].W, GPR_Name(RSPOpC.rt)); } else { MoveVariableToX86reg(RSPInfo.SP_SEMAPHORE_REG, "SP_SEMAPHORE_REG", x86_EAX); - if (SemaphoreExit != 0) - MoveConstToVariable(0, &RSP_Running, "RSP_Running"); + MoveConstToVariable(0, &RSP_Running, "RSP_Running"); MoveConstToVariable(1, RSPInfo.SP_SEMAPHORE_REG, "SP_SEMAPHORE_REG"); MoveX86regToVariable(x86_EAX, &RSP_GPR[RSPOpC.rt].W, GPR_Name(RSPOpC.rt)); if (NextInstruction == NORMAL) From c01d002850967b06d9c98555da1a8eb88dccd6a7 Mon Sep 17 00:00:00 2001 From: purplemarshmallow Date: Sun, 20 Mar 2016 20:26:48 +0100 Subject: [PATCH 4/4] [RDB] remove interpreter only entries --- Config/Project64.rdb | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/Config/Project64.rdb b/Config/Project64.rdb index bd5d848c3..015f0e7e4 100644 --- a/Config/Project64.rdb +++ b/Config/Project64.rdb @@ -2469,7 +2469,7 @@ Good Name=Indiana Jones and the Infernal Machine (E) (Unreleased) Internal Name=Indiana Jones Status=Only intro/part OK Core Note=Camera issue; can't play -Plugin Note=[rsp] interpreter only [video] HLE not supported +Plugin Note=[Glide64] errors:various 32bit=No AudioResetOnLoad=Yes Counter Factor=1 @@ -2489,7 +2489,7 @@ Good Name=Indiana Jones and the Infernal Machine (U) Internal Name=Indiana Jones Status=Only intro/part OK Core Note=Camera issue; can't play -Plugin Note=[rsp] interpreter only [video] HLE not supported +Plugin Note=[Glide64] errors:various 32bit=No AudioResetOnLoad=Yes Counter Factor=1 @@ -4440,6 +4440,7 @@ Culling=1 Emulate Clear=1 Linking=Off RDRAM Size=8 +RSP-Mfc0Count=10 [AC5AA5C7-A9B0CDC3-C:46] Good Name=Pokemon Stadium 2 (F) @@ -4450,6 +4451,7 @@ Culling=1 Emulate Clear=1 Linking=Off RDRAM Size=8 +RSP-Mfc0Count=10 [439B7E7E-C1A1495D-C:44] Good Name=Pokemon Stadium 2 (G) @@ -4460,6 +4462,7 @@ Culling=1 Emulate Clear=1 Linking=Off RDRAM Size=8 +RSP-Mfc0Count=10 [EFCEAF00-22094848-C:49] Good Name=Pokemon Stadium 2 (I) @@ -4470,6 +4473,7 @@ Culling=1 Emulate Clear=1 Linking=Off RDRAM Size=8 +RSP-Mfc0Count=10 [63775886-5FB80E7B-C:4A] Good Name=Pokemon Stadium 2 (J) @@ -4490,6 +4494,7 @@ Culling=1 Emulate Clear=1 Linking=Off RDRAM Size=8 +RSP-Mfc0Count=10 [03571182-892FD06D-C:45] Good Name=Pokemon Stadium 2 (U) @@ -4500,6 +4505,7 @@ Culling=1 Emulate Clear=1 Linking=Off RDRAM Size=8 +RSP-Mfc0Count=10 [EE4FD7C2-9CF1D938-C:4A] Good Name=Pokemon Stadium Kin Gin (J) @@ -4510,6 +4516,7 @@ Culling=1 Emulate Clear=1 Linking=Off RDRAM Size=8 +RSP-Mfc0Count=10 [41380792-A167E045-C:45] Good Name=Polaris SnoCross (U) @@ -5273,7 +5280,7 @@ SMM-TLB=0 Good Name=Star Wars - Rogue Squadron (E) (M3) (V1.0) Internal Name=Rogue Squadron Status=Broken (plugin) -Plugin Note=[rsp] interpreter only [video] HLE not supported +Plugin Note=[Glide64] errors:various 32bit=No AudioResetOnLoad=Yes Counter Factor=1 @@ -5285,7 +5292,7 @@ RSP-JumpTableSize=3584 Good Name=Star Wars - Rogue Squadron (E) (M3) (V1.1) Internal Name=Rogue Squadron Status=Broken (plugin) -Plugin Note=[rsp] interpreter only [video] HLE not supported +Plugin Note=[Glide64] errors:various 32bit=No AudioResetOnLoad=Yes Counter Factor=1 @@ -5297,7 +5304,7 @@ RSP-JumpTableSize=3584 Good Name=Star Wars - Rogue Squadron (U) (V1.0) Internal Name=Rogue Squadron Status=Broken (plugin) -Plugin Note=[rsp] interpreter only [video] HLE not supported +Plugin Note=[Glide64] errors:various 32bit=No AudioResetOnLoad=Yes Counter Factor=1 @@ -5309,7 +5316,7 @@ RSP-JumpTableSize=3584 Good Name=Star Wars - Rogue Squadron (U) (V1.1) Internal Name=Rogue Squadron Status=Broken (plugin) -Plugin Note=[rsp] interpreter only [video] HLE not supported +Plugin Note=[Glide64] errors:various 32bit=No AudioResetOnLoad=Yes Counter Factor=1 @@ -5354,7 +5361,7 @@ RDRAM Size=8 Good Name=Star Wars - Shutsugeki! Rogue Chuutai (J) Internal Name=rogue squadron Status=Broken (plugin) -Plugin Note=[rsp] interpreter only [video] HLE not supported +Plugin Note=[Glide64] errors:various 32bit=No HLE GFX=No RDRAM Size=8 @@ -5374,7 +5381,7 @@ Good Name=Star Wars Episode I - Battle for Naboo (E) Internal Name=Battle for Naboo Status=Only intro/part OK Core Note=Camera issue; can't play -Plugin Note=[rsp] interpreter only [video] HLE not supported +Plugin Note=[Glide64] errors:various 32bit=No AudioResetOnLoad=Yes Counter Factor=1 @@ -5387,7 +5394,7 @@ Good Name=Star Wars Episode I - Battle for Naboo (U) Internal Name=Battle for Naboo Status=Only intro/part OK Core Note=Camera issue; can't play -Plugin Note=[rsp] interpreter only [video] HLE not supported +Plugin Note=[Glide64] errors:various 32bit=No AudioResetOnLoad=Yes Counter Factor=1