[Project64] Some code cleanup in InterpreterCPU.cpp
This commit is contained in:
parent
264666e2bb
commit
7e0dd2e83b
|
@ -272,6 +272,8 @@ void CInterpreterCPU::InPermLoop()
|
||||||
|
|
||||||
void CInterpreterCPU::ExecuteCPU()
|
void CInterpreterCPU::ExecuteCPU()
|
||||||
{
|
{
|
||||||
|
WriteTrace(TraceN64System, TraceDebug, "Start");
|
||||||
|
|
||||||
bool & Done = g_System->m_EndEmulation;
|
bool & Done = g_System->m_EndEmulation;
|
||||||
uint32_t & PROGRAM_COUNTER = *_PROGRAM_COUNTER;
|
uint32_t & PROGRAM_COUNTER = *_PROGRAM_COUNTER;
|
||||||
OPCODE & Opcode = R4300iOp::m_Opcode;
|
OPCODE & Opcode = R4300iOp::m_Opcode;
|
||||||
|
@ -280,6 +282,7 @@ void CInterpreterCPU::ExecuteCPU()
|
||||||
const int32_t & bDoSomething = g_SystemEvents->DoSomething();
|
const int32_t & bDoSomething = g_SystemEvents->DoSomething();
|
||||||
uint32_t CountPerOp = g_System->CountPerOp();
|
uint32_t CountPerOp = g_System->CountPerOp();
|
||||||
int32_t & NextTimer = *g_NextTimer;
|
int32_t & NextTimer = *g_NextTimer;
|
||||||
|
bool CheckTimer = false;
|
||||||
|
|
||||||
__except_try()
|
__except_try()
|
||||||
{
|
{
|
||||||
|
@ -313,8 +316,7 @@ void CInterpreterCPU::ExecuteCPU()
|
||||||
R4300iOp::m_NextInstruction = PERMLOOP_DELAY_DONE;
|
R4300iOp::m_NextInstruction = PERMLOOP_DELAY_DONE;
|
||||||
break;
|
break;
|
||||||
case JUMP:
|
case JUMP:
|
||||||
{
|
CheckTimer = (JumpToLocation < PROGRAM_COUNTER - 4 || TestTimer);
|
||||||
bool CheckTimer = (JumpToLocation < PROGRAM_COUNTER - 4 || TestTimer);
|
|
||||||
PROGRAM_COUNTER = JumpToLocation;
|
PROGRAM_COUNTER = JumpToLocation;
|
||||||
R4300iOp::m_NextInstruction = NORMAL;
|
R4300iOp::m_NextInstruction = NORMAL;
|
||||||
if (CheckTimer)
|
if (CheckTimer)
|
||||||
|
@ -329,8 +331,7 @@ void CInterpreterCPU::ExecuteCPU()
|
||||||
g_SystemEvents->ExecuteEvents();
|
g_SystemEvents->ExecuteEvents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
|
||||||
case PERMLOOP_DELAY_DONE:
|
case PERMLOOP_DELAY_DONE:
|
||||||
PROGRAM_COUNTER = JumpToLocation;
|
PROGRAM_COUNTER = JumpToLocation;
|
||||||
R4300iOp::m_NextInstruction = NORMAL;
|
R4300iOp::m_NextInstruction = NORMAL;
|
||||||
|
@ -350,6 +351,7 @@ void CInterpreterCPU::ExecuteCPU()
|
||||||
{
|
{
|
||||||
g_Notify->FatalError(GS(MSG_UNKNOWN_MEM_ACTION));
|
g_Notify->FatalError(GS(MSG_UNKNOWN_MEM_ACTION));
|
||||||
}
|
}
|
||||||
|
WriteTrace(TraceN64System, TraceDebug, "Done");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInterpreterCPU::ExecuteOps(int32_t Cycles)
|
void CInterpreterCPU::ExecuteOps(int32_t Cycles)
|
||||||
|
@ -361,6 +363,7 @@ void CInterpreterCPU::ExecuteOps(int32_t Cycles)
|
||||||
bool & TestTimer = R4300iOp::m_TestTimer;
|
bool & TestTimer = R4300iOp::m_TestTimer;
|
||||||
const int32_t & DoSomething = g_SystemEvents->DoSomething();
|
const int32_t & DoSomething = g_SystemEvents->DoSomething();
|
||||||
uint32_t CountPerOp = g_System->CountPerOp();
|
uint32_t CountPerOp = g_System->CountPerOp();
|
||||||
|
bool CheckTimer = false;
|
||||||
|
|
||||||
__except_try()
|
__except_try()
|
||||||
{
|
{
|
||||||
|
@ -416,21 +419,19 @@ void CInterpreterCPU::ExecuteOps(int32_t Cycles)
|
||||||
PROGRAM_COUNTER += 4;
|
PROGRAM_COUNTER += 4;
|
||||||
break;
|
break;
|
||||||
case JUMP:
|
case JUMP:
|
||||||
|
CheckTimer = (JumpToLocation < PROGRAM_COUNTER || TestTimer);
|
||||||
|
PROGRAM_COUNTER = JumpToLocation;
|
||||||
|
R4300iOp::m_NextInstruction = NORMAL;
|
||||||
|
if (CheckTimer)
|
||||||
{
|
{
|
||||||
bool CheckTimer = (JumpToLocation < PROGRAM_COUNTER || TestTimer);
|
TestTimer = false;
|
||||||
PROGRAM_COUNTER = JumpToLocation;
|
if (*g_NextTimer < 0)
|
||||||
R4300iOp::m_NextInstruction = NORMAL;
|
|
||||||
if (CheckTimer)
|
|
||||||
{
|
{
|
||||||
TestTimer = false;
|
g_SystemTimer->TimerDone();
|
||||||
if (*g_NextTimer < 0)
|
}
|
||||||
{
|
if (DoSomething)
|
||||||
g_SystemTimer->TimerDone();
|
{
|
||||||
}
|
g_SystemEvents->ExecuteEvents();
|
||||||
if (DoSomething)
|
|
||||||
{
|
|
||||||
g_SystemEvents->ExecuteEvents();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue