mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-03-06 21:00:31 +01:00
fix handling of halts
This commit is contained in:
parent
21323bd1b7
commit
cec4c2c880
2 changed files with 26 additions and 8 deletions
32
src/ARM.cpp
32
src/ARM.cpp
|
@ -823,7 +823,7 @@ void ARMv5::Execute()
|
|||
if constexpr (mode == CPUExecuteMode::InterpreterGDB)
|
||||
GdbCheckB();
|
||||
|
||||
if (Halted)
|
||||
if (Halted && !FuncQueueActive)
|
||||
{
|
||||
if (Halted == 2)
|
||||
{
|
||||
|
@ -831,6 +831,7 @@ void ARMv5::Execute()
|
|||
}
|
||||
else if (NDS.HaltInterrupted(0))
|
||||
{
|
||||
NDS.ARM9Timestamp = IRQTimestamp;
|
||||
Halted = 0;
|
||||
if (NDS.IME[0] & 0x1)
|
||||
{
|
||||
|
@ -910,6 +911,14 @@ void ARMv5::Execute()
|
|||
FuncQueueEnd = 0;
|
||||
FuncQueueActive = false;
|
||||
FuncQueue[0] = StartExec;
|
||||
if (Halted)
|
||||
{
|
||||
if (Halted == 1 && NDS.ARM9Timestamp < NDS.ARM9Target)
|
||||
{
|
||||
NDS.ARM9Timestamp = NDS.ARM9Target;
|
||||
}
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -942,7 +951,7 @@ void ARMv5::Execute()
|
|||
if (MRTrack.Type != MainRAMType::Null) return; // check if we need to resolve main ram
|
||||
|
||||
// TODO optimize this shit!!!
|
||||
if (Halted)
|
||||
if (Halted && !FuncQueueActive)
|
||||
{
|
||||
if (Halted == 1 && NDS.ARM9Timestamp < NDS.ARM9Target)
|
||||
{
|
||||
|
@ -965,7 +974,7 @@ void ARMv5::Execute()
|
|||
|
||||
exit:
|
||||
|
||||
if (Halted == 2)
|
||||
if (Halted == 2 && !FuncQueueActive)
|
||||
Halted = 0;
|
||||
}
|
||||
template void ARMv5::Execute<CPUExecuteMode::Interpreter>();
|
||||
|
@ -1017,7 +1026,7 @@ void ARMv4::Execute()
|
|||
if constexpr (mode == CPUExecuteMode::InterpreterGDB)
|
||||
GdbCheckB();
|
||||
|
||||
if (Halted)
|
||||
if (Halted && !FuncQueueActive)
|
||||
{
|
||||
if (Halted == 2)
|
||||
{
|
||||
|
@ -1025,6 +1034,7 @@ void ARMv4::Execute()
|
|||
}
|
||||
else if (NDS.HaltInterrupted(1))
|
||||
{
|
||||
NDS.ARM7Timestamp = IRQTimestamp;
|
||||
Halted = 0;
|
||||
if (NDS.IME[1] & 0x1)
|
||||
{
|
||||
|
@ -1103,6 +1113,14 @@ void ARMv4::Execute()
|
|||
FuncQueueEnd = 0;
|
||||
FuncQueueActive = false;
|
||||
FuncQueue[0] = StartExec;
|
||||
if (Halted)
|
||||
{
|
||||
if (Halted == 1 && NDS.ARM7Timestamp < NDS.ARM7Target)
|
||||
{
|
||||
NDS.ARM7Timestamp = NDS.ARM7Target;
|
||||
}
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1134,7 +1152,7 @@ void ARMv4::Execute()
|
|||
if (MRTrack.Type != MainRAMType::Null) return; // check if we need to resolve main ram
|
||||
|
||||
// TODO optimize this shit!!!
|
||||
if (Halted)
|
||||
if (Halted && !FuncQueueActive)
|
||||
{
|
||||
if (Halted == 1 && NDS.ARM7Timestamp < NDS.ARM7Target)
|
||||
{
|
||||
|
@ -1149,10 +1167,10 @@ void ARMv4::Execute()
|
|||
|
||||
exit:
|
||||
|
||||
if (Halted == 2)
|
||||
if (Halted == 2 && !FuncQueueActive)
|
||||
Halted = 0;
|
||||
|
||||
if (Halted == 4)
|
||||
if (Halted == 4 && !FuncQueueActive)
|
||||
{
|
||||
assert(NDS.ConsoleType == 1);
|
||||
auto& dsi = dynamic_cast<melonDS::DSi&>(NDS);
|
||||
|
|
|
@ -1874,7 +1874,7 @@ u32 NDS::RunFrame()
|
|||
SPU.TransferOutput();
|
||||
break;
|
||||
}
|
||||
//printf("MAIN LOOP: 9 %lli %lli %08X %08llX %i %i %i 7 %lli %lli %08X %08llX %i %i %i\n", ARM9Timestamp, ARM9Target, ARM9.PC, ARM9.CurInstr, (u8)ARM9.MRTrack.Type, ARM9.Halted, ARM9.FuncQueueActive, ARM7Timestamp, ARM7Target, ARM7.R[15], ARM7.CurInstr, (u8)ARM7.MRTrack.Type, ARM7.Halted, ARM7.FuncQueueActive);
|
||||
//printf("MAIN LOOP: 9 %lli %lli %08X %08llX %i %i %i 7 %lli %lli %08X %08llX %i %i %i\n", ARM9Timestamp, ARM9Target, ARM9.R[15], ARM9.CurInstr, (u8)ARM9.MRTrack.Type, ARM9.Halted, ARM9.FuncQueueActive, ARM7Timestamp, ARM7Target, ARM7.R[15], ARM7.CurInstr, (u8)ARM7.MRTrack.Type, ARM7.Halted, ARM7.FuncQueueActive);
|
||||
|
||||
// In the context of TASes, frame count is traditionally the primary measure of emulated time,
|
||||
// so it needs to be tracked even if NDS is powered off.
|
||||
|
|
Loading…
Add table
Reference in a new issue