From b6a8c54fde2a81208be532edbbfad03c3545896b Mon Sep 17 00:00:00 2001 From: LegendOfDragoon Date: Sun, 20 Sep 2015 13:21:26 -0700 Subject: [PATCH 1/2] Implement case 7 in Compile_Cop0_MF --- Source/RSP/Recompiler Ops.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/Source/RSP/Recompiler Ops.c b/Source/RSP/Recompiler Ops.c index e8b4107b1..36cc9b8d5 100644 --- a/Source/RSP/Recompiler Ops.c +++ b/Source/RSP/Recompiler Ops.c @@ -41,6 +41,7 @@ #pragma warning(disable : 4152) // nonstandard extension, function/data pointer conversion in expression +extern BOOL AudioHle, GraphicsHle; UWORD32 Recp, RecpResult, SQroot, SQrootResult; DWORD ESP_RegSave = 0, EBP_RegSave = 0; DWORD BranchCompare = 0; @@ -1646,7 +1647,6 @@ void Compile_Cop0_MF ( void ) { MoveX86regToVariable(x86_EAX, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt)); break; case 4: - case 7: MoveConstToVariable(RSPOpC.Hex, &RSPOpC.Hex, "RSPOpC.Hex" ); Call_Direct(RSP_Cop0_MF,"RSP_Cop0_MF"); if (NextInstruction == NORMAL) @@ -1661,6 +1661,28 @@ void Compile_Cop0_MF ( void ) { BreakPoint(); } break; + case 7: + if (AudioHle || GraphicsHle) + { + 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"); + MoveConstToVariable(1, RSPInfo.SP_SEMAPHORE_REG, "SP_SEMAPHORE_REG"); + MoveX86regToVariable(x86_EAX, &RSP_GPR[RSPOpC.rt].W, GPR_Name(RSPOpC.rt)); + if (NextInstruction == NORMAL) + { + MoveConstToVariable(CompilePC + 4, PrgCount, "RSP PC"); + Ret(); + NextInstruction = FINISH_SUB_BLOCK; + } else if (NextInstruction == DELAY_SLOT) { + NextInstruction = DELAY_SLOT_EXIT; + } else { + CompilerWarning("MF error\nWeird Delay Slot.\n\nNextInstruction = %X\nEmulation will now stop", NextInstruction); + BreakPoint(); + } + } + break; case 8: MoveVariableToX86reg(RSPInfo.DPC_START_REG, "DPC_START_REG", x86_EAX); MoveX86regToVariable(x86_EAX, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt)); From aa70b43ffce30417d0ad71644b66fb4173bda684 Mon Sep 17 00:00:00 2001 From: LegendOfDragoon Date: Sun, 20 Sep 2015 14:57:45 -0700 Subject: [PATCH 2/2] Implement case 4 in Compile_Cop0_MF --- Source/RSP/Recompiler Ops.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Source/RSP/Recompiler Ops.c b/Source/RSP/Recompiler Ops.c index 36cc9b8d5..17f4ce600 100644 --- a/Source/RSP/Recompiler Ops.c +++ b/Source/RSP/Recompiler Ops.c @@ -1647,8 +1647,14 @@ void Compile_Cop0_MF ( void ) { MoveX86regToVariable(x86_EAX, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt)); break; case 4: - MoveConstToVariable(RSPOpC.Hex, &RSPOpC.Hex, "RSPOpC.Hex" ); - Call_Direct(RSP_Cop0_MF,"RSP_Cop0_MF"); + 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"); + IncX86reg(x86_ECX); + MoveX86regToVariable(x86_EAX, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt)); + MoveX86regToVariable(x86_ECX, &RSP_MfStatusCount, "RSP_MfStatusCount"); if (NextInstruction == NORMAL) { MoveConstToVariable(CompilePC + 4,PrgCount,"RSP PC");