Added logic to protect against PPU and NT view windows from crash when being opened with no game loaded.
This commit is contained in:
parent
c66fc35a40
commit
652cc4f2c9
|
@ -572,15 +572,8 @@ static void DrawNameTable(int scanline, int ntnum, bool invalidateCache)
|
|||
|
||||
//obviously this whole scheme of nt cache doesnt work if an mmc5 game is playing tricks with the attribute table
|
||||
}
|
||||
//pbitmap += (8*3);
|
||||
}
|
||||
//pbitmap += 7*((NTWIDTH*3));
|
||||
}
|
||||
|
||||
//this copies the attribute tables to the cache if needed. but we arent using it now because
|
||||
//if(redrawtables){
|
||||
// memcpy(tablecache+0x3c0,table+0x3c0,0x40);
|
||||
//}
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void FCEUD_UpdateNTView(int scanline, bool drawall)
|
||||
|
@ -594,12 +587,8 @@ void FCEUD_UpdateNTView(int scanline, bool drawall)
|
|||
return;
|
||||
}
|
||||
|
||||
//uint8 *pbitmap = ppuv_palette;
|
||||
//if (!hNTView) return;
|
||||
|
||||
ppu_getScroll(xpos,ypos);
|
||||
|
||||
|
||||
if (NTViewSkip < NTViewRefresh)
|
||||
{
|
||||
NTViewSkip++;
|
||||
|
@ -619,12 +608,18 @@ void FCEUD_UpdateNTView(int scanline, bool drawall)
|
|||
drawall = 1; //palette has changed, so redraw all
|
||||
}
|
||||
|
||||
ntmirroring = NT_NONE;
|
||||
if(vnapage[0] == vnapage[1])ntmirroring = NT_HORIZONTAL;
|
||||
if(vnapage[0] == vnapage[2])ntmirroring = NT_VERTICAL;
|
||||
if((vnapage[0] != vnapage[1]) && (vnapage[0] != vnapage[2]))ntmirroring = NT_FOUR_SCREEN;
|
||||
if ( vnapage[0] == NULL )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if((vnapage[0] == vnapage[1]) && (vnapage[1] == vnapage[2]) && (vnapage[2] == vnapage[3])){
|
||||
ntmirroring = NT_NONE;
|
||||
if (vnapage[0] == vnapage[1])ntmirroring = NT_HORIZONTAL;
|
||||
if (vnapage[0] == vnapage[2])ntmirroring = NT_VERTICAL;
|
||||
if ((vnapage[0] != vnapage[1]) && (vnapage[0] != vnapage[2]))ntmirroring = NT_FOUR_SCREEN;
|
||||
|
||||
if ((vnapage[0] == vnapage[1]) && (vnapage[1] == vnapage[2]) && (vnapage[2] == vnapage[3]))
|
||||
{
|
||||
if(vnapage[0] == &NTARAM[0x000])ntmirroring = NT_SINGLE_SCREEN_TABLE_0;
|
||||
if(vnapage[0] == &NTARAM[0x400])ntmirroring = NT_SINGLE_SCREEN_TABLE_1;
|
||||
if(vnapage[0] == ExtraNTARAM)ntmirroring = NT_SINGLE_SCREEN_TABLE_2;
|
||||
|
|
|
@ -510,19 +510,28 @@ void FCEUD_UpdatePPUView(int scanline, int refreshchr)
|
|||
|
||||
if (refreshchr)
|
||||
{
|
||||
int i10, x10;
|
||||
for (i = 0, x=0x1000; i < 0x1000; i++, x++)
|
||||
{
|
||||
chrcache0[i] = VPage[i>>10][i];
|
||||
chrcache1[i] = VPage[x>>10][x];
|
||||
i10 = i>>10;
|
||||
x10 = x>>10;
|
||||
|
||||
if ( VPage[i10] == NULL )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
chrcache0[i] = VPage[i10][i];
|
||||
chrcache1[i] = VPage[x10][x];
|
||||
|
||||
if (debug_loggingCD)
|
||||
{
|
||||
if (cdloggerVideoDataSize)
|
||||
{
|
||||
int addr;
|
||||
addr = &VPage[i >> 10][i] - CHRptr[0];
|
||||
addr = &VPage[i10][i] - CHRptr[0];
|
||||
if ((addr >= 0) && (addr < (int)cdloggerVideoDataSize))
|
||||
logcache0[i] = cdloggervdata[addr];
|
||||
addr = &VPage[x >> 10][x] - CHRptr[0];
|
||||
addr = &VPage[x10][x] - CHRptr[0];
|
||||
if ((addr >= 0) && (addr < (int)cdloggerVideoDataSize))
|
||||
logcache1[i] = cdloggervdata[addr];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue