RSP: Handle break in delay slot

This commit is contained in:
zilmar 2024-06-13 12:55:23 +09:30
parent d3411809f7
commit 7161a6f591
1 changed files with 6 additions and 0 deletions

View File

@ -256,6 +256,7 @@ void Compile_BEQ(void)
if (RSPOpC.rs == 0 && RSPOpC.rt == 0)
{
NextInstruction = RSPPIPELINE_DO_DELAY_SLOT;
MoveConstByteToVariable(1, &BranchCompare, "BranchCompare");
return;
}
bDelayAffect = DelaySlotAffectBranch(CompilePC);
@ -338,6 +339,7 @@ void Compile_BNE(void)
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
if (RSPOpC.rs == 0 && RSPOpC.rt == 0)
{
MoveConstByteToVariable(0, &BranchCompare, "BranchCompare");
NextInstruction = RSPPIPELINE_DO_DELAY_SLOT;
return;
}
@ -1544,6 +1546,10 @@ void Compile_Special_BREAK(void)
Ret();
NextInstruction = RSPPIPELINE_FINISH_SUB_BLOCK;
}
else if (NextInstruction == RSPPIPELINE_DELAY_SLOT)
{
NextInstruction = RSPPIPELINE_DELAY_SLOT_EXIT;
}
else
{
CompilerWarning(stdstr_f("WTF\n\nBREAK\nNextInstruction = %X", NextInstruction).c_str());