Core: In R4300iOp::ExecuteOps only update UpdateInstructionMemory at the start of the loop

This commit is contained in:
zilmar 2025-02-13 12:19:22 +10:30
parent b8a514a483
commit 8ae9d7b9ff
1 changed files with 13 additions and 9 deletions

View File

@ -93,10 +93,15 @@ void R4300iOp::ExecuteOps(uint32_t Cycles)
uint32_t CountPerOp = m_System.CountPerOp();
int32_t & NextTimer = *g_NextTimer;
bool CheckTimer = false;
bool updateInstructionMemory = true;
UpdateInstructionMemory();
while (!Done && Cycles > 0)
{
if (updateInstructionMemory)
{
UpdateInstructionMemory();
updateInstructionMemory = false;
}
m_Opcode.Value = *m_InstructionPtr;
if (HaveDebugger())
{
@ -143,6 +148,10 @@ void R4300iOp::ExecuteOps(uint32_t Cycles)
}
m_PROGRAM_COUNTER += 4;
if ((((uint32_t)m_PROGRAM_COUNTER) & 0xFFFUL) == 0)
{
updateInstructionMemory = true;
}
m_InstructionPtr++;
switch (PipelineStage)
@ -177,13 +186,13 @@ void R4300iOp::ExecuteOps(uint32_t Cycles)
SystemEvents.ExecuteEvents();
}
}
UpdateInstructionMemory();
updateInstructionMemory = true;
break;
case PIPELINE_STAGE_JUMP_DELAY_SLOT:
PipelineStage = PIPELINE_STAGE_JUMP;
m_PROGRAM_COUNTER = JumpToLocation;
JumpToLocation = JumpDelayLocation;
UpdateInstructionMemory();
updateInstructionMemory = true;
break;
case PIPELINE_STAGE_PERMLOOP_DELAY_DONE:
m_PROGRAM_COUNTER = JumpToLocation;
@ -194,16 +203,11 @@ void R4300iOp::ExecuteOps(uint32_t Cycles)
{
SystemEvents.ExecuteEvents();
}
UpdateInstructionMemory();
updateInstructionMemory = true;
break;
default:
g_Notify->BreakPoint(__FILE__, __LINE__);
}
if ((((uint32_t)m_PROGRAM_COUNTER) & 0xFFFUL) == 0)
{
UpdateInstructionMemory();
}
}
g_SystemTimer->UpdateTimers();
}