diff --git a/src/drivers/win/res.rc b/src/drivers/win/res.rc index e0acfc29..8b876282 100644 --- a/src/drivers/win/res.rc +++ b/src/drivers/win/res.rc @@ -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 diff --git a/src/drivers/win/tracer.cpp b/src/drivers/win/tracer.cpp index bf48fb47..8a584b47 100644 --- a/src/drivers/win/tracer.cpp +++ b/src/drivers/win/tracer.cpp @@ -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; diff --git a/src/drivers/win/tracer.h b/src/drivers/win/tracer.h index 03ca9e65..0f934c2c 100644 --- a/src/drivers/win/tracer.h +++ b/src/drivers/win/tracer.h @@ -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; diff --git a/src/movie.cpp b/src/movie.cpp index 4239e1e8..f816a278 100644 --- a/src/movie.cpp +++ b/src/movie.cpp @@ -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; }