RSP: improve running RSP multithreaded

This commit is contained in:
zilmar 2023-09-28 14:46:36 +09:30
parent 15e6e460d2
commit 46e6e54f24
4 changed files with 9 additions and 15 deletions

View File

@ -563,15 +563,18 @@ uint32_t CRSP_Plugin::RspThread(void)
CRegisters & Reg = m_System->m_Reg;
for (;;)
{
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;

View File

@ -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)
{

View File

@ -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

View File

@ -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: