tracer/logger fixed unlogged ram code

This commit is contained in:
CaH4e3 2012-12-07 19:18:47 +00:00
parent 7c0604e323
commit f3d6e617d5
2 changed files with 28 additions and 21 deletions

View File

@ -205,10 +205,13 @@ unsigned int NewBreak(const char* name, int start, int end, unsigned int type, c
int GetPRGAddress(int A){ int GetPRGAddress(int A){
int result; int result;
if((A < 0x8000) || (A > 0xFFFF))return -1; if(A > 0xFFFF)
return -1;
result = &Page[A>>11][A]-PRGptr[0]; result = &Page[A>>11][A]-PRGptr[0];
if((result > (int)PRGsize[0]) || (result < 0))return -1; if((result > (int)PRGsize[0]) || (result < 0))
else return result; return -1;
else
return result;
} }
/** /**

View File

@ -349,26 +349,30 @@ void FCEUD_TraceInstruction(uint8 *opcode, int size)
uint8 tmp; uint8 tmp;
static int unloggedlines; static int unloggedlines;
if(((logging_options & LOG_NEW_INSTRUCTIONS) && (oldcodecount != codecount)) || // if instruction executed from the RAM, skip this, log all instead
((logging_options & LOG_NEW_DATA) && (olddatacount != datacount))) // TODO: loops folding mame-lyke style
{ if(GetPRGAddress(addr) != -1) {
//something new was logged if(((logging_options & LOG_NEW_INSTRUCTIONS) && (oldcodecount != codecount)) ||
oldcodecount = codecount; ((logging_options & LOG_NEW_DATA) && (olddatacount != datacount)))
olddatacount = datacount;
if(unloggedlines > 0)
{ {
sprintf(str_temp, "(%d lines skipped)", unloggedlines); //something new was logged
OutputLogLine(str_temp); oldcodecount = codecount;
unloggedlines = 0; olddatacount = datacount;
} if(unloggedlines > 0)
} else {
{ sprintf(str_temp, "(%d lines skipped)", unloggedlines);
if((logging_options & LOG_NEW_INSTRUCTIONS) || OutputLogLine(str_temp);
(logging_options & LOG_NEW_DATA)) unloggedlines = 0;
}
} else
{ {
if(FCEUI_GetLoggingCD()) if((logging_options & LOG_NEW_INSTRUCTIONS) ||
unloggedlines++; (logging_options & LOG_NEW_DATA))
return; {
if(FCEUI_GetLoggingCD())
unloggedlines++;
return;
}
} }
} }