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 result;
if((A < 0x8000) || (A > 0xFFFF))return -1;
if(A > 0xFFFF)
return -1;
result = &Page[A>>11][A]-PRGptr[0];
if((result > (int)PRGsize[0]) || (result < 0))return -1;
else return result;
if((result > (int)PRGsize[0]) || (result < 0))
return -1;
else
return result;
}
/**

View File

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