crash-fix to my last commit

This commit is contained in:
CaH4e3 2015-12-21 20:32:19 +00:00
parent 385ecbe2d6
commit 101ff8d79d
4 changed files with 19 additions and 19 deletions

View File

@ -117,8 +117,6 @@ extern void IncrementInstructionsCounters();
extern uint8 *vnapage[4],*VPage[8]; extern uint8 *vnapage[4],*VPage[8];
extern uint8 PPU[4],PALRAM[0x20],SPRAM[0x100],VRAMBuffer,PPUGenLatch,XOffset; extern uint8 PPU[4],PALRAM[0x20],SPRAM[0x100],VRAMBuffer,PPUGenLatch,XOffset;
extern uint32 FCEUPPU_PeekAddress(); extern uint32 FCEUPPU_PeekAddress();
extern int debug_loggingCD;
extern int numWPs; extern int numWPs;
///encapsulates the operational state of the debugger core ///encapsulates the operational state of the debugger core

View File

@ -554,13 +554,13 @@ void FreeCDLog()
if (cdloggerdata) if (cdloggerdata)
{ {
free(cdloggerdata); free(cdloggerdata);
cdloggerdata = 0; cdloggerdata = NULL;
cdloggerdataSize = 0; cdloggerdataSize = 0;
} }
if (cdloggervdata) if (cdloggervdata)
{ {
free(cdloggervdata); free(cdloggervdata);
cdloggervdata = 0; cdloggervdata = NULL;
cdloggerVideoDataSize = 0; cdloggerVideoDataSize = 0;
} }
} }

View File

@ -20,6 +20,7 @@
#include "common.h" #include "common.h"
#include "ppuview.h" #include "ppuview.h"
#include "../../debug.h"
#include "../../palette.h" #include "../../palette.h"
#include "../../fceu.h" #include "../../fceu.h"
#include "../../cart.h" #include "../../cart.h"
@ -117,7 +118,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 && debug_loggingCD && (((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;
@ -157,19 +158,20 @@ void FCEUD_UpdatePPUView(int scanline, int refreshchr)
{ {
chrcache0[i] = VPage[i>>10][i]; chrcache0[i] = VPage[i>>10][i];
chrcache1[i] = VPage[x>>10][x]; chrcache1[i] = VPage[x>>10][x];
if (cdloggerVideoDataSize) if (debug_loggingCD) {
{ if (cdloggerVideoDataSize)
int addr; {
addr = &VPage[i >> 10][i] - CHRptr[0]; int addr;
if ((addr >= 0) && (addr < (int)cdloggerVideoDataSize)) addr = &VPage[i >> 10][i] - CHRptr[0];
logcache0[i] = cdloggervdata[addr]; if ((addr >= 0) && (addr < (int)cdloggerVideoDataSize))
addr = &VPage[x >> 10][x] - CHRptr[0]; logcache0[i] = cdloggervdata[addr];
if ((addr >= 0) && (addr < (int)cdloggerVideoDataSize)) addr = &VPage[x >> 10][x] - CHRptr[0];
logcache1[i] = cdloggervdata[addr]; if ((addr >= 0) && (addr < (int)cdloggerVideoDataSize))
} else logcache1[i] = cdloggervdata[addr];
{ } else {
logcache0[i] = cdloggervdata[i]; logcache0[i] = cdloggervdata[i];
logcache1[i] = cdloggervdata[x]; logcache1[i] = cdloggervdata[x];
}
} }
} }
} }

View File

@ -423,7 +423,7 @@ inline void FFCEUX_PPUWrite_Default(uint32 A, uint8 V) {
} }
volatile int rendercount, vromreadcount, undefinedvromcount, LogAddress = -1; volatile int rendercount, vromreadcount, undefinedvromcount, LogAddress = -1;
unsigned char *cdloggervdata; unsigned char *cdloggervdata = NULL;
unsigned int cdloggerVideoDataSize = 0; unsigned int cdloggerVideoDataSize = 0;
int GetCHRAddress(int A) { int GetCHRAddress(int A) {