diff --git a/Source/Project64-core/Plugins/RSPPlugin.cpp b/Source/Project64-core/Plugins/RSPPlugin.cpp index 0dd5bcc3e..350076942 100644 --- a/Source/Project64-core/Plugins/RSPPlugin.cpp +++ b/Source/Project64-core/Plugins/RSPPlugin.cpp @@ -563,15 +563,18 @@ uint32_t CRSP_Plugin::RspThread(void) CRegisters & Reg = m_System->m_Reg; for (;;) { - m_RunEvent.IsTriggered(SyncEvent::INFINITE_TIMEOUT); + if ((Reg.SP_STATUS_REG & SP_STATUS_HALT) != 0) + { + m_RunEvent.Reset(); + m_RunEvent.IsTriggered(SyncEvent::INFINITE_TIMEOUT); + } if (!m_RomOpened) { break; } - m_DoRspCycles(100); - if ((Reg.SP_STATUS_REG & SP_STATUS_HALT) != 0) + if ((Reg.SP_STATUS_REG & SP_STATUS_HALT) == 0) { - m_RunEvent.Reset(); + m_DoRspCycles(100); } } return 0; diff --git a/Source/Project64-rsp-core/cpu/RSPCpu.cpp b/Source/Project64-rsp-core/cpu/RSPCpu.cpp index 636bffb59..fa72c3cf0 100644 --- a/Source/Project64-rsp-core/cpu/RSPCpu.cpp +++ b/Source/Project64-rsp-core/cpu/RSPCpu.cpp @@ -10,7 +10,7 @@ class RSPRegisterHandler; UDWORD EleSpec[16], Indx[16]; RSPOpcode RSPOpC; -uint32_t *PrgCount, NextInstruction, RSP_Running, RSP_MfStatusCount; +uint32_t *PrgCount, NextInstruction, RSP_Running; p_func RSP_Opcode[64]; p_func RSP_RegImm[32]; @@ -175,7 +175,6 @@ uint32_t DoRspCycles(uint32_t Cycles) g_RSPDebugger->RspCyclesStart(); CGuard Guard(g_CPUCriticalSection); - RSP_MfStatusCount = 0; switch (g_CPUCore) { diff --git a/Source/Project64-rsp-core/cpu/RSPInterpreterCPU.h b/Source/Project64-rsp-core/cpu/RSPInterpreterCPU.h index 2663ecb3c..f37894111 100644 --- a/Source/Project64-rsp-core/cpu/RSPInterpreterCPU.h +++ b/Source/Project64-rsp-core/cpu/RSPInterpreterCPU.h @@ -17,7 +17,6 @@ enum RSPPIPELINE_STAGE extern RSPPIPELINE_STAGE RSP_NextInstruction; extern uint32_t RSP_JumpTo; -extern uint32_t RSP_MfStatusCount; // Standard MIPS PC-relative branch // Returns the new PC, based on whether the condition passes diff --git a/Source/Project64-rsp-core/cpu/RSPInterpreterOps.cpp b/Source/Project64-rsp-core/cpu/RSPInterpreterOps.cpp index d3fa6c7ca..18daf33dd 100644 --- a/Source/Project64-rsp-core/cpu/RSPInterpreterOps.cpp +++ b/Source/Project64-rsp-core/cpu/RSPInterpreterOps.cpp @@ -420,14 +420,7 @@ void RSP_Cop0_MF(void) case 1: RSP_GPR[RSPOpC.rt].UW = g_RSPRegisterHandler->ReadReg(RSPRegister_DRAM_ADDR); break; case 2: RSP_GPR[RSPOpC.rt].UW = g_RSPRegisterHandler->ReadReg(RSPRegister_RD_LEN); break; case 3: RSP_GPR[RSPOpC.rt].UW = g_RSPRegisterHandler->ReadReg(RSPRegister_WR_LEN); break; - case 4: - RSP_MfStatusCount += 1; - RSP_GPR[RSPOpC.rt].UW = g_RSPRegisterHandler->ReadReg(RSPRegister_STATUS); - if (Mfc0Count != 0 && RSP_MfStatusCount > Mfc0Count) - { - RSP_Running = false; - } - break; + case 4: RSP_GPR[RSPOpC.rt].UW = g_RSPRegisterHandler->ReadReg(RSPRegister_STATUS); break; 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: