61
59
int log_update_window = 0;
62
60
//int tracer_open=0;
63
61
volatile int logtofile = 0, logging = 0;
64
bool tracerIsReadyForResizing = false;
65
int tracerMinWidth = 0;
66
int tracerMinHeight = 0;
67
int Tracer_wndx = 0, Tracer_wndy = 0;
68
int Tracer_wndWidth = 640, Tracer_wndHeight = 500;
69
int tracerInitialClientWidth = 0, tracerInitialClientHeight = 0;
70
int tracerCurrentClientWidth = 0, tracerCurrentClientHeight = 0;
72
// this structure stores the data of an existing window pos and how it should be resized. The data is calculated at runtime
73
struct WindowItemPosData
80
unsigned int leftResizeType;
81
unsigned int topResizeType;
82
unsigned int rightResizeType;
83
unsigned int bottomResizeType;
85
std::vector<WindowItemPosData> arrayOfWindowItemPosData; // the data is filled in WM_INITDIALOG
87
// this structure holds the data how a known item should be resized. The data is prepared
88
struct KnownWindowItemPosData
91
unsigned int leftResizeType;
92
unsigned int topResizeType;
93
unsigned int rightResizeType;
94
unsigned int bottomResizeType;
96
// not all window items have to be mentioned here, others will be resized by default method (WINDOW_ITEM_RESIZE_TYPE_MULTIPLY, WINDOW_ITEM_RESIZE_TYPE_RIGHT_ALIGNED, WINDOW_ITEM_RESIZE_TYPE_MULTIPLY, WINDOW_ITEM_RESIZE_TYPE_RIGHT_ALIGNED)
97
KnownWindowItemPosData tracerKnownWindowItems[] = {
98
IDC_TRACER_LOG, WINDOW_ITEM_RESIZE_TYPE_LEFT_ALIGNED, WINDOW_ITEM_RESIZE_TYPE_LEFT_ALIGNED, WINDOW_ITEM_RESIZE_TYPE_RIGHT_ALIGNED, WINDOW_ITEM_RESIZE_TYPE_RIGHT_ALIGNED,
99
IDC_SCRL_TRACER_LOG, WINDOW_ITEM_RESIZE_TYPE_RIGHT_ALIGNED, WINDOW_ITEM_RESIZE_TYPE_LEFT_ALIGNED, WINDOW_ITEM_RESIZE_TYPE_RIGHT_ALIGNED, WINDOW_ITEM_RESIZE_TYPE_RIGHT_ALIGNED,
100
IDC_BTN_START_STOP_LOGGING, WINDOW_ITEM_RESIZE_TYPE_CENTER_ALIGNED, WINDOW_ITEM_RESIZE_TYPE_RIGHT_ALIGNED, WINDOW_ITEM_RESIZE_TYPE_CENTER_ALIGNED, WINDOW_ITEM_RESIZE_TYPE_RIGHT_ALIGNED,
101
IDC_RADIO_LOG_LAST, WINDOW_ITEM_RESIZE_TYPE_LEFT_ALIGNED, WINDOW_ITEM_RESIZE_TYPE_RIGHT_ALIGNED, WINDOW_ITEM_RESIZE_TYPE_LEFT_ALIGNED, WINDOW_ITEM_RESIZE_TYPE_RIGHT_ALIGNED,
102
IDC_TRACER_LOG_SIZE, WINDOW_ITEM_RESIZE_TYPE_LEFT_ALIGNED, WINDOW_ITEM_RESIZE_TYPE_RIGHT_ALIGNED, WINDOW_ITEM_RESIZE_TYPE_LEFT_ALIGNED, WINDOW_ITEM_RESIZE_TYPE_RIGHT_ALIGNED,
103
IDC_TEXT_LINES_TO_THIS_WINDOW, WINDOW_ITEM_RESIZE_TYPE_LEFT_ALIGNED, WINDOW_ITEM_RESIZE_TYPE_RIGHT_ALIGNED, WINDOW_ITEM_RESIZE_TYPE_LEFT_ALIGNED, WINDOW_ITEM_RESIZE_TYPE_RIGHT_ALIGNED,
104
IDC_RADIO_LOG_TO_FILE, WINDOW_ITEM_RESIZE_TYPE_LEFT_ALIGNED, WINDOW_ITEM_RESIZE_TYPE_RIGHT_ALIGNED, WINDOW_ITEM_RESIZE_TYPE_LEFT_ALIGNED, WINDOW_ITEM_RESIZE_TYPE_RIGHT_ALIGNED,
105
IDC_BTN_LOG_BROWSE, WINDOW_ITEM_RESIZE_TYPE_LEFT_ALIGNED, WINDOW_ITEM_RESIZE_TYPE_RIGHT_ALIGNED, WINDOW_ITEM_RESIZE_TYPE_LEFT_ALIGNED, WINDOW_ITEM_RESIZE_TYPE_RIGHT_ALIGNED,
65
108
int log_optn_intlst[LOG_OPTION_SIZE] = {3000000, 1000000, 300000, 100000, 30000, 10000, 3000, 1000, 300, 100};
66
109
char *log_optn_strlst[LOG_OPTION_SIZE] = {"3 000 000", "1 000 000", "300 000", "100 000", "30 000", "10 000", "3000", "1000", "300", "100"};
67
110
int log_lines_option = 5; // 10000 lines by default
90
int Tracer_wndx=0, Tracer_wndy=0;
137
char trace_str[35000] = {0};
138
WNDPROC IDC_TRACER_LOG_oldWndProc = 0;
92
140
void ShowLogDirDialog(void);
93
141
void BeginLoggingSequence(void);
94
void EndLoggingSequence(void);
142
void ClearTraceLogBuf();
143
void EndLoggingSequence();
95
144
void UpdateLogWindow(void);
145
void ScrollLogWindowToLastLine();
96
146
void UpdateLogText(void);
97
147
void EnableTracerMenuItems(void);
98
148
int PromptForCDLogger(void);
150
// returns the address, or EOF if selection cursor points to something else
151
int Tracer_CheckClickingOnAnAddressOrSymbolicName(unsigned int lineNumber, bool onlyCheckWhenNothingSelected)
153
if (!tracelogbufsize)
156
// trace_str contains the text in the log window
157
int sel_start, sel_end;
158
SendDlgItemMessage(hTracer, IDC_TRACER_LOG, EM_GETSEL, (WPARAM)&sel_start, (LPARAM)&sel_end);
159
if (onlyCheckWhenNothingSelected)
160
if (sel_end > sel_start)
163
// find the "$" before sel_start
164
int i = sel_start - 1;
165
for (; i > sel_start - 6; i--)
166
if (i >= 0 && trace_str[i] == '$')
168
if (i > sel_start - 6)
170
char offsetBuffer[5];
171
strncpy(offsetBuffer, trace_str + i + 1, 4);
173
// invalidate the string if a space or \r is found in it
174
char* firstspace = strstr(offsetBuffer, " ");
176
firstspace = strstr(offsetBuffer, "\r");
180
if (sscanf(offsetBuffer, "%4X", &offset) != EOF)
183
SendDlgItemMessage(hTracer, IDC_TRACER_LOG, EM_SETSEL, (WPARAM)(i + 1), (LPARAM)(i + 5));
185
PrintOffsetToSeekAndBookmarkFields(offset);
191
if (tracelogbufusedsize == tracelogbufsize)
192
lineNumber = (tracelogbufpos + lineNumber) % tracelogbufsize;
194
if (lineNumber < tracelogbufAddressesLog.size())
203
for (i = tracelogbufAddressesLog[lineNumber].size() - 1; i >= 0; i--)
205
addr = tracelogbufAddressesLog[lineNumber][i];
206
node = findNode(getNamesPointerForAddress(addr), addr);
207
if (node && node->name && *(node->name))
210
nameLen = strlen(name);
211
if (sel_start - nameLen <= 0)
212
start_pos = trace_str;
214
start_pos = trace_str + (sel_start - nameLen);
215
pos = strstr(start_pos, name);
216
if (pos && pos <= trace_str + sel_start)
218
// clicked on the operand name
220
SendDlgItemMessage(hTracer, IDC_TRACER_LOG, EM_SETSEL, (WPARAM)(int)(pos - trace_str), (LPARAM)((int)(pos - trace_str) + nameLen));
222
PrintOffsetToSeekAndBookmarkFields(addr);
232
BOOL CALLBACK IDC_TRACER_LOG_WndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
236
case WM_LBUTTONDBLCLK:
238
int offset = Tracer_CheckClickingOnAnAddressOrSymbolicName(tracesi.nPos + (GET_Y_LPARAM(lParam) / debugSystem->fixedFontHeight), false);
241
// open Debugger at this address
245
Disassemble(hDebug, IDC_DEBUGGER_DISASSEMBLY, IDC_DEBUGGER_DISASSEMBLY_VSCR, offset);
246
PrintOffsetToSeekAndBookmarkFields(offset);
253
Tracer_CheckClickingOnAnAddressOrSymbolicName(tracesi.nPos + (GET_Y_LPARAM(lParam) / debugSystem->fixedFontHeight), true);
258
// if nothing is selected, simulate Left-click
259
int sel_start, sel_end;
260
SendDlgItemMessage(hTracer, IDC_TRACER_LOG, EM_GETSEL, (WPARAM)&sel_start, (LPARAM)&sel_end);
261
if (sel_start == sel_end)
263
CallWindowProc(IDC_TRACER_LOG_oldWndProc, hwndDlg, WM_LBUTTONDOWN, wParam, lParam);
264
CallWindowProc(IDC_TRACER_LOG_oldWndProc, hwndDlg, WM_LBUTTONUP, wParam, lParam);
271
// save current selection
272
int sel_start, sel_end;
273
SendDlgItemMessage(hTracer, IDC_TRACER_LOG, EM_GETSEL, (WPARAM)&sel_start, (LPARAM)&sel_end);
275
CallWindowProc(IDC_TRACER_LOG_oldWndProc, hwndDlg, WM_LBUTTONDOWN, wParam, lParam);
276
CallWindowProc(IDC_TRACER_LOG_oldWndProc, hwndDlg, WM_LBUTTONUP, wParam, lParam);
277
// try bringing Symbolic Debug Naming dialog
278
int offset = Tracer_CheckClickingOnAnAddressOrSymbolicName(tracesi.nPos + (GET_Y_LPARAM(lParam) / debugSystem->fixedFontHeight), false);
281
if (DoSymbolicDebugNaming(offset, hTracer))
284
UpdateDebugger(false);
289
// then restore old selection
290
SendDlgItemMessage(hTracer, IDC_TRACER_LOG, EM_SETSEL, (WPARAM)sel_start, (LPARAM)sel_end);
295
// then restore old selection
296
SendDlgItemMessage(hTracer, IDC_TRACER_LOG, EM_SETSEL, (WPARAM)sel_start, (LPARAM)sel_end);
302
SendMessage(GetDlgItem(hTracer, IDC_SCRL_TRACER_LOG), uMsg, wParam, lParam);
306
return CallWindowProc(IDC_TRACER_LOG_oldWndProc, hwndDlg, uMsg, wParam, lParam);
309
BOOL CALLBACK TracerInitialEnumWindowsProc(HWND hwnd, LPARAM lParam)
314
// create new WindowItemPosData with default settings of resizing the item
315
WindowItemPosData windowItemPosData;
316
windowItemPosData.itemHWND = hwnd;
317
GetWindowRect(hwnd, &rect);
320
ScreenToClient(hTracer, &p);
321
windowItemPosData.initialLeft = p.x;
322
windowItemPosData.initialTop = p.y;
325
ScreenToClient(hTracer, &p);
326
windowItemPosData.initialRight = p.x;
327
windowItemPosData.initialBottom = p.y;
328
windowItemPosData.leftResizeType = WINDOW_ITEM_RESIZE_TYPE_MULTIPLY;
329
windowItemPosData.topResizeType = WINDOW_ITEM_RESIZE_TYPE_RIGHT_ALIGNED;
330
windowItemPosData.rightResizeType = WINDOW_ITEM_RESIZE_TYPE_MULTIPLY;
331
windowItemPosData.bottomResizeType = WINDOW_ITEM_RESIZE_TYPE_RIGHT_ALIGNED;
333
// try to find the info in tracerKnownWindowItems
334
int controlID = GetDlgCtrlID(hwnd);
335
int sizeofKnownWindowItemPosData = sizeof(KnownWindowItemPosData);
336
int tracerKnownWindowItemsTotal = sizeof(tracerKnownWindowItems) / sizeofKnownWindowItemPosData;
338
for (i = 0; i < tracerKnownWindowItemsTotal; ++i)
340
if (tracerKnownWindowItems[i].id == controlID)
343
if (i < tracerKnownWindowItemsTotal)
345
// this item is known, so its resizing method may differ from defaults
346
windowItemPosData.leftResizeType = tracerKnownWindowItems[i].leftResizeType;
347
windowItemPosData.topResizeType = tracerKnownWindowItems[i].topResizeType;
348
windowItemPosData.rightResizeType = tracerKnownWindowItems[i].rightResizeType;
349
windowItemPosData.bottomResizeType = tracerKnownWindowItems[i].bottomResizeType;
352
arrayOfWindowItemPosData.push_back(windowItemPosData);
355
BOOL CALLBACK TracerResizingEnumWindowsProc(HWND hwnd, LPARAM lParam)
357
// find the data about resizing type
358
for (int i = arrayOfWindowItemPosData.size() - 1; i >= 0; i--)
360
if (arrayOfWindowItemPosData[i].itemHWND == hwnd)
362
// recalculate the coordinates according to the resizing type of the item
363
int left = recalculateResizedItemCoordinate(arrayOfWindowItemPosData[i].initialLeft, tracerInitialClientWidth, tracerCurrentClientWidth, arrayOfWindowItemPosData[i].leftResizeType);
364
int top = recalculateResizedItemCoordinate(arrayOfWindowItemPosData[i].initialTop, tracerInitialClientHeight, tracerCurrentClientHeight, arrayOfWindowItemPosData[i].topResizeType);
365
int right = recalculateResizedItemCoordinate(arrayOfWindowItemPosData[i].initialRight, tracerInitialClientWidth, tracerCurrentClientWidth, arrayOfWindowItemPosData[i].rightResizeType);
366
int bottom = recalculateResizedItemCoordinate(arrayOfWindowItemPosData[i].initialBottom, tracerInitialClientHeight, tracerCurrentClientHeight, arrayOfWindowItemPosData[i].bottomResizeType);
367
SetWindowPos(hwnd, 0, left, top, right - left, bottom - top, SWP_NOZORDER | SWP_NOOWNERZORDER);
100
374
BOOL CALLBACK TracerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
107
if (!IsIconic(hwndDlg))
110
GetWindowRect(hwndDlg,&wrect);
111
Tracer_wndx = wrect.left;
112
Tracer_wndy = wrect.top;
113
WindowBoundsCheckNoResize(Tracer_wndx,Tracer_wndy,wrect.right);
117
379
case WM_INITDIALOG:
382
// calculate initial size/positions of items
384
GetClientRect(hTracer, &mainRect);
385
tracerInitialClientWidth = mainRect.right;
386
tracerInitialClientHeight = mainRect.bottom;
387
// set min size of the window to current size
388
GetWindowRect(hTracer, &mainRect);
389
tracerMinWidth = mainRect.right - mainRect.left;
390
tracerMinHeight = mainRect.bottom - mainRect.top;
391
if (Tracer_wndWidth < tracerMinWidth)
392
Tracer_wndWidth = tracerMinWidth;
393
if (Tracer_wndHeight < tracerMinHeight)
394
Tracer_wndHeight = tracerMinHeight;
395
// remember initial positions of all items
396
EnumChildWindows(hTracer, TracerInitialEnumWindowsProc, 0);
397
// restore position and size from config, also bring the window on top
119
398
if (Tracer_wndx==-32000) Tracer_wndx=0; //Just in case
120
399
if (Tracer_wndy==-32000) Tracer_wndy=0;
121
SetWindowPos(hwndDlg,0,Tracer_wndx,Tracer_wndy,0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOOWNERZORDER);
125
SendDlgItemMessage(hwndDlg, IDC_TRACER_LOG, WM_SETFONT, (WPARAM)debugSystem->hFixedFont, FALSE);
400
SetWindowPos(hTracer, HWND_TOP, Tracer_wndx, Tracer_wndy, Tracer_wndWidth, Tracer_wndHeight, SWP_NOOWNERZORDER);
127
402
// calculate tracesi.nPage
129
404
GetClientRect(GetDlgItem(hwndDlg, IDC_TRACER_LOG), &wrect);
130
405
tracesi.nPage = wrect.bottom / debugSystem->fixedFontHeight;
408
SendDlgItemMessage(hwndDlg, IDC_TRACER_LOG, WM_SETFONT, (WPARAM)debugSystem->hFixedFont, FALSE);
132
410
//check the disabled radio button
133
411
CheckRadioButton(hwndDlg,IDC_RADIO_LOG_LAST,IDC_RADIO_LOG_TO_FILE,IDC_RADIO_LOG_LAST);
135
413
//EnableWindow(GetDlgItem(hwndDlg,IDC_SCRL_TRACER_LOG),FALSE);
136
//fill in the options for the log size
414
// fill in the options for the log size
137
415
for(i = 0;i < LOG_OPTION_SIZE;i++)
139
417
SendDlgItemMessage(hwndDlg, IDC_TRACER_LOG_SIZE, CB_INSERTSTRING, -1, (LPARAM)(LPSTR)log_optn_strlst[i]);
141
419
SendDlgItemMessage(hwndDlg, IDC_TRACER_LOG_SIZE, CB_SETCURSEL, (WPARAM)log_lines_option, 0);
142
SetDlgItemText(hwndDlg, IDC_TRACER_LOG, "Welcome to the Trace Logger.");
420
strcpy(trace_str, "Welcome to the Trace Logger.");
421
SetDlgItemText(hwndDlg, IDC_TRACER_LOG, trace_str);
145
424
CheckDlgButton(hwndDlg, IDC_CHECK_LOG_REGISTERS, (logging_options & LOG_REGISTERS) ? BST_CHECKED : BST_UNCHECKED);
157
438
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_LOG_BROWSE), FALSE);
158
439
CheckDlgButton(hwndDlg, IDC_CHECK_LOG_UPDATE_WINDOW, log_update_window ? BST_CHECKED : BST_UNCHECKED);
159
440
EnableTracerMenuItems();
442
// subclass editfield
443
IDC_TRACER_LOG_oldWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndDlg, IDC_TRACER_LOG), GWL_WNDPROC, (LONG)IDC_TRACER_LOG_WndProc);
446
case WM_WINDOWPOSCHANGED:
448
WINDOWPOS* windowpos = (WINDOWPOS*)lParam;
449
if (!(windowpos->flags & SWP_NOSIZE))
451
// window was resized
452
if (!IsIconic(hwndDlg))
454
if (arrayOfWindowItemPosData.size())
457
GetWindowRect(hTracer, &mainRect);
458
Tracer_wndWidth = mainRect.right - mainRect.left;
459
Tracer_wndHeight = mainRect.bottom - mainRect.top;
461
GetClientRect(hTracer, &mainRect);
462
tracerCurrentClientWidth = mainRect.right;
463
tracerCurrentClientHeight = mainRect.bottom;
464
EnumChildWindows(hTracer, TracerResizingEnumWindowsProc, 0);
465
InvalidateRect(hTracer, 0, TRUE);
467
// recalculate tracesi.nPage
469
GetClientRect(GetDlgItem(hwndDlg, IDC_TRACER_LOG), &wrect);
470
int newPageSize = wrect.bottom / debugSystem->fixedFontHeight;
471
if (tracesi.nPage != newPageSize)
473
tracesi.nPage = newPageSize;
474
if ((tracesi.nPos + (int)tracesi.nPage) > tracesi.nMax)
475
tracesi.nPos = tracesi.nMax - (int)tracesi.nPage;
476
if (tracesi.nPos < tracesi.nMin)
477
tracesi.nPos = tracesi.nMin;
478
SetScrollInfo(GetDlgItem(hTracer, IDC_SCRL_TRACER_LOG), SB_CTL, &tracesi, TRUE);
484
if (!(windowpos->flags & SWP_NOMOVE))
487
if (!IsIconic(hwndDlg) && arrayOfWindowItemPosData.size())
490
GetWindowRect(hTracer, &mainRect);
491
Tracer_wndWidth = mainRect.right - mainRect.left;
492
Tracer_wndHeight = mainRect.bottom - mainRect.top;
493
Tracer_wndx = mainRect.left;
494
Tracer_wndy = mainRect.top;
495
WindowBoundsCheckNoResize(Tracer_wndx, Tracer_wndy, mainRect.right);
500
case WM_GETMINMAXINFO:
504
((MINMAXINFO*)lParam)->ptMinTrackSize.x = tracerMinWidth;
505
((MINMAXINFO*)lParam)->ptMinTrackSize.y = tracerMinHeight;
165
512
EndLoggingSequence();
167
515
EndDialog(hwndDlg,0);
170
switch(HIWORD(wParam)) {
518
switch(HIWORD(wParam))
172
switch(LOWORD(wParam)) {
522
switch(LOWORD(wParam))
173
524
case IDC_BTN_START_STOP_LOGGING:
174
if(logging)EndLoggingSequence();
175
else BeginLoggingSequence();
526
EndLoggingSequence();
528
BeginLoggingSequence();
176
529
EnableTracerMenuItems();
178
531
case IDC_RADIO_LOG_LAST:
651
GetScrollInfo(GetDlgItem(hTracer, IDC_SCRL_TRACER_LOG), SB_CTL, &tracesi);
652
i = GET_WHEEL_DELTA_WPARAM(wParam) / WHEEL_DELTA;
656
if ((tracesi.nPos + (int)tracesi.nPage) > tracesi.nMax)
657
tracesi.nPos = tracesi.nMax - tracesi.nPage;
658
if (tracesi.nPos < tracesi.nMin)
659
tracesi.nPos = tracesi.nMin;
660
SetScrollInfo(GetDlgItem(hTracer, IDC_SCRL_TRACER_LOG), SB_CTL, &tracesi, TRUE);
290
668
void BeginLoggingSequence(void)
292
char str[2048], str2[100];
295
if(!PromptForCDLogger())return; //do nothing if user selected no and CD Logger is needed
673
if (!PromptForCDLogger())
674
return; //do nothing if user selected no and CD Logger is needed
299
678
if(logfilename == NULL) ShowLogDirDialog();
300
679
if (!logfilename) return;
301
680
LOG_FP = fopen(logfilename,"w");
303
sprintf(str,"Error Opening File %s",logfilename);
304
MessageBox(hTracer,str, "File Error", MB_OK);
683
sprintf(trace_str, "Error Opening File %s", logfilename);
684
MessageBox(hTracer, trace_str, "File Error", MB_OK);
307
687
fprintf(LOG_FP,FCEU_NAME_AND_VERSION" - Trace Log File\n"); //mbg merge 7/19/06 changed string
310
692
log_lines_option = SendDlgItemMessage(hTracer, IDC_TRACER_LOG_SIZE, CB_GETCURSEL, 0, 0);
311
693
if (log_lines_option == CB_ERR)
312
694
log_lines_option = 0;
313
strcpy(str,"Allocating Memory...\r\n");
314
SetDlgItemText(hTracer, IDC_TRACER_LOG, str);
695
strcpy(trace_str, "Allocating Memory...\r\n");
696
SetDlgItemText(hTracer, IDC_TRACER_LOG, trace_str);
315
697
tracelogbufsize = j = log_optn_intlst[log_lines_option];
316
tracelogbuf = (char**)malloc(j*sizeof(char *)); //mbg merge 7/19/06 added cast
698
tracelogbuf = (char**)malloc(j * sizeof(char *));
699
for (i = 0;i < j;i++)
319
tracelogbuf[i] = (char*)malloc(LOG_LINE_MAX_LEN); //mbg merge 7/19/06 added cast
701
tracelogbuf[i] = (char*)malloc(LOG_LINE_MAX_LEN);
320
702
tracelogbuf[i][0] = 0;
322
704
sprintf(str2, "%d Bytes Allocated...\r\n", j * LOG_LINE_MAX_LEN);
705
strcat(trace_str, str2);
706
tracelogbufAddressesLog.resize(0);
707
tracelogbufAddressesLog.resize(tracelogbufsize);
324
708
// Assemble the message to pause the game. Uses the current hotkey mapping dynamically
325
string m1 = "Pause the game (press ";
326
string m2 = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_PAUSE]);
327
string m3 = " key or snap the Debugger) to update this window.\r\n";
328
string pauseMessage = m1 + m2 + m3;
329
strcat(str, pauseMessage.c_str());
330
SetDlgItemText(hTracer, IDC_TRACER_LOG, str);
709
strcat(trace_str, "Pause the game (press ");
710
strcat(trace_str, GetKeyComboName(FCEUD_CommandMapping[EMUCMD_PAUSE]));
711
strcat(trace_str, " key or snap the Debugger) to update this window.\r\n");
712
SetDlgItemText(hTracer, IDC_TRACER_LOG, trace_str);
331
713
tracelogbufpos = tracelogbufusedsize = 0;
419
806
if (logging_options & LOG_SYMBOLIC)
809
tempAddressesLog.resize(0);
421
810
// Insert Name and Comment lines if needed
422
tracer_decoration_name = 0;
423
tracer_decoration_comment = 0;
424
decorateAddress(addr, &tracer_decoration_name, &tracer_decoration_comment);
425
if (tracer_decoration_name)
427
strcpy(str_decoration, tracer_decoration_name);
428
strcat(str_decoration, ": ");
429
OutputLogLine(str_decoration, true);
431
if (tracer_decoration_comment)
434
strcpy(str_decoration_comment, tracer_decoration_comment);
435
strcat(str_decoration_comment, "\r\n");
436
tracer_decoration_comment = str_decoration_comment;
437
// divide the str_decoration_comment into strings (Comment1, Comment2, ...)
438
char* end_pos = strstr(tracer_decoration_comment, "\r");
441
end_pos[0] = 0; // set \0 instead of \r
442
strcpy(str_decoration, "; ");
443
strcat(str_decoration, tracer_decoration_comment);
444
OutputLogLine(str_decoration, true);
446
tracer_decoration_comment = end_pos;
447
end_pos = strstr(tracer_decoration_comment, "\r");
450
replaceNames(ramBankNames, a);
451
replaceNames(loadedBankNames, a);
452
replaceNames(lastBankNames, a);
811
Name* node = findNode(getNamesPointerForAddress(addr), addr);
816
strcpy(str_decoration, node->name);
817
strcat(str_decoration, ":");
818
tempAddressesLog.push_back(addr);
819
OutputLogLine(str_decoration, &tempAddressesLog);
824
strcpy(str_decoration_comment, node->comment);
825
strcat(str_decoration_comment, "\r\n");
826
tracer_decoration_comment = str_decoration_comment;
827
// divide the str_decoration_comment into strings (Comment1, Comment2, ...)
828
char* tracer_decoration_comment_end_pos = strstr(tracer_decoration_comment, "\r\n");
829
while (tracer_decoration_comment_end_pos)
831
tracer_decoration_comment_end_pos[0] = 0; // set \0 instead of \r
832
strcpy(str_decoration, "; ");
833
strcat(str_decoration, tracer_decoration_comment);
834
OutputLogLine(str_decoration, &tempAddressesLog);
835
tracer_decoration_comment_end_pos += 2;
836
tracer_decoration_comment = tracer_decoration_comment_end_pos;
837
tracer_decoration_comment_end_pos = strstr(tracer_decoration_comment_end_pos, "\r\n");
842
replaceNames(ramBankNames, a, &tempAddressesLog);
843
replaceNames(loadedBankNames, a, &tempAddressesLog);
844
replaceNames(lastBankNames, a, &tempAddressesLog);
454
strcpy(str_disassembly, a);
846
strncpy(str_disassembly, a, LOG_DISASSEMBLY_MAX_LEN);
847
str_disassembly[LOG_DISASSEMBLY_MAX_LEN - 1] = 0;
608
1047
if (tracesi.nPos < tracesi.nMin)
609
1048
tracesi.nPos = tracesi.nMin;
610
1049
SetScrollInfo(GetDlgItem(hTracer,IDC_SCRL_TRACER_LOG),SB_CTL,&tracesi,TRUE);
612
if (logging_options & LOG_SYMBOLIC)
620
1052
void UpdateLogText(void)
1057
if (!tracelogbuf || !tracelogbufpos || !tracelogbufsize)
625
1060
int last_line = tracesi.nPos + tracesi.nPage;
626
1061
if (last_line > tracesi.nMax)
627
1062
last_line = tracesi.nMax;
629
for(i = tracesi.nPos; i < last_line; i++)
1064
int i = tracesi.nPos;
1065
if (i < tracesi.nMin)
1068
for (; i < last_line; i++)
632
if(tracelogbufusedsize == tracelogbufsize)
634
j = (tracelogbufpos+i)%tracelogbufsize;
636
strcat(str,tracelogbuf[j]);
1071
if (tracelogbufusedsize == tracelogbufsize)
1072
j = (tracelogbufpos + i) % tracelogbufsize;
1073
strcat(trace_str, tracelogbuf[j]);
638
SetDlgItemText(hTracer, IDC_TRACER_LOG, str);
639
sprintf(str,"nPage = %d, nPos = %d, nMax = %d, nMin = %d",tracesi.nPage,tracesi.nPos,tracesi.nMax,tracesi.nMin);
640
SetDlgItemText(hTracer, IDC_TRACER_STATS, str);
1075
SetDlgItemText(hTracer, IDC_TRACER_LOG, trace_str);
1076
//sprintf(str,"nPage = %d, nPos = %d, nMax = %d, nMin = %d",tracesi.nPage,tracesi.nPos,tracesi.nMax,tracesi.nMin);
1077
//SetDlgItemText(hTracer, IDC_TRACER_STATS, str);
644
void EnableTracerMenuItems(void){
1081
void EnableTracerMenuItems(void)
647
1085
EnableWindow(GetDlgItem(hTracer,IDC_RADIO_LOG_LAST),FALSE);
648
1086
EnableWindow(GetDlgItem(hTracer,IDC_RADIO_LOG_TO_FILE),FALSE);