fixed "Use Stack Pointer for lines tabbing" in Tracer

This commit is contained in:
ansstuff 2012-09-03 19:02:32 +00:00
parent cf440d61ed
commit 3069bf3f8a
4 changed files with 26 additions and 32 deletions

View File

@ -1157,36 +1157,36 @@ BEGIN
CONTROL "Display ROM offsets",IDC_DEBUGGER_ROM_OFFSETS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,442,249,82,10
END
TRACER DIALOGEX 65527, 65513, 383, 316
TRACER DIALOGEX 65527, 65513, 403, 316
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Trace Logger"
FONT 8, "MS Sans Serif", 400, 0, 0x0
BEGIN
SCROLLBAR IDC_SCRL_TRACER_LOG,369,4,10,169,SBS_VERT
EDITTEXT IDC_TRACER_LOG,4,4,364,169,ES_MULTILINE | ES_NOHIDESEL | ES_READONLY | WS_HSCROLL
CONTROL "Log last",IDC_RADIO_LOG_LAST,"Button",BS_AUTORADIOBUTTON | BS_LEFT,7,195,38,10
CONTROL "Log to File",IDC_RADIO_LOG_TO_FILE,"Button",BS_AUTORADIOBUTTON | BS_LEFT,7,214,49,10
LTEXT "instructions to this window",106,98,195,87,10
PUSHBUTTON "Start Logging",IDC_BTN_START_STOP_LOGGING,171,176,67,14,BS_CENTER | BS_VCENTER
COMBOBOX IDC_TRACER_LOG_SIZE,47,193,48,127,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Extra Log Options",109,3,232,376,39
SCROLLBAR IDC_SCRL_TRACER_LOG,389,4,10,169,SBS_VERT
EDITTEXT IDC_TRACER_LOG,4,4,384,169,ES_MULTILINE | ES_NOHIDESEL | ES_READONLY | WS_HSCROLL
CONTROL "Log last",IDC_RADIO_LOG_LAST,"Button",BS_AUTORADIOBUTTON | BS_LEFT,17,195,38,10
CONTROL "Log to File",IDC_RADIO_LOG_TO_FILE,"Button",BS_AUTORADIOBUTTON | BS_LEFT,17,214,49,10
LTEXT "instructions to this window",106,108,195,87,10
PUSHBUTTON "Start Logging",IDC_BTN_START_STOP_LOGGING,181,176,67,14,BS_CENTER | BS_VCENTER
COMBOBOX IDC_TRACER_LOG_SIZE,57,193,48,127,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Extra Log Options",109,12,232,378,39
CONTROL "Log state of A, X, Y and S registers",IDC_CHECK_LOG_REGISTERS,
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,9,243,126,10
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,18,243,126,10
CONTROL "Log Processor Status Flags",IDC_CHECK_LOG_PROCESSOR_STATUS,
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,138,243,102,10
PUSHBUTTON "Browse...",IDC_BTN_LOG_BROWSE,56,212,45,14,BS_CENTER | BS_VCENTER
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,148,243,102,10
PUSHBUTTON "Browse...",IDC_BTN_LOG_BROWSE,66,212,45,14,BS_CENTER | BS_VCENTER
LTEXT "",IDC_TRACER_STATS,121,213,246,12
CONTROL "Only log newly mapped code",IDC_CHECK_LOG_NEW_INSTRUCTIONS,
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,9,284,107,10
GROUPBOX "Extra Log Options that work with the Code/Data Logger",113,3,272,376,40
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,18,284,107,10
GROUPBOX "Extra Log Options that work with the Code/Data Logger",113,12,272,378,40
CONTROL "Only log code that accesses newly mapped data",IDC_CHECK_LOG_NEW_DATA,
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,9,297,169,10
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,18,297,169,10
CONTROL "Automatically update Window while logging",IDC_CHECK_LOG_UPDATE_WINDOW,
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,192,195,156,10
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,202,195,156,10
CONTROL "Use Stack Pointer for lines tabbing (nesting visualization)",IDC_CHECK_LINES_TABBING,
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,9,256,197,10
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,18,256,197,10
CONTROL "To the left from disassembly text",IDC_CHECK_LOG_STATUSES_TO_THE_LEFT,
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,251,243,121,10
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,261,243,121,10
END
ADDBP DIALOGEX 66, 83, 196, 130
@ -1981,6 +1981,7 @@ BEGIN
"TRACER", DIALOG
BEGIN
RIGHTMARGIN, 383
END
"ADDBP", DIALOG

View File

@ -335,7 +335,7 @@ done:
void FCEUD_TraceInstruction(){
if(!logging) return;
char str_tabs[LOG_TABS_MAX_LEN], address[7], data[11], disassembly[LOG_DISASSEMBLY_MAX_LEN], axystate[21], procstatus[12];
char str_tabs[LOG_TABS_MASK+1], address[7], data[11], disassembly[LOG_DISASSEMBLY_MAX_LEN], axystate[21], procstatus[12];
char str[LOG_LINE_MAX_LEN];
int addr=X.PC;
int size, j;
@ -435,9 +435,7 @@ void FCEUD_TraceInstruction(){
if (tracer_lines_tabbing)
{
// add spaces at the beginning of the line according to stack pointer
int spaces = 0xFF - X.S;
if (spaces >= LOG_TABS_MAX_LEN)
spaces = LOG_TABS_MAX_LEN - 1;
int spaces = (0xFF - X.S) & LOG_TABS_MASK;
for (int i = 0; i < spaces; i++)
str_tabs[i] = ' ';
str_tabs[spaces] = 0;

View File

@ -5,7 +5,7 @@
#define LOG_NEW_DATA 8
#define LOG_LINE_MAX_LEN 120
#define LOG_TABS_MAX_LEN 40
#define LOG_TABS_MASK 31
#define LOG_DISASSEMBLY_MAX_LEN 30
extern HWND hTracer;

View File

@ -1143,18 +1143,13 @@ int CheckTimelines(MovieData& stateMovie, MovieData& currMovie)
if (end_frame > currFrameCounter)
end_frame = currFrameCounter;
int x = 0;
for (; x < end_frame; x++)
for (int x = 0; x < end_frame; x++)
{
if (!stateMovie.records[x].Compare(currMovie.records[x]))
break;
return x;
}
if (x < end_frame)
{
return x;
} else
return -1; // no mismatch found
// no mismatch found
return -1;
}