implemented visual CHR data usage logging for VRAM-only games (mapper 2, etc). no cdl log save available, just display current used/unused tiles in ppu tile viewer. reset tile usage flags if rewritten by the program.

This commit is contained in:
CaH4e3 2015-12-20 16:22:46 +00:00
parent c73cf9eb63
commit c50535a398
4 changed files with 20 additions and 8 deletions

View File

@ -93,7 +93,7 @@ static DECLFW(NROMWrite) {
static void NROMPower(void) { static void NROMPower(void) {
setprg8r(0x10, 0x6000, 0); // Famili BASIC (v3.0) need it (uses only 4KB), FP-BASIC uses 8KB setprg8r(0x10, 0x6000, 0); // Famili BASIC (v3.0) need it (uses only 4KB), FP-BASIC uses 8KB
setprg16(0x8000, 0); setprg16(0x8000, ~1);
setprg16(0xC000, ~0); setprg16(0xC000, ~0);
setchr8(0); setchr8(0);

View File

@ -572,8 +572,10 @@ void InitCDLog()
if(!CHRram[0] || (CHRptr[0] == PRGptr[0])) { // Some kind of workaround for my OneBus VRAM hack, will remove it if I find another solution for that if(!CHRram[0] || (CHRptr[0] == PRGptr[0])) { // Some kind of workaround for my OneBus VRAM hack, will remove it if I find another solution for that
cdloggerVideoDataSize = CHRsize[0]; cdloggerVideoDataSize = CHRsize[0];
cdloggervdata = (unsigned char*)malloc(cdloggerVideoDataSize); cdloggervdata = (unsigned char*)malloc(cdloggerVideoDataSize);
} else } else {
cdloggerVideoDataSize = 0; cdloggerVideoDataSize = 0;
cdloggervdata = (unsigned char*)malloc(8192);
}
} }
void ResetCDLog() void ResetCDLog()
@ -581,10 +583,12 @@ void ResetCDLog()
codecount = datacount = rendercount = vromreadcount = 0; codecount = datacount = rendercount = vromreadcount = 0;
undefinedcount = cdloggerdataSize; undefinedcount = cdloggerdataSize;
ZeroMemory(cdloggerdata, cdloggerdataSize); ZeroMemory(cdloggerdata, cdloggerdataSize);
if(cdloggerVideoDataSize != 0) if(cdloggerVideoDataSize != 0) {
{
undefinedvromcount = cdloggerVideoDataSize; undefinedvromcount = cdloggerVideoDataSize;
ZeroMemory(cdloggervdata, cdloggerVideoDataSize); ZeroMemory(cdloggervdata, cdloggerVideoDataSize);
} else {
undefinedvromcount = 8192;
ZeroMemory(cdloggervdata, 8192);
} }
} }

View File

@ -117,7 +117,7 @@ void DrawPatternTable(uint8 *bitmap, uint8 *table, uint8 *log, uint8 pal)
chr1 = table[index + 8]; chr1 = table[index + 8];
logs = log[index] & log[index + 8]; logs = log[index] & log[index + 8];
tmp = 7; tmp = 7;
shift=(PPUView_maskUnusedGraphics && cdloggerVideoDataSize && (((logs & 3) != 0) == PPUView_invertTheMask))?3:0; shift=(PPUView_maskUnusedGraphics /*&& cdloggerVideoDataSize*/ && (((logs & 3) != 0) == PPUView_invertTheMask))?3:0;
for (x = 0; x < 8; x++) for (x = 0; x < 8; x++)
{ {
p = (chr0 >> tmp) & 1; p = (chr0 >> tmp) & 1;
@ -168,8 +168,8 @@ void FCEUD_UpdatePPUView(int scanline, int refreshchr)
logcache1[i] = cdloggervdata[addr]; logcache1[i] = cdloggervdata[addr];
} else } else
{ {
logcache0[i] = 0; logcache0[i] = cdloggervdata[i];
logcache1[i] = 0; logcache1[i] = cdloggervdata[x];
} }
} }
} }

View File

@ -431,7 +431,8 @@ int GetCHRAddress(int A) {
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;
} } else
if(A < 0x2000) return A;
return -1; return -1;
} }
@ -886,6 +887,13 @@ static DECLFW(B2006) {
static DECLFW(B2007) { static DECLFW(B2007) {
uint32 tmp = RefreshAddr & 0x3FFF; uint32 tmp = RefreshAddr & 0x3FFF;
if (debug_loggingCD) {
if(tmp < 0x2000) {
cdloggervdata[tmp] = 0;
undefinedvromcount++;
}
}
if (newppu) { if (newppu) {
PPUGenLatch = V; PPUGenLatch = V;
RefreshAddr = ppur.get_2007access() & 0x3FFF; RefreshAddr = ppur.get_2007access() & 0x3FFF;