add proper support for GXFIFO stalls.

bad games that blast the GXFIFO and overflow it:
* Super Mario 64 DS
* Rayman RR2

latter seems to get its music streaming crapoed.
This commit is contained in:
StapleButter
2018-11-23 22:21:41 +01:00
parent 27e1ca4103
commit a9e7f8bc5b
8 changed files with 140 additions and 34 deletions

View File

@ -242,12 +242,14 @@ s32 DMA::Run(s32 cycles)
if (!Running)
return cycles;
Executing = true;
if (!(Cnt & 0x04000000))
{
u16 (*readfn)(u32) = CPU ? NDS::ARM7Read16 : NDS::ARM9Read16;
void (*writefn)(u32,u16) = CPU ? NDS::ARM7Write16 : NDS::ARM9Write16;
while (IterCount > 0 && cycles > 0)
while (IterCount > 0 && cycles > 0 && !Stall)
{
writefn(CurDstAddr, readfn(CurSrcAddr));
@ -264,7 +266,8 @@ s32 DMA::Run(s32 cycles)
else
{
// optimized path for typical GXFIFO DMA
if (IsGXFIFODMA)
// likely not worth it tbh
/*if (IsGXFIFODMA)
{
while (IterCount > 0 && cycles > 0)
{
@ -278,12 +281,12 @@ s32 DMA::Run(s32 cycles)
IterCount--;
RemCount--;
}
}
}*/
u32 (*readfn)(u32) = CPU ? NDS::ARM7Read32 : NDS::ARM9Read32;
void (*writefn)(u32,u32) = CPU ? NDS::ARM7Write32 : NDS::ARM9Write32;
while (IterCount > 0 && cycles > 0)
while (IterCount > 0 && cycles > 0 && !Stall)
{
writefn(CurDstAddr, readfn(CurSrcAddr));
@ -298,6 +301,9 @@ s32 DMA::Run(s32 cycles)
}
}
Executing = false;
Stall = false;
if (RemCount)
{
if (IterCount == 0)