* Tracer: added Symbolic Debug naming by right-clicking any address
* Tracer: clicking any address select the address * Tracer: double-clicking any address brings Debugger at the address * Tracer: added mouse wheel support
This commit is contained in:
parent
5072684a8f
commit
1bdd98b78e
|
@ -577,6 +577,18 @@ void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr)
|
||||||
}
|
}
|
||||||
SetDlgItemText(hWnd, IDC_DEBUGGER_DISASSEMBLY_LEFT_PANEL, debug_cdl_str);
|
SetDlgItemText(hWnd, IDC_DEBUGGER_DISASSEMBLY_LEFT_PANEL, debug_cdl_str);
|
||||||
}
|
}
|
||||||
|
void PrintOffsetToSeekAndBookmarkFields(int offset)
|
||||||
|
{
|
||||||
|
if (offset >= 0 && hDebug)
|
||||||
|
{
|
||||||
|
char offsetBuffer[5];
|
||||||
|
sprintf(offsetBuffer, "%04X", offset);
|
||||||
|
// send the address to "Seek To" field
|
||||||
|
SetDlgItemText(hDebug, IDC_DEBUGGER_VAL_PCSEEK, offsetBuffer);
|
||||||
|
// send the address to "Bookmark Add" field
|
||||||
|
SetDlgItemText(hDebug, IDC_DEBUGGER_BOOKMARK, offsetBuffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
char *DisassembleLine(int addr) {
|
char *DisassembleLine(int addr) {
|
||||||
static char str[64]={0},chr[25]={0};
|
static char str[64]={0},chr[25]={0};
|
||||||
|
@ -834,8 +846,8 @@ void UpdateDebugger(bool jump_to_pc)
|
||||||
|
|
||||||
|
|
||||||
// "Address Bookmark Add" follows the address
|
// "Address Bookmark Add" follows the address
|
||||||
sprintf(str,"%04X", starting_address);
|
//sprintf(str, "%04X", starting_address);
|
||||||
SetDlgItemText(hDebug, IDC_DEBUGGER_BOOKMARK, str);
|
//SetDlgItemText(hDebug, IDC_DEBUGGER_BOOKMARK, str);
|
||||||
|
|
||||||
sprintf(str, "%02X", X.A);
|
sprintf(str, "%02X", X.A);
|
||||||
SetDlgItemText(hDebug, IDC_DEBUGGER_VAL_A, str);
|
SetDlgItemText(hDebug, IDC_DEBUGGER_VAL_A, str);
|
||||||
|
@ -1331,23 +1343,24 @@ BOOL CALLBACK DebuggerEnumWindowsProc(HWND hwnd, LPARAM lParam)
|
||||||
SetWindowPos(hwnd,0,0,0,crect.right-crect.left,crect.bottom-crect.top,SWP_NOZORDER | SWP_NOMOVE);
|
SetWindowPos(hwnd,0,0,0,crect.right-crect.left,crect.bottom-crect.top,SWP_NOZORDER | SWP_NOMOVE);
|
||||||
GetScrollInfo(GetDlgItem(hDebug,IDC_DEBUGGER_DISASSEMBLY_VSCR),SB_CTL,&si);
|
GetScrollInfo(GetDlgItem(hDebug,IDC_DEBUGGER_DISASSEMBLY_VSCR),SB_CTL,&si);
|
||||||
Disassemble(hDebug, IDC_DEBUGGER_DISASSEMBLY, IDC_DEBUGGER_DISASSEMBLY_VSCR, si.nPos);
|
Disassemble(hDebug, IDC_DEBUGGER_DISASSEMBLY, IDC_DEBUGGER_DISASSEMBLY_VSCR, si.nPos);
|
||||||
// "Address Bookmark Add" follows the address
|
} else if(hwnd == icontray)
|
||||||
sprintf(str,"%04X", si.nPos);
|
{
|
||||||
SetDlgItemText(hDebug, IDC_DEBUGGER_BOOKMARK, str);
|
|
||||||
} else if(hwnd == icontray) {
|
|
||||||
crect.bottom += dy;
|
crect.bottom += dy;
|
||||||
SetWindowPos(hwnd,0,0,0,crect.right-crect.left,crect.bottom-crect.top,SWP_NOZORDER | SWP_NOMOVE);
|
SetWindowPos(hwnd,0,0,0,crect.right-crect.left,crect.bottom-crect.top,SWP_NOZORDER | SWP_NOMOVE);
|
||||||
} else if(hwnd == addrline) {
|
} else if(hwnd == addrline)
|
||||||
|
{
|
||||||
crect.top += dy;
|
crect.top += dy;
|
||||||
crect.bottom += dy;
|
crect.bottom += dy;
|
||||||
crect.right += dx;
|
crect.right += dx;
|
||||||
SetWindowPos(hwnd,0,crect.left,crect.top,crect.right-crect.left,crect.bottom-crect.top,SWP_NOZORDER);
|
SetWindowPos(hwnd,0,crect.left,crect.top,crect.right-crect.left,crect.bottom-crect.top,SWP_NOZORDER);
|
||||||
} else if(hwnd == vscr) {
|
} else if(hwnd == vscr)
|
||||||
|
{
|
||||||
crect.bottom += dy;
|
crect.bottom += dy;
|
||||||
crect.left += dx;
|
crect.left += dx;
|
||||||
crect.right += dx;
|
crect.right += dx;
|
||||||
SetWindowPos(hwnd,0,crect.left,crect.top,crect.right-crect.left,crect.bottom-crect.top,SWP_NOZORDER);
|
SetWindowPos(hwnd,0,crect.left,crect.top,crect.right-crect.left,crect.bottom-crect.top,SWP_NOZORDER);
|
||||||
} else {
|
} else
|
||||||
|
{
|
||||||
crect.left += dx;
|
crect.left += dx;
|
||||||
//if (crect.left < 256) crect.left = 256; //Limit how far left the remaining child windows will move
|
//if (crect.left < 256) crect.left = 256; //Limit how far left the remaining child windows will move
|
||||||
SetWindowPos(hwnd,0,crect.left,crect.top,0,0,SWP_NOZORDER | SWP_NOSIZE);
|
SetWindowPos(hwnd,0,crect.left,crect.top,0,0,SWP_NOZORDER | SWP_NOSIZE);
|
||||||
|
@ -1366,11 +1379,14 @@ void LoadGameDebuggerData(HWND hwndDlg = hDebug)
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns the address, or EOF if selection cursor points to something else
|
// returns the address, or EOF if selection cursor points to something else
|
||||||
int CheckClickingOnAnAddress()
|
int Debugger_CheckClickingOnAnAddress(bool onlyCheckWhenNothingSelected)
|
||||||
{
|
{
|
||||||
// debug_str contains the text in the disassembly window
|
// debug_str contains the text in the disassembly window
|
||||||
int sel_start, sel_end;
|
int sel_start, sel_end;
|
||||||
SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_GETSEL, (WPARAM)&sel_start, (LPARAM)&sel_end);
|
SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_GETSEL, (WPARAM)&sel_start, (LPARAM)&sel_end);
|
||||||
|
if (onlyCheckWhenNothingSelected)
|
||||||
|
if (sel_end > sel_start)
|
||||||
|
return EOF;
|
||||||
// find the ":" or "$" before sel_start
|
// find the ":" or "$" before sel_start
|
||||||
int i = sel_start - 1;
|
int i = sel_start - 1;
|
||||||
for (; i > sel_start - 6; i--)
|
for (; i > sel_start - 6; i--)
|
||||||
|
@ -1381,7 +1397,7 @@ int CheckClickingOnAnAddress()
|
||||||
char offsetBuffer[5];
|
char offsetBuffer[5];
|
||||||
strncpy(offsetBuffer, debug_str + i + 1, 4);
|
strncpy(offsetBuffer, debug_str + i + 1, 4);
|
||||||
offsetBuffer[4] = 0;
|
offsetBuffer[4] = 0;
|
||||||
// invalidate the string if a space or \r is found
|
// invalidate the string if a space or \r is found in it
|
||||||
char* firstspace = strstr(offsetBuffer, " ");
|
char* firstspace = strstr(offsetBuffer, " ");
|
||||||
if (!firstspace)
|
if (!firstspace)
|
||||||
firstspace = strstr(offsetBuffer, "\r");
|
firstspace = strstr(offsetBuffer, "\r");
|
||||||
|
@ -1392,10 +1408,7 @@ int CheckClickingOnAnAddress()
|
||||||
{
|
{
|
||||||
// select the text
|
// select the text
|
||||||
SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_SETSEL, (WPARAM)(i + 1), (LPARAM)(i + 5));
|
SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_SETSEL, (WPARAM)(i + 1), (LPARAM)(i + 5));
|
||||||
// send the address to "Seek To" field
|
PrintOffsetToSeekAndBookmarkFields(offset);
|
||||||
SetDlgItemText(hDebug, IDC_DEBUGGER_VAL_PCSEEK, offsetBuffer);
|
|
||||||
// send the address to "Bookmark Add" field
|
|
||||||
SetDlgItemText(hDebug, IDC_DEBUGGER_BOOKMARK, offsetBuffer);
|
|
||||||
return (int)offset;
|
return (int)offset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1409,7 +1422,7 @@ BOOL CALLBACK IDC_DEBUGGER_DISASSEMBLY_WndProc(HWND hwndDlg, UINT uMsg, WPARAM w
|
||||||
{
|
{
|
||||||
case WM_LBUTTONDBLCLK:
|
case WM_LBUTTONDBLCLK:
|
||||||
{
|
{
|
||||||
int offset = CheckClickingOnAnAddress();
|
int offset = Debugger_CheckClickingOnAnAddress(false);
|
||||||
if (offset != EOF)
|
if (offset != EOF)
|
||||||
{
|
{
|
||||||
// bring "Add Breakpoint" dialog
|
// bring "Add Breakpoint" dialog
|
||||||
|
@ -1423,7 +1436,7 @@ BOOL CALLBACK IDC_DEBUGGER_DISASSEMBLY_WndProc(HWND hwndDlg, UINT uMsg, WPARAM w
|
||||||
}
|
}
|
||||||
case WM_LBUTTONUP:
|
case WM_LBUTTONUP:
|
||||||
{
|
{
|
||||||
CheckClickingOnAnAddress();
|
Debugger_CheckClickingOnAnAddress(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WM_RBUTTONDOWN:
|
case WM_RBUTTONDOWN:
|
||||||
|
@ -1442,13 +1455,19 @@ BOOL CALLBACK IDC_DEBUGGER_DISASSEMBLY_WndProc(HWND hwndDlg, UINT uMsg, WPARAM w
|
||||||
case WM_RBUTTONUP:
|
case WM_RBUTTONUP:
|
||||||
{
|
{
|
||||||
// if nothing is selected, try bringing Symbolic Debug Naming dialog
|
// if nothing is selected, try bringing Symbolic Debug Naming dialog
|
||||||
int sel_start, sel_end;
|
int offset = Debugger_CheckClickingOnAnAddress(true);
|
||||||
SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_GETSEL, (WPARAM)&sel_start, (LPARAM)&sel_end);
|
if (offset != EOF)
|
||||||
if (sel_start == sel_end)
|
|
||||||
{
|
{
|
||||||
int offset = CheckClickingOnAnAddress();
|
if (DoSymbolicDebugNaming(offset, hDebug))
|
||||||
if (offset != EOF)
|
{
|
||||||
DoSymbolicDebugNaming(offset);
|
// enable "Symbolic Debug" if not yet enabled
|
||||||
|
if (!symbDebugEnabled)
|
||||||
|
{
|
||||||
|
symbDebugEnabled = true;
|
||||||
|
CheckDlgButton(hDebug, IDC_DEBUGGER_ENABLE_SYMBOLIC, BST_CHECKED);
|
||||||
|
}
|
||||||
|
UpdateDebugger(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1490,7 +1509,7 @@ BOOL CALLBACK IDC_DEBUGGER_DISASSEMBLY_WndProc(HWND hwndDlg, UINT uMsg, WPARAM w
|
||||||
}
|
}
|
||||||
case WM_MOUSEWHEEL:
|
case WM_MOUSEWHEEL:
|
||||||
{
|
{
|
||||||
SendMessage(GetDlgItem(hDebug,IDC_DEBUGGER_DISASSEMBLY_VSCR), uMsg, wParam, lParam);
|
SendMessage(GetDlgItem(hDebug, IDC_DEBUGGER_DISASSEMBLY_VSCR), uMsg, wParam, lParam);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,8 @@ extern char* BreakToText(unsigned int num);
|
||||||
void UpdateDebugger(bool jump_to_pc = true);
|
void UpdateDebugger(bool jump_to_pc = true);
|
||||||
void DoDebug(uint8 halt);
|
void DoDebug(uint8 halt);
|
||||||
void DebuggerExit();
|
void DebuggerExit();
|
||||||
|
void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr);
|
||||||
|
void PrintOffsetToSeekAndBookmarkFields(int offset);
|
||||||
|
|
||||||
void LoadGameDebuggerData(HWND hwndDlg);
|
void LoadGameDebuggerData(HWND hwndDlg);
|
||||||
void updateGameDependentMenusDebugger(unsigned int enable);
|
void updateGameDependentMenusDebugger(unsigned int enable);
|
||||||
|
|
|
@ -822,8 +822,6 @@ void FillDebuggerBookmarkListbox(HWND hwnd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows the code at the bookmark address in the disassembly window
|
* Shows the code at the bookmark address in the disassembly window
|
||||||
*
|
*
|
||||||
|
@ -911,18 +909,15 @@ BOOL CALLBACK SymbolicNamingCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoSymbolicDebugNaming(int offset)
|
// returns true if user pressed OK, false if Cancel
|
||||||
|
bool DoSymbolicDebugNaming(int offset, HWND parentHWND)
|
||||||
{
|
{
|
||||||
|
if (!FCEUI_EmulationPaused())
|
||||||
|
FCEUI_ToggleEmulationPause();
|
||||||
loadNameFiles();
|
loadNameFiles();
|
||||||
childwnd = 1;
|
if (DialogBoxParam(fceu_hInstance, MAKEINTRESOURCE(IDD_SYMBOLIC_DEBUG_NAMING), parentHWND, SymbolicNamingCallB, offset))
|
||||||
if (DialogBoxParam(fceu_hInstance, MAKEINTRESOURCE(IDD_SYMBOLIC_DEBUG_NAMING), hDebug, SymbolicNamingCallB, offset))
|
return true;
|
||||||
{
|
return false;
|
||||||
|
|
||||||
symbDebugEnabled = true;
|
|
||||||
CheckDlgButton(hDebug, IDC_DEBUGGER_ENABLE_SYMBOLIC, BST_CHECKED);
|
|
||||||
UpdateDebugger(false);
|
|
||||||
}
|
|
||||||
childwnd = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddNewSymbolicName(unsigned int newAddress, char* newOffset, char* newName, char* newComment)
|
void AddNewSymbolicName(unsigned int newAddress, char* newOffset, char* newName, char* newComment)
|
||||||
|
|
|
@ -54,6 +54,6 @@ void FillDebuggerBookmarkListbox(HWND hwnd);
|
||||||
void GoToDebuggerBookmark(HWND hwnd);
|
void GoToDebuggerBookmark(HWND hwnd);
|
||||||
int isHex(char c);
|
int isHex(char c);
|
||||||
|
|
||||||
void DoSymbolicDebugNaming(int offset);
|
bool DoSymbolicDebugNaming(int offset, HWND parentHWND);
|
||||||
void AddNewSymbolicName(unsigned int newAddress, char* newOffset, char* newName, char* newComment);
|
void AddNewSymbolicName(unsigned int newAddress, char* newOffset, char* newName, char* newComment);
|
||||||
void WriteNameFileToDisk(const char* filename, Name* node);
|
void WriteNameFileToDisk(const char* filename, Name* node);
|
||||||
|
|
|
@ -107,6 +107,7 @@ struct
|
||||||
}
|
}
|
||||||
popupmenu[] =
|
popupmenu[] =
|
||||||
{
|
{
|
||||||
|
{0x0000,0xFFFF, MODE_NES_MEMORY, ID_ADDRESS_SYMBOLIC_NAME, "Add symbolic debug name"},
|
||||||
{0x0000,0x2000, MODE_NES_MEMORY,ID_ADDRESS_FRZ_SUBMENU,"Freeze/Unfreeze This Address"},
|
{0x0000,0x2000, MODE_NES_MEMORY,ID_ADDRESS_FRZ_SUBMENU,"Freeze/Unfreeze This Address"},
|
||||||
{0x6000,0x7FFF, MODE_NES_MEMORY,ID_ADDRESS_FRZ_SUBMENU,"Freeze/Unfreeze This Address"},
|
{0x6000,0x7FFF, MODE_NES_MEMORY,ID_ADDRESS_FRZ_SUBMENU,"Freeze/Unfreeze This Address"},
|
||||||
{0x0000,0xFFFF, MODE_NES_MEMORY,ID_ADDRESS_ADDBP_R,"Add Debugger Read Breakpoint"},
|
{0x0000,0xFFFF, MODE_NES_MEMORY,ID_ADDRESS_ADDBP_R,"Add Debugger Read Breakpoint"},
|
||||||
|
@ -116,11 +117,7 @@ popupmenu[] =
|
||||||
{0x0000,0xFFFF, MODE_NES_MEMORY,ID_ADDRESS_ADDBP_X,"Add Debugger Execute Breakpoint"},
|
{0x0000,0xFFFF, MODE_NES_MEMORY,ID_ADDRESS_ADDBP_X,"Add Debugger Execute Breakpoint"},
|
||||||
{0x8000,0xFFFF, MODE_NES_MEMORY,ID_ADDRESS_SEEK_IN_ROM,"Go Here In ROM File"},
|
{0x8000,0xFFFF, MODE_NES_MEMORY,ID_ADDRESS_SEEK_IN_ROM,"Go Here In ROM File"},
|
||||||
{0x8000,0xFFFF, MODE_NES_MEMORY,ID_ADDRESS_CREATE_GG_CODE,"Create Game Genie Code At This Address"},
|
{0x8000,0xFFFF, MODE_NES_MEMORY,ID_ADDRESS_CREATE_GG_CODE,"Create Game Genie Code At This Address"},
|
||||||
//{0x0000,0xFFFFFF,MODE_NES_FILE,7,"Create Game Genie Code At This Address"}
|
|
||||||
// ################################## Start of SP CODE ###########################
|
|
||||||
{0x0000,0xFFFF, MODE_NES_MEMORY, ID_ADDRESS_BOOKMARK, "Add / Remove bookmark"},
|
{0x0000,0xFFFF, MODE_NES_MEMORY, ID_ADDRESS_BOOKMARK, "Add / Remove bookmark"},
|
||||||
// ################################## End of SP CODE ###########################
|
|
||||||
{0x0000,0xFFFF, MODE_NES_MEMORY, ID_ADDRESS_SYMBOLIC_NAME, "Add symbolic debug name"},
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
#define POPUPNUM (sizeof popupmenu / sizeof popupmenu[0])
|
#define POPUPNUM (sizeof popupmenu / sizeof popupmenu[0])
|
||||||
|
@ -129,7 +126,6 @@ int LoadTableFile();
|
||||||
void UnloadTableFile();
|
void UnloadTableFile();
|
||||||
void InputData(char *input);
|
void InputData(char *input);
|
||||||
int GetMemViewData(uint32 i);
|
int GetMemViewData(uint32 i);
|
||||||
void UpdateCaption();
|
|
||||||
int UpdateCheatColorCallB(char *name, uint32 a, uint8 v, int compare,int s,int type, void *data); //mbg merge 6/29/06 - added arg
|
int UpdateCheatColorCallB(char *name, uint32 a, uint8 v, int compare,int s,int type, void *data); //mbg merge 6/29/06 - added arg
|
||||||
int DeleteCheatCallB(char *name, uint32 a, uint8 v, int compare,int s,int type); //mbg merge 6/29/06 - added arg
|
int DeleteCheatCallB(char *name, uint32 a, uint8 v, int compare,int s,int type); //mbg merge 6/29/06 - added arg
|
||||||
// ################################## Start of SP CODE ###########################
|
// ################################## Start of SP CODE ###########################
|
||||||
|
@ -280,7 +276,8 @@ void GotoAddress(HWND hwnd) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetHexEditorAddress(int gotoaddress) {
|
void SetHexEditorAddress(int gotoaddress)
|
||||||
|
{
|
||||||
|
|
||||||
if (gotoaddress < 0)
|
if (gotoaddress < 0)
|
||||||
gotoaddress = 0;
|
gotoaddress = 0;
|
||||||
|
@ -1413,6 +1410,24 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
UpdateCaption();
|
UpdateCaption();
|
||||||
UpdateColorTable();
|
UpdateColorTable();
|
||||||
return 0;
|
return 0;
|
||||||
|
case WM_RBUTTONDOWN:
|
||||||
|
{
|
||||||
|
if (!lbuttondown && CursorEndAddy == -1)
|
||||||
|
{
|
||||||
|
x = GET_X_LPARAM(lParam);
|
||||||
|
y = GET_Y_LPARAM(lParam);
|
||||||
|
i = GetAddyFromCoord(x,y);
|
||||||
|
if (i != -1)
|
||||||
|
{
|
||||||
|
EditingText = AddyWasText;
|
||||||
|
CursorStartAddy = i;
|
||||||
|
UpdateCaption();
|
||||||
|
UpdateColorTable();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
mousex = x = GET_X_LPARAM(lParam);
|
mousex = x = GET_X_LPARAM(lParam);
|
||||||
mousey = y = GET_Y_LPARAM(lParam);
|
mousey = y = GET_Y_LPARAM(lParam);
|
||||||
|
@ -1722,8 +1737,20 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
}
|
}
|
||||||
// ################################## End of SP CODE ###########################
|
// ################################## End of SP CODE ###########################
|
||||||
case ID_ADDRESS_SYMBOLIC_NAME:
|
case ID_ADDRESS_SYMBOLIC_NAME:
|
||||||
DoSymbolicDebugNaming(j);
|
{
|
||||||
|
if (DoSymbolicDebugNaming(j, hMemView))
|
||||||
|
{
|
||||||
|
// enable "Symbolic Debug" if not yet enabled
|
||||||
|
if (!symbDebugEnabled)
|
||||||
|
{
|
||||||
|
symbDebugEnabled = true;
|
||||||
|
if (hDebug)
|
||||||
|
CheckDlgButton(hDebug, IDC_DEBUGGER_ENABLE_SYMBOLIC, BST_CHECKED);
|
||||||
|
}
|
||||||
|
UpdateCaption();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//6 = Create GG Code
|
//6 = Create GG Code
|
||||||
|
|
|
@ -3,6 +3,7 @@ void KillMemView();
|
||||||
void UpdateMemoryView(int draw_all);
|
void UpdateMemoryView(int draw_all);
|
||||||
void UpdateColorTable();
|
void UpdateColorTable();
|
||||||
void ChangeMemViewFocus(int newEditingMode, int StartOffset,int EndOffset);
|
void ChangeMemViewFocus(int newEditingMode, int StartOffset,int EndOffset);
|
||||||
|
void UpdateCaption();
|
||||||
|
|
||||||
void ApplyPatch(int addr,int size, uint8* data);
|
void ApplyPatch(int addr,int size, uint8* data);
|
||||||
void UndoLastPatch();
|
void UndoLastPatch();
|
||||||
|
|
|
@ -1170,43 +1170,42 @@ BEGIN
|
||||||
EDITTEXT IDC_DEBUGGER_DISASSEMBLY_LEFT_PANEL,4,5,14,301,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | WS_DISABLED
|
EDITTEXT IDC_DEBUGGER_DISASSEMBLY_LEFT_PANEL,4,5,14,301,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | WS_DISABLED
|
||||||
END
|
END
|
||||||
|
|
||||||
TRACER DIALOGEX 65527, 65513, 403, 339
|
TRACER DIALOGEX 65527, 65513, 382, 317
|
||||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||||
CAPTION "Trace Logger"
|
CAPTION "Trace Logger"
|
||||||
FONT 8, "MS Sans Serif", 400, 0, 0x0
|
FONT 8, "MS Sans Serif", 400, 0, 0x0
|
||||||
BEGIN
|
BEGIN
|
||||||
SCROLLBAR IDC_SCRL_TRACER_LOG,389,4,10,169,SBS_VERT
|
SCROLLBAR IDC_SCRL_TRACER_LOG,367,4,11,169,SBS_VERT
|
||||||
EDITTEXT IDC_TRACER_LOG,4,4,384,169,ES_MULTILINE | ES_NOHIDESEL | ES_READONLY | WS_HSCROLL
|
EDITTEXT IDC_TRACER_LOG,4,4,363,169,ES_MULTILINE | ES_NOHIDESEL | ES_READONLY | WS_HSCROLL
|
||||||
CONTROL "Log last",IDC_RADIO_LOG_LAST,"Button",BS_AUTORADIOBUTTON | BS_LEFT,18,195,38,10
|
CONTROL "Log last",IDC_RADIO_LOG_LAST,"Button",BS_AUTORADIOBUTTON | BS_LEFT,11,181,38,10
|
||||||
CONTROL "Log to File",IDC_RADIO_LOG_TO_FILE,"Button",BS_AUTORADIOBUTTON | BS_LEFT,18,213,48,10
|
CONTROL "Log to File",IDC_RADIO_LOG_TO_FILE,"Button",BS_AUTORADIOBUTTON | BS_LEFT,11,198,47,10
|
||||||
LTEXT "lines to this window",106,110,195,72,10
|
LTEXT "lines to this window",106,101,181,63,10
|
||||||
PUSHBUTTON "Start Logging",IDC_BTN_START_STOP_LOGGING,177,176,67,14,BS_CENTER | BS_VCENTER
|
PUSHBUTTON "Start Logging",IDC_BTN_START_STOP_LOGGING,165,178,67,14,BS_CENTER | BS_VCENTER
|
||||||
COMBOBOX IDC_TRACER_LOG_SIZE,58,193,48,127,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
COMBOBOX IDC_TRACER_LOG_SIZE,51,179,48,127,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||||
GROUPBOX "Log Options",109,12,230,378,69
|
GROUPBOX "Log Options",109,4,212,374,68
|
||||||
CONTROL "Log state of A, X, Y and S registers",IDC_CHECK_LOG_REGISTERS,
|
CONTROL "Log state of A, X, Y and S registers",IDC_CHECK_LOG_REGISTERS,
|
||||||
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,19,242,126,10
|
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,11,224,126,10
|
||||||
CONTROL "Log Processor Status flags",IDC_CHECK_LOG_PROCESSOR_STATUS,
|
CONTROL "Log Processor Status flags",IDC_CHECK_LOG_PROCESSOR_STATUS,
|
||||||
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,149,242,104,10
|
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,141,224,104,10
|
||||||
PUSHBUTTON "Browse...",IDC_BTN_LOG_BROWSE,67,211,46,14,BS_CENTER | BS_VCENTER
|
PUSHBUTTON "Browse...",IDC_BTN_LOG_BROWSE,59,196,46,14,BS_CENTER | BS_VCENTER
|
||||||
LTEXT "",IDC_TRACER_STATS,121,212,246,13
|
|
||||||
CONTROL "Only log newly mapped code",IDC_CHECK_LOG_NEW_INSTRUCTIONS,
|
CONTROL "Only log newly mapped code",IDC_CHECK_LOG_NEW_INSTRUCTIONS,
|
||||||
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,19,315,111,10
|
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,11,295,111,10
|
||||||
GROUPBOX "Extra Log Options that work with the Code/Data Logger",113,12,302,378,30
|
GROUPBOX "Extra Log Options that work with the Code/Data Logger",113,4,282,374,29
|
||||||
CONTROL "Only log code that accesses newly mapped data",IDC_CHECK_LOG_NEW_DATA,
|
CONTROL "Only log code that accesses newly mapped data",IDC_CHECK_LOG_NEW_DATA,
|
||||||
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,149,315,171,10
|
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,141,295,171,10
|
||||||
CONTROL "Automatically update Window while logging",IDC_CHECK_LOG_UPDATE_WINDOW,
|
CONTROL "Automatically update Window while logging",IDC_CHECK_LOG_UPDATE_WINDOW,
|
||||||
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,203,195,160,10
|
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,141,198,160,10
|
||||||
CONTROL "Use Stack Pointer for code tabbing (nesting visualization)",IDC_CHECK_CODE_TABBING,
|
CONTROL "Use Stack Pointer for code tabbing (nesting visualization)",IDC_CHECK_CODE_TABBING,
|
||||||
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,149,283,197,10
|
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,141,264,197,10
|
||||||
CONTROL "To the left from disassembly text",IDC_CHECK_LOG_STATUSES_TO_THE_LEFT,
|
CONTROL "To the left from disassembly text",IDC_CHECK_LOG_STATUSES_TO_THE_LEFT,
|
||||||
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,262,242,119,10
|
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,254,224,117,10
|
||||||
CONTROL "Log Frames count",IDC_CHECK_LOG_FRAMES_COUNT,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,19,255,102,10
|
CONTROL "Log Frames count",IDC_CHECK_LOG_FRAMES_COUNT,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,11,237,102,10
|
||||||
CONTROL "Symbolic trace",IDC_CHECK_SYMBOLIC_TRACING,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,19,283,72,10
|
CONTROL "Symbolic trace",IDC_CHECK_SYMBOLIC_TRACING,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,11,264,72,10
|
||||||
CONTROL "Log emulator messages",IDC_CHECK_LOG_MESSAGES,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,19,268,94,10
|
CONTROL "Log emulator messages",IDC_CHECK_LOG_MESSAGES,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,11,250,94,10
|
||||||
CONTROL "Log breakpoint hits",IDC_CHECK_LOG_BREAKPOINTS,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,149,268,82,10
|
CONTROL "Log breakpoint hits",IDC_CHECK_LOG_BREAKPOINTS,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,141,250,82,10
|
||||||
CONTROL "Log Cycles count",IDC_CHECK_LOG_CYCLES_COUNT,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,149,255,102,10
|
CONTROL "Log Cycles count",IDC_CHECK_LOG_CYCLES_COUNT,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,141,237,102,10
|
||||||
CONTROL "Log Instructions count",IDC_CHECK_LOG_INSTRUCTIONS_COUNT,
|
CONTROL "Log Instructions count",IDC_CHECK_LOG_INSTRUCTIONS_COUNT,
|
||||||
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,262,255,102,10
|
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,254,237,102,10
|
||||||
END
|
END
|
||||||
|
|
||||||
ADDBP DIALOGEX 66, 83, 196, 130
|
ADDBP DIALOGEX 66, 83, 196, 130
|
||||||
|
|
|
@ -88,6 +88,9 @@ FILE *LOG_FP;
|
||||||
|
|
||||||
int Tracer_wndx=0, Tracer_wndy=0;
|
int Tracer_wndx=0, Tracer_wndy=0;
|
||||||
|
|
||||||
|
char trace_str[35000] = {0};
|
||||||
|
WNDPROC IDC_TRACER_LOG_oldWndProc = 0;
|
||||||
|
|
||||||
void ShowLogDirDialog(void);
|
void ShowLogDirDialog(void);
|
||||||
void BeginLoggingSequence(void);
|
void BeginLoggingSequence(void);
|
||||||
void EndLoggingSequence(void);
|
void EndLoggingSequence(void);
|
||||||
|
@ -96,6 +99,115 @@ void UpdateLogText(void);
|
||||||
void EnableTracerMenuItems(void);
|
void EnableTracerMenuItems(void);
|
||||||
int PromptForCDLogger(void);
|
int PromptForCDLogger(void);
|
||||||
|
|
||||||
|
// returns the address, or EOF if selection cursor points to something else
|
||||||
|
int Tracer_CheckClickingOnAnAddress(bool onlyCheckWhenNothingSelected)
|
||||||
|
{
|
||||||
|
// trace_str contains the text in the log window
|
||||||
|
int sel_start, sel_end;
|
||||||
|
SendDlgItemMessage(hTracer, IDC_TRACER_LOG, EM_GETSEL, (WPARAM)&sel_start, (LPARAM)&sel_end);
|
||||||
|
if (onlyCheckWhenNothingSelected)
|
||||||
|
if (sel_end > sel_start)
|
||||||
|
return EOF;
|
||||||
|
// find the "$" before sel_start
|
||||||
|
int i = sel_start - 1;
|
||||||
|
for (; i > sel_start - 6; i--)
|
||||||
|
if (i >= 0 && trace_str[i] == '$')
|
||||||
|
break;
|
||||||
|
if (i > sel_start - 6)
|
||||||
|
{
|
||||||
|
char offsetBuffer[5];
|
||||||
|
strncpy(offsetBuffer, trace_str + i + 1, 4);
|
||||||
|
offsetBuffer[4] = 0;
|
||||||
|
// invalidate the string if a space or \r is found in it
|
||||||
|
char* firstspace = strstr(offsetBuffer, " ");
|
||||||
|
if (!firstspace)
|
||||||
|
firstspace = strstr(offsetBuffer, "\r");
|
||||||
|
if (!firstspace)
|
||||||
|
{
|
||||||
|
unsigned int offset;
|
||||||
|
if (sscanf(offsetBuffer, "%4X", &offset) != EOF)
|
||||||
|
{
|
||||||
|
// select the text
|
||||||
|
SendDlgItemMessage(hTracer, IDC_TRACER_LOG, EM_SETSEL, (WPARAM)(i + 1), (LPARAM)(i + 5));
|
||||||
|
if (hDebug)
|
||||||
|
PrintOffsetToSeekAndBookmarkFields(offset);
|
||||||
|
return (int)offset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return EOF;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CALLBACK IDC_TRACER_LOG_WndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
switch(uMsg)
|
||||||
|
{
|
||||||
|
case WM_LBUTTONDBLCLK:
|
||||||
|
{
|
||||||
|
int offset = Tracer_CheckClickingOnAnAddress(false);
|
||||||
|
if (offset != EOF)
|
||||||
|
{
|
||||||
|
// open Debugger at this address
|
||||||
|
DoDebug(0);
|
||||||
|
if (hDebug)
|
||||||
|
{
|
||||||
|
Disassemble(hDebug, IDC_DEBUGGER_DISASSEMBLY, IDC_DEBUGGER_DISASSEMBLY_VSCR, offset);
|
||||||
|
PrintOffsetToSeekAndBookmarkFields(offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case WM_LBUTTONUP:
|
||||||
|
{
|
||||||
|
Tracer_CheckClickingOnAnAddress(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WM_RBUTTONDOWN:
|
||||||
|
{
|
||||||
|
// if nothing is selected, simulate Left-click
|
||||||
|
int sel_start, sel_end;
|
||||||
|
SendDlgItemMessage(hTracer, IDC_TRACER_LOG, EM_GETSEL, (WPARAM)&sel_start, (LPARAM)&sel_end);
|
||||||
|
if (sel_start == sel_end)
|
||||||
|
{
|
||||||
|
CallWindowProc(IDC_TRACER_LOG_oldWndProc, hwndDlg, WM_LBUTTONDOWN, wParam, lParam);
|
||||||
|
CallWindowProc(IDC_TRACER_LOG_oldWndProc, hwndDlg, WM_LBUTTONUP, wParam, lParam);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WM_RBUTTONUP:
|
||||||
|
{
|
||||||
|
// if nothing is selected, try bringing Symbolic Debug Naming dialog
|
||||||
|
int offset = Tracer_CheckClickingOnAnAddress(true);
|
||||||
|
if (offset != EOF)
|
||||||
|
{
|
||||||
|
if (DoSymbolicDebugNaming(offset, hTracer))
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
// enable "Symbolic trace" if not yet enabled
|
||||||
|
if (!(logging_options & LOG_SYMBOLIC))
|
||||||
|
{
|
||||||
|
logging_options |= LOG_SYMBOLIC;
|
||||||
|
CheckDlgButton(hTracer, IDC_CHECK_SYMBOLIC_TRACING, BST_CHECKED);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
if (hDebug)
|
||||||
|
UpdateDebugger(false);
|
||||||
|
if (hMemView)
|
||||||
|
UpdateCaption();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WM_MOUSEWHEEL:
|
||||||
|
{
|
||||||
|
SendMessage(GetDlgItem(hTracer, IDC_SCRL_TRACER_LOG), uMsg, wParam, lParam);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return CallWindowProc(IDC_TRACER_LOG_oldWndProc, hwndDlg, uMsg, wParam, lParam);
|
||||||
|
}
|
||||||
|
|
||||||
BOOL CALLBACK TracerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
BOOL CALLBACK TracerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -138,7 +250,8 @@ BOOL CALLBACK TracerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
SendDlgItemMessage(hwndDlg, IDC_TRACER_LOG_SIZE, CB_INSERTSTRING, -1, (LPARAM)(LPSTR)log_optn_strlst[i]);
|
SendDlgItemMessage(hwndDlg, IDC_TRACER_LOG_SIZE, CB_INSERTSTRING, -1, (LPARAM)(LPSTR)log_optn_strlst[i]);
|
||||||
}
|
}
|
||||||
SendDlgItemMessage(hwndDlg, IDC_TRACER_LOG_SIZE, CB_SETCURSEL, (WPARAM)log_lines_option, 0);
|
SendDlgItemMessage(hwndDlg, IDC_TRACER_LOG_SIZE, CB_SETCURSEL, (WPARAM)log_lines_option, 0);
|
||||||
SetDlgItemText(hwndDlg, IDC_TRACER_LOG, "Welcome to the Trace Logger.");
|
strcpy(trace_str, "Welcome to the Trace Logger.");
|
||||||
|
SetDlgItemText(hwndDlg, IDC_TRACER_LOG, trace_str);
|
||||||
logtofile = 0;
|
logtofile = 0;
|
||||||
|
|
||||||
CheckDlgButton(hwndDlg, IDC_CHECK_LOG_REGISTERS, (logging_options & LOG_REGISTERS) ? BST_CHECKED : BST_UNCHECKED);
|
CheckDlgButton(hwndDlg, IDC_CHECK_LOG_REGISTERS, (logging_options & LOG_REGISTERS) ? BST_CHECKED : BST_UNCHECKED);
|
||||||
|
@ -158,6 +271,9 @@ BOOL CALLBACK TracerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_LOG_BROWSE), FALSE);
|
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_LOG_BROWSE), FALSE);
|
||||||
CheckDlgButton(hwndDlg, IDC_CHECK_LOG_UPDATE_WINDOW, log_update_window ? BST_CHECKED : BST_UNCHECKED);
|
CheckDlgButton(hwndDlg, IDC_CHECK_LOG_UPDATE_WINDOW, log_update_window ? BST_CHECKED : BST_UNCHECKED);
|
||||||
EnableTracerMenuItems();
|
EnableTracerMenuItems();
|
||||||
|
|
||||||
|
// subclass editfield
|
||||||
|
IDC_TRACER_LOG_oldWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndDlg, IDC_TRACER_LOG), GWL_WNDPROC, (LONG)IDC_TRACER_LOG_WndProc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
|
@ -247,11 +363,10 @@ BOOL CALLBACK TracerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
if(!FCEUI_EmulationPaused() && !log_update_window)
|
if(!FCEUI_EmulationPaused() && !log_update_window)
|
||||||
{
|
{
|
||||||
// Assemble the message to pause the game. Uses the current hotkey mapping dynamically
|
// Assemble the message to pause the game. Uses the current hotkey mapping dynamically
|
||||||
string m1 = "Pause the game (press ";
|
strcpy(trace_str, "Pause the game (press ");
|
||||||
string m2 = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_PAUSE]);
|
strcat(trace_str, GetKeyComboName(FCEUD_CommandMapping[EMUCMD_PAUSE]));
|
||||||
string m3 = " key or snap the Debugger) to update this window.\r\n";
|
strcat(trace_str, " key or snap the Debugger) to update this window.\r\n");
|
||||||
string pauseMessage = m1 + m2 + m3;
|
SetDlgItemText(hTracer, IDC_TRACER_LOG, trace_str);
|
||||||
SetDlgItemText(hTracer, IDC_TRACER_LOG, pauseMessage.c_str());
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -265,15 +380,16 @@ BOOL CALLBACK TracerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
break;
|
break;
|
||||||
case WM_MOVING:
|
case WM_MOVING:
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
switch(uMsg) {
|
|
||||||
case WM_VSCROLL:
|
case WM_VSCROLL:
|
||||||
if (lParam) {
|
{
|
||||||
if ((!logging) || logtofile) break;
|
if (lParam)
|
||||||
|
{
|
||||||
|
if ((!logging) || logtofile)
|
||||||
|
break;
|
||||||
|
|
||||||
if(!FCEUI_EmulationPaused() && !log_update_window) break; //mbg merge 7/19/06 changd to use EmulationPaused()
|
if (!FCEUI_EmulationPaused() && !log_update_window)
|
||||||
|
break;
|
||||||
|
|
||||||
GetScrollInfo((HWND)lParam,SB_CTL,&tracesi);
|
GetScrollInfo((HWND)lParam,SB_CTL,&tracesi);
|
||||||
switch(LOWORD(wParam))
|
switch(LOWORD(wParam))
|
||||||
|
@ -296,13 +412,30 @@ BOOL CALLBACK TracerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
UpdateLogText();
|
UpdateLogText();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
case WM_MOUSEWHEEL:
|
||||||
|
{
|
||||||
|
GetScrollInfo((HWND)lParam, SB_CTL, &tracesi);
|
||||||
|
i = GET_WHEEL_DELTA_WPARAM(wParam) / WHEEL_DELTA;
|
||||||
|
if (i < -1 || i > 1)
|
||||||
|
i *= 2;
|
||||||
|
tracesi.nPos -= i;
|
||||||
|
if ((tracesi.nPos + (int)tracesi.nPage) > tracesi.nMax)
|
||||||
|
tracesi.nPos = tracesi.nMax - tracesi.nPage;
|
||||||
|
else if (tracesi.nPos < tracesi.nMin)
|
||||||
|
tracesi.nPos = tracesi.nMin;
|
||||||
|
SetScrollInfo((HWND)lParam, SB_CTL, &tracesi, TRUE);
|
||||||
|
|
||||||
|
UpdateLogText();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BeginLoggingSequence(void)
|
void BeginLoggingSequence(void)
|
||||||
{
|
{
|
||||||
char str[2048], str2[100];
|
char str2[100];
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
if(!PromptForCDLogger())return; //do nothing if user selected no and CD Logger is needed
|
if(!PromptForCDLogger())return; //do nothing if user selected no and CD Logger is needed
|
||||||
|
@ -312,9 +445,10 @@ void BeginLoggingSequence(void)
|
||||||
if(logfilename == NULL) ShowLogDirDialog();
|
if(logfilename == NULL) ShowLogDirDialog();
|
||||||
if (!logfilename) return;
|
if (!logfilename) return;
|
||||||
LOG_FP = fopen(logfilename,"w");
|
LOG_FP = fopen(logfilename,"w");
|
||||||
if(LOG_FP == NULL){
|
if (LOG_FP == NULL)
|
||||||
sprintf(str,"Error Opening File %s",logfilename);
|
{
|
||||||
MessageBox(hTracer,str, "File Error", MB_OK);
|
sprintf(trace_str, "Error Opening File %s", logfilename);
|
||||||
|
MessageBox(hTracer, trace_str, "File Error", MB_OK);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fprintf(LOG_FP,FCEU_NAME_AND_VERSION" - Trace Log File\n"); //mbg merge 7/19/06 changed string
|
fprintf(LOG_FP,FCEU_NAME_AND_VERSION" - Trace Log File\n"); //mbg merge 7/19/06 changed string
|
||||||
|
@ -323,8 +457,8 @@ void BeginLoggingSequence(void)
|
||||||
log_lines_option = SendDlgItemMessage(hTracer, IDC_TRACER_LOG_SIZE, CB_GETCURSEL, 0, 0);
|
log_lines_option = SendDlgItemMessage(hTracer, IDC_TRACER_LOG_SIZE, CB_GETCURSEL, 0, 0);
|
||||||
if (log_lines_option == CB_ERR)
|
if (log_lines_option == CB_ERR)
|
||||||
log_lines_option = 0;
|
log_lines_option = 0;
|
||||||
strcpy(str,"Allocating Memory...\r\n");
|
strcpy(trace_str, "Allocating Memory...\r\n");
|
||||||
SetDlgItemText(hTracer, IDC_TRACER_LOG, str);
|
SetDlgItemText(hTracer, IDC_TRACER_LOG, trace_str);
|
||||||
tracelogbufsize = j = log_optn_intlst[log_lines_option];
|
tracelogbufsize = j = log_optn_intlst[log_lines_option];
|
||||||
tracelogbuf = (char**)malloc(j*sizeof(char *)); //mbg merge 7/19/06 added cast
|
tracelogbuf = (char**)malloc(j*sizeof(char *)); //mbg merge 7/19/06 added cast
|
||||||
for(i = 0;i < j;i++)
|
for(i = 0;i < j;i++)
|
||||||
|
@ -333,14 +467,12 @@ void BeginLoggingSequence(void)
|
||||||
tracelogbuf[i][0] = 0;
|
tracelogbuf[i][0] = 0;
|
||||||
}
|
}
|
||||||
sprintf(str2, "%d Bytes Allocated...\r\n", j * LOG_LINE_MAX_LEN);
|
sprintf(str2, "%d Bytes Allocated...\r\n", j * LOG_LINE_MAX_LEN);
|
||||||
strcat(str,str2);
|
strcat(trace_str, str2);
|
||||||
// Assemble the message to pause the game. Uses the current hotkey mapping dynamically
|
// Assemble the message to pause the game. Uses the current hotkey mapping dynamically
|
||||||
string m1 = "Pause the game (press ";
|
strcat(trace_str, "Pause the game (press ");
|
||||||
string m2 = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_PAUSE]);
|
strcat(trace_str, GetKeyComboName(FCEUD_CommandMapping[EMUCMD_PAUSE]));
|
||||||
string m3 = " key or snap the Debugger) to update this window.\r\n";
|
strcat(trace_str, " key or snap the Debugger) to update this window.\r\n");
|
||||||
string pauseMessage = m1 + m2 + m3;
|
SetDlgItemText(hTracer, IDC_TRACER_LOG, trace_str);
|
||||||
strcat(str, pauseMessage.c_str());
|
|
||||||
SetDlgItemText(hTracer, IDC_TRACER_LOG, str);
|
|
||||||
tracelogbufpos = tracelogbufusedsize = 0;
|
tracelogbufpos = tracelogbufusedsize = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -653,24 +785,27 @@ void UpdateLogWindow(void)
|
||||||
void UpdateLogText(void)
|
void UpdateLogText(void)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
char str[3000];
|
trace_str[0] = 0;
|
||||||
str[0] = 0;
|
|
||||||
|
if (!tracelogbufpos)
|
||||||
|
return;
|
||||||
|
|
||||||
int last_line = tracesi.nPos + tracesi.nPage;
|
int last_line = tracesi.nPos + tracesi.nPage;
|
||||||
if (last_line > tracesi.nMax)
|
if (last_line > tracesi.nMax)
|
||||||
last_line = tracesi.nMax;
|
last_line = tracesi.nMax;
|
||||||
|
|
||||||
for(i = tracesi.nPos; i < last_line; i++)
|
for (i = tracesi.nPos; i < last_line; i++)
|
||||||
{
|
{
|
||||||
j = i;
|
j = i;
|
||||||
if(tracelogbufusedsize == tracelogbufsize)
|
if(tracelogbufusedsize == tracelogbufsize)
|
||||||
{
|
{
|
||||||
j = (tracelogbufpos+i)%tracelogbufsize;
|
j = (tracelogbufpos + i) % tracelogbufsize;
|
||||||
}
|
}
|
||||||
strcat(str,tracelogbuf[j]);
|
strcat(trace_str, tracelogbuf[j]);
|
||||||
}
|
}
|
||||||
SetDlgItemText(hTracer, IDC_TRACER_LOG, str);
|
SetDlgItemText(hTracer, IDC_TRACER_LOG, trace_str);
|
||||||
sprintf(str,"nPage = %d, nPos = %d, nMax = %d, nMin = %d",tracesi.nPage,tracesi.nPos,tracesi.nMax,tracesi.nMin);
|
//sprintf(str,"nPage = %d, nPos = %d, nMax = %d, nMin = %d",tracesi.nPage,tracesi.nPos,tracesi.nMax,tracesi.nMin);
|
||||||
SetDlgItemText(hTracer, IDC_TRACER_STATS, str);
|
//SetDlgItemText(hTracer, IDC_TRACER_STATS, str);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue