diff --git a/trunk/src/drivers/win/config.cpp b/trunk/src/drivers/win/config.cpp index c03a2f53..a5638715 100644 --- a/trunk/src/drivers/win/config.cpp +++ b/trunk/src/drivers/win/config.cpp @@ -297,7 +297,8 @@ static CFGSTRUCT fceuconfig[] = AC(symbRegNames), AC(debuggerSaveLoadDEBFiles), AC(debuggerDisplayROMoffsets), - AC(debuggerFontSize), + AC(debuggerIDAFont), + //AC(debuggerFontSize), AC(debuggerPageSize), AC(hexeditorFontWidth), AC(hexeditorFontHeight), diff --git a/trunk/src/drivers/win/debugger.cpp b/trunk/src/drivers/win/debugger.cpp index 0d08a77c..a25c0624 100644 --- a/trunk/src/drivers/win/debugger.cpp +++ b/trunk/src/drivers/win/debugger.cpp @@ -37,6 +37,7 @@ #include "ntview.h" #include "cdlogger.h" #include "ppuview.h" +#include "richedit.h" // ################################## Start of SP CODE ########################### @@ -65,15 +66,17 @@ uint8 debugger_open=0; HWND hDebug; static HMENU hDebugcontext; //Handle to context menu static HMENU hDebugcontextsub; //Handle to context sub menu +static HMENU hDisasmcontext; //Handle to context menu +static HMENU hDisasmcontextsub; //Handle to context sub menu WNDPROC IDC_DEBUGGER_DISASSEMBLY_oldWndProc = 0; static HFONT hFont; static SCROLLINFO si; -static HBRUSH WhiteBrush = CreateSolidBrush(RGB(255,255,255)); -static HBRUSH BlueBrush = CreateSolidBrush(RGB(208,255,255)); bool debuggerAutoload = false; bool debuggerSaveLoadDEBFiles = true; +bool debuggerIDAFont = false; +unsigned int IDAFontSize = 16; bool debuggerDisplayROMoffsets = false; char debug_str[35000] = {0}; @@ -113,7 +116,7 @@ void RestoreSize(HWND hwndDlg) { //If the dialog dimensions are changed those changes need to be reflected here. - adelikat const int DEFAULT_WIDTH = 820; //Original width - const int DEFAULT_HEIGHT = 570; //Original height + const int DEFAULT_HEIGHT = 574; //Original height SetWindowPos(hwndDlg,HWND_TOP,DbgPosX,DbgPosY,DEFAULT_WIDTH,DEFAULT_HEIGHT,SWP_SHOWWINDOW); } @@ -387,6 +390,37 @@ BOOL CALLBACK AddbpCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) return FALSE; //TRUE; } +void HighlightPC() +{ + FINDTEXT ft; + ft.lpstrText = ">"; + ft.chrg.cpMin = 0; + ft.chrg.cpMax = -1; + int start = SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_FINDTEXT, (WPARAM)FR_DOWN, (LPARAM)&ft); + if (start >= 0) + { + int old_start, old_end; + SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_GETSEL, (WPARAM)&old_start, (LPARAM)&old_end); + for (int end = start; end < start + 100; end++) + { + if (debug_str[end] == '\n') + { + SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_SETSEL, (WPARAM)start, (LPARAM)end); + CHARFORMAT2 cf; + memset(&cf, 0, sizeof cf); + cf.cbSize = sizeof cf; + cf.dwMask = CFM_COLOR; + cf.crTextColor = RGB(0,0,255); + //cf.dwMask = CFM_BACKCOLOR; + //cf.crBackColor = RGB(208,255,255); + SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_SETCHARFORMAT, (WPARAM)SCF_SELECTION, (LPARAM)&cf); + break; + } + } + SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_SETSEL, (WPARAM)old_start, (LPARAM)old_end); + } +} + void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr) { char chr[40] = {0}; @@ -410,7 +444,7 @@ void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr) //figure out how many lines we can draw RECT rect; GetClientRect(GetDlgItem(hWnd, id), &rect); - int lines = (rect.bottom-rect.top) / debugSystem->fixedFontHeight; + int lines = (rect.bottom-rect.top) / debugSystem->disasmFontHeight; debug_str[0] = 0; PCLine = -1; @@ -431,7 +465,7 @@ void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr) if (node->name) { strcat(debug_str, node->name); - strcat(debug_str, ":\r\n"); + strcat(debug_str, ":\n"); // we added one line to the disassembly window disassembly_addresses.push_back(addr); disassembly_operands.resize(i + 1); @@ -441,16 +475,16 @@ void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr) { // make a copy strcpy(debug_str_decoration_comment, node->comment); - strcat(debug_str_decoration_comment, "\r\n"); + strcat(debug_str_decoration_comment, "\n"); // divide the debug_str_decoration_comment into strings (Comment1, Comment2, ...) debug_decoration_comment = debug_str_decoration_comment; - debug_decoration_comment_end_pos = strstr(debug_decoration_comment, "\r\n"); + debug_decoration_comment_end_pos = strstr(debug_decoration_comment, "\n"); while (debug_decoration_comment_end_pos) { debug_decoration_comment_end_pos[0] = 0; // set \0 instead of \r strcat(debug_str, "; "); strcat(debug_str, debug_decoration_comment); - strcat(debug_str, "\r\n"); + strcat(debug_str, "\n"); // we added one line to the disassembly window disassembly_addresses.push_back(addr); disassembly_operands.resize(i + 1); @@ -458,7 +492,7 @@ void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr) debug_decoration_comment_end_pos += 2; debug_decoration_comment = debug_decoration_comment_end_pos; - debug_decoration_comment_end_pos = strstr(debug_decoration_comment_end_pos, "\r\n"); + debug_decoration_comment_end_pos = strstr(debug_decoration_comment_end_pos, "\n"); } } } @@ -487,7 +521,7 @@ void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr) } } else { - sprintf(chr, " %04X: ", addr); + sprintf(chr, " :%04X: ", addr); } // Add address @@ -508,7 +542,7 @@ void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr) { while (addr < 0xFFFF) { - sprintf(chr, "%02X OVERFLOW\r\n", GetMem(addr++)); + sprintf(chr, "%02X OVERFLOW\n", GetMem(addr++)); strcat(debug_str, chr); } break; @@ -547,11 +581,14 @@ void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr) // append the disassembly to current line strcat(strcat(debug_str, " "), a); } - strcat(debug_str, "\r\n"); + strcat(debug_str, "\n"); instructions_count++; } SetDlgItemText(hWnd, id, debug_str); + if (PCLine >= 0) + HighlightPC(); + // fill the left panel data debug_cdl_str[0] = 0; if (cdloggerdataSize) @@ -819,7 +856,7 @@ void UpdateDebugger(bool jump_to_pc) // ensure that PC pointer will be visible even after the window was resized RECT rect; GetClientRect(GetDlgItem(hDebug, IDC_DEBUGGER_DISASSEMBLY), &rect); - unsigned int lines = (rect.bottom-rect.top) / debugSystem->fixedFontHeight; + unsigned int lines = (rect.bottom-rect.top) / debugSystem->disasmFontHeight; if (PC_pointerOffset >= lines) PC_pointerOffset = 0; @@ -1487,34 +1524,11 @@ int Debugger_CheckClickingOnAnAddressOrSymbolicName(unsigned int lineNumber, boo BOOL CALLBACK IDC_DEBUGGER_DISASSEMBLY_WndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - PAINTSTRUCT ps; switch(uMsg) { - case WM_PAINT: - { - BeginPaint(hwndDlg, &ps); - HDC hdcStatic = GetDC(hwndDlg); - SetBkMode(hdcStatic, TRANSPARENT); - SetTextColor(hdcStatic, RGB(0, 0, 0)); - RECT rect; - GetClientRect(hwndDlg, &rect); - SelectObject(hdcStatic, (HGDIOBJ)debugSystem->hFixedFont); - FillRect(hdcStatic, &rect, WhiteBrush); - if (PCLine != -1) - { - RECT PC = { - rect.left, debugSystem->fixedFontHeight * PCLine + 1, - rect.right, debugSystem->fixedFontHeight * PCLine + debugSystem->fixedFontHeight + 1 }; - FillRect(hdcStatic, &PC, BlueBrush); - } - OffsetRect(&rect, 1, 1); - DrawText(hdcStatic, debug_str, strlen(debug_str), &rect, NULL); - EndPaint(hwndDlg, &ps); - return 0; - } case WM_LBUTTONDBLCLK: { - int offset = Debugger_CheckClickingOnAnAddressOrSymbolicName(GET_Y_LPARAM(lParam) / debugSystem->fixedFontHeight, false); + int offset = Debugger_CheckClickingOnAnAddressOrSymbolicName(GET_Y_LPARAM(lParam) / debugSystem->disasmFontHeight, false); if (offset != EOF) { // bring "Add Breakpoint" dialog @@ -1526,16 +1540,9 @@ BOOL CALLBACK IDC_DEBUGGER_DISASSEMBLY_WndProc(HWND hwndDlg, UINT uMsg, WPARAM w } return 0; } - case WM_LBUTTONDOWN: - { - RECT rect; - GetClientRect(hwndDlg, &rect); - InvalidateRect(hwndDlg, &rect, 0); - break; - } case WM_LBUTTONUP: { - Debugger_CheckClickingOnAnAddressOrSymbolicName(GET_Y_LPARAM(lParam) / debugSystem->fixedFontHeight, true); + Debugger_CheckClickingOnAnAddressOrSymbolicName(GET_Y_LPARAM(lParam) / debugSystem->disasmFontHeight, true); break; } case WM_RBUTTONDOWN: @@ -1560,7 +1567,7 @@ BOOL CALLBACK IDC_DEBUGGER_DISASSEMBLY_WndProc(HWND hwndDlg, UINT uMsg, WPARAM w CallWindowProc(IDC_DEBUGGER_DISASSEMBLY_oldWndProc, hwndDlg, WM_LBUTTONDOWN, wParam, lParam); CallWindowProc(IDC_DEBUGGER_DISASSEMBLY_oldWndProc, hwndDlg, WM_LBUTTONUP, wParam, lParam); // try bringing Symbolic Debug Naming dialog - int offset = Debugger_CheckClickingOnAnAddressOrSymbolicName(GET_Y_LPARAM(lParam) / debugSystem->fixedFontHeight, false); + int offset = Debugger_CheckClickingOnAnAddressOrSymbolicName(GET_Y_LPARAM(lParam) / debugSystem->disasmFontHeight, false); if (offset != EOF) { if (DoSymbolicDebugNaming(offset, hDebug)) @@ -1594,7 +1601,7 @@ BOOL CALLBACK IDC_DEBUGGER_DISASSEMBLY_WndProc(HWND hwndDlg, UINT uMsg, WPARAM w mouse_x = GET_X_LPARAM(lParam); mouse_y = GET_Y_LPARAM(lParam); - tmp = mouse_y / debugSystem->fixedFontHeight; + tmp = mouse_y / debugSystem->disasmFontHeight; if (tmp < (int)disassembly_addresses.size()) { i = disassembly_addresses[tmp]; @@ -1626,6 +1633,42 @@ BOOL CALLBACK IDC_DEBUGGER_DISASSEMBLY_WndProc(HWND hwndDlg, UINT uMsg, WPARAM w SendMessage(GetDlgItem(hDebug, IDC_DEBUGGER_DISASSEMBLY_VSCR), uMsg, wParam, lParam); return 0; } + case WM_CONTEXTMENU: + { + int sel_start = 0, sel_end = 0; + SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_GETSEL, (WPARAM)&sel_start, (LPARAM)&sel_end); + hDisasmcontextsub = GetSubMenu(hDisasmcontext, 0); + if (sel_end - sel_start == 0) + EnableMenuItem(hDisasmcontextsub, DISASM_CONTEXT_COPY, MF_GRAYED); + else + EnableMenuItem(hDisasmcontextsub, DISASM_CONTEXT_COPY, MF_ENABLED); + if (lParam != -1) + TrackPopupMenu(hDisasmcontextsub, TPM_RIGHTBUTTON, LOWORD(lParam), HIWORD(lParam), 0, hwndDlg, 0); + else + { + // Handle the context menu keyboard key + RECT wrect; + GetWindowRect(GetDlgItem(hDebug, IDC_DEBUGGER_DISASSEMBLY), &wrect); + TrackPopupMenu(hDisasmcontextsub, TPM_RIGHTBUTTON, wrect.left + 50, wrect.top + 50, 0, hwndDlg, 0); + } + break; + } + case WM_COMMAND: + { + switch(LOWORD(wParam)) + { + case DISASM_CONTEXT_COPY: + SendMessage(hwndDlg, WM_COPY, 0, 0); + break; + case DISASM_CONTEXT_SELECTALL: + CHARRANGE charr; + charr.cpMin = 0; + charr.cpMax = -1; + SendMessage(hwndDlg, EM_SETSEL, 0, (LPARAM)&charr); + break; + } + break; + } } return CallWindowProc(IDC_DEBUGGER_DISASSEMBLY_oldWndProc, hwndDlg, uMsg, wParam, lParam); } @@ -1653,6 +1696,7 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara CheckDlgButton(hwndDlg, IDC_DEBUGGER_BREAK_ON_BAD_OP, FCEUI_Debugger().badopbreak ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, DEBUGLOADDEB, debuggerSaveLoadDEBFiles ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, DEBUGIDAFONT, debuggerIDAFont ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, DEBUGAUTOLOAD, debuggerAutoload ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_DEBUGGER_ROM_OFFSETS, debuggerDisplayROMoffsets ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_DEBUGGER_ENABLE_SYMBOLIC, symbDebugEnabled ? BST_CHECKED : BST_UNCHECKED); @@ -1673,7 +1717,7 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara SetScrollInfo(GetDlgItem(hwndDlg,IDC_DEBUGGER_DISASSEMBLY_VSCR),SB_CTL,&si,TRUE); //setup font - SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_DISASSEMBLY,WM_SETFONT,(WPARAM)debugSystem->hFixedFont,FALSE); + SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_DISASSEMBLY,WM_SETFONT,(WPARAM)debugSystem->hDisasmFont,FALSE); SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_DISASSEMBLY_LEFT_PANEL,WM_SETFONT,(WPARAM)debugSystem->hFixedFont,FALSE); //SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_VAL_A,WM_SETFONT,(WPARAM)debugSystem->hFixedFont,FALSE); //SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_VAL_X,WM_SETFONT,(WPARAM)debugSystem->hFixedFont,FALSE); @@ -1709,6 +1753,7 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara // Enable Context Sub-Menus hDebugcontext = LoadMenu(fceu_hInstance,"DEBUGCONTEXTMENUS"); + hDisasmcontext = LoadMenu(fceu_hInstance,"DISASMCONTEXTMENUS"); // subclass editfield IDC_DEBUGGER_DISASSEMBLY_oldWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndDlg, IDC_DEBUGGER_DISASSEMBLY), GWL_WNDPROC, (LONG)IDC_DEBUGGER_DISASSEMBLY_WndProc); @@ -1772,14 +1817,6 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara } break; - case WM_CTLCOLORSTATIC: - if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_DEBUGGER_DISASSEMBLY)) - { - SetBkColor((HDC)wParam, RGB(255, 255, 255)); - return (LRESULT) GetStockObject(DC_BRUSH); - } - break; - //adelikat: Buttons that don't need a rom loaded to do something, such as autoload case WM_COMMAND: { @@ -1791,6 +1828,13 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara case DEBUGLOADDEB: debuggerSaveLoadDEBFiles = !debuggerSaveLoadDEBFiles; break; + case DEBUGIDAFONT: + debuggerIDAFont ^= 1; + debugSystem->hDisasmFont = debuggerIDAFont ? debugSystem->hIDAFont : debugSystem->hFixedFont; + debugSystem->disasmFontHeight = debuggerIDAFont ? IDAFontSize : debugSystem->fixedFontHeight; + SendDlgItemMessage(hwndDlg, IDC_DEBUGGER_DISASSEMBLY, WM_SETFONT, (WPARAM)debugSystem->hDisasmFont, FALSE); + UpdateDebugger(); + break; case IDC_DEBUGGER_CYCLES_EXCEED: { if (HIWORD(wParam) == EN_CHANGE) @@ -1902,18 +1946,16 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara // Handle certain stubborn context menus for nearly incapable controls. if (wParam == (uint32)GetDlgItem(hwndDlg,IDC_DEBUGGER_BP_LIST)) { - // Only open the menu if a cheat is selected + // Only open the menu if a breakpoint is selected if (SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_BP_LIST,LB_GETCURSEL,0,0) >= 0) { - // Open IDC_LIST_CHEATS Context Menu hDebugcontextsub = GetSubMenu(hDebugcontext,0); - SetMenuDefaultItem(hDebugcontextsub, DEBUGGER_CONTEXT_TOGGLEBREAK, false); + //SetMenuDefaultItem(hDebugcontextsub, DEBUGGER_CONTEXT_TOGGLEBREAK, false); if (lParam != -1) TrackPopupMenu(hDebugcontextsub,TPM_RIGHTBUTTON,LOWORD(lParam),HIWORD(lParam),0,hwndDlg,0); //Create menu else { // Handle the context menu keyboard key GetWindowRect(GetDlgItem(hwndDlg,IDC_DEBUGGER_BP_LIST), &wrect); TrackPopupMenu(hDebugcontextsub,TPM_RIGHTBUTTON,wrect.left + int((wrect.right - wrect.left) / 3),wrect.top + int((wrect.bottom - wrect.top) / 3),0,hwndDlg,0); //Create menu - } - + } } } break; @@ -1972,7 +2014,7 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara tmp = mouse_y - 10; if(tmp > height) setString = false; - tmp /= debugSystem->fixedFontHeight; + tmp /= debugSystem->disasmFontHeight; } if (setString) @@ -1992,7 +2034,7 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara //mbg merge 7/18/06 changed pausing check if (FCEUI_EmulationPaused() && (mouse_x > 6) && (mouse_x < 30) && (mouse_y > 10)) { - tmp = (mouse_y - 10) / debugSystem->fixedFontHeight; + tmp = (mouse_y - 10) / debugSystem->disasmFontHeight; // ################################## End of SP CODE ########################### if (tmp < (int)disassembly_addresses.size()) { @@ -2015,7 +2057,7 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara //mbg merge 7/18/06 changed pausing check if (FCEUI_EmulationPaused() && (mouse_x > 6) && (mouse_x < 30) && (mouse_y > 10)) { - tmp = (mouse_y - 10) / debugSystem->fixedFontHeight; + tmp = (mouse_y - 10) / debugSystem->disasmFontHeight; if (tmp < (int)disassembly_addresses.size()) { i = disassembly_addresses[tmp]; @@ -2036,7 +2078,7 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara //mbg merge 7/18/06 changed pausing check if (FCEUI_EmulationPaused() && (mouse_x > 6) && (mouse_x < 30) && (mouse_y > 10)) { - tmp = (mouse_y - 10) / debugSystem->fixedFontHeight; + tmp = (mouse_y - 10) / debugSystem->disasmFontHeight; if (tmp < (int)disassembly_addresses.size()) { i = disassembly_addresses[tmp]; @@ -2398,6 +2440,13 @@ void DebugSystem::init() DEFAULT_QUALITY, DEFAULT_PITCH, /*quality, and pitch*/ "Courier New"); /*font name*/ + hIDAFont = CreateFont(IDAFontSize, IDAFontSize / 2, /*Height,Width*/ + 0,0, /*escapement,orientation*/ + FW_REGULAR,FALSE,FALSE,FALSE, /*weight, italic, underline, strikeout*/ + ANSI_CHARSET,OUT_DEVICE_PRECIS,CLIP_MASK, /*charset, precision, clipping*/ + DEFAULT_QUALITY, DEFAULT_PITCH, /*quality, and pitch*/ + "Fixedsys"); /*font name*/ + //if the user provided his own courier font, use that extern std::string BaseDirectory; std::string courefon_path = BaseDirectory + "\\coure.fon"; @@ -2427,6 +2476,9 @@ void DebugSystem::init() HexeditorFontWidth = tm.tmAveCharWidth; SelectObject(hdc,old); DeleteDC(hdc); + LoadLibrary(TEXT("Riched20.dll")); + hDisasmFont = debuggerIDAFont ? hIDAFont : hFixedFont; + disasmFontHeight = debuggerIDAFont ? IDAFontSize : fixedFontHeight; } DebugSystem::~DebugSystem() @@ -2441,5 +2493,10 @@ DebugSystem::~DebugSystem() DeleteObject(hHexeditorFont); hHexeditorFont = 0; } + if (hIDAFont) + { + DeleteObject(hIDAFont); + hIDAFont = 0; + } } diff --git a/trunk/src/drivers/win/debugger.h b/trunk/src/drivers/win/debugger.h index 49f3df0b..befd1cff 100644 --- a/trunk/src/drivers/win/debugger.h +++ b/trunk/src/drivers/win/debugger.h @@ -20,6 +20,7 @@ extern int childwnd,numWPs; //mbg merge 7/18/06 had to make extern extern bool debuggerAutoload; extern bool debuggerSaveLoadDEBFiles; extern bool debuggerDisplayROMoffsets; +extern bool debuggerIDAFont; extern unsigned int debuggerPageSize; extern unsigned int debuggerFontSize; @@ -57,6 +58,11 @@ public: int fixedFontWidth; int fixedFontHeight; + HFONT hIDAFont; + + HFONT hDisasmFont; + int disasmFontHeight; + HFONT hHexeditorFont; int HexeditorFontWidth; int HexeditorFontHeight; diff --git a/trunk/src/drivers/win/res.rc b/trunk/src/drivers/win/res.rc index ef0d41e5..a588c7b7 100644 --- a/trunk/src/drivers/win/res.rc +++ b/trunk/src/drivers/win/res.rc @@ -710,13 +710,13 @@ BEGIN PUSHBUTTON "<",MEMW_EXPANDCOLLAPSE,1,259,11,10 END -DEBUGGER DIALOGEX 54, 74, 546, 329 +DEBUGGER DIALOGEX 54, 74, 546, 332 STYLE DS_SETFONT | DS_3DLOOK | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME CAPTION "6502 Debugger" FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN - EDITTEXT IDC_DEBUGGER_DISASSEMBLY,18,5,316,312,ES_MULTILINE | ES_NOHIDESEL | ES_READONLY | WS_HSCROLL - SCROLLBAR IDC_DEBUGGER_DISASSEMBLY_VSCR,334,5,11,312,SBS_VERT + CONTROL "",IDC_DEBUGGER_DISASSEMBLY,"RichEdit20A",ES_MULTILINE | ES_NOHIDESEL | ES_READONLY | WS_BORDER | WS_HSCROLL,18,5,316,315 + SCROLLBAR IDC_DEBUGGER_DISASSEMBLY_VSCR,334,5,11,315,SBS_VERT GROUPBOX "Status Flags",401,434,140,106,35,WS_TABSTOP CONTROL "N",IDC_DEBUGGER_FLAG_N,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,440,149,18,12 CONTROL "V",IDC_DEBUGGER_FLAG_V,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,466,149,18,12 @@ -761,7 +761,7 @@ BEGIN EDITTEXT IDC_DEBUGGER_VAL_CYCLES_COUNT2,492,179,54,12,ES_READONLY | ES_WANTRETURN | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_TRANSPARENT EDITTEXT IDC_DEBUGGER_VAL_INSTRUCTIONS_COUNT,442,204,47,12,ES_NOHIDESEL | ES_READONLY | ES_WANTRETURN | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_TRANSPARENT EDITTEXT IDC_DEBUGGER_VAL_INSTRUCTIONS_COUNT2,491,204,55,12,ES_READONLY | ES_WANTRETURN | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_TRANSPARENT - CONTROL "",IDC_DEBUGGER_ADDR_LINE,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,4,318,341,11 + CONTROL "",IDC_DEBUGGER_ADDR_LINE,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,4,321,341,11 CONTROL "Break on Bad Opcodes",IDC_DEBUGGER_BREAK_ON_BAD_OP, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,440,126,94,10 CONTROL "Symbolic debug",IDC_DEBUGGER_ENABLE_SYMBOLIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,473,261,62,10 @@ -772,12 +772,11 @@ BEGIN PUSHBUTTON "Add",IDC_DEBUGGER_BOOKMARK_ADD,431,256,30,14 PUSHBUTTON "Delete",IDC_DEBUGGER_BOOKMARK_DEL,431,272,30,14 PUSHBUTTON "Rom Patcher",IDC_DEBUGGER_ROM_PATCHER,472,299,64,14 - PUSHBUTTON "",IDC_DEBUGGER_RESTORESIZE,349,319,13,10 - LTEXT "Default window size",IDC_STATIC,364,320,68,9 + PUSHBUTTON "Default window size",IDC_DEBUGGER_RESTORESIZE,348,318,68,14 PUSHBUTTON "Run Line",IDC_DEBUGGER_RUN_LINE,351,37,38,14 PUSHBUTTON "128 Lines",IDC_DEBUGGER_RUN_FRAME2,392,37,39,14 - CONTROL ".DEB files",DEBUGLOADDEB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,491,316,46,13 - CONTROL "Auto-open",DEBUGAUTOLOAD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,439,316,47,13 + CONTROL ".DEB files",DEBUGLOADDEB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,463,319,42,13 + CONTROL "Auto-open",DEBUGAUTOLOAD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,417,319,45,13 LTEXT "CPU cycles:",IDC_STATIC,403,179,39,8 PUSHBUTTON "Reset counters",IDC_DEBUGGER_RESET_COUNTERS,470,229,68,14 CONTROL "Break when exceed",IDC_DEBUGGER_BREAK_ON_CYCLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,405,191,78,10 @@ -789,8 +788,9 @@ BEGIN GROUPBOX "",IDC_STATIC,468,241,72,75 CONTROL "ROM offsets",IDC_DEBUGGER_ROM_OFFSETS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,473,249,62,10 PUSHBUTTON "Name",IDC_DEBUGGER_BOOKMARK_NAME,431,288,30,14 - EDITTEXT IDC_DEBUGGER_DISASSEMBLY_LEFT_PANEL,4,5,14,312,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | WS_DISABLED + EDITTEXT IDC_DEBUGGER_DISASSEMBLY_LEFT_PANEL,4,5,14,315,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | WS_DISABLED CONTROL "Register names",IDC_DEBUGGER_PREDEFINED_REGS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,473,272,65,10 + CONTROL "IDA font",DEBUGIDAFONT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,507,319,38,13 END TRACER DIALOGEX 0, 0, 317, 181 @@ -2263,6 +2263,15 @@ BEGIN END END +DISASMCONTEXTMENUS MENU +BEGIN + POPUP "DisasmPopup" + BEGIN + MENUITEM "Copy\tCtrl+C", DISASM_CONTEXT_COPY + MENUITEM "Select All\tCtrl+A", DISASM_CONTEXT_SELECTALL + END +END + #endif // Neutral resources ///////////////////////////////////////////////////////////////////////////// diff --git a/trunk/src/drivers/win/resource.h b/trunk/src/drivers/win/resource.h index 1ea42240..1ca6ac9f 100644 --- a/trunk/src/drivers/win/resource.h +++ b/trunk/src/drivers/win/resource.h @@ -780,6 +780,10 @@ #define STATIC_CONTRASTVALUE 1300 #define CTL_PALBRIGHT_TRACKBAR 1301 #define STATIC_BRIGHTVALUE 1302 +#define IDC_RICHEDIT21 1304 +#define IDC_RICHEDIT_DISASM 1304 +#define IDC_CHECK2 1305 +#define DEBUGIDAFONT 1305 #define MENU_NETWORK 40040 #define MENU_PALETTE 40041 #define MENU_SOUND 40042 @@ -1236,9 +1240,13 @@ #define MENU_RAMINIT_FF 40594 #define MENU_RAMINIT_00 40595 #define MENU_RAMINIT_RANDOM 40596 +#define ID_COPY_SELECTALL 40596 #define MENU_MV_FILE_LOAD_RAM 40597 +#define ID_COPY_COPY 40597 #define MENU_MV_FILE_LOAD_PPU 40598 +#define DISASM_CONTEXT_COPY 40598 #define MENU_MV_FILE_LOAD_OAM 40599 +#define DISASM_CONTEXT_SELECTALL 40599 #define IDC_DEBUGGER_ICONTRAY 55535 #define MW_ValueLabel2 65423 #define MW_ValueLabel1 65426 @@ -1250,9 +1258,9 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 292 -#define _APS_NEXT_COMMAND_VALUE 40596 -#define _APS_NEXT_CONTROL_VALUE 1303 +#define _APS_NEXT_RESOURCE_VALUE 293 +#define _APS_NEXT_COMMAND_VALUE 40600 +#define _APS_NEXT_CONTROL_VALUE 1306 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/trunk/src/drivers/win/tracer.cpp b/trunk/src/drivers/win/tracer.cpp index d3a65fe1..47cec2ad 100644 --- a/trunk/src/drivers/win/tracer.cpp +++ b/trunk/src/drivers/win/tracer.cpp @@ -163,7 +163,9 @@ int Tracer_CheckClickingOnAnAddressOrSymbolicName(unsigned int lineNumber, bool // find the "$" before sel_start int i = sel_start - 1; for (; i > sel_start - 6; i--) - if (i >= 0 && trace_str[i] == '$') + if (i >= 0 && + (trace_str[i] == '$' && trace_str[i+3] != ':') || // allow zero page indexted, ignore bank + (trace_str[i] == ':' && trace_str[i+5] == ':')) break; if (i > sel_start - 6) {