Skip to content

Commit

Permalink
fix gxfifo stalls being borked under certain circumstances
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaklyy committed Dec 20, 2024
1 parent e0ac68c commit 98d0a6b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/NDS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1645,7 +1645,7 @@ bool NDS::MainRAMHandle()
{
if (A9ContentionTS < ARM7Timestamp)
{
if (ARM9.MRTrack.Type == MainRAMType::Null) return 0;
if (ARM9.MRTrack.Type == MainRAMType::Null || (CPUStop & CPUStop_GXStall)) return 0;
MainRAMHandleARM9();
}
else
Expand All @@ -1661,7 +1661,7 @@ bool NDS::MainRAMHandle()
{
if (A9ContentionTS <= ARM7Timestamp)
{
if (ARM9.MRTrack.Type == MainRAMType::Null) return 0;
if (ARM9.MRTrack.Type == MainRAMType::Null || (CPUStop & CPUStop_GXStall)) return 0;
MainRAMHandleARM9();
}
else
Expand Down Expand Up @@ -1748,15 +1748,15 @@ u32 NDS::RunFrame()
RunTimers(0);
GPU.GPU3D.Run();

if (ARM9.MRTrack.Type == MainRAMType::Null)
if (CPUStop & CPUStop_GXStall)
{
if (CPUStop & CPUStop_GXStall)
{
// GXFIFO stall
s32 cycles = GPU.GPU3D.CyclesToRunFor();
DMA9Timestamp = std::min(ARM9Target, std::max(ARM9Timestamp+(cycles<<ARM9ClockShift), DMA9Timestamp+(cycles<<ARM9ClockShift)));
}
else if (CPUStop & CPUStop_DMA9)
// GXFIFO stall
s32 cycles = GPU.GPU3D.CyclesToRunFor();
DMA9Timestamp = std::min(ARM9Target, std::max(ARM9Timestamp, DMA9Timestamp)+(cycles<<ARM9ClockShift));
}
else if (ARM9.MRTrack.Type == MainRAMType::Null)
{
if (CPUStop & CPUStop_DMA9)
{
DMAs[0].Run();
if (!(CPUStop & CPUStop_GXStall) && (ARM9.MRTrack.Type == MainRAMType::Null)) DMAs[1].Run();
Expand Down

0 comments on commit 98d0a6b

Please sign in to comment.