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