fix a bunch of GXFIFO related bugs.
This commit is contained in:
parent
cca0a71d81
commit
97d76addd9
1
ARM.cpp
1
ARM.cpp
|
@ -328,6 +328,7 @@ s32 ARM::Execute()
|
|||
else
|
||||
{
|
||||
Cycles = CyclesToRun;
|
||||
GPU3D::Run(CyclesToRun >> 1);
|
||||
return Cycles;
|
||||
}
|
||||
}
|
||||
|
|
7
DMA.cpp
7
DMA.cpp
|
@ -46,7 +46,7 @@ DMA::DMA(u32 cpu, u32 num)
|
|||
Waitstates[1][i] = 1;
|
||||
}
|
||||
|
||||
if (!num)
|
||||
if (!cpu)
|
||||
{
|
||||
// ARM9
|
||||
// note: 33MHz cycles
|
||||
|
@ -206,8 +206,6 @@ s32 DMA::Run(s32 cycles)
|
|||
if (!Running)
|
||||
return cycles;
|
||||
|
||||
u32 zorp = IterCount;
|
||||
|
||||
if (!(Cnt & 0x04000000))
|
||||
{
|
||||
u16 (*readfn)(u32) = CPU ? NDS::ARM7Read16 : NDS::ARM9Read16;
|
||||
|
@ -250,6 +248,9 @@ s32 DMA::Run(s32 cycles)
|
|||
{
|
||||
Running = false;
|
||||
NDS::StopCPU(CPU, false);
|
||||
|
||||
if (StartMode & 0x07)
|
||||
GPU3D::CheckFIFODMA();
|
||||
}
|
||||
|
||||
return cycles;
|
||||
|
|
24
GPU3D.cpp
24
GPU3D.cpp
|
@ -848,7 +848,6 @@ void CmdFIFOWrite(CmdFIFOEntry& entry)
|
|||
if (CmdFIFO->IsEmpty() && !CmdPIPE->IsFull())
|
||||
{
|
||||
CmdPIPE->Write(entry);
|
||||
GXStat |= (1<<27);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -890,24 +889,19 @@ void ExecuteCommand()
|
|||
{
|
||||
CmdFIFOEntry entry = CmdFIFORead();
|
||||
|
||||
//printf("FIFO: %02X %08X\n", entry.Command, entry.Param);
|
||||
//printf("FIFO: processing %02X %08X. Levels: FIFO=%d, PIPE=%d\n", entry.Command, entry.Param, CmdFIFO->Level(), CmdPIPE->Level());
|
||||
|
||||
ExecParams[ExecParamCount] = entry.Param;
|
||||
ExecParamCount++;
|
||||
|
||||
//if ((entry.Command&0xF0)==0x10)
|
||||
// printf("MATRIX CMD %02X %08X\n", entry.Command, entry.Param);
|
||||
|
||||
if (ExecParamCount >= CmdNumParams[entry.Command])
|
||||
{
|
||||
CycleCount += CmdNumCycles[entry.Command];
|
||||
ExecParamCount = 0;
|
||||
|
||||
GXStat &= ~(1<<14);
|
||||
//if (CycleCount > 0)
|
||||
// GXStat |= (1<<27);
|
||||
|
||||
//printf("3D CMD %02X\n", entry.Command);
|
||||
if (CycleCount > 0)
|
||||
GXStat |= (1<<27);
|
||||
|
||||
switch (entry.Command)
|
||||
{
|
||||
|
@ -1268,6 +1262,10 @@ void Run(s32 cycles)
|
|||
{
|
||||
if (FlushRequest)
|
||||
return;
|
||||
if (CycleCount <= 0 && CmdPIPE->IsEmpty())
|
||||
return;
|
||||
|
||||
CycleCount -= cycles;
|
||||
|
||||
if (CycleCount <= 0)
|
||||
{
|
||||
|
@ -1275,12 +1273,10 @@ void Run(s32 cycles)
|
|||
ExecuteCommand();
|
||||
}
|
||||
|
||||
CycleCount -= cycles;
|
||||
|
||||
if (CycleCount <= 0 && CmdPIPE->IsEmpty())
|
||||
{
|
||||
CycleCount = 0;
|
||||
GXStat &= ~(1<<27);
|
||||
GXStat &= ~((1<<27)|(1<<14));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1318,7 +1314,6 @@ void VBlank()
|
|||
NumPolygons = 0;
|
||||
|
||||
FlushRequest = 0;
|
||||
GXStat &= ~(1<<27);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1409,11 +1404,14 @@ void Write32(u32 addr, u32 val)
|
|||
ParamCount++;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if ((CurCommand & 0xFF) || (NumCommands == 4))
|
||||
{
|
||||
CmdFIFOEntry entry;
|
||||
entry.Command = CurCommand & 0xFF;
|
||||
entry.Param = val;
|
||||
CmdFIFOWrite(entry);
|
||||
}
|
||||
|
||||
if (ParamCount >= TotalParams)
|
||||
{
|
||||
|
|
2
NDS.cpp
2
NDS.cpp
|
@ -311,7 +311,7 @@ void Reset()
|
|||
// test
|
||||
//LoadROM();
|
||||
//LoadFirmware();
|
||||
if (NDSCart::LoadROM("rom/raving.nds"))
|
||||
if (NDSCart::LoadROM("rom/nsmb.nds"))
|
||||
Running = true; // hax
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
1481161027 c:\documents\sources\melonds\types.h
|
||||
|
||||
1487304040 source:c:\documents\sources\melonds\nds.cpp
|
||||
1487349286 source:c:\documents\sources\melonds\nds.cpp
|
||||
<stdio.h>
|
||||
<string.h>
|
||||
"NDS.h"
|
||||
|
@ -24,7 +24,7 @@
|
|||
"RTC.h"
|
||||
"Wifi.h"
|
||||
|
||||
1486736660 source:c:\documents\sources\melonds\arm.cpp
|
||||
1487349559 source:c:\documents\sources\melonds\arm.cpp
|
||||
<stdio.h>
|
||||
"NDS.h"
|
||||
"ARM.h"
|
||||
|
@ -109,7 +109,7 @@
|
|||
1486511075 c:\documents\sources\melonds\fifo.h
|
||||
"types.h"
|
||||
|
||||
1487305720 source:c:\documents\sources\melonds\dma.cpp
|
||||
1487354030 source:c:\documents\sources\melonds\dma.cpp
|
||||
<stdio.h>
|
||||
"NDS.h"
|
||||
"DMA.h"
|
||||
|
@ -148,7 +148,7 @@
|
|||
|
||||
1487287868 c:\documents\sources\melonds\gpu3d.h
|
||||
|
||||
1487305740 source:c:\documents\sources\melonds\gpu3d.cpp
|
||||
1487354054 source:c:\documents\sources\melonds\gpu3d.cpp
|
||||
<stdio.h>
|
||||
<string.h>
|
||||
"NDS.h"
|
||||
|
|
Loading…
Reference in New Issue