Slightly improved CDLogger for the CHR data. The Old PPU is now fully supported. Removed the garbage logging. TODO: fix for the MMC5, currently isn't supported
code cleanup
This commit is contained in:
parent
6422560659
commit
887aaa1bfd
211
src/ppu.cpp
211
src/ppu.cpp
|
@ -50,8 +50,8 @@
|
||||||
|
|
||||||
#define SpriteON (PPU[1]&0x10) //Show Sprite
|
#define SpriteON (PPU[1]&0x10) //Show Sprite
|
||||||
#define ScreenON (PPU[1]&0x08) //Show screen
|
#define ScreenON (PPU[1]&0x08) //Show screen
|
||||||
#define PPUON (PPU[1]&0x18) //PPU should operate
|
#define PPUON (PPU[1]&0x18) //PPU should operate
|
||||||
#define GRAYSCALE (PPU[1]&0x01) //Grayscale (AND palette entries with 0x30)
|
#define GRAYSCALE (PPU[1]&0x01) //Grayscale (AND palette entries with 0x30)
|
||||||
|
|
||||||
#define SpriteLeft8 (PPU[1]&0x04)
|
#define SpriteLeft8 (PPU[1]&0x04)
|
||||||
#define BGLeft8 (PPU[1]&0x02)
|
#define BGLeft8 (PPU[1]&0x02)
|
||||||
|
@ -341,7 +341,8 @@ static int deempcnt[8];
|
||||||
void (*GameHBIRQHook)(void), (*GameHBIRQHook2)(void);
|
void (*GameHBIRQHook)(void), (*GameHBIRQHook2)(void);
|
||||||
void (*PPU_hook)(uint32 A);
|
void (*PPU_hook)(uint32 A);
|
||||||
|
|
||||||
uint8 vtoggle=0;
|
uint8 vtoggle5=0;
|
||||||
|
uint8 vtoggle6=0;
|
||||||
uint8 XOffset=0;
|
uint8 XOffset=0;
|
||||||
|
|
||||||
uint32 TempAddr=0,RefreshAddr=0,DummyRead=0;
|
uint32 TempAddr=0,RefreshAddr=0,DummyRead=0;
|
||||||
|
@ -360,8 +361,8 @@ uint8 UPALRAM[0x03]; //for 0x4/0x8/0xC addresses in palette, the ones in
|
||||||
//0x20 are 0 to not break fceu rendering.
|
//0x20 are 0 to not break fceu rendering.
|
||||||
|
|
||||||
|
|
||||||
#define MMC5SPRVRAMADR(V) &MMC5SPRVPage[(V)>>10][(V)]
|
#define MMC5SPRVRAMADR(V) &MMC5SPRVPage[(V)>>10][(V)]
|
||||||
#define VRAMADR(V) &VPage[(V)>>10][(V)]
|
#define VRAMADR(V) &VPage[(V)>>10][(V)]
|
||||||
|
|
||||||
//mbg 8/6/08 - fix a bug relating to
|
//mbg 8/6/08 - fix a bug relating to
|
||||||
//"When in 8x8 sprite mode, only one set is used for both BG and sprites."
|
//"When in 8x8 sprite mode, only one set is used for both BG and sprites."
|
||||||
|
@ -441,16 +442,30 @@ unsigned char *cdloggervdata;
|
||||||
unsigned int cdloggerVideoDataSize = 0;
|
unsigned int cdloggerVideoDataSize = 0;
|
||||||
|
|
||||||
int GetCHRAddress(int A){
|
int GetCHRAddress(int A){
|
||||||
if(A < 0x2000) { // Mapper 90 can map nametables from the VROM
|
if(cdloggerVideoDataSize) {
|
||||||
if(cdloggerVideoDataSize) {
|
|
||||||
int result = &VPage[A>>10][A] - CHRptr[0];
|
int result = &VPage[A>>10][A] - CHRptr[0];
|
||||||
if((result >= 0) && (result < (int)cdloggerVideoDataSize))
|
if((result >= 0) && (result < (int)cdloggerVideoDataSize))
|
||||||
return result;
|
return result;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define RENDER_LOG(tmp) { \
|
||||||
|
if(debug_loggingCD) \
|
||||||
|
{ \
|
||||||
|
int addr = GetCHRAddress(tmp); \
|
||||||
|
if(addr != -1) \
|
||||||
|
{ \
|
||||||
|
if(!(cdloggervdata[addr] & 1)) \
|
||||||
|
{ \
|
||||||
|
cdloggervdata[addr] |= 1; \
|
||||||
|
if(!(cdloggervdata[addr] & 2))undefinedvromcount--; \
|
||||||
|
rendercount++; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
uint8 FASTCALL FFCEUX_PPURead_Default(uint32 A) {
|
uint8 FASTCALL FFCEUX_PPURead_Default(uint32 A) {
|
||||||
uint32 tmp = A;
|
uint32 tmp = A;
|
||||||
|
|
||||||
|
@ -458,19 +473,6 @@ uint8 FASTCALL FFCEUX_PPURead_Default(uint32 A) {
|
||||||
|
|
||||||
if(tmp<0x2000)
|
if(tmp<0x2000)
|
||||||
{
|
{
|
||||||
if(debug_loggingCD)
|
|
||||||
{
|
|
||||||
int addr = GetCHRAddress(tmp);
|
|
||||||
if(addr != -1)
|
|
||||||
{
|
|
||||||
if(!(cdloggervdata[addr] & 1))
|
|
||||||
{
|
|
||||||
cdloggervdata[addr] |= 1;
|
|
||||||
if(!(cdloggervdata[addr] & 2))undefinedvromcount--;
|
|
||||||
rendercount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return VPage[tmp>>10][tmp];
|
return VPage[tmp>>10][tmp];
|
||||||
}
|
}
|
||||||
else if (tmp < 0x3F00)
|
else if (tmp < 0x3F00)
|
||||||
|
@ -543,9 +545,9 @@ static DECLFR(A2002)
|
||||||
if(!fceuindbg)
|
if(!fceuindbg)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
vtoggle=0;
|
vtoggle5 = vtoggle6 = 0;
|
||||||
PPU_status&=0x7F;
|
PPU_status &= 0x7F;
|
||||||
PPUGenLatch=ret;
|
PPUGenLatch = ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -742,31 +744,6 @@ static DECLFR(A200x) /* Not correct for $2004 reads. */
|
||||||
return PPUGenLatch;
|
return PPUGenLatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
static DECLFR(A2004)
|
|
||||||
{
|
|
||||||
uint8 ret;
|
|
||||||
|
|
||||||
FCEUPPU_LineUpdate();
|
|
||||||
ret = SPRAM[PPU[3]];
|
|
||||||
|
|
||||||
if(PPUSPL>=8)
|
|
||||||
{
|
|
||||||
if(PPU[3]>=8)
|
|
||||||
ret = SPRAM[PPU[3]];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//printf("$%02x:$%02x\n",PPUSPL,V);
|
|
||||||
ret = SPRAM[PPUSPL];
|
|
||||||
}
|
|
||||||
PPU[3]++;
|
|
||||||
PPUSPL++;
|
|
||||||
PPUGenLatch = ret;
|
|
||||||
printf("%d, %02x\n",scanline,ret);
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
static DECLFR(A2007)
|
static DECLFR(A2007)
|
||||||
{
|
{
|
||||||
uint8 ret;
|
uint8 ret;
|
||||||
|
@ -811,7 +788,7 @@ static DECLFR(A2007)
|
||||||
VRAMBuffer = CALL_PPUREAD(RefreshAddr - 0x1000);
|
VRAMBuffer = CALL_PPUREAD(RefreshAddr - 0x1000);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(debug_loggingCD)
|
if(debug_loggingCD && (RefreshAddr < 0x2000))
|
||||||
LogAddress = GetCHRAddress(RefreshAddr);
|
LogAddress = GetCHRAddress(RefreshAddr);
|
||||||
VRAMBuffer = CALL_PPUREAD(RefreshAddr);
|
VRAMBuffer = CALL_PPUREAD(RefreshAddr);
|
||||||
}
|
}
|
||||||
|
@ -878,15 +855,12 @@ static DECLFR(A2007)
|
||||||
|
|
||||||
static DECLFW(B2000)
|
static DECLFW(B2000)
|
||||||
{
|
{
|
||||||
// FCEU_printf("%04x:%02x, (%d) %02x, %02x\n",A,V,scanline,PPU[0],PPU_status);
|
|
||||||
|
|
||||||
FCEUPPU_LineUpdate();
|
FCEUPPU_LineUpdate();
|
||||||
PPUGenLatch=V;
|
PPUGenLatch=V;
|
||||||
|
|
||||||
if(!(PPU[0]&0x80) && (V&0x80) && (PPU_status&0x80))
|
if(!(PPU[0]&0x80) && (V&0x80) && (PPU_status&0x80))
|
||||||
{
|
|
||||||
// FCEU_printf("Trigger NMI, %d, %d\n",timestamp,ppudead);
|
|
||||||
TriggerNMI2();
|
TriggerNMI2();
|
||||||
}
|
|
||||||
PPU[0]=V;
|
PPU[0]=V;
|
||||||
TempAddr&=0xF3FF;
|
TempAddr&=0xF3FF;
|
||||||
TempAddr|=(V&3)<<10;
|
TempAddr|=(V&3)<<10;
|
||||||
|
@ -898,14 +872,13 @@ static DECLFW(B2000)
|
||||||
|
|
||||||
static DECLFW(B2001)
|
static DECLFW(B2001)
|
||||||
{
|
{
|
||||||
//printf("%04x:$%02x, %d\n",A,V,scanline);
|
|
||||||
FCEUPPU_LineUpdate();
|
FCEUPPU_LineUpdate();
|
||||||
PPUGenLatch=V;
|
PPUGenLatch=V;
|
||||||
PPU[1]=V;
|
PPU[1]=V;
|
||||||
if(V&0xE0)
|
if(V&0xE0)
|
||||||
deemp=V>>5;
|
deemp=V>>5;
|
||||||
}
|
}
|
||||||
//
|
|
||||||
static DECLFW(B2002)
|
static DECLFW(B2002)
|
||||||
{
|
{
|
||||||
PPUGenLatch=V;
|
PPUGenLatch=V;
|
||||||
|
@ -913,7 +886,6 @@ static DECLFW(B2002)
|
||||||
|
|
||||||
static DECLFW(B2003)
|
static DECLFW(B2003)
|
||||||
{
|
{
|
||||||
//printf("$%04x:$%02x, %d, %d\n",A,V,timestamp,scanline);
|
|
||||||
PPUGenLatch=V;
|
PPUGenLatch=V;
|
||||||
PPU[3]=V;
|
PPU[3]=V;
|
||||||
PPUSPL=V&0x7;
|
PPUSPL=V&0x7;
|
||||||
|
@ -921,7 +893,6 @@ static DECLFW(B2003)
|
||||||
|
|
||||||
static DECLFW(B2004)
|
static DECLFW(B2004)
|
||||||
{
|
{
|
||||||
//printf("Wr: %04x:$%02x\n",A,V);
|
|
||||||
PPUGenLatch=V;
|
PPUGenLatch=V;
|
||||||
if (newppu)
|
if (newppu)
|
||||||
{
|
{
|
||||||
|
@ -941,10 +912,7 @@ static DECLFW(B2004)
|
||||||
SPRAM[PPU[3]]=V;
|
SPRAM[PPU[3]]=V;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
//printf("$%02x:$%02x\n",PPUSPL,V);
|
|
||||||
SPRAM[PPUSPL]=V;
|
SPRAM[PPUSPL]=V;
|
||||||
}
|
|
||||||
PPU[3]++;
|
PPU[3]++;
|
||||||
PPUSPL++;
|
PPUSPL++;
|
||||||
}
|
}
|
||||||
|
@ -955,7 +923,7 @@ static DECLFW(B2005)
|
||||||
uint32 tmp=TempAddr;
|
uint32 tmp=TempAddr;
|
||||||
FCEUPPU_LineUpdate();
|
FCEUPPU_LineUpdate();
|
||||||
PPUGenLatch=V;
|
PPUGenLatch=V;
|
||||||
if(!vtoggle)
|
if(!vtoggle5)
|
||||||
{
|
{
|
||||||
tmp&=0xFFE0;
|
tmp&=0xFFE0;
|
||||||
tmp|=V>>3;
|
tmp|=V>>3;
|
||||||
|
@ -972,7 +940,7 @@ static DECLFW(B2005)
|
||||||
ppur._fv = V&7;
|
ppur._fv = V&7;
|
||||||
}
|
}
|
||||||
TempAddr=tmp;
|
TempAddr=tmp;
|
||||||
vtoggle^=1;
|
vtoggle5^=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -981,7 +949,7 @@ static DECLFW(B2006)
|
||||||
FCEUPPU_LineUpdate();
|
FCEUPPU_LineUpdate();
|
||||||
|
|
||||||
PPUGenLatch=V;
|
PPUGenLatch=V;
|
||||||
if(!vtoggle)
|
if(!vtoggle6)
|
||||||
{
|
{
|
||||||
TempAddr&=0x00FF;
|
TempAddr&=0x00FF;
|
||||||
TempAddr|=(V&0x3f)<<8;
|
TempAddr|=(V&0x3f)<<8;
|
||||||
|
@ -1001,7 +969,6 @@ static DECLFW(B2006)
|
||||||
DummyRead=1;
|
DummyRead=1;
|
||||||
if(PPU_hook)
|
if(PPU_hook)
|
||||||
PPU_hook(RefreshAddr);
|
PPU_hook(RefreshAddr);
|
||||||
//printf("%d, %04x\n",scanline,RefreshAddr);
|
|
||||||
|
|
||||||
ppur._vt &= 0x18;
|
ppur._vt &= 0x18;
|
||||||
ppur._vt |= (V>>5);
|
ppur._vt |= (V>>5);
|
||||||
|
@ -1010,7 +977,7 @@ static DECLFW(B2006)
|
||||||
ppur.install_latches();
|
ppur.install_latches();
|
||||||
}
|
}
|
||||||
|
|
||||||
vtoggle^=1;
|
vtoggle6^=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DECLFW(B2007)
|
static DECLFW(B2007)
|
||||||
|
@ -1021,20 +988,20 @@ static DECLFW(B2007)
|
||||||
PPUGenLatch=V;
|
PPUGenLatch=V;
|
||||||
RefreshAddr = ppur.get_2007access() & 0x3FFF;
|
RefreshAddr = ppur.get_2007access() & 0x3FFF;
|
||||||
CALL_PPUWRITE(RefreshAddr,V);
|
CALL_PPUWRITE(RefreshAddr,V);
|
||||||
//printf("%04x ",RefreshAddr);
|
|
||||||
ppur.increment2007(INC32!=0);
|
ppur.increment2007(INC32!=0);
|
||||||
RefreshAddr = ppur.get_2007access();
|
RefreshAddr = ppur.get_2007access();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//printf("%04x ",tmp);
|
|
||||||
PPUGenLatch=V;
|
PPUGenLatch=V;
|
||||||
if(tmp>=0x3F00)
|
if(tmp>=0x3F00)
|
||||||
{
|
{
|
||||||
// hmmm....
|
// hmmm....
|
||||||
if(!(tmp&0xf))
|
if(!(tmp&0xf))
|
||||||
PALRAM[0x00]=PALRAM[0x04]=PALRAM[0x08]=PALRAM[0x0C]=V&0x3F;
|
PALRAM[0x00]=PALRAM[0x04]=PALRAM[0x08]=PALRAM[0x0C]=V&0x3F;
|
||||||
else if(tmp&3) PALRAM[(tmp&0x1f)]=V&0x3f;
|
else
|
||||||
|
if(tmp&3)
|
||||||
|
PALRAM[(tmp&0x1f)]=V&0x3f;
|
||||||
}
|
}
|
||||||
else if(tmp<0x2000)
|
else if(tmp<0x2000)
|
||||||
{
|
{
|
||||||
|
@ -1046,10 +1013,12 @@ static DECLFW(B2007)
|
||||||
if(PPUNTARAM&(1<<((tmp&0xF00)>>10)))
|
if(PPUNTARAM&(1<<((tmp&0xF00)>>10)))
|
||||||
vnapage[((tmp&0xF00)>>10)][tmp&0x3FF]=V;
|
vnapage[((tmp&0xF00)>>10)][tmp&0x3FF]=V;
|
||||||
}
|
}
|
||||||
// FCEU_printf("ppu (%04x) %04x:%04x %d, %d\n",X.PC,RefreshAddr,PPUGenLatch,scanline,timestamp);
|
if (INC32)
|
||||||
if(INC32) RefreshAddr+=32;
|
RefreshAddr+=32;
|
||||||
else RefreshAddr++;
|
else
|
||||||
if(PPU_hook) PPU_hook(RefreshAddr&0x3fff);
|
RefreshAddr++;
|
||||||
|
if(PPU_hook)
|
||||||
|
PPU_hook(RefreshAddr&0x3fff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1115,39 +1084,6 @@ void FCEUI_GetRenderPlanes(bool& sprites, bool& bg)
|
||||||
bg = renderbg;
|
bg = renderbg;
|
||||||
}
|
}
|
||||||
|
|
||||||
//mbg 6/21/08 - tileview is being ripped out since i dont know how long its been since it worked
|
|
||||||
//static int tileview=1;
|
|
||||||
//void FCEUI_ToggleTileView(void)
|
|
||||||
//{
|
|
||||||
// tileview^=1;
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
//mbg 6/21/08 - tileview is being ripped out since i dont know how long its been since it worked
|
|
||||||
//static void TileView(void)
|
|
||||||
//{
|
|
||||||
// uint8 *P=XBuf+16*256;
|
|
||||||
// int bgh;
|
|
||||||
// int y;
|
|
||||||
// int X1;
|
|
||||||
// for(bgh=0;bgh<2;bgh++)
|
|
||||||
// for(y=0;y<16*8;y++)
|
|
||||||
// for(P=XBuf+bgh*128+(16+y)*256,X1=16;X1;X1--,P+=8)
|
|
||||||
// {
|
|
||||||
// uint8 *C;
|
|
||||||
// register uint8 cc;
|
|
||||||
// uint32 vadr;
|
|
||||||
//
|
|
||||||
// vadr=((((16-X1)|((y>>3)<<4))<<4)|(y&7))+bgh*0x1000;
|
|
||||||
// //C= ROM+vadr+turt*8192;
|
|
||||||
// C = VRAMADR(vadr);
|
|
||||||
// //if((vadr+turt*8192)>=524288)
|
|
||||||
// //printf("%d ",vadr+turt*8192);
|
|
||||||
// cc=0;
|
|
||||||
// //#include "pputile.inc"
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
static void CheckSpriteHit(int p);
|
static void CheckSpriteHit(int p);
|
||||||
|
|
||||||
static void EndRL(void)
|
static void EndRL(void)
|
||||||
|
@ -1175,10 +1111,6 @@ static void CheckSpriteHit(int p)
|
||||||
if((sphitdata&(0x80>>(x-sphitx))) && !(Plinef[x]&64) && x < 255)
|
if((sphitdata&(0x80>>(x-sphitx))) && !(Plinef[x]&64) && x < 255)
|
||||||
{
|
{
|
||||||
PPU_status|=0x40;
|
PPU_status|=0x40;
|
||||||
//printf("Ha: %d, %d, Hita: %d, %d, %d, %d, %d\n",p,p&~7,scanline,GETLASTPIXEL-16,&Plinef[x],Pline,Pline-Plinef);
|
|
||||||
//printf("%d\n",GETLASTPIXEL-16);
|
|
||||||
//if(Plinef[x] == 0xFF)
|
|
||||||
//printf("PL: %d, %02x\n",scanline, Plinef[x]);
|
|
||||||
sphitx=0x100;
|
sphitx=0x100;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1196,7 +1128,7 @@ static void RefreshLine(int lastpixel)
|
||||||
static uint32 atlatch;
|
static uint32 atlatch;
|
||||||
uint32 smorkus=RefreshAddr;
|
uint32 smorkus=RefreshAddr;
|
||||||
|
|
||||||
#define RefreshAddr smorkus
|
#define RefreshAddr smorkus
|
||||||
uint32 vofs;
|
uint32 vofs;
|
||||||
int X1;
|
int X1;
|
||||||
|
|
||||||
|
@ -1213,10 +1145,7 @@ static void RefreshLine(int lastpixel)
|
||||||
if(sphitx != 0x100 && !(PPU_status&0x40))
|
if(sphitx != 0x100 && !(PPU_status&0x40))
|
||||||
{
|
{
|
||||||
if((sphitx < (lastpixel-16)) && !(sphitx < ((lasttile - 2)*8)))
|
if((sphitx < (lastpixel-16)) && !(sphitx < ((lasttile - 2)*8)))
|
||||||
{
|
|
||||||
//printf("OK: %d\n",scanline);
|
|
||||||
lasttile++;
|
lasttile++;
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1242,7 +1171,7 @@ static void RefreshLine(int lastpixel)
|
||||||
|
|
||||||
firsttile=lasttile;
|
firsttile=lasttile;
|
||||||
|
|
||||||
#define TOFIXNUM (272-0x4)
|
#define TOFIXNUM (272-0x4)
|
||||||
if(lastpixel>=TOFIXNUM && tofix)
|
if(lastpixel>=TOFIXNUM && tofix)
|
||||||
{
|
{
|
||||||
Fixit1();
|
Fixit1();
|
||||||
|
@ -1376,13 +1305,10 @@ static void RefreshLine(int lastpixel)
|
||||||
|
|
||||||
if(lastpixel>=TOFIXNUM && tofix)
|
if(lastpixel>=TOFIXNUM && tofix)
|
||||||
{
|
{
|
||||||
//puts("Fixed");
|
|
||||||
Fixit1();
|
Fixit1();
|
||||||
tofix=0;
|
tofix=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//CheckSpriteHit(lasttile*8); //lasttile*8); //lastpixel);
|
|
||||||
|
|
||||||
//This only works right because of a hack earlier in this function.
|
//This only works right because of a hack earlier in this function.
|
||||||
CheckSpriteHit(lastpixel);
|
CheckSpriteHit(lastpixel);
|
||||||
|
|
||||||
|
@ -1552,7 +1478,6 @@ static void FetchSpriteData(void)
|
||||||
for(n=63;n>=0;n--,spr++)
|
for(n=63;n>=0;n--,spr++)
|
||||||
{
|
{
|
||||||
if((unsigned int)(scanline-spr->y)>=H) continue;
|
if((unsigned int)(scanline-spr->y)>=H) continue;
|
||||||
//printf("%d, %u\n",scanline,(unsigned int)(scanline-spr->y));
|
|
||||||
if(ns<maxsprites)
|
if(ns<maxsprites)
|
||||||
{
|
{
|
||||||
if(n==63) sb=1;
|
if(n==63) sb=1;
|
||||||
|
@ -1584,11 +1509,17 @@ static void FetchSpriteData(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fix this geniestage hack */
|
/* Fix this geniestage hack */
|
||||||
if(MMC5Hack && geniestage!=1) C = MMC5SPRVRAMADR(vadr);
|
if(MMC5Hack && geniestage!=1)
|
||||||
else C = VRAMADR(vadr);
|
C = MMC5SPRVRAMADR(vadr);
|
||||||
|
else {
|
||||||
|
C = VRAMADR(vadr);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(SpriteON)
|
||||||
|
RENDER_LOG(vadr);
|
||||||
dst.ca[0]=C[0];
|
dst.ca[0]=C[0];
|
||||||
|
if(SpriteON)
|
||||||
|
RENDER_LOG(vadr + 8);
|
||||||
dst.ca[1]=C[8];
|
dst.ca[1]=C[8];
|
||||||
dst.x=spr->x;
|
dst.x=spr->x;
|
||||||
dst.atr=spr->atr;
|
dst.atr=spr->atr;
|
||||||
|
@ -1639,14 +1570,20 @@ static void FetchSpriteData(void)
|
||||||
vadr+=t&8;
|
vadr+=t&8;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(MMC5Hack) C = MMC5SPRVRAMADR(vadr);
|
if(MMC5Hack)
|
||||||
else C = VRAMADR(vadr);
|
C = MMC5SPRVRAMADR(vadr);
|
||||||
|
else
|
||||||
|
C = VRAMADR(vadr);
|
||||||
|
if(SpriteON)
|
||||||
|
RENDER_LOG(vadr);
|
||||||
dst.ca[0]=C[0];
|
dst.ca[0]=C[0];
|
||||||
if(ns<8)
|
if(ns<8)
|
||||||
{
|
{
|
||||||
PPU_hook(0x2000);
|
PPU_hook(0x2000);
|
||||||
PPU_hook(vadr);
|
PPU_hook(vadr);
|
||||||
}
|
}
|
||||||
|
if(SpriteON)
|
||||||
|
RENDER_LOG(vadr + 8);
|
||||||
dst.ca[1]=C[8];
|
dst.ca[1]=C[8];
|
||||||
dst.x=spr->x;
|
dst.x=spr->x;
|
||||||
dst.atr=spr->atr;
|
dst.atr=spr->atr;
|
||||||
|
@ -1663,8 +1600,6 @@ static void FetchSpriteData(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//if(ns>=7)
|
|
||||||
//printf("%d %d\n",scanline,ns);
|
|
||||||
|
|
||||||
//Handle case when >8 sprites per scanline option is enabled.
|
//Handle case when >8 sprites per scanline option is enabled.
|
||||||
if(ns>8) PPU_status|=0x20;
|
if(ns>8) PPU_status|=0x20;
|
||||||
|
@ -1912,15 +1847,14 @@ void PPU_ResetHooks()
|
||||||
|
|
||||||
void FCEUPPU_Reset(void)
|
void FCEUPPU_Reset(void)
|
||||||
{
|
{
|
||||||
VRAMBuffer=PPU[0]=PPU[1]=PPU_status=PPU[3]=0;
|
VRAMBuffer = PPU[0] = PPU[1] = PPU_status = PPU[3] = 0;
|
||||||
PPUSPL=0;
|
PPUSPL = 0;
|
||||||
PPUGenLatch=0;
|
PPUGenLatch = 0;
|
||||||
RefreshAddr=TempAddr=0;
|
RefreshAddr = TempAddr = 0;
|
||||||
vtoggle = 0;
|
vtoggle5 = vtoggle6 = 0;
|
||||||
ppudead = 2;
|
ppudead = 2;
|
||||||
kook = 0;
|
kook = 0;
|
||||||
idleSynch = 1;
|
idleSynch = 1;
|
||||||
// XOffset=0;
|
|
||||||
|
|
||||||
ppur.reset();
|
ppur.reset();
|
||||||
spr_read.reset();
|
spr_read.reset();
|
||||||
|
@ -2117,7 +2051,8 @@ SFORMAT FCEUPPU_STATEINFO[]={
|
||||||
{ &ppudead, 1, "DEAD"},
|
{ &ppudead, 1, "DEAD"},
|
||||||
{ &PPUSPL, 1, "PSPL"},
|
{ &PPUSPL, 1, "PSPL"},
|
||||||
{ &XOffset, 1, "XOFF"},
|
{ &XOffset, 1, "XOFF"},
|
||||||
{ &vtoggle, 1, "VTOG"},
|
{ &vtoggle5, 1, "VTG5"},
|
||||||
|
{ &vtoggle6, 1, "VTG6"},
|
||||||
{ &RefreshAddrT, 2|FCEUSTATE_RLSB, "RADD"},
|
{ &RefreshAddrT, 2|FCEUSTATE_RLSB, "RADD"},
|
||||||
{ &TempAddrT, 2|FCEUSTATE_RLSB, "TADD"},
|
{ &TempAddrT, 2|FCEUSTATE_RLSB, "TADD"},
|
||||||
{ &VRAMBuffer, 1, "VBUF"},
|
{ &VRAMBuffer, 1, "VBUF"},
|
||||||
|
@ -2215,9 +2150,13 @@ struct BGData {
|
||||||
|
|
||||||
ppur.par = nt;
|
ppur.par = nt;
|
||||||
RefreshAddr = ppur.get_ptread();
|
RefreshAddr = ppur.get_ptread();
|
||||||
|
if(ScreenON)
|
||||||
|
RENDER_LOG(RefreshAddr);
|
||||||
pt[0] = CALL_PPUREAD(RefreshAddr);
|
pt[0] = CALL_PPUREAD(RefreshAddr);
|
||||||
runppu(kFetchTime);
|
runppu(kFetchTime);
|
||||||
RefreshAddr |= 8;
|
RefreshAddr |= 8;
|
||||||
|
if(ScreenON)
|
||||||
|
RENDER_LOG(RefreshAddr);
|
||||||
pt[1] = CALL_PPUREAD(RefreshAddr);
|
pt[1] = CALL_PPUREAD(RefreshAddr);
|
||||||
runppu(kFetchTime);
|
runppu(kFetchTime);
|
||||||
}
|
}
|
||||||
|
@ -2540,10 +2479,14 @@ int FCEUX_PPU_Loop(int skip) {
|
||||||
|
|
||||||
//pattern table fetches
|
//pattern table fetches
|
||||||
RefreshAddr = patternAddress;
|
RefreshAddr = patternAddress;
|
||||||
|
if(SpriteON)
|
||||||
|
RENDER_LOG(RefreshAddr);
|
||||||
oam[4] = CALL_PPUREAD(RefreshAddr);
|
oam[4] = CALL_PPUREAD(RefreshAddr);
|
||||||
if(realSprite) runppu(kFetchTime);
|
if(realSprite) runppu(kFetchTime);
|
||||||
|
|
||||||
RefreshAddr += 8;
|
RefreshAddr += 8;
|
||||||
|
if(SpriteON)
|
||||||
|
RENDER_LOG(RefreshAddr);
|
||||||
oam[5] = CALL_PPUREAD(RefreshAddr);
|
oam[5] = CALL_PPUREAD(RefreshAddr);
|
||||||
if(realSprite) runppu(kFetchTime);
|
if(realSprite) runppu(kFetchTime);
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ pshift[1]<<=8;
|
||||||
MMC5HackVROMMask) << 12) + (vadr & 0xfff);
|
MMC5HackVROMMask) << 12) + (vadr & 0xfff);
|
||||||
C += (MMC50x5130&0x3)<<18; //11-jun-2009 for kuja_killer
|
C += (MMC50x5130&0x3)<<18; //11-jun-2009 for kuja_killer
|
||||||
#elif defined(PPUT_MMC5)
|
#elif defined(PPUT_MMC5)
|
||||||
C=MMC5BGVRAMADR(vadr);
|
C = MMC5BGVRAMADR(vadr);
|
||||||
#else
|
#else
|
||||||
C = VRAMADR(vadr);
|
C = VRAMADR(vadr);
|
||||||
#endif
|
#endif
|
||||||
|
@ -88,7 +88,11 @@ pshift[1]<<=8;
|
||||||
PPU_hook(vadr);
|
PPU_hook(vadr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if(ScreenON)
|
||||||
|
RENDER_LOG(vadr);
|
||||||
pshift[0]|=C[0];
|
pshift[0]|=C[0];
|
||||||
|
if(ScreenON)
|
||||||
|
RENDER_LOG(vadr + 8);
|
||||||
pshift[1]|=C[8];
|
pshift[1]|=C[8];
|
||||||
|
|
||||||
if((RefreshAddr&0x1f)==0x1f)
|
if((RefreshAddr&0x1f)==0x1f)
|
||||||
|
|
Loading…
Reference in New Issue