core:
- many fixes in experimental GEOMETRY_FIFO_EMULATION (now work many 3D games - Castlevania, M&L - TiP, MetalSlug 7 and many, but glitches in full 3D games: NSMB, FFx, Sonic etc.). need to test.
This commit is contained in:
parent
c742ca7c82
commit
52f43889b3
|
@ -154,7 +154,7 @@ void GFX_FIFOsend(u8 cmd, u32 param)
|
|||
u32 gxstat = T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600);
|
||||
if (gxstat & 0x01000000) return; // full
|
||||
|
||||
gxstat &= 0x0000FFFF;
|
||||
gxstat &= 0xF000FFFF;
|
||||
|
||||
gxFIFO.cmd[gxFIFO.tail] = cmd;
|
||||
gxFIFO.param[gxFIFO.tail] = param;
|
||||
|
@ -163,12 +163,14 @@ void GFX_FIFOsend(u8 cmd, u32 param)
|
|||
gxFIFO.tail = 256;
|
||||
|
||||
// TODO: irq handle
|
||||
if (gxFIFO.tail < 128)
|
||||
gxstat |= 0x02000000;
|
||||
//gxstat |= 0x08000000; // set busy flag
|
||||
gxstat |= (gxFIFO.tail << 16);
|
||||
|
||||
#ifdef USE_GEOMETRY_FIFO_EMULATION
|
||||
gxstat |= 0x08000000; // busy
|
||||
// TODO irq21
|
||||
gxstat |= 0x02000000; // this is hack (must be removed later)
|
||||
//if (gxFIFO.tail < 128)
|
||||
// gxstat |= 0x02000000;
|
||||
#else
|
||||
gxstat |= 0x02000000; // this is hack (must be removed later)
|
||||
#endif
|
||||
|
@ -180,7 +182,7 @@ BOOL GFX_FIFOrecv(u8 *cmd, u32 *param)
|
|||
{
|
||||
u32 gxstat = T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600);
|
||||
gxstat &= 0xF000FFFF;
|
||||
if (!gxFIFO.tail) // empty
|
||||
if (gxFIFO.tail == 0) // empty
|
||||
{
|
||||
//gxstat |= (0x01FF << 16);
|
||||
gxstat |= 0x06000000;
|
||||
|
@ -196,16 +198,10 @@ BOOL GFX_FIFOrecv(u8 *cmd, u32 *param)
|
|||
gxFIFO.param[i] = gxFIFO.param[i+1];
|
||||
}
|
||||
|
||||
if (gxFIFO.tail) // not empty
|
||||
{
|
||||
gxstat |= (gxFIFO.tail << 16);
|
||||
gxstat |= 0x08000000;
|
||||
}
|
||||
else
|
||||
{
|
||||
gxstat |= (gxFIFO.tail << 16);
|
||||
|
||||
if (gxFIFO.tail == 0)
|
||||
gxstat |= 0x04000000;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (gxFIFO.tail < 128)
|
||||
gxstat |= 0x02000000;
|
||||
|
@ -218,10 +214,9 @@ BOOL GFX_FIFOrecv(u8 *cmd, u32 *param)
|
|||
void GFX_FIFOcnt(u32 val)
|
||||
{
|
||||
u32 gxstat = T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600);
|
||||
//INFO("GFX FIFO: write context 0x%08X (prev 0x%08X)\n", val, gxstat);
|
||||
//INFO("GFX FIFO: write context 0x%08X (prev 0x%08X) tail %i\n", val, gxstat, gxFIFO.tail);
|
||||
if (val & (1<<29)) // clear? (homebrew)
|
||||
{
|
||||
// need to flush before???
|
||||
GFX_FIFOclear();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#ifndef FIFO_H
|
||||
#define FIFO_H
|
||||
|
||||
//#define USE_GEOMETRY_FIFO_EMULATION
|
||||
//#define USE_GEOMETRY_FIFO_EMULATION //enables new experimental gxFIFO
|
||||
|
||||
#include "types.h"
|
||||
|
||||
|
|
|
@ -1019,6 +1019,9 @@ void MMU_clearMem()
|
|||
partie = 1;
|
||||
addonsReset();
|
||||
Mic_Reset();
|
||||
#ifdef USE_GEOMETRY_FIFO_EMULATION
|
||||
MMU.gfx3dCycles = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void MMU_setRom(u8 * rom, u32 mask)
|
||||
|
@ -2190,8 +2193,10 @@ void FASTCALL _MMU_ARM9_write32(u32 adr, u32 val)
|
|||
case 0x400041:
|
||||
case 0x400042:
|
||||
case 0x400043: // FIFO Commands
|
||||
((u32 *)(MMU.MMU_MEM[ARMCPU_ARM9][0x40]))[(adr & 0xFFF) >> 2] = val;
|
||||
gfx3d_sendCommandToFIFO(val);
|
||||
return;
|
||||
|
||||
case 0x400044:
|
||||
case 0x400045:
|
||||
case 0x400046:
|
||||
|
@ -2217,6 +2222,7 @@ void FASTCALL _MMU_ARM9_write32(u32 adr, u32 val)
|
|||
case 0x40005A:
|
||||
case 0x40005B:
|
||||
case 0x40005C: // Individual Commands
|
||||
((u32 *)(MMU.MMU_MEM[ARMCPU_ARM9][0x40]))[(adr & 0xFFF) >> 2] = val;
|
||||
gfx3d_sendCommand(adr, val);
|
||||
return;
|
||||
default:
|
||||
|
|
|
@ -112,6 +112,10 @@ struct MMU_struct {
|
|||
u32 sqrtCnt;
|
||||
s32 sqrtCycles;
|
||||
|
||||
#ifdef USE_GEOMETRY_FIFO_EMULATION
|
||||
s32 gfx3dCycles;
|
||||
#endif
|
||||
|
||||
u8 powerMan_CntReg;
|
||||
BOOL powerMan_CntRegWritten;
|
||||
u8 powerMan_Reg[4];
|
||||
|
|
|
@ -1916,6 +1916,10 @@ void NDS_exec(s32 nb)
|
|||
nds.ARM7Cycle -= (560190<<1);
|
||||
nb -= (560190<<1);
|
||||
|
||||
#ifdef USE_GEOMETRY_FIFO_EMULATION
|
||||
MMU.gfx3dCycles -= (560190 << 1);
|
||||
#endif
|
||||
|
||||
if(MMU.divRunning)
|
||||
{
|
||||
MMU.divCycles -= (560190 << 1);
|
||||
|
@ -1989,6 +1993,11 @@ void NDS_exec(s32 nb)
|
|||
if(!nds.sleeping)
|
||||
{*/
|
||||
|
||||
#ifdef USE_GEOMETRY_FIFO_EMULATION
|
||||
if (nds.cycles > MMU.gfx3dCycles)
|
||||
gfx3d_execute3D();
|
||||
#endif
|
||||
|
||||
if(MMU.divRunning)
|
||||
{
|
||||
if(nds.cycles > MMU.divCycles)
|
||||
|
@ -2411,8 +2420,17 @@ void NDS_exec(s32 nb)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef USE_GEOMETRY_FIFO_EMULATION
|
||||
// todo: hack - remove later
|
||||
if(MMU.reg_IE[ARMCPU_ARM9]&(1<<21))
|
||||
{
|
||||
NDS_makeARM9Int(21); // GX geometry
|
||||
//INFO("IRQ21\n");
|
||||
}
|
||||
#else
|
||||
if(MMU.reg_IE[ARMCPU_ARM9]&(1<<21))
|
||||
NDS_makeARM9Int(21); // GX geometry
|
||||
#endif
|
||||
|
||||
if((MMU.reg_IF[0]&MMU.reg_IE[0]) && (MMU.reg_IME[0]))
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -298,6 +298,9 @@ void gfx3d_VBlankSignal();
|
|||
void gfx3d_VBlankEndSignal(bool skipFrame);
|
||||
void gfx3d_Control(u32 v);
|
||||
u32 gfx3d_GetGXstatus();
|
||||
#ifdef USE_GEOMETRY_FIFO_EMULATION
|
||||
void gfx3d_execute3D();
|
||||
#endif
|
||||
void gfx3d_sendCommandToFIFO(u32 val);
|
||||
void gfx3d_sendCommand(u32 cmd, u32 param);
|
||||
|
||||
|
|
Loading…
Reference in New Issue