diff --git a/src/drivers/win/cdlogger.cpp b/src/drivers/win/cdlogger.cpp index 5fb12951..955990f1 100644 --- a/src/drivers/win/cdlogger.cpp +++ b/src/drivers/win/cdlogger.cpp @@ -23,7 +23,6 @@ #include "../../cart.h" //mbg merge 7/18/06 moved beneath fceu.h #include "../../x6502.h" #include "../../debug.h" -#include "debugger.h" #include "tracer.h" #include "cdlogger.h" #include "main.h" //for GetRomName() @@ -116,7 +115,7 @@ INT_PTR CALLBACK CDLoggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP if (autoloadCDL) { char nameo[2048]; - strcpy(nameo, GetRomPath()); + strcpy(nameo, GetRomPath().c_str()); strcat(nameo, mass_replace(GetRomName(), "|", ".").c_str()); strcat(nameo, ".cdl"); LoadCDLog(nameo); @@ -289,8 +288,8 @@ void SaveCDLogFile() if (loadedcdfile[0] == 0) { char nameo[2048]; - strcpy(nameo, GetRomPath()); - strcat(nameo, mass_replace(GetRomName(), "|", ".").c_str()); + strcpy(nameo, GetRomName().c_str()); + strcat(nameo, mass_replace(GetRomPath(), "|", ".").c_str()); strcat(nameo, ".cdl"); RenameCDLog(nameo); } @@ -500,7 +499,7 @@ void CDLoggerROMChanged() // try to load respective CDL file char nameo[2048]; - strcpy(nameo, GetRomPath()); + strcpy(nameo, GetRomName().c_str()); strcat(nameo, mass_replace(GetRomName(), "|", ".").c_str()); strcat(nameo, ".cdl"); diff --git a/src/drivers/win/cheat.cpp b/src/drivers/win/cheat.cpp index 11f9b093..f2d6c83e 100644 --- a/src/drivers/win/cheat.cpp +++ b/src/drivers/win/cheat.cpp @@ -22,7 +22,6 @@ #include "cheat.h" #include "memview.h" #include "memwatch.h" -#include "debugger.h" #include "ramwatch.h" #include "../../fceu.h" #include "../../cart.h" @@ -401,6 +400,7 @@ INT_PTR CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA case WM_QUIT: case WM_CLOSE: DestroyWindow(hCheatTip); + DestroyMenu(hCheatcontext); if (CheatStyle) DestroyWindow(hwndDlg); else diff --git a/src/drivers/win/config.cpp b/src/drivers/win/config.cpp index 3d293793..51ecf121 100644 --- a/src/drivers/win/config.cpp +++ b/src/drivers/win/config.cpp @@ -116,34 +116,12 @@ extern int GGConv_wndx, GGConv_wndy; extern int MetaPosX,MetaPosY; extern int MLogPosX,MLogPosY; +// owomomo: I'm tired to write those repeated words +#define ACRGB(name) AC(name##Color##R), AC(name##Color##G), AC(name##Color##B) +#define ACOPRGB(_OP) OPHEXRGB(_OP, _COMMA), OPCDLRGB(_OP, _COMMA), OPDBGRGB(_OP, _COMMA) +extern COLORREF custom_color[]; + extern int HexRowHeightBorder; -extern int HexBackColorR; -extern int HexBackColorG; -extern int HexBackColorB; -extern int HexForeColorR; -extern int HexForeColorG; -extern int HexForeColorB; -extern int HexHlBackColorR; -extern int HexHlBackColorG; -extern int HexHlBackColorB; -extern int HexHlForeColorR; -extern int HexHlForeColorG; -extern int HexHlForeColorB; -extern int HexFreezeColorR; -extern int HexFreezeColorG; -extern int HexFreezeColorB; -extern int RomFreezeColorR; -extern int RomFreezeColorG; -extern int RomFreezeColorB; -extern int HexBoundColorR; -extern int HexBoundColorG; -extern int HexBoundColorB; -extern int HexHlShdBackColorR; -extern int HexHlShdBackColorG; -extern int HexHlShdBackColorB; -extern int HexHlShdForeColorR; -extern int HexHlShdForeColorG; -extern int HexHlShdForeColorB; extern int importBookmarkProps; //adelikat: Hacky fix for Ram Watch recent menu @@ -457,34 +435,24 @@ static CFGSTRUCT fceuconfig[] = AC(fullscreenByDoubleclick), AC(CurrentState), AC(HexRowHeightBorder), - AC(HexBackColorR), - AC(HexBackColorG), - AC(HexBackColorB), - AC(HexForeColorR), - AC(HexForeColorG), - AC(HexForeColorB), - AC(HexHlBackColorR), - AC(HexHlBackColorG), - AC(HexHlBackColorB), - AC(HexHlForeColorR), - AC(HexHlForeColorG), - AC(HexHlForeColorB), - AC(HexHlShdBackColorR), - AC(HexHlShdBackColorG), - AC(HexHlShdBackColorB), - AC(HexHlShdForeColorR), - AC(HexHlShdForeColorG), - AC(HexHlShdForeColorB), - AC(HexFreezeColorR), - AC(HexFreezeColorG), - AC(HexFreezeColorB), - AC(RomFreezeColorR), - AC(RomFreezeColorG), - AC(RomFreezeColorB), - AC(HexBoundColorR), - AC(HexBoundColorG), - AC(HexBoundColorB), AC(importBookmarkProps), + ACOPRGB(ACRGB), + AC(custom_color[0]), + AC(custom_color[1]), + AC(custom_color[2]), + AC(custom_color[3]), + AC(custom_color[4]), + AC(custom_color[5]), + AC(custom_color[6]), + AC(custom_color[7]), + AC(custom_color[8]), + AC(custom_color[9]), + AC(custom_color[10]), + AC(custom_color[11]), + AC(custom_color[12]), + AC(custom_color[13]), + AC(custom_color[14]), + AC(custom_color[15]), //ACS(memwLastfile[2048]), AC(AutoRWLoad), diff --git a/src/drivers/win/debugger.cpp b/src/drivers/win/debugger.cpp index c564d2a9..e942b392 100644 --- a/src/drivers/win/debugger.cpp +++ b/src/drivers/win/debugger.cpp @@ -79,18 +79,49 @@ bool debuggerIDAFont = false; unsigned int IDAFontSize = 16; bool debuggerDisplayROMoffsets = false; -char debug_str[35000] = {0}; -char debug_cdl_str[500] = {0}; -char debug_str_decoration_comment[NL_MAX_MULTILINE_COMMENT_LEN + 10] = {0}; +wchar_t* debug_wstr; +char* debug_cdl_str; +char* debug_str_decoration_comment; char* debug_decoration_comment; char* debug_decoration_comment_end_pos; -CHARFORMAT2 mnem; -CHARFORMAT2 oper; -CHARFORMAT2 comm; FINDTEXT newline; FINDTEXT num; +int DefDbgRGB; +CHARFORMAT2 DefDbgChFmt; + +struct DBGCOLORMENU { + COLORMENU menu; + CHARFORMAT2 *fmt; +} dbgcolormenu[] = { + { "PC", PPCCF(DbgPC) }, + { NULL }, + { "Mnemonic", PPCCF(DbgMnem) }, + { NULL }, + { "Symbolic name", PPCCF(DbgSym) }, + { "Comment" , PPCCF(DbgComm) }, + { NULL }, + { "Operand" , PPCCF(DbgOper) }, + { "Operand note" , PPCCF(DbgOpNt) }, + { "Effective address", PPCCF(DbgEff) }, + { NULL }, + { "RTS Line", PPCCF(DbgRts) } +}; + +#define IDC_DEBUGGER_RESTORESIZE 1000 +#define ID_COLOR_DEBUGGER 2000 + +bool ChangeColor(HWND hwnd, DBGCOLORMENU* item) +{ + if (ChangeColor(hwnd, (COLORMENU*)item)) + { + item->fmt->crTextColor = RGB(*item->menu.r, *item->menu.g, *item->menu.b); + return true; + } + return false; +} + // this is used to keep track of addresses that lines of Disassembly window correspond to std::vector disassembly_addresses; // this is used to keep track of addresses in operands of each printed instruction @@ -118,15 +149,28 @@ void UpdateOtherDebuggingDialogs() PPUViewDoBlit(); //PPU Viewer } +#define DISASM_DEFAULT_WIDTH (debuggerIDAFont ? 540 : 470) + +#define DEBUGGER_MIN_HEIGHT_LEFT 120 // Minimum height for the left part +#define DEBUGGER_MIN_HEIGHT_RIGHT 590 // Minimun height for the right part. + +#define DEBUGGER_MIN_WIDTH 360 // Minimum width for debugger +#define DEBUGGER_DEFAULT_HEIGHT 594 // default height for debugger +// owomomo: default width of the debugger is depend on the default width of disasm view, so it's not defined here. + void RestoreSize(HWND hwndDlg) { HDC hdc = GetDC(hwndDlg); - //If the dialog dimensions are changed those changes need to be reflected here. - adelikat - const int DEFAULT_WIDTH = MulDiv(820 + (debuggerIDAFont ? 64 : 0), GetDeviceCaps(hdc, LOGPIXELSX), 96); //Original width - const int DEFAULT_HEIGHT = MulDiv(576 + (debuggerIDAFont ? 2 : 0), GetDeviceCaps(hdc, LOGPIXELSY), 96); //Original height + RECT wndRect, disasmRect; + GetWindowRect(hwndDlg, &wndRect); + GetWindowRect(GetDlgItem(hwndDlg, IDC_DEBUGGER_DISASSEMBLY), &disasmRect); + + int default_width = (disasmRect.left - wndRect.left) + DISASM_DEFAULT_WIDTH + (wndRect.right - disasmRect.right); + int default_height = MulDiv(DEBUGGER_DEFAULT_HEIGHT, GetDeviceCaps(hdc, LOGPIXELSY), 96); + ReleaseDC(hwndDlg, hdc); - SetWindowPos(hwndDlg,HWND_TOP,DbgPosX,DbgPosY,DEFAULT_WIDTH,DEFAULT_HEIGHT,SWP_SHOWWINDOW); + SetWindowPos(hwndDlg,HWND_TOP,DbgPosX,DbgPosY,default_width,default_height,SWP_SHOWWINDOW); } unsigned int NewBreakWindows(HWND hwndDlg, unsigned int num, bool enable) @@ -356,7 +400,8 @@ INT_PTR CALLBACK AddbpCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara switch(HIWORD(wParam)) { case BN_CLICKED: switch(LOWORD(wParam)) { - case IDC_ADDBP_MODE_F: { + case IDC_ADDBP_MODE_F: + { UpdateDialog(hwndDlg); break; } @@ -403,7 +448,7 @@ INT_PTR CALLBACK AddbpCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara return FALSE; //TRUE; } -void HighlightPC() +void HighlightPC(HWND hWnd) { if (PCLine == -1) return; @@ -412,91 +457,121 @@ void HighlightPC() ft.lpstrText = ">"; ft.chrg.cpMin = 0; ft.chrg.cpMax = -1; - int start = SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_FINDTEXT, (WPARAM)FR_DOWN, (LPARAM)&ft); + int start = SendDlgItemMessage(hWnd, 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); - SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_SETSEL, (WPARAM)start, (LPARAM)start+20); - CHARFORMAT2 cf; - memset(&cf, 0, sizeof cf); - cf.cbSize = sizeof cf; - cf.dwMask = CFM_COLOR; - cf.crTextColor = RGB(0,0,255); - SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_SETCHARFORMAT, (WPARAM)SCF_SELECTION, (LPARAM)&cf); - SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_SETSEL, (WPARAM)old_start, (LPARAM)old_end); + SendDlgItemMessage(hWnd, IDC_DEBUGGER_DISASSEMBLY, EM_GETSEL, (WPARAM)&old_start, (LPARAM)&old_end); + SendDlgItemMessage(hWnd, IDC_DEBUGGER_DISASSEMBLY, EM_SETSEL, (WPARAM)start, (LPARAM)start+20); + SendDlgItemMessage(hWnd, IDC_DEBUGGER_DISASSEMBLY, EM_SETCHARFORMAT, (WPARAM)SCF_SELECTION, (LPARAM)PPCF(DbgPC)); + SendDlgItemMessage(hWnd, IDC_DEBUGGER_DISASSEMBLY, EM_SETSEL, (WPARAM)old_start, (LPARAM)old_end); } } -void HighlightSyntax(int lines) +void HighlightSyntax(HWND hWnd, int lines) { int wordbreak = 0; int opbreak = 0; int numpos = 0; int old_start, old_end; bool commentline; - SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_GETSEL, (WPARAM)&old_start, (LPARAM)&old_end); + SendDlgItemMessage(hWnd, IDC_DEBUGGER_DISASSEMBLY, EM_GETSEL, (WPARAM)&old_start, (LPARAM)&old_end); for (int line = 0; ; line++) { commentline = false; - wordbreak = SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_FINDWORDBREAK, (WPARAM)WB_RIGHT, (LPARAM)newline.chrg.cpMin + 21); + wordbreak = SendDlgItemMessage(hWnd, IDC_DEBUGGER_DISASSEMBLY, EM_FINDWORDBREAK, (WPARAM)WB_RIGHT, (LPARAM)newline.chrg.cpMin + 21); for (int ch = newline.chrg.cpMin; ; ch++) { - if (debug_str[ch] == '=' || debug_str[ch] == '@' || debug_str[ch] == '\n' || debug_str[ch] == '-' || debug_str[ch] == ';') + if (debug_wstr[ch] == L'=' || debug_wstr[ch] == L'@' || debug_wstr[ch] == L'\n' || debug_wstr[ch] == L'-' || debug_wstr[ch] == L';') { opbreak = ch; break; } } - if (debug_str[newline.chrg.cpMin] == ';') + if (debug_wstr[newline.chrg.cpMin] == L';') commentline = true; - SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_SETSEL, (WPARAM)newline.chrg.cpMin + 20, (LPARAM)opbreak); + SendDlgItemMessage(hWnd, IDC_DEBUGGER_DISASSEMBLY, EM_SETSEL, (WPARAM)newline.chrg.cpMin + 20, (LPARAM)opbreak); int oldline = newline.chrg.cpMin; - newline.chrg.cpMin = SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_FINDTEXT, (WPARAM)FR_DOWN, (LPARAM)&newline) + 1; + newline.chrg.cpMin = SendDlgItemMessage(hWnd, IDC_DEBUGGER_DISASSEMBLY, EM_FINDTEXT, (WPARAM)FR_DOWN, (LPARAM)&newline) + 1; if(newline.chrg.cpMin == 0) break; // symbolic address - if (debug_str[newline.chrg.cpMin - 2] == ':') + if (debug_wstr[newline.chrg.cpMin - 2] == L':') { - SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_SETSEL, (WPARAM)oldline, (LPARAM)newline.chrg.cpMin); - SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_SETCHARFORMAT, (WPARAM)SCF_SELECTION, (LPARAM)&mnem); + SendDlgItemMessage(hWnd, IDC_DEBUGGER_DISASSEMBLY, EM_SETSEL, (WPARAM)oldline, (LPARAM)newline.chrg.cpMin); + SendDlgItemMessage(hWnd, IDC_DEBUGGER_DISASSEMBLY, EM_SETCHARFORMAT, (WPARAM)SCF_SELECTION, (LPARAM)PPCF(DbgSym)); continue; } if (!commentline) - SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_SETCHARFORMAT, (WPARAM)SCF_SELECTION, (LPARAM)&mnem); + SendDlgItemMessage(hWnd, IDC_DEBUGGER_DISASSEMBLY, EM_SETCHARFORMAT, (WPARAM)SCF_SELECTION, (LPARAM)PPCF(DbgMnem)); // comment if (opbreak < newline.chrg.cpMin) { - SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_SETSEL, (WPARAM)opbreak, (LPARAM)newline.chrg.cpMin); - SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_SETCHARFORMAT, (WPARAM)SCF_SELECTION, (LPARAM)&comm); + SendDlgItemMessage(hWnd, IDC_DEBUGGER_DISASSEMBLY, EM_SETSEL, (WPARAM)opbreak, (LPARAM)newline.chrg.cpMin); + if (commentline) + SendDlgItemMessage(hWnd, IDC_DEBUGGER_DISASSEMBLY, EM_SETCHARFORMAT, (WPARAM)SCF_SELECTION, (LPARAM)PPCF(DbgComm)); + else + { + if (debug_wstr[opbreak] == L'-') + SendDlgItemMessage(hWnd, IDC_DEBUGGER_DISASSEMBLY, EM_SETCHARFORMAT, (WPARAM)SCF_SELECTION, + (LPARAM)PPCF(DbgRts)); + else + { + SendDlgItemMessage(hWnd, IDC_DEBUGGER_DISASSEMBLY, EM_SETCHARFORMAT, (WPARAM)SCF_SELECTION, (LPARAM)PPCF(DbgOpNt)); + if (debug_wstr[opbreak] == L'@') + { + // effective address + FINDTEXT ft = { { opbreak, newline.chrg.cpMin }, "=" }; + SendDlgItemMessage(hWnd, IDC_DEBUGGER_DISASSEMBLY, EM_SETSEL, opbreak, SendDlgItemMessage(hWnd, IDC_DEBUGGER_DISASSEMBLY, EM_FINDTEXT, (WPARAM)FR_DOWN, (LPARAM)&ft)); + SendDlgItemMessage(hWnd, IDC_DEBUGGER_DISASSEMBLY, EM_SETCHARFORMAT, (WPARAM)SCF_SELECTION, (LPARAM)PPCF(DbgEff)); + } + } + } } if (commentline) continue; // operand num.chrg.cpMin = wordbreak; num.chrg.cpMax = wordbreak + 6; - numpos = SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_FINDTEXT, (WPARAM)FR_DOWN, (LPARAM)&num); + numpos = SendDlgItemMessage(hWnd, IDC_DEBUGGER_DISASSEMBLY, EM_FINDTEXT, (WPARAM)FR_DOWN, (LPARAM)&num); if (numpos != 0) { - if (debug_str[numpos + 3] == ',' || debug_str[numpos + 3] == ')' || debug_str[numpos + 3] == '\n' - || debug_str[numpos + 3] == ' ' //zero 30-nov-2017 - in support of combined label/offset disassembly. not sure this is a good idea + if (debug_wstr[numpos + 3] == L',' || debug_wstr[numpos + 3] == L')' || debug_wstr[numpos + 3] == L'\n' + || debug_wstr[numpos + 3] == L' ' //zero 30-nov-2017 - in support of combined label/offset disassembly. not sure this is a good idea ) wordbreak = numpos + 2; else wordbreak = numpos + 4; - SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_SETSEL, (WPARAM)numpos, (LPARAM)wordbreak + 1); - SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_SETCHARFORMAT, (WPARAM)SCF_SELECTION, (LPARAM)&oper); + SendDlgItemMessage(hWnd, IDC_DEBUGGER_DISASSEMBLY, EM_SETSEL, (WPARAM)numpos, (LPARAM)wordbreak + 1); + SendDlgItemMessage(hWnd, IDC_DEBUGGER_DISASSEMBLY, EM_SETCHARFORMAT, (WPARAM)SCF_SELECTION, (LPARAM)PPCF(DbgOper)); } if (newline.chrg.cpMin == 0) break; } - SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_SETSEL, (WPARAM)old_start, (LPARAM)old_end); + SendDlgItemMessage(hWnd, IDC_DEBUGGER_DISASSEMBLY, EM_SETSEL, (WPARAM)old_start, (LPARAM)old_end); +} + +void UpdateDisassembleView(HWND hWnd, UINT id, int lines, bool text = false) +{ + // basic syntax highlighter and due richedit optimizations + int eventMask = SendDlgItemMessage(hWnd, id, EM_SETEVENTMASK, 0, 0); + SendDlgItemMessage(hWnd, id, WM_SETREDRAW, false, 0); + + if (text) + SetDlgItemTextW(hWnd, id, debug_wstr); + HighlightSyntax(hWnd, lines); + HighlightPC(hWnd); + + SendDlgItemMessage(hWnd, id, WM_SETREDRAW, true, 0); + InvalidateRect(GetDlgItem(hWnd, id), 0, true); + SendDlgItemMessage(hWnd, id, EM_SETEVENTMASK, 0, eventMask); } void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr) { - char chr[40] = {0}; + wchar_t chr[40] = { 0 }; + wchar_t debug_wbuf[2048] = { 0 }; int size; uint8 opcode[3]; unsigned int instruction_addr; @@ -519,7 +594,7 @@ void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr) GetClientRect(GetDlgItem(hWnd, id), &rect); int lines = (rect.bottom-rect.top) / debugSystem->disasmFontHeight; - debug_str[0] = 0; + debug_wstr[0] = 0; PCLine = -1; unsigned int instructions_count = 0; for (int i = 0; i < lines; i++) @@ -537,8 +612,8 @@ void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr) { if (node->name) { - strcat(debug_str, node->name); - strcat(debug_str, ":\n"); + swprintf(debug_wbuf, L"%S:\n", node->name); + wcscat(debug_wstr, debug_wbuf); // we added one line to the disassembly window disassembly_addresses.push_back(addr); disassembly_operands.resize(i + 1); @@ -556,9 +631,8 @@ void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr) { debug_decoration_comment_end_pos[0] = 0; // set \0 instead of \r debug_decoration_comment_end_pos[1] = 0; // set \0 instead of \n - strcat(debug_str, "; "); - strcat(debug_str, debug_decoration_comment); - strcat(debug_str, "\n"); + swprintf(debug_wbuf, L"; %S\n", debug_decoration_comment); + wcscat(debug_wstr, debug_wbuf); // we added one line to the disassembly window disassembly_addresses.push_back(addr); disassembly_operands.resize(i + 1); @@ -576,30 +650,30 @@ void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr) { PC_pointerOffset = instructions_count; PCPointerWasDrawn = true; - beginningOfPCPointerLine = strlen(debug_str); - strcat(debug_str, ">"); + beginningOfPCPointerLine = wcslen(debug_wstr); + wcscat(debug_wstr, L">"); PCLine = instructions_count; } else { - strcat(debug_str, " "); + wcscat(debug_wstr, L" "); } if (addr >= 0x8000) { if (debuggerDisplayROMoffsets && GetNesFileAddress(addr) != -1) { - sprintf(chr, " %06X: ", GetNesFileAddress(addr)); + swprintf(chr, L" %06X: ", GetNesFileAddress(addr)); } else { - sprintf(chr, "%02X:%04X: ", getBank(addr), addr); + swprintf(chr, L"%02X:%04X: ", getBank(addr), addr); } } else { - sprintf(chr, " :%04X: ", addr); + swprintf(chr, L" :%04X: ", addr); } // Add address - strcat(debug_str, chr); + wcscat(debug_wstr, chr); disassembly_addresses.push_back(addr); if (symbDebugEnabled) disassembly_operands.resize(i + 1); @@ -607,27 +681,27 @@ void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr) size = opsize[GetMem(addr)]; if (size == 0) { - sprintf(chr, "%02X UNDEFINED", GetMem(addr++)); - strcat(debug_str, chr); + swprintf(chr, L"%02X UNDEFINED", GetMem(addr++)); + wcscat(debug_wstr, chr); } else { if ((addr + size) > 0xFFFF) { while (addr < 0xFFFF) { - sprintf(chr, "%02X OVERFLOW\n", GetMem(addr++)); - strcat(debug_str, chr); + swprintf(chr, L"%02X OVERFLOW\n", GetMem(addr++)); + wcscat(debug_wstr, chr); } break; } for (int j = 0; j < size; j++) { - sprintf(chr, "%02X ", opcode[j] = GetMem(addr++)); - strcat(debug_str, chr); + swprintf(chr, L"%02X ", opcode[j] = GetMem(addr++)); + wcscat(debug_wstr, chr); } while (size < 3) { - strcat(debug_str, " "); //pad output to align ASM + wcscat(debug_wstr, L" "); //pad output to align ASM size++; } @@ -654,23 +728,13 @@ void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr) } // append the disassembly to current line - strcat(strcat(debug_str, " "), bufferForDisassemblyWithPlentyOfStuff); + swprintf(debug_wbuf, L" %S", bufferForDisassemblyWithPlentyOfStuff); + wcscat(debug_wstr, debug_wbuf); } - strcat(debug_str, "\n"); + wcscat(debug_wstr, L"\n"); instructions_count++; } - - // basic syntax highlighter and due richedit optimizations - int eventMask = SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_SETEVENTMASK, 0, 0); - SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, WM_SETREDRAW, false, 0); - - SetDlgItemText(hWnd, id, debug_str); - HighlightSyntax(lines); - HighlightPC(); - - SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, WM_SETREDRAW, true, 0); - InvalidateRect(GetDlgItem(hWnd, id), 0, true); - SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_SETEVENTMASK, 0, eventMask); + UpdateDisassembleView(hWnd, id, lines, true); // fill the left panel data debug_cdl_str[0] = 0; @@ -1216,7 +1280,11 @@ void DeleteBreak(int sel) } void KillDebugger() { - SendDlgItemMessage(hDebug,IDC_DEBUGGER_BP_LIST,LB_RESETCONTENT,0,0); + if (hDebug) + { + SendDlgItemMessage(hDebug,IDC_DEBUGGER_BP_LIST,LB_RESETCONTENT,0,0); + DebuggerExit(); + } FCEUI_Debugger().reset(); FCEUI_SetEmulationPaused(0); //mbg merge 7/18/06 changed from userpause } @@ -1441,8 +1509,25 @@ void DebuggerExit() FCEUI_Debugger().badopbreak = 0; debugger_open = 0; inDebugger = false; - DestroyWindow(hDebug); - hDebug=0; + // in case someone call it multiple times + if (hDebug) + { + // release bitmap icons + for (int i = 0; i < sizeof(dbgcolormenu) / sizeof(DBGCOLORMENU); ++i) + { + DeleteObject(dbgcolormenu[i].menu.bitmap); + dbgcolormenu[i].menu.bitmap = NULL; + } + // Destroy menu + DestroyMenu(hDebugcontext); + DestroyMenu(hDisasmcontext); + // Destroy debug window + DestroyWindow(hDebug); + hDebug = NULL; + free(debug_wstr); + free(debug_cdl_str); + free(debug_str_decoration_comment); + } } static RECT currDebuggerRect; @@ -1451,51 +1536,145 @@ static RECT newDebuggerRect; //used to move all child items in the dialog when you resize (except for the dock fill controls which are resized) BOOL CALLBACK DebuggerEnumWindowsProc(HWND hwnd, LPARAM lParam) { - int dx = (newDebuggerRect.right-newDebuggerRect.left)-(currDebuggerRect.right-currDebuggerRect.left); //Calculate & store difference in width of old size vs new size - int dy = (newDebuggerRect.bottom-newDebuggerRect.top)-(currDebuggerRect.bottom-currDebuggerRect.top); //ditto wtih height - - HWND editbox = GetDlgItem(hDebug, IDC_DEBUGGER_DISASSEMBLY); //Get handle for Disassembly list box (large guy on the left) - HWND icontray = GetDlgItem(hDebug, IDC_DEBUGGER_DISASSEMBLY_LEFT_PANEL); //Get handle for Icontray, vertical column to the left of disassembly - HWND addrline = GetDlgItem(hDebug, IDC_DEBUGGER_ADDR_LINE); //Get handle of address line (text area under the disassembly - HWND vscr = GetDlgItem(hDebug, IDC_DEBUGGER_DISASSEMBLY_VSCR); //Get handle for disassembly Vertical Scrollbar - - char str[8] = {0}; + POINT* p = (POINT*)lParam; + int dx = p[0].x; + int dy_l = p[0].y; + int dy_r = p[1].y; RECT crect; - GetWindowRect(hwnd,&crect); //Get rect of current child to be resized - ScreenToClient(hDebug,(LPPOINT)&crect); //Convert rect coordinates to client area coordinates - ScreenToClient(hDebug,((LPPOINT)&crect)+1); + HWND parent = GetParent(hwnd); + GetWindowRect(hwnd, &crect); //Get rect of current child to be resized + ScreenToClient(parent, (LPPOINT)&crect); //Convert rect coordinates to client area coordinates + ScreenToClient(parent, ((LPPOINT)&crect) + 1); - if(hwnd == editbox) + switch (GetDlgCtrlID(hwnd)) { - crect.right += dx; - crect.bottom += dy; - 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); - Disassemble(hDebug, IDC_DEBUGGER_DISASSEMBLY, IDC_DEBUGGER_DISASSEMBLY_VSCR, si.nPos); - } else if(hwnd == icontray) - { - crect.bottom += dy; - SetWindowPos(hwnd,0,0,0,crect.right-crect.left,crect.bottom-crect.top,SWP_NOZORDER | SWP_NOMOVE); - } else if(hwnd == addrline) - { - crect.top += dy; - crect.bottom += dy; - crect.right += dx; - SetWindowPos(hwnd,0,crect.left,crect.top,crect.right-crect.left,crect.bottom-crect.top,SWP_NOZORDER); - } else if(hwnd == vscr) - { - crect.bottom += dy; - crect.left += dx; - crect.right += dx; - SetWindowPos(hwnd,0,crect.left,crect.top,crect.right-crect.left,crect.bottom-crect.top,SWP_NOZORDER); - } else - { - crect.left += dx; - //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); + case IDC_DEBUGGER_DISASSEMBLY: + // horizontal and vertical stretch + crect.right += dx; + crect.bottom += dy_l; + SetWindowPos(hwnd, 0, 0, 0, crect.right - crect.left, crect.bottom - crect.top, SWP_NOZORDER | SWP_NOMOVE); + GetScrollInfo(GetDlgItem(parent, IDC_DEBUGGER_DISASSEMBLY_VSCR), SB_CTL, &si); + Disassemble(parent, IDC_DEBUGGER_DISASSEMBLY, IDC_DEBUGGER_DISASSEMBLY_VSCR, si.nPos); + break; + case IDC_DEBUGGER_DISASSEMBLY_LEFT_PANEL: + // vertical stretch, no movement + crect.bottom += dy_l; + SetWindowPos(hwnd, 0, 0, 0, crect.right - crect.left, crect.bottom - crect.top, SWP_NOZORDER | SWP_NOMOVE); + break; + case IDC_DEBUGGER_VAL_S: + case IDC_DEBUGGER_STACK_CONTENTS: + case IDC_DEBUGGER_BP_LIST: + case IDC_DEBUGGER_BREAKPOINTS: + // vertical stretch half length, move left and right full length, stick top + crect.bottom += dy_r / 2; + crect.left += dx; + crect.right += dx; + SetWindowPos(hwnd, 0, crect.left, crect.top, crect.right - crect.left, crect.bottom - crect.top, SWP_NOZORDER); + break; + case LIST_DEBUGGER_BOOKMARKS: + case IDC_DEBUGGER_BOOKMARKS: + // vertical strectch half length, move left and right full length, stick bottom + crect.bottom += dy_r; + crect.top += dy_r / 2; + crect.left += dx; + crect.right += dx; + SetWindowPos(hwnd, 0, crect.left, crect.top, crect.right - crect.left, crect.bottom - crect.top, SWP_NOZORDER); + break; + case IDC_DEBUGGER_RUN: + case IDC_DEBUGGER_STEP_IN: + case IDC_DEBUGGER_STEP_OUT: + case IDC_DEBUGGER_STEP_OVER: + case IDC_DEBUGGER_RUN_LINE: + case IDC_DEBUGGER_RUN_FRAME2: + case IDC_DEBUGGER_SEEK_TO: + case IDC_DEBUGGER_VAL_PCSEEK: + case IDC_DEBUGGER_TEXT_PC: + case IDC_DEBUGGER_VAL_PC: + case IDC_DEBUGGER_SEEK_PC: + case IDC_DEBUGGER_TEXT_A: + case IDC_DEBUGGER_VAL_A: + case IDC_DEBUGGER_TEXT_X: + case IDC_DEBUGGER_VAL_X: + case IDC_DEBUGGER_TEXT_Y: + case IDC_DEBUGGER_VAL_Y: + // no stretch, move left and right full length + crect.left += dx; + SetWindowPos(hwnd, 0, crect.left, crect.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + break; + case IDC_DEBUGGER_BP_ADD: + case IDC_DEBUGGER_BP_DEL: + case IDC_DEBUGGER_BP_EDIT: + case IDC_DEBUGGER_BREAK_ON_BAD_OP: + case IDC_DEBUGGER_STATUSFLAGS: + case IDC_DEBUGGER_FLAG_N: + case IDC_DEBUGGER_FLAG_V: + case IDC_DEBUGGER_FLAG_U: + case IDC_DEBUGGER_FLAG_B: + case IDC_DEBUGGER_FLAG_D: + case IDC_DEBUGGER_FLAG_I: + case IDC_DEBUGGER_FLAG_Z: + case IDC_DEBUGGER_FLAG_C: + case IDC_DEBUGGER_VAL_S2: + case IDC_DEBUGGER_TEXT_PPU: + case IDC_DEBUGGER_VAL_PPU: + case IDC_DEBUGGER_TEXT_SPR: + case IDC_DEBUGGER_VAL_SPR: + case IDC_DEBUGGER_TEXT_SLINE: + case IDC_DEBUGGER_VAL_SLINE: + case IDC_DEBUGGER_TEXT_PPUPIXEL: + case IDC_DEBUGGER_VAL_PPUPIXEL: + case IDC_DEBUGGER_TEXT_CYCLES_COUNT: + case IDC_DEBUGGER_VAL_CYCLES_COUNT: + case IDC_DEBUGGER_VAL_CYCLES_COUNT2: + case IDC_DEBUGGER_BREAK_ON_CYCLES: + case IDC_DEBUGGER_CYCLES_EXCEED: + case IDC_DEBUGGER_BOOKMARK: + case IDC_DEBUGGER_BOOKMARK_ADD: + case IDC_DEBUGGER_BOOKMARK_DEL: + case IDC_DEBUGGER_BOOKMARK_EDIT: + case IDC_DEBUGGER_TEXT_INSTRUCTIONS_COUNT: + case IDC_DEBUGGER_VAL_INSTRUCTIONS_COUNT: + case IDC_DEBUGGER_VAL_INSTRUCTIONS_COUNT2: + case IDC_DEBUGGER_BREAK_ON_INSTRUCTIONS: + case IDC_DEBUGGER_INSTRUCTIONS_EXCEED: + case IDC_DEBUGGER_RESET_COUNTERS: + // no stretch, move up and down half length, move left and right full length + crect.top += dy_r / 2; + crect.left += dx; + SetWindowPos(hwnd, 0, crect.left, crect.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + break; + case IDC_DEBUGGER_VAL_S3: + case IDC_DEBUGGER_ROM_OFFSETS: + case IDC_DEBUGGER_ENABLE_SYMBOLIC: + case IDC_DEBUGGER_PREDEFINED_REGS: + case IDC_DEBUGGER_RELOAD_SYMS: + case IDC_DEBUGGER_ROM_PATCHER: + case DEBUGAUTOLOAD: + case DEBUGLOADDEB: + case DEBUGIDAFONT: + // no stretch, move up and down full length, move left and right full length + crect.top += dy_r; + crect.left += dx; + SetWindowPos(hwnd, 0, crect.left, crect.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + break; + case IDC_DEBUGGER_ADDR_LINE: + // horizontal stretch, move up and down full length + crect.top += dy_l; + crect.bottom += dy_r; + crect.right += dx; + SetWindowPos(hwnd, 0, crect.left, crect.top, crect.right - crect.left, crect.bottom - crect.top, SWP_NOZORDER); + break; + case IDC_DEBUGGER_DISASSEMBLY_VSCR: + // vertical stretch, move left and right full length + crect.bottom += dy_l; + crect.left += dx; + crect.right += dx; + SetWindowPos(hwnd, 0, crect.left, crect.top, crect.right - crect.left, crect.bottom - crect.top, SWP_NOZORDER); } + return TRUE; + } void LoadGameDebuggerData(HWND hwndDlg = hDebug) @@ -1517,28 +1696,28 @@ int Debugger_CheckClickingOnAnAddressOrSymbolicName(unsigned int lineNumber, boo if (onlyCheckWhenNothingSelected) if (sel_end > sel_start) return EOF; - + // find the ":" or "$" before sel_start int i = sel_start - 1; for (; i > sel_start - 6; i--) - if ((i >= 0 && debug_str[i] == ':' || debug_str[i] == '$') && debug_str[i+3] != '\n') + if ((i >= 0 && debug_wstr[i] == L':' || debug_wstr[i] == L'$') && debug_wstr[i+3] != L'\n') break; if (i > sel_start - 6) { - char offsetBuffer[5]; - strncpy(offsetBuffer, debug_str + i + 1, 4); + wchar_t offsetBuffer[5]; + wcsncpy(offsetBuffer, debug_wstr + i + 1, 4); offsetBuffer[4] = 0; // invalidate the string if a space or \r is found in it - char* firstspace = strstr(offsetBuffer, " "); + wchar_t* firstspace = wcsstr(offsetBuffer, L" "); if (!firstspace) - firstspace = strstr(offsetBuffer, "\r"); + firstspace = wcsstr(offsetBuffer, L"\r"); if (!firstspace) { unsigned int offset; int numend; - if (sscanf(offsetBuffer, "%4X", &offset) != EOF) + if (swscanf(offsetBuffer, L"%4X", &offset) != EOF) { - if (debug_str[i+3] == ',' || debug_str[i+3] == ')') + if (debug_wstr[i + 3] == L',' || debug_wstr[i+3] == L')') numend = 3; else numend = 5; @@ -1554,28 +1733,30 @@ int Debugger_CheckClickingOnAnAddressOrSymbolicName(unsigned int lineNumber, boo { uint16 addr; Name* node; - char* name; + wchar_t* name; int nameLen; - char* start_pos; - char* pos; + wchar_t* start_pos; + wchar_t* pos; // first, try finding the name of disassembly_addresses[lineNumber] addr = disassembly_addresses[lineNumber]; node = findNode(getNamesPointerForAddress(addr), addr); if (node && node->name && *(node->name)) { - name = node->name; - nameLen = strlen(name); + nameLen = MultiByteToWideChar(CP_ACP, 0, node->name, -1, 0, 0); + name = (wchar_t*)malloc(nameLen * sizeof(wchar_t)); + MultiByteToWideChar(CP_ACP, 0, node->name, -1, name, nameLen); if (sel_start - nameLen <= 0) - start_pos = debug_str; + start_pos = debug_wstr; else - start_pos = debug_str + (sel_start - nameLen); - pos = strstr(start_pos, name); - if (pos && pos <= debug_str + sel_start) + start_pos = debug_wstr + (sel_start - nameLen); + pos = wcsstr(start_pos, name); + free(name); + if (pos && pos <= debug_wstr + sel_start) { // clicked on the Name // select the text - SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_SETSEL, (WPARAM)(int)(pos - debug_str), (LPARAM)((int)(pos - debug_str) + nameLen)); + SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_SETSEL, (WPARAM)(int)(pos - debug_wstr), (LPARAM)((int)(pos - debug_wstr) + nameLen)); PrintOffsetToSeekAndBookmarkFields(addr); return (int)addr; } @@ -1588,18 +1769,20 @@ int Debugger_CheckClickingOnAnAddressOrSymbolicName(unsigned int lineNumber, boo node = findNode(getNamesPointerForAddress(addr), addr); if (node && node->name && *(node->name)) { - name = node->name; - nameLen = strlen(name); + nameLen = MultiByteToWideChar(CP_ACP, 0, node->name, -1, 0, 0); + name = (wchar_t*)malloc(nameLen * sizeof(wchar_t)); + MultiByteToWideChar(CP_ACP, 0, node->name, -1, name, nameLen); if (sel_start - nameLen <= 0) - start_pos = debug_str; + start_pos = debug_wstr; else - start_pos = debug_str + (sel_start - nameLen); - pos = strstr(start_pos, name); - if (pos && pos <= debug_str + sel_start) + start_pos = debug_wstr + (sel_start - nameLen); + pos = wcsstr(start_pos, name); + free(name); + if (pos && pos <= debug_wstr + sel_start) { // clicked on the operand name // select the text - SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_SETSEL, (WPARAM)(int)(pos - debug_str), (LPARAM)((int)(pos - debug_str) + nameLen)); + SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_SETSEL, (WPARAM)(int)(pos - debug_wstr), (LPARAM)((int)(pos - debug_wstr) + nameLen)); PrintOffsetToSeekAndBookmarkFields(addr); return (int)addr; } @@ -1689,7 +1872,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); - if(mouse_y<0 || mouse_x<0) + if(mouse_y < 0 || mouse_x < 0) break; tmp = mouse_y / debugSystem->disasmFontHeight; @@ -1766,17 +1949,12 @@ BOOL CALLBACK IDC_DEBUGGER_DISASSEMBLY_WndProc(HWND hwndDlg, UINT uMsg, WPARAM w INT_PTR CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - RECT wrect; - char str[256] = {0}; - int tmp; - int mouse_x, mouse_y; - int i; - //these messages get handled at any time switch(uMsg) { case WM_INITDIALOG: { + char str[256] = { 0 }; CheckDlgButton(hwndDlg, IDC_DEBUGGER_BREAK_ON_CYCLES, break_on_cycles ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_DEBUGGER_BREAK_ON_INSTRUCTIONS, break_on_instructions ? BST_CHECKED : BST_UNCHECKED); sprintf(str, "%u", (unsigned)break_cycles_limit); @@ -1830,8 +2008,8 @@ INT_PTR CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP // limit input // Don't limit address entry. See: debugcpp offsetStringToInt - DefaultEditCtrlProc = (WNDPROC) //DefaultEditCtrlProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_DEBUGGER_VAL_PCSEEK), GWLP_WNDPROC, (LONG_PTR)FilterEditCtrlProc); + DefaultEditCtrlProc = (WNDPROC) SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_DEBUGGER_VAL_PC), GWLP_WNDPROC, (LONG_PTR)FilterEditCtrlProc); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_DEBUGGER_VAL_A), GWLP_WNDPROC, (LONG_PTR)FilterEditCtrlProc); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_DEBUGGER_VAL_X), GWLP_WNDPROC, (LONG_PTR)FilterEditCtrlProc); @@ -1856,44 +2034,69 @@ INT_PTR CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP hDebugcontext = LoadMenu(fceu_hInstance,"DEBUGCONTEXTMENUS"); hDisasmcontext = LoadMenu(fceu_hInstance,"DISASMCONTEXTMENUS"); + // prevent the font of the edit control from screwing up when it contains MBC or characters not contained the current font. + SendDlgItemMessage(hwndDlg, IDC_DEBUGGER_DISASSEMBLY, EM_SETLANGOPTIONS, 0, SendDlgItemMessage(hwndDlg, IDC_DEBUGGER_DISASSEMBLY, EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOFONT); + // subclass editfield IDC_DEBUGGER_DISASSEMBLY_oldWndProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_DEBUGGER_DISASSEMBLY), GWLP_WNDPROC, (LONG_PTR)IDC_DEBUGGER_DISASSEMBLY_WndProc); + // prepare menu + HMENU hdbgmenu = GetMenu(hwndDlg); + InsertMenu(hdbgmenu, 0, MF_STRING | MF_BYPOSITION, IDC_DEBUGGER_RESTORESIZE, "Default window size"); + HMENU hcolorpopupmenu = GetSubMenu(hdbgmenu, 1); + for (int i = 0; i < sizeof(dbgcolormenu) / sizeof(DBGCOLORMENU); ++i) + InsertColorMenu(hwndDlg, hcolorpopupmenu, &dbgcolormenu[i].menu, i, ID_COLOR_DEBUGGER + i); + debugger_open = 1; inDebugger = true; break; } case WM_SIZE: { - if(wParam == SIZE_RESTORED) //If dialog was resized + if(wParam == SIZE_RESTORED) //If dialog was resized { - GetWindowRect(hwndDlg,&newDebuggerRect); //Get new size + GetWindowRect(hwndDlg,&newDebuggerRect); //Get new size + //Force a minimum Dialog size------------------------------- - if (newDebuggerRect.right - newDebuggerRect.left < 368 || newDebuggerRect.bottom - newDebuggerRect.top < 150) //If either x or y is too small run the force size routine - { - if (newDebuggerRect.right - newDebuggerRect.left < 367) //If width is too small reset to previous width - { - newDebuggerRect.right = currDebuggerRect.right; - newDebuggerRect.left = currDebuggerRect.left; - - } - if (newDebuggerRect.bottom - newDebuggerRect.top < 150) //If heigth is too small reset to previous height - { - newDebuggerRect.top = currDebuggerRect.top; - newDebuggerRect.bottom = currDebuggerRect.bottom; - } - SetWindowPos(hwndDlg,HWND_TOPMOST,newDebuggerRect.left,newDebuggerRect.top,(newDebuggerRect.right-newDebuggerRect.left),(newDebuggerRect.bottom-newDebuggerRect.top),SWP_SHOWWINDOW); - } - //Else run normal resizing procedure------------------------- - else - { - DbgSizeX = newDebuggerRect.right-newDebuggerRect.left; //Store new size (this will be used to store in the .cfg file) - DbgSizeY = newDebuggerRect.bottom-newDebuggerRect.top; - EnumChildWindows(hwndDlg,DebuggerEnumWindowsProc,0); //Initiate callback for resizing child windows - currDebuggerRect = newDebuggerRect; //Store current debugger window size (for future calculations in EnumChildWindows - InvalidateRect(hwndDlg,0,TRUE); - UpdateWindow(hwndDlg); - } + DbgSizeX = newDebuggerRect.right - newDebuggerRect.left; //Store new size (this will be used to store in the .cfg file) + DbgSizeY = newDebuggerRect.bottom - newDebuggerRect.top; + + // convert minimum size to actural screen size + // owomomo: the minimum height is different between left and right part, + // but width is the same, similarly hereinafter + HDC hdc = GetDC(hwndDlg); + int min_w = MulDiv(DEBUGGER_MIN_WIDTH, GetDeviceCaps(hdc, LOGPIXELSX), 96); + int min_h_l = MulDiv(DEBUGGER_MIN_HEIGHT_LEFT, GetDeviceCaps(hdc, LOGPIXELSY), 96); + int min_h_r = MulDiv(DEBUGGER_MIN_HEIGHT_RIGHT, GetDeviceCaps(hdc, LOGPIXELSY), 96); + ReleaseDC(hwndDlg, hdc); + + // calculate current width and height + int curr_w = currDebuggerRect.right - currDebuggerRect.left; + int curr_h_l = currDebuggerRect.bottom - currDebuggerRect.top; + int curr_h_r = curr_h_l; + // calculate new width and height + int new_w = newDebuggerRect.right - newDebuggerRect.left; + int new_h_l = newDebuggerRect.bottom - newDebuggerRect.top; + int new_h_r = new_h_l; + + // when the size is smaller than the minimum, calculate it as the minimum size + if (curr_w < min_w) curr_w = min_w; + if (curr_h_l < min_h_l) curr_h_l = min_h_l; + if (curr_h_r < min_h_r) curr_h_r = min_h_r; + + if (new_w < min_w) new_w = min_w; + if (new_h_l < min_h_l) new_h_l = min_h_l; + if (new_h_r < min_h_r) new_h_r = min_h_r; + + POINT p[2]; + // Calculate ditto with size + p[0].x = p[1].x = new_w - curr_w; + p[0].y = new_h_l - curr_h_l; + p[1].y = new_h_r - curr_h_r; + EnumChildWindows(hwndDlg, DebuggerEnumWindowsProc, (LPARAM)p); //Initiate callback for resizing child windows + InvalidateRect(hwndDlg, 0, TRUE); + UpdateWindow(hwndDlg); + currDebuggerRect = newDebuggerRect; //Store current debugger window size (for future calculations in EnumChildWindows } break; } @@ -1908,6 +2111,7 @@ INT_PTR CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP break; case WM_MOVE: if (!IsIconic(hwndDlg)) { + RECT wrect; GetWindowRect(hwndDlg,&wrect); DbgPosX = wrect.left; DbgPosY = wrect.top; @@ -1921,41 +2125,89 @@ INT_PTR CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP //adelikat: Buttons that don't need a rom loaded to do something, such as autoload case WM_COMMAND: { - switch(LOWORD(wParam)) + switch (HIWORD(wParam)) { - case DEBUGAUTOLOAD: - debuggerAutoload ^= 1; - break; - 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(false); - break; - case IDC_DEBUGGER_CYCLES_EXCEED: + case BN_CLICKED: { - if (HIWORD(wParam) == EN_CHANGE) + switch (LOWORD(wParam)) { - GetDlgItemText(hwndDlg, IDC_DEBUGGER_CYCLES_EXCEED, str, 16); - break_cycles_limit = strtoul(str, NULL, 10); + case DEBUGAUTOLOAD: + debuggerAutoload ^= 1; + break; + 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(false); + break; + case IDC_DEBUGGER_CYCLES_EXCEED: + { + if (HIWORD(wParam) == EN_CHANGE) + { + char str[16]; + GetDlgItemText(hwndDlg, IDC_DEBUGGER_CYCLES_EXCEED, str, 16); + break_cycles_limit = strtoul(str, NULL, 10); + } + break; + } + case IDC_DEBUGGER_INSTRUCTIONS_EXCEED: + { + if (HIWORD(wParam) == EN_CHANGE) + { + char str[16]; + GetDlgItemText(hwndDlg, IDC_DEBUGGER_INSTRUCTIONS_EXCEED, str, 16); + break_instructions_limit = strtoul(str, NULL, 10); + } + break; + } + case ID_DEBUGGER_DEFCOLOR: + { + if (!IsDebugColorDefault() && MessageBox(hwndDlg, "Do you want to restore all the colors to default?", "Restore default colors", MB_YESNO | MB_ICONINFORMATION) == IDYES) + { + RestoreDefaultDebugColor(); + RECT rect; + GetClientRect(GetDlgItem(hwndDlg, IDC_DEBUGGER_DISASSEMBLY), &rect); + UpdateDisassembleView(hwndDlg, IDC_DEBUGGER_DISASSEMBLY, (rect.bottom - rect.top) / debugSystem->disasmFontHeight); + HMENU hcolorpopupmenu = GetSubMenu(GetMenu(hwndDlg), 1); + for (int i = 0; i < sizeof(dbgcolormenu) / sizeof(DBGCOLORMENU); ++i) + ModifyColorMenu(hwndDlg, hcolorpopupmenu, &dbgcolormenu[i].menu, i, ID_COLOR_DEBUGGER + i); + } + } + break; + case ID_COLOR_DEBUGGER: + case ID_COLOR_DEBUGGER + 1: + case ID_COLOR_DEBUGGER + 2: + case ID_COLOR_DEBUGGER + 3: + case ID_COLOR_DEBUGGER + 4: + case ID_COLOR_DEBUGGER + 5: + case ID_COLOR_DEBUGGER + 6: + case ID_COLOR_DEBUGGER + 7: + case ID_COLOR_DEBUGGER + 8: + case ID_COLOR_DEBUGGER + 9: + case ID_COLOR_DEBUGGER + 10: + case ID_COLOR_DEBUGGER + 11: + case ID_COLOR_DEBUGGER + 12: + { + int index = wParam - ID_COLOR_DEBUGGER; + if (ChangeColor(hwndDlg, &dbgcolormenu[index])) + { + RECT rect; + GetClientRect(GetDlgItem(hwndDlg, IDC_DEBUGGER_DISASSEMBLY), &rect); + UpdateDisassembleView(hwndDlg, IDC_DEBUGGER_DISASSEMBLY, (rect.bottom - rect.top) / debugSystem->disasmFontHeight); + ModifyColorMenu(hwndDlg, GetSubMenu(GetMenu(hwndDlg), 1), &dbgcolormenu[index].menu, index, wParam); + } + } + break; + case IDC_DEBUGGER_RESTORESIZE: + RestoreSize(hwndDlg); + break; } - break; - } - case IDC_DEBUGGER_INSTRUCTIONS_EXCEED: - { - if (HIWORD(wParam) == EN_CHANGE) - { - GetDlgItemText(hwndDlg, IDC_DEBUGGER_INSTRUCTIONS_EXCEED, str, 16); - break_instructions_limit = strtoul(str, NULL, 10); - } - break; } } - break; } } @@ -2035,10 +2287,11 @@ INT_PTR CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP si.nPos = si.nMax - si.nPage; SetScrollInfo((HWND)lParam,SB_CTL,&si,TRUE); - Disassemble(hDebug, IDC_DEBUGGER_DISASSEMBLY, IDC_DEBUGGER_DISASSEMBLY_VSCR, si.nPos); + Disassemble(hwndDlg, IDC_DEBUGGER_DISASSEMBLY, IDC_DEBUGGER_DISASSEMBLY_VSCR, si.nPos); // "Address Bookmark Add" follows the address + char str[16]; sprintf(str,"%04X", si.nPos); - SetDlgItemText(hDebug, IDC_DEBUGGER_BOOKMARK, str); + SetDlgItemText(hwndDlg, IDC_DEBUGGER_BOOKMARK, str); } break; } @@ -2054,6 +2307,7 @@ INT_PTR CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP if (lParam != -1) TrackPopupMenu(hDebugcontextsub,TPM_RIGHTBUTTON,LOWORD(lParam),HIWORD(lParam),0,hwndDlg,0); //Create menu else { // Handle the context menu keyboard key + RECT wrect; 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 } @@ -2064,7 +2318,7 @@ INT_PTR CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP case WM_MOUSEWHEEL: { GetScrollInfo((HWND)lParam,SB_CTL,&si); - i = GET_WHEEL_DELTA_WPARAM(wParam) / WHEEL_DELTA; + int i = GET_WHEEL_DELTA_WPARAM(wParam) / WHEEL_DELTA; if (i < 0) { for (i *= -(int)si.nPage; i > 0; i--) @@ -2092,6 +2346,7 @@ INT_PTR CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP Disassemble(hDebug, IDC_DEBUGGER_DISASSEMBLY, IDC_DEBUGGER_DISASSEMBLY_VSCR, si.nPos); // "Address Bookmark Add" follows the address + char str[16]; sprintf(str,"%04X", si.nPos); SetDlgItemText(hDebug, IDC_DEBUGGER_BOOKMARK, str); break; @@ -2102,8 +2357,8 @@ INT_PTR CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP case WM_MOUSEMOVE: { - mouse_x = GET_X_LPARAM(lParam); - mouse_y = GET_Y_LPARAM(lParam); + int mouse_x = GET_X_LPARAM(lParam); + int mouse_y = GET_Y_LPARAM(lParam); bool setString = false; if ((mouse_x > 6) && (mouse_x < 30) && (mouse_y > 10)) @@ -2112,10 +2367,10 @@ INT_PTR CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP RECT rectDisassembly; GetClientRect(GetDlgItem(hDebug,IDC_DEBUGGER_DISASSEMBLY),&rectDisassembly); int height = rectDisassembly.bottom-rectDisassembly.top; - tmp = mouse_y - 10; - if(tmp > height) + mouse_y -= 10; + if(mouse_y > height) setString = false; - tmp /= debugSystem->disasmFontHeight; + mouse_y /= debugSystem->disasmFontHeight; } if (setString) @@ -2126,8 +2381,8 @@ INT_PTR CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP } case WM_LBUTTONDOWN: { - mouse_x = GET_X_LPARAM(lParam); - mouse_y = GET_Y_LPARAM(lParam); + int mouse_x = GET_X_LPARAM(lParam); + int mouse_y = GET_Y_LPARAM(lParam); // ################################## Start of SP CODE ########################### // mouse_y < 538 @@ -2135,11 +2390,11 @@ INT_PTR CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP //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->disasmFontHeight; // ################################## End of SP CODE ########################### + int tmp = (mouse_y - 10) / debugSystem->disasmFontHeight; if (tmp < (int)disassembly_addresses.size()) { - i = disassembly_addresses[tmp]; + int i = disassembly_addresses[tmp]; //DoPatcher(GetNesFileAddress(i),hwndDlg); iaPC=i; if (iaPC >= 0x8000) @@ -2153,15 +2408,15 @@ INT_PTR CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP } case WM_RBUTTONDOWN: { - mouse_x = GET_X_LPARAM(lParam); - mouse_y = GET_Y_LPARAM(lParam); + int mouse_x = GET_X_LPARAM(lParam); + int mouse_y = GET_Y_LPARAM(lParam); //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->disasmFontHeight; + int tmp = (mouse_y - 10) / debugSystem->disasmFontHeight; if (tmp < (int)disassembly_addresses.size()) { - i = disassembly_addresses[tmp]; + int i = disassembly_addresses[tmp]; if (i >= 0x8000) // show ROM data in Hexeditor ChangeMemViewFocus(3, GetNesFileAddress(i), -1); @@ -2174,15 +2429,15 @@ INT_PTR CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP } case WM_MBUTTONDOWN: { - mouse_x = GET_X_LPARAM(lParam); - mouse_y = GET_Y_LPARAM(lParam); + int mouse_x = GET_X_LPARAM(lParam); + int mouse_y = GET_Y_LPARAM(lParam); //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->disasmFontHeight; + int tmp = (mouse_y - 10) / debugSystem->disasmFontHeight; if (tmp < (int)disassembly_addresses.size()) { - i = disassembly_addresses[tmp]; + int i = disassembly_addresses[tmp]; SetGGConvFocus(i,GetMem(i)); } } @@ -2197,9 +2452,6 @@ INT_PTR CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP { case BN_CLICKED: switch(LOWORD(wParam)) { - case IDC_DEBUGGER_RESTORESIZE: - RestoreSize(hwndDlg); - break; case IDC_DEBUGGER_BP_ADD: childwnd = 1; if (DialogBoxParam(fceu_hInstance,"ADDBP",hwndDlg,AddbpCallB, 0)) AddBreakList(); @@ -2277,7 +2529,8 @@ INT_PTR CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP //mbg merge 7/18/06 changed pausing check and set if (FCEUI_EmulationPaused()) { UpdateRegs(hwndDlg); - uint8 opcode = GetMem(tmp=X.PC); + int tmp = X.PC; + uint8 opcode = GetMem(tmp); bool jsr = opcode==0x20; bool call = jsr; #ifdef BRK_3BYTE_HACK @@ -2307,8 +2560,9 @@ INT_PTR CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP //mbg merge 7/18/06 changed pausing check if (FCEUI_EmulationPaused()) UpdateRegs(hwndDlg); + char str[16]; GetDlgItemText(hwndDlg,IDC_DEBUGGER_VAL_PCSEEK,str,5); - tmp = offsetStringToInt(BT_C, str); + int tmp = offsetStringToInt(BT_C, str); if (tmp != -1) { sprintf(str,"%04X", tmp); @@ -2504,6 +2758,13 @@ void DoDebug(uint8 halt) { if (!debugger_open) { + // init buffers + // owomomo: initialize buffers even before the debugger is open, + // because some of the operations about hDebug may occur before + // its WM_INITDIALOG runs. + debug_wstr = (wchar_t*)malloc(16384 * sizeof(wchar_t)); + debug_cdl_str = (char*)malloc(512); + debug_str_decoration_comment = (char*)malloc(NL_MAX_MULTILINE_COMMENT_LEN + 10); hDebug = CreateDialog(fceu_hInstance,"DEBUGGER",NULL,DebuggerCallB); if(DbgSizeX != -1 && DbgSizeY != -1) SetWindowPos(hDebug,0,0,0,DbgSizeX,DbgSizeY,SWP_NOMOVE|SWP_NOZORDER|SWP_NOOWNERZORDER); @@ -2580,30 +2841,7 @@ void DebugSystem::init() hDisasmFont = debuggerIDAFont ? hIDAFont : hFixedFont; disasmFontHeight = debuggerIDAFont ? IDAFontSize : fixedFontHeight; - memset(&mnem, 0, sizeof mnem); - mnem.cbSize = sizeof mnem; - //if (!debuggerIDAFont) - //{ - // mnem.dwMask = CFM_COLOR | CFM_BOLD; - // mnem.dwEffects = CFE_BOLD; - //} else - mnem.dwMask = CFM_COLOR; - mnem.crTextColor = RGB(0,0,128); - - memset(&oper, 0, sizeof oper); - oper.cbSize = sizeof oper; - //if (!debuggerIDAFont) - //{ - // oper.dwMask = CFM_COLOR | CFM_BOLD; - // oper.dwEffects = CFE_BOLD; - //} else - oper.dwMask = CFM_COLOR; - oper.crTextColor = RGB(0,128,0); - - memset(&comm, 0, sizeof comm); - comm.cbSize = sizeof comm; - comm.dwMask = CFM_COLOR; - comm.crTextColor = RGB(128,128,128); + InitDbgCharFormat(); newline.lpstrText = "\r"; newline.chrg.cpMin = 0; diff --git a/src/drivers/win/debugger.h b/src/drivers/win/debugger.h index 4f5a2d9f..2063229e 100644 --- a/src/drivers/win/debugger.h +++ b/src/drivers/win/debugger.h @@ -69,7 +69,112 @@ public: } *debugSystem; -// extern WNDPROC DefaultEditCtrlProc; -// extern INT_PTR APIENTRY FilterEditCtrlProc(HWND hwnd, UINT msg, WPARAM wP, LPARAM lP); +// Partial List of Color Definitions +// owomomo: I'm tired to write those repeated words. +#define OPHEXRGB(_OP, _SEP) \ +/* normal hex text color */ \ +_OP(HexFore, 0, 0, 0) _SEP /* Black */ \ +/* normal hex background color */ \ +_OP(HexBack, 255, 255, 255) _SEP /* White */ \ +/* highlight hex text color */ \ +_OP(HexHlFore, 255, 255, 255) _SEP /* White */ \ +/* highlight hex background color */ \ +_OP(HexHlBack, 0, 0, 0) _SEP /* Black */ \ +/* unfocused highlight hex text color */ \ +_OP(HexHlShdFore, 0, 0, 0) _SEP /* Black */ \ +/* unfocused highlight hex background color */ \ +_OP(HexHlShdBack, 224, 224, 224) _SEP /* Grey */ \ +/* freezed color */ \ +_OP(HexFreeze, 0, 0, 255) _SEP /* Blue */ \ +/* freezed color in ROM */ \ +_OP(RomFreeze, 255, 0, 0) _SEP /* Red */ \ +/* hex color out of bounds */ \ +_OP(HexBound, 220, 220, 220) _SEP /* Grey */ \ +/* bookmark color */ \ +_OP(HexBookmark, 0, 204, 0) _SEP /* Light green */ \ +/* address header color*/ \ +_OP(HexAddr, 128, 128, 128) /* Dark grey */ + +#define OPCDLRGB(_OP, _SEP) \ +/* Logged as code */ \ +_OP(CdlCode, 160, 140, 0) _SEP /* Dark yellow */ \ +/* Logged as data */ \ +_OP(CdlData, 0, 0, 210) _SEP /* Blue */ \ +/* Logged as PCM */ \ +_OP(CdlPcm, 0, 130, 160) _SEP /* Cyan */ \ +/* Logged as code and data */ \ +_OP(CdlCodeData, 0, 190, 0) _SEP /* Green */ \ +/* Rendered */ \ +_OP(CdlRender, 210, 190, 0) _SEP /* Yellow */ \ +/* Read */ \ +_OP(CdlRead, 15, 15, 255) _SEP /* Light blue */ \ +/* Rendered and read */ \ +_OP(CdlRenderRead, 5, 255, 5) /* Light green */ + +// Debugger color list +// owomomo: the configurable colors +#define OPDBGRGB(_OP, _SEP) \ +/* PC */ \ +_OP(DbgPC, 0, 0, 255) _SEP /* Blue */ \ +/* Mnemonic */ \ +_OP(DbgMnem, 0, 0, 128) _SEP /* Dark blue */ \ +/* Operand */ \ +_OP(DbgOper, 0, 128, 0) _SEP /* Green */ \ +/* Comment */ \ +_OP(DbgComm, 128, 128, 128) _SEP /* Grey */ \ +/* Operand note */ \ +_OP(DbgOpNt, 128, 128, 255) _SEP /* Purple */ \ +/* Symbolic name */ \ +_OP(DbgSym, 34, 75, 143) _SEP /* Rurikon */ \ +/* Effective address */ \ +_OP(DbgEff, 106, 109, 169) _SEP /* Fujinando */ \ +/* RTS */ \ +_OP(DbgRts, 187, 80, 93) /* Imayou */ + +#define _COMMA , +#define SBT(name, suf) name##suf + +#define SBCLR(name, suf) SBT(name, Color)##suf +#define SPCLR(pf, name, suf) pf SBCLR(name, suf) +#define CSCLR(pf, name, suf, op, val) SPCLR(pf, name, suf) op val +#define CNRGB(pf, name, op, r, g, b, sep) CSCLR(pf, name, R, op, r) sep CSCLR(pf, name, G, op, g) sep CSCLR(pf, name, B, op, b) +#define PPRGB(name) NULL, CNRGB(&, name, , , , , _COMMA) +#define MKRGB(name) (RGB(SBCLR(name, R), SBCLR(name, G), SBCLR(name, B))) +#define DEFRGB(name, r, g, b) CNRGB( , name, =, r, g, b, _COMMA) +#define DCLRGB(name, r, g, b) CNRGB( , name, , , , , _COMMA) +#define CMPRGB(name, r, g, b) (CNRGB( , name, !=, r, g, b, ||)) + +#define SBCF(name) SBT(name, ChFmt) +#define PPCF(name) &SBCF(name) +#define PPCCF(name) PPRGB(name), PPCF(name) +#define DEFCF(name, r, g, b) (DEFRGB(name, r, g, b), SBCF(name).crTextColor = RGB(r, g, b)) +#define CMPCF(name, r, g, b) (CNRGB( , name, !=, r, g, b, ||) || SBCF(name).crTextColor != RGB(r, g, b)) +#define INITCF(name) \ +(memset(PPCF(name), 0, sizeof(SBCF(name))), \ +SBCF(name).cbSize = sizeof(SBCF(name)), \ +SBCF(name).dwMask = CFM_COLOR, \ +SBCF(name).crTextColor = MKRGB(name)) + +#define RGBOP DCLRGB + +#define DefHexRGB OPHEXRGB(RGBOP, _COMMA) +#define DefCdlRGB OPCDLRGB(RGBOP, _COMMA) +#define DefDbgRGB OPDBGRGB(RGBOP, _COMMA) +#define DefDbgChFmt OPDBGRGB(SBCF, _COMMA) + +extern int DefHexRGB, DefCdlRGB, DefDbgRGB; + +#undef RGBOP +#define RGBOP DEFRGB + +#define RestoreDefaultHexColor() (DefHexRGB) +#define IsHexColorDefault() (!(OPHEXRGB(CMPRGB, ||))) + +#define RestoreDefaultCdlColor() (DefCdlRGB) +#define IsCdlColorDefault() (!(OPCDLRGB(CMPRGB, ||))) + +#define InitDbgCharFormat() (OPDBGRGB(INITCF, _COMMA)) +#define RestoreDefaultDebugColor() (OPDBGRGB(DEFCF, _COMMA)) +#define IsDebugColorDefault() (!(OPDBGRGB(CMPCF, ||))) #endif diff --git a/src/drivers/win/debuggersp.cpp b/src/drivers/win/debuggersp.cpp index ffadcac8..1f78660f 100644 --- a/src/drivers/win/debuggersp.cpp +++ b/src/drivers/win/debuggersp.cpp @@ -21,7 +21,6 @@ #include "common.h" #include "utils/xstring.h" #include "debuggersp.h" -#include "debugger.h" #include "../../fceu.h" #include "../../debug.h" #include "../../conddebug.h" diff --git a/src/drivers/win/debuggersp.h b/src/drivers/win/debuggersp.h index f942e675..01b7d907 100644 --- a/src/drivers/win/debuggersp.h +++ b/src/drivers/win/debuggersp.h @@ -68,3 +68,6 @@ bool DoSymbolicDebugNaming(int offset, int size, HWND parentHWND); void AddNewSymbolicName(uint16 newAddress, char* newOffset, char* newName, char* newComment, int size, int init, bool nameOverwrite, bool commentHeadOnly, bool commentOverwrite); void DeleteSymbolicName(uint16 address, int size); void WriteNameFileToDisk(const char* filename, Name* node); + +extern void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr); +extern void CenterWindow(HWND hwnd); \ No newline at end of file diff --git a/src/drivers/win/header_editor.cpp b/src/drivers/win/header_editor.cpp index 1a032428..492b38cb 100644 --- a/src/drivers/win/header_editor.cpp +++ b/src/drivers/win/header_editor.cpp @@ -1806,7 +1806,7 @@ bool GetComboBoxListItemData(HWND hwnd, UINT id, int* value, char* buf, iNES_HEA // Warning: when in save mode, the content of buf might be overwritten by the save filename which user changed. bool ShowINESFileBox(HWND parent, char* buf, iNES_HEADER* header) { - char *filename = NULL, *path = NULL; + char filename[2048] = { 0 }, path[2048] = { 0 }; bool success = true; if (header) @@ -1814,24 +1814,23 @@ bool ShowINESFileBox(HWND parent, char* buf, iNES_HEADER* header) // When open this dialog for saving prpose, the buf must be a separate buf. if (buf && buf != LoadedRomFName) { - extern char* GetRomName(bool force = false); - extern char* GetRomPath(bool force = false); - filename = GetRomName(true); + extern std::string GetRomName(bool force = false); + extern std::string GetRomPath(bool force = false); + strcpy(filename, GetRomName(true).c_str()); char* second = strchr(filename, '|'); if (second) { - char* _filename = (char*)calloc(1, 2048); + char _filename[2048]; strcpy(_filename, second + 1); char* third = strrchr(filename, '\\'); if (third) strcpy(_filename, third + 1); - free(filename); - filename = _filename; + strcpy(filename, _filename); } char header_str[32]; sprintf(header_str, " [%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X].nes", header->ROM_size, header->VROM_size, header->ROM_size, header->ROM_type2, header->ROM_type3, header->Upper_ROM_VROM_size, header->RAM_size, header->VRAM_size, header->TV_system, header->VS_hardware, header->reserved[0], header->reserved[1]); strcat(filename, header_str); - path = GetRomPath(true); + strcpy(path, GetRomPath(true).c_str()); } else success = false; @@ -1839,8 +1838,6 @@ bool ShowINESFileBox(HWND parent, char* buf, iNES_HEADER* header) else { if (!buf) buf = LoadedRomFName; - filename = (char*)calloc(1, 2048); - path = (char*)calloc(1, 2048); } if (success) @@ -1864,9 +1861,6 @@ bool ShowINESFileBox(HWND parent, char* buf, iNES_HEADER* header) success = false; } - if (filename) free(filename); - if (path) free(path); - return success; } diff --git a/src/drivers/win/main.cpp b/src/drivers/win/main.cpp index 8e1d33c4..99c2de6c 100644 --- a/src/drivers/win/main.cpp +++ b/src/drivers/win/main.cpp @@ -530,7 +530,11 @@ void DoFCEUExit() } } + exiting = 1; + KillDebugger(); //mbg merge 7/19/06 added + ResetWatches(); + KillMemView(); FCEUI_StopMovie(); FCEUD_AviStop(); @@ -538,7 +542,6 @@ void DoFCEUExit() FCEU_LuaStop(); // kill lua script before the gui dies #endif - exiting = 1; closeGame = true;//mbg 6/30/06 - for housekeeping purposes we need to exit after the emulation cycle finishes // remember the ROM name extern char LoadedRomFName[2048]; @@ -1165,7 +1168,7 @@ void FCEUD_ToggleStatusIcon(void) UpdateCheckedMenuItems(); } -char *GetRomName(bool force) +std::string GetRomName(bool force) { //The purpose of this function is to format the ROM name stored in LoadedRomFName //And return a char array with just the name with path or extension @@ -1173,20 +1176,18 @@ char *GetRomName(bool force) extern char LoadedRomFName[2048]; //Contains full path of ROM std::string Rom; //Will contain the formatted path if(GameInfo || force) //If ROM is loaded - { + { char drv[PATH_MAX], dir[PATH_MAX], name[PATH_MAX], ext[PATH_MAX]; splitpath(LoadedRomFName,drv,dir,name,ext); //Extract components of the ROM path Rom = name; //Pull out the Name only - } + } else Rom = ""; - char*mystring = (char*)malloc(2048*sizeof(char)); - strcpy(mystring, Rom.c_str()); //Convert string to char* - return mystring; + return Rom; } -char *GetRomPath(bool force) +std::string GetRomPath(bool force) { //The purpose of this function is to format the ROM name stored in LoadedRomFName //And return a char array with just the name with path or extension @@ -1194,16 +1195,13 @@ char *GetRomPath(bool force) extern char LoadedRomFName[2048]; //Contains full path of ROM std::string Rom; //Will contain the formatted path if(GameInfo || force) //If ROM is loaded - { + { char drv[PATH_MAX], dir[PATH_MAX], name[PATH_MAX], ext[PATH_MAX]; splitpath(LoadedRomFName,drv,dir,name,ext); //Extract components of the ROM path Rom = drv; //Pull out the Path only Rom.append(dir); - } + } else Rom = ""; - char*mystring = (char*)malloc(2048*sizeof(char)); - strcpy(mystring, Rom.c_str()); //Convert string to char* - - return mystring; -} + return Rom; +} \ No newline at end of file diff --git a/src/drivers/win/main.h b/src/drivers/win/main.h index 4ea60580..6b3c08d6 100644 --- a/src/drivers/win/main.h +++ b/src/drivers/win/main.h @@ -67,8 +67,8 @@ extern char* directory_names[14]; extern int edit_id[14]; extern int browse_btn_id[14]; -char *GetRomName(bool force = false); //Checks if rom is loaded, if so, outputs the Rom name with no directory path or file extension -char *GetRomPath(bool force = false); //Checks if rom is loaded, if so, outputs the Rom path only +std::string GetRomName(bool force = false); //Checks if rom is loaded, if so, outputs the Rom name with no directory path or file extension +std::string GetRomPath(bool force = false); //Checks if rom is loaded, if so, outputs the Rom path only ///Contains the names of the default directories. static const char *default_directory_names[14] = { diff --git a/src/drivers/win/memview.cpp b/src/drivers/win/memview.cpp index 74983835..66367835 100644 --- a/src/drivers/win/memview.cpp +++ b/src/drivers/win/memview.cpp @@ -76,45 +76,26 @@ using namespace std; #define ID_ADDRESS_FRZ_SEP 52 #define ID_ADDRESS_FRZ_UNFREEZE_ALL 53 +#define HIGHLIGHTING_SUBMENU_POS 3 +#define HEXEDITOR_COLOR_SUBMENU_POS 4 +#define CDLOGGER_COLOR_SUBMENU_POS 5 +#define ID_COLOR_HEXEDITOR 600 +#define ID_COLOR_CDLOGGER 650 + #define HIGHLIGHT_ACTIVITY_MIN_VALUE 0 #define HIGHLIGHT_ACTIVITY_NUM_COLORS 16 #define PREVIOUS_VALUE_UNDEFINED -1 COLORREF highlightActivityColors[HIGHLIGHT_ACTIVITY_NUM_COLORS] = { 0x0, 0x004035, 0x185218, 0x5e5c34, 0x804c00, 0xba0300, 0xd10038, 0xb21272, 0xba00ab, 0x6f00b0, 0x3700c2, 0x000cba, 0x002cc9, 0x0053bf, 0x0072cf, 0x3c8bc7 }; +COLORREF custom_color[16] = { 0 }; // User defined color for ChooseColor() + string memviewhelp = "HexEditor"; //Hex Editor Help Page int HexRowHeightBorder = 0; //adelikat: This will determine the number of pixels between rows in the hex editor, to alter this, the user can change it in the .cfg file, changing one will revert to the way FCEUX2.1.0 did it int HexCharSpacing = 1; // pixels between chars -// Partial List of Color Definitions -int HexBackColorR = 255; // White -int HexBackColorG = 255; -int HexBackColorB = 255; -int HexForeColorR = 0; // Black -int HexForeColorG = 0; -int HexForeColorB = 0; -int HexHlBackColorR = 0; // Black -int HexHlBackColorG = 0; -int HexHlBackColorB = 0; -int HexHlForeColorR = 255; // White -int HexHlForeColorG = 255; -int HexHlForeColorB = 255; -int HexHlShdBackColorR = 224; // Grey -int HexHlShdBackColorG = 224; -int HexHlShdBackColorB = 224; -int HexHlShdForeColorR = 0; // Black -int HexHlShdForeColorG = 0; -int HexHlShdForeColorB = 0; -int HexFreezeColorR = 0; // Blue -int HexFreezeColorG = 0; -int HexFreezeColorB = 255; -int RomFreezeColorR = 255; // Red -int RomFreezeColorG = 0; -int RomFreezeColorB = 0; -int HexBoundColorR = 220; // Grey -int HexBoundColorG = 220; -int HexBoundColorB = 220; +int DefHexRGB, DefCdlRGB; // This defines all of our right click popup menus struct @@ -138,7 +119,44 @@ popupmenu[] = {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"} }; + #define POPUPNUM (sizeof popupmenu / sizeof popupmenu[0]) +// The color configure menu +COLORMENU hexcolormenu[] = { + { "Normal text", PPRGB(HexFore) }, + { "Address header", PPRGB(HexAddr) }, +// { "Normal text background", PPRGB(HexBack) }, + { NULL }, + { "Selected text", PPRGB(HexHlFore) }, + { "Selected background", PPRGB(HexHlBack) }, + { "Selected text (unfocused)", PPRGB(HexHlShdFore) }, + { "Selected background (unfocused)", PPRGB(HexHlShdBack) }, + { NULL }, + { "Freezed address", PPRGB(HexFreeze), }, +// { "Freezed ROM address", PPRGB(RomFreeze), }, + { "Bookmark", PPRGB(HexBookmark) } +}, +cdlcolormenu[] = { + { "Code", PPRGB(CdlCode) }, + { "Data", PPRGB(CdlData) }, + { "PCM Data", PPRGB(CdlPcm) }, + { "Code && Data", PPRGB(CdlCodeData) }, + { NULL }, + { "Render", PPRGB(CdlRender) }, + { "Read", PPRGB(CdlRead) }, + { "Render && Read", PPRGB(CdlRenderRead) } +}; + +struct { + COLORMENU* items; + int base_id; + int sub; + int size; +} colormenu[] = +{ + { hexcolormenu, ID_COLOR_HEXEDITOR, HEXEDITOR_COLOR_SUBMENU_POS, sizeof(hexcolormenu) / sizeof(hexcolormenu[0]) }, + { cdlcolormenu, ID_COLOR_CDLOGGER, CDLOGGER_COLOR_SUBMENU_POS, sizeof(cdlcolormenu) / sizeof(cdlcolormenu[0]) } +}; int LoadTableFile(); void UnloadTableFile(); @@ -153,7 +171,7 @@ int GetAddyFromCoord(int x,int y); void AutoScrollFromCoord(int x,int y); LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK MemFindCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); -INT_PTR CALLBACK importBookmarkCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK ImportBookmarkCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); void FindNext(); void OpenFindDialog(); static int GetFileData(uint32 offset); @@ -235,7 +253,7 @@ void resetHighlightingActivityLog() } void ApplyPatch(int addr,int size, uint8* data){ - UNDOSTRUCT *tmp=(UNDOSTRUCT*)malloc(sizeof(UNDOSTRUCT)); //mbg merge 7/18/06 removed struct qualifiers and added cast + UNDOSTRUCT *tmp = (UNDOSTRUCT*)malloc(sizeof(UNDOSTRUCT)); //mbg merge 7/18/06 removed struct qualifiers and added cast int i; @@ -454,8 +472,8 @@ void UpdateMemoryView(int draw_all) const int MemFontWidth = debugSystem->HexeditorFontWidth + HexCharSpacing; const int MemFontHeight = debugSystem->HexeditorFontHeight + HexRowHeightBorder; const char hex[] = "0123456789ABCDEF"; - const COLORREF CBackColor = RGB(HexBackColorR, HexBackColorG, HexBackColorB); - const COLORREF CForeColor = RGB(HexForeColorR, HexForeColorG, HexForeColorB); + const COLORREF CBackColor = MKRGB(HexBack); + const COLORREF CForeColor = MKRGB(HexFore); int i, j; int byteValue; int byteHighlightingValue; @@ -473,9 +491,9 @@ void UpdateMemoryView(int draw_all) { SetBkColor(HDataDC, CBackColor); //addresses back color if (i < MaxSize) - SetTextColor(HDataDC, CForeColor); //addresses text color #000000 = black, #FFFFFF = white + SetTextColor(HDataDC, MKRGB(HexAddr)); //addresses text color #000000 = black, #FFFFFF = white else - SetTextColor(HDataDC, RGB(HexBoundColorR, HexBoundColorG, HexBoundColorB)); //addresses out of bounds + SetTextColor(HDataDC, MKRGB(HexBound)); //addresses out of bounds sprintf(str, "%06X: :", i); ExtTextOut(HDataDC, 0, MemLineRow, NULL, NULL, str, strlen(str), NULL); } @@ -510,8 +528,8 @@ void UpdateMemoryView(int draw_all) { // Single Byte highlight // 1st nibble - SetBkColor(HDataDC, EditingText ? RGB(HexHlShdBackColorR, HexHlShdBackColorG, HexHlShdBackColorB) : RGB(HexHlBackColorR, HexHlBackColorG, HexHlBackColorB)); - SetTextColor(HDataDC, EditingText ? RGB(255, 0, 0) : RGB(255, 255, 255)); + SetBkColor(HDataDC, EditingText ? MKRGB(HexHlShdBack) : MKRGB(HexHlBack)); + SetTextColor(HDataDC, EditingText ? MKRGB(HexHlShdFore) : MKRGB(HexHlFore)); str[0] = hex[(byteValue >> 4) & 0xF]; str[1] = 0; ExtTextOut(HDataDC, MemLinePos, MemLineRow, NULL, NULL, str, 1, NULL); @@ -524,8 +542,8 @@ void UpdateMemoryView(int draw_all) } // single address highlight - right column - SetBkColor(HDataDC, EditingText ? RGB(HexHlBackColorR, HexHlBackColorG, HexHlBackColorB) : RGB(HexHlShdBackColorR, HexHlShdBackColorG, HexHlShdBackColorB)); - SetTextColor(HDataDC, EditingText ? RGB(HexHlForeColorR, HexHlForeColorG, HexHlForeColorB) : RGB(HexHlShdForeColorR, HexHlShdForeColorG, HexHlShdForeColorB)); + SetBkColor(HDataDC, EditingText ? MKRGB(HexHlBack) : MKRGB(HexHlShdBack)); + SetTextColor(HDataDC, EditingText ? MKRGB(HexHlFore) : MKRGB(HexHlShdFore)); str[0] = chartable[byteValue]; if ((u8)str[0] < 0x20) str[0] = 0x2E; // if ((u8)str[0] > 0x7e) str[0] = 0x2E; @@ -679,17 +697,17 @@ void UpdateColorTable() { if((i+CurOffset >= CursorStartAddy) && (i+CurOffset <= CursorEndAddy)) { - CurBGColorList[i] = RGB(HexHlBackColorR, HexHlBackColorG, HexHlBackColorB); //Highlighter color bg - 2 columns - DimBGColorList[i] = RGB(HexHlShdBackColorR, HexHlShdBackColorG, HexHlShdBackColorB); - CurTextColorList[i] = RGB(HexHlForeColorR, HexHlForeColorG, HexHlForeColorB); //Highlighter color text - 2 columns - DimTextColorList[i] = RGB(HexHlShdForeColorR, HexHlShdForeColorG, HexHlShdForeColorB); + CurBGColorList[i] = MKRGB(HexHlBack); //Highlighter color bg - 2 columns + DimBGColorList[i] = MKRGB(HexHlShdBack); + CurTextColorList[i] = MKRGB(HexHlFore); //Highlighter color text - 2 columns + DimTextColorList[i] = MKRGB(HexHlShdFore); continue; } - CurBGColorList[i] = RGB(HexBackColorR, HexBackColorG, HexBackColorB); //Regular color bb - 2columns - DimBGColorList[i] = RGB(HexBackColorR, HexBackColorG, HexBackColorB); //Regular color bb - 2columns - CurTextColorList[i] = RGB(HexForeColorR, HexForeColorG, HexForeColorB); //Regular color text - 2 columns - DimTextColorList[i] = RGB(HexForeColorR, HexForeColorG, HexForeColorB); //Regular color text - 2 columns + CurBGColorList[i] = MKRGB(HexBack); //Regular color bb - 2columns + DimBGColorList[i] = MKRGB(HexBack); //Regular color bb - 2columns + CurTextColorList[i] = MKRGB(HexFore); //Regular color text - 2 columns + DimTextColorList[i] = MKRGB(HexFore); //Regular color text - 2 columns } for (j=0;j= CurOffset) && ((int)hexBookmarks[j].address < CurOffset+DataAmount)) { - CurTextColorList[hexBookmarks[j].address - CurOffset] = RGB(0, 0xCC, 0); // Green for Bookmarks - DimTextColorList[hexBookmarks[j].address - CurOffset] = RGB(0, 0xCC, 0); // Green for Bookmarks + CurTextColorList[hexBookmarks[j].address - CurOffset] = MKRGB(HexBookmark); // Green for Bookmarks + DimTextColorList[hexBookmarks[j].address - CurOffset] = MKRGB(HexBookmark); // Green for Bookmarks } } @@ -708,8 +726,8 @@ void UpdateColorTable() for (int a = CurOffset; a < CurOffset + DataAmount; ++a) if (FCEUI_FindCheatMapByte(a)) { - CurTextColorList[a - CurOffset] = RGB(HexFreezeColorR, HexFreezeColorG, HexFreezeColorB); - DimTextColorList[a - CurOffset] = RGB(HexFreezeColorR, HexFreezeColorG, HexFreezeColorB); + CurTextColorList[a - CurOffset] = MKRGB(HexFreeze); + DimTextColorList[a - CurOffset] = MKRGB(HexFreeze); } break; case MODE_NES_FILE: @@ -727,14 +745,14 @@ void UpdateColorTable() if ((cdloggerdata[temp_offset] & 3) == 3) { // the byte is both Code and Data - green - CurTextColorList[i] = RGB(0, 190, 0); - DimTextColorList[i] = RGB(0, 190, 0); + CurTextColorList[i] = MKRGB(CdlCodeData); + DimTextColorList[i] = MKRGB(CdlCodeData); } else if ((cdloggerdata[temp_offset] & 3) == 1) { // the byte is Code - dark-yellow - CurTextColorList[i] = RGB(160, 140, 0); - DimTextColorList[i] = RGB(160, 140, 0); + CurTextColorList[i] = MKRGB(CdlCode); + DimTextColorList[i] = MKRGB(CdlCode); } else if ((cdloggerdata[temp_offset] & 3) == 2) { @@ -742,14 +760,14 @@ void UpdateColorTable() if (cdloggerdata[temp_offset] & 0x40) { // PCM data - cyan - CurTextColorList[i] = RGB(0, 130, 160); - DimTextColorList[i] = RGB(0, 130, 160); + CurTextColorList[i] = MKRGB(CdlPcm); + DimTextColorList[i] = MKRGB(CdlPcm); } else { // non-PCM data - blue - CurTextColorList[i] = RGB(0, 0, 210); - DimTextColorList[i] = RGB(0, 0, 210); + CurTextColorList[i] = MKRGB(CdlData); + DimTextColorList[i] = MKRGB(CdlData); } } } @@ -762,20 +780,20 @@ void UpdateColorTable() if ((cdloggervdata[temp_offset] & 3) == 3) { // the byte was both rendered and read programmatically - light-green - CurTextColorList[i] = RGB(5, 255, 5); - DimTextColorList[i] = RGB(5, 255, 5); + CurTextColorList[i] = MKRGB(CdlRenderRead); + DimTextColorList[i] = MKRGB(CdlRenderRead); } else if ((cdloggervdata[temp_offset] & 3) == 1) { // the byte was rendered - yellow - CurTextColorList[i] = RGB(210, 190, 0); - DimTextColorList[i] = RGB(210, 190, 0); + CurTextColorList[i] = MKRGB(CdlRender); + DimTextColorList[i] = MKRGB(CdlRender); } else if ((cdloggervdata[temp_offset] & 3) == 2) { // the byte was read programmatically - light-blue - CurTextColorList[i] = RGB(15, 15, 255); - DimTextColorList[i] = RGB(15, 15, 255); + CurTextColorList[i] = MKRGB(CdlRead); + DimTextColorList[i] = MKRGB(CdlRead); } } } @@ -790,8 +808,8 @@ void UpdateColorTable() for (i = tmp->addr; i < tmp->addr + tmp->size; i++) { if ((i > CurOffset) && (i < CurOffset + DataAmount)) { - CurTextColorList[i - CurOffset] = RGB(RomFreezeColorR, RomFreezeColorG, RomFreezeColorB); - DimTextColorList[i - CurOffset] = RGB(RomFreezeColorR, RomFreezeColorG, RomFreezeColorB); + CurTextColorList[i - CurOffset] = MKRGB(RomFreeze); + DimTextColorList[i - CurOffset] = MKRGB(RomFreeze); } } tmp = tmp->last; @@ -1154,6 +1172,12 @@ void KillMemView() free(DimBGColorList); if (EditingMode == MODE_NES_MEMORY) ReleaseCheatMap(); + for (int i = 0; i < sizeof(colormenu) / sizeof(colormenu[0]); ++i) + for (int j = 0; j < colormenu[i].size; ++j) + { + DeleteObject(colormenu[i].items[j].bitmap); + colormenu[i].items[j].bitmap = NULL; + } } } @@ -1197,15 +1221,16 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa return 0; case WM_CREATE: - SetWindowPos(hwnd,0,MemView_wndx,MemView_wndy,MemViewSizeX,MemViewSizeY,SWP_NOZORDER|SWP_NOOWNERZORDER); + { + SetWindowPos(hwnd, 0, MemView_wndx, MemView_wndy, MemViewSizeX, MemViewSizeY, SWP_NOZORDER | SWP_NOOWNERZORDER); debuggerWasActive = 1; HDataDC = GetDC(hwnd); - SelectObject (HDataDC, debugSystem->hHexeditorFont); - SetTextAlign(HDataDC,TA_NOUPDATECP | TA_TOP | TA_LEFT); + SelectObject(HDataDC, debugSystem->hHexeditorFont); + SetTextAlign(HDataDC, TA_NOUPDATECP | TA_TOP | TA_LEFT); -// TEXTMETRIC textMetric; -// GetTextMetrics (HDataDC, &textMetric); + // TEXTMETRIC textMetric; + // GetTextMetrics (HDataDC, &textMetric); MaxSize = 0x10000; //Allocate Memory for color lists @@ -1231,16 +1256,24 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa UpdateColorTable(); //draw it // update menus + HMENU menu = GetMenu(hwnd); + for (int i = MODE_NES_MEMORY; i <= MODE_NES_FILE; i++) - if(EditingMode == i) { - CheckMenuRadioItem(GetMenu(hwnd), MENU_MV_VIEW_RAM, MENU_MV_VIEW_ROM, MENU_MV_VIEW_RAM, MF_BYCOMMAND); + if (EditingMode == i) { + CheckMenuRadioItem(menu, MENU_MV_VIEW_RAM, MENU_MV_VIEW_ROM, MENU_MV_VIEW_RAM, MF_BYCOMMAND); break; } - CheckMenuItem(GetMenu(hwnd), ID_HIGHLIGHTING_HIGHLIGHT_ACTIVITY, (MemView_HighlightActivity) ? MF_CHECKED: MF_UNCHECKED); - CheckMenuItem(GetMenu(hwnd), ID_HIGHLIGHTING_FADEWHENPAUSED, (MemView_HighlightActivity_FadeWhenPaused) ? MF_CHECKED: MF_UNCHECKED); + CheckMenuItem(menu, ID_HIGHLIGHTING_HIGHLIGHT_ACTIVITY, (MemView_HighlightActivity) ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(menu, ID_HIGHLIGHTING_FADEWHENPAUSED, (MemView_HighlightActivity_FadeWhenPaused) ? MF_CHECKED : MF_UNCHECKED); - updateBookmarkMenus(GetSubMenu(GetMenu(hwnd), BOOKMARKS_SUBMENU_POS)); - return 0; + updateBookmarkMenus(GetSubMenu(menu, BOOKMARKS_SUBMENU_POS)); + + HMENU hilightMenu = GetSubMenu(menu, HIGHLIGHTING_SUBMENU_POS); + for (int i = 0; i < sizeof(colormenu) / sizeof(colormenu[0]); ++i) + for (int j = 0; j < colormenu[i].size; ++j) + InsertColorMenu(hwnd, GetSubMenu(hilightMenu, colormenu[i].sub), &colormenu[i].items[j], j, colormenu[i].base_id + j); + } + return 0; case WM_PAINT: BeginPaint(hwnd, &ps); EndPaint(hwnd, &ps); @@ -1253,7 +1286,7 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa char *ftmp; len=DragQueryFile((HDROP)wParam,0,0,0)+1; - if((ftmp=(char*)malloc(len))) + if(ftmp = (char*)malloc(len)) { DragQueryFile((HDROP)wParam,0,ftmp,len); string fileDropped = ftmp; @@ -1270,6 +1303,7 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa std::string str = "Could not open " + fileDropped; MessageBox(hwnd, str.c_str(), "File error", 0); } + free(ftmp); } } break; @@ -1542,7 +1576,7 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa if (wParam >= '0' && wParam <= '9') { char buf[3]; - sprintf(buf, "%c", wParam); + sprintf(buf, "%c", (int)wParam); int key_num; sscanf(buf, "%d", &key_num); key_num = (key_num + 9) % 10; @@ -2350,7 +2384,64 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa resetHighlightingActivityLog(); return 0; } - + case ID_COLOR_HEXEDITOR: + case ID_COLOR_HEXEDITOR + 1: + case ID_COLOR_HEXEDITOR + 2: + case ID_COLOR_HEXEDITOR + 3: + case ID_COLOR_HEXEDITOR + 4: + case ID_COLOR_HEXEDITOR + 5: + case ID_COLOR_HEXEDITOR + 6: + case ID_COLOR_HEXEDITOR + 7: + case ID_COLOR_HEXEDITOR + 8: + case ID_COLOR_HEXEDITOR + 9: + { + int index = wParam - ID_COLOR_HEXEDITOR; + if (ChangeColor(hwnd, &hexcolormenu[index])) + { + UpdateColorTable(); + ModifyColorMenu(hwnd, GetHexColorMenu(hwnd), &hexcolormenu[index], index, wParam); + } + } + break; + case ID_HEXEDITOR_DEFCOLOR: + { + if (!IsHexColorDefault() && MessageBox(hwnd, "Do you want to restore all the colors to default?", "Restore default colors", MB_YESNO | MB_ICONINFORMATION) == IDYES) + { + RestoreDefaultHexColor(); + UpdateColorTable(); + for (int i = 0; i < sizeof(hexcolormenu) / sizeof(COLORMENU); ++i) + ModifyColorMenu(hwnd, GetHexColorMenu(hwnd), &hexcolormenu[i], i, ID_COLOR_HEXEDITOR + i); + } + } + break; + case ID_COLOR_CDLOGGER: + case ID_COLOR_CDLOGGER + 1: + case ID_COLOR_CDLOGGER + 2: + case ID_COLOR_CDLOGGER + 3: + case ID_COLOR_CDLOGGER + 4: + case ID_COLOR_CDLOGGER + 5: + case ID_COLOR_CDLOGGER + 6: + case ID_COLOR_CDLOGGER + 7: + case ID_COLOR_CDLOGGER + 8: + case ID_COLOR_CDLOGGER + 9: + { + int index = wParam - ID_COLOR_CDLOGGER; + if (ChangeColor(hwnd, &cdlcolormenu[index])) + { + UpdateColorTable(); + ModifyColorMenu(hwnd, GetCdlColorMenu(hwnd), &cdlcolormenu[index], index, wParam); + } + } + break; + case ID_CDLOGGER_DEFCOLOR: + if (!IsCdlColorDefault() && MessageBox(hwnd, "Do you want to restore all the colors to default?", "Restore default colors", MB_YESNO | MB_ICONINFORMATION) == IDYES) + { + RestoreDefaultCdlColor(); + UpdateColorTable(); + for (int i = 0; i < sizeof(hexcolormenu) / sizeof(COLORMENU); ++i) + ModifyColorMenu(hwnd, GetCdlColorMenu(hwnd), &cdlcolormenu[i], i, ID_COLOR_CDLOGGER + i); + } + break; case MENU_MV_BOOKMARKS_RM_ALL: if (hexBookmarks.bookmarkCount) { @@ -2569,7 +2660,7 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa } strcat(buffer, " with yours.\r\nYou must choose which side would be reserved. Do you want to continue?"); - continue_ = MessageBox(hwnd, buffer, "Bookmark conflict", MB_YESNO | MB_ICONEXCLAMATION) == IDYES && DialogBoxParam(fceu_hInstance, "IMPORTBOOKMARKOPTIONDIALOG", hwnd, importBookmarkCallB, (LPARAM)&tmpImportBookmarkProps); + continue_ = MessageBox(hwnd, buffer, "Bookmark conflict", MB_YESNO | MB_ICONEXCLAMATION) == IDYES && DialogBoxParam(fceu_hInstance, "IMPORTBOOKMARKOPTIONDIALOG", hwnd, ImportBookmarkCallB, (LPARAM)&tmpImportBookmarkProps); if (tmpImportBookmarkProps & IMPORT_OVERWRITE_NO_PROMPT) importBookmarkProps = tmpImportBookmarkProps; @@ -2644,7 +2735,7 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa case ID_BOOKMARKS_OPTION: { int tmpImportBookmarkProps = importBookmarkProps; - if (DialogBoxParam(fceu_hInstance, "IMPORTBOOKMARKOPTIONDIALOG", hwnd, importBookmarkCallB, (LPARAM)&tmpImportBookmarkProps)) + if (DialogBoxParam(fceu_hInstance, "IMPORTBOOKMARKOPTIONDIALOG", hwnd, ImportBookmarkCallB, (LPARAM)&tmpImportBookmarkProps)) importBookmarkProps = tmpImportBookmarkProps; } return 0; @@ -2752,80 +2843,82 @@ void DoMemView() INT_PTR CALLBACK MemFindCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - switch(uMsg) { - case WM_INITDIALOG: - SetWindowPos(hwndDlg,0,MemFind_wndx,MemFind_wndy,0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOOWNERZORDER); + switch(uMsg) + { + case WM_INITDIALOG: + SetWindowPos(hwndDlg,0,MemFind_wndx,MemFind_wndy,0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOOWNERZORDER); - if(FindDirectionUp) CheckDlgButton(hwndDlg, IDC_MEMVIEWFIND_DIR_UP, BST_CHECKED); - else CheckDlgButton(hwndDlg, IDC_MEMVIEWFIND_DIR_DOWN, BST_CHECKED); + if(FindDirectionUp) CheckDlgButton(hwndDlg, IDC_MEMVIEWFIND_DIR_UP, BST_CHECKED); + else CheckDlgButton(hwndDlg, IDC_MEMVIEWFIND_DIR_DOWN, BST_CHECKED); - if(FindAsText) CheckDlgButton(hwndDlg, IDC_MEMVIEWFIND_TYPE_TEXT, BST_CHECKED); - else CheckDlgButton(hwndDlg, IDC_MEMVIEWFIND_TYPE_HEX, BST_CHECKED); + if(FindAsText) CheckDlgButton(hwndDlg, IDC_MEMVIEWFIND_TYPE_TEXT, BST_CHECKED); + else CheckDlgButton(hwndDlg, IDC_MEMVIEWFIND_TYPE_HEX, BST_CHECKED); - if(FindTextBox[0])SetDlgItemText(hwndDlg,IDC_MEMVIEWFIND_WHAT,FindTextBox); + if(FindTextBox[0])SetDlgItemText(hwndDlg,IDC_MEMVIEWFIND_WHAT,FindTextBox); - SendDlgItemMessage(hwndDlg,IDC_MEMVIEWFIND_WHAT,EM_SETLIMITTEXT,59,0); - break; - case WM_CREATE: + SendDlgItemMessage(hwndDlg,IDC_MEMVIEWFIND_WHAT,EM_SETLIMITTEXT,59,0); + break; + case WM_CREATE: - break; - case WM_PAINT: - break; - case WM_CLOSE: - case WM_QUIT: - GetDlgItemText(hwndDlg,IDC_MEMVIEWFIND_WHAT,FindTextBox,60); - DestroyWindow(hwndDlg); - hMemFind = 0; - hwndDlg = 0; - break; - case WM_MOVING: - break; - case WM_MOVE: { - if (!IsIconic(hwndDlg)) { - RECT wrect; - GetWindowRect(hwndDlg,&wrect); - MemFind_wndx = wrect.left; - MemFind_wndy = wrect.top; + break; + case WM_PAINT: + break; + case WM_CLOSE: + case WM_QUIT: + GetDlgItemText(hwndDlg,IDC_MEMVIEWFIND_WHAT,FindTextBox,60); + DestroyWindow(hwndDlg); + hMemFind = 0; + hwndDlg = 0; + break; + case WM_MOVING: + break; + case WM_MOVE: { + if (!IsIconic(hwndDlg)) { + RECT wrect; + GetWindowRect(hwndDlg,&wrect); + MemFind_wndx = wrect.left; + MemFind_wndy = wrect.top; - #ifdef WIN32 - WindowBoundsCheckNoResize(MemFind_wndx,MemFind_wndy,wrect.right); - #endif + #ifdef WIN32 + WindowBoundsCheckNoResize(MemFind_wndx,MemFind_wndy,wrect.right); + #endif + } + break; } - break; - } - case WM_RBUTTONDBLCLK: - case WM_RBUTTONDOWN: - break; - case WM_MOUSEMOVE: - break; + case WM_RBUTTONDBLCLK: + case WM_RBUTTONDOWN: + break; + case WM_MOUSEMOVE: + break; - case WM_COMMAND: - switch(HIWORD(wParam)) { - case BN_CLICKED: - switch(LOWORD(wParam)) { - case IDC_MEMVIEWFIND_TYPE_HEX : - FindAsText=0; - break; - case IDC_MEMVIEWFIND_TYPE_TEXT : - FindAsText=1; - break; + case WM_COMMAND: + switch(HIWORD(wParam)) { + case BN_CLICKED: + switch(LOWORD(wParam)) + { + case IDC_MEMVIEWFIND_TYPE_HEX : + FindAsText=0; + break; + case IDC_MEMVIEWFIND_TYPE_TEXT : + FindAsText=1; + break; - case IDC_MEMVIEWFIND_DIR_UP : - FindDirectionUp = 1; - break; - case IDC_MEMVIEWFIND_DIR_DOWN : - FindDirectionUp = 0; - break; - case IDC_MEMVIEWFIND_NEXT : - FindNext(); - break; + case IDC_MEMVIEWFIND_DIR_UP : + FindDirectionUp = 1; + break; + case IDC_MEMVIEWFIND_DIR_DOWN : + FindDirectionUp = 0; + break; + case IDC_MEMVIEWFIND_NEXT : + FindNext(); + break; + } + break; } break; - } - break; - case WM_HSCROLL: - break; - } + case WM_HSCROLL: + break; + } return FALSE; } void FindNext(){ @@ -2949,7 +3042,7 @@ void PalettePoke(uint32 addr, uint8 data) } } -INT_PTR CALLBACK importBookmarkCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK ImportBookmarkCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { static int* tmpImportBookmarkProps; @@ -3128,7 +3221,6 @@ INT_PTR CALLBACK importBookmarkCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA return FALSE; } - void SwitchEditingText(int editingText) { if (EditingText != editingText) { @@ -3147,4 +3239,71 @@ void SwitchEditingText(int editingText) { } EditingText = editingText; } +} + +bool ChangeColor(HWND hwnd, COLORMENU* item) +{ + int backup = RGB(*item->r, *item->g, *item->b); + CHOOSECOLOR choose; + memset(&choose, 0, sizeof(CHOOSECOLOR)); + choose.lStructSize = sizeof(CHOOSECOLOR); + choose.hwndOwner = hwnd; + choose.rgbResult = backup; + choose.lpCustColors = custom_color; + choose.Flags = CC_RGBINIT | CC_FULLOPEN | CC_ANYCOLOR; + if (ChooseColor(&choose) && choose.rgbResult != backup) + { + *item->r = GetRValue(choose.rgbResult); + *item->g = GetGValue(choose.rgbResult); + *item->b = GetBValue(choose.rgbResult); + return true; + } + return false; + +} + + +BOOL OpColorMenu(HWND hwnd, HMENU menu, COLORMENU* item, int pos, int id, BOOL (WINAPI *opMenu)(HMENU hmenu, UINT item, BOOL byPos, LPCMENUITEMINFO info)) +{ + + MENUITEMINFO info; + memset(&info, 0, sizeof(MENUITEMINFO)); + info.cbSize = sizeof(MENUITEMINFO); + + if (item->text) + { + HDC hdc = GetDC(hwnd); + HDC memdc = CreateCompatibleDC(hdc); + + int width = GetSystemMetrics(SM_CXMENUCHECK); + int height = GetSystemMetrics(SM_CYMENUCHECK); + + if (!item->bitmap) + item->bitmap = CreateCompatibleBitmap(hdc, width, height); + SelectObject(memdc, item->bitmap); + HBRUSH brush = CreateSolidBrush(RGB(*item->r, *item->g, *item->b)); + RECT rect = { 1, 1, width - 1, height - 1}; + FillRect(memdc, &rect, brush); + DeleteObject(brush); + DeleteDC(memdc); + ReleaseDC(hwnd, hdc); + + char menu_str[64]; + sprintf(menu_str, "%s\t#%02X%02X%02X", item->text, *item->r, *item->g, *item->b); + + info.dwTypeData = menu_str; + info.cch = strlen(menu_str); + info.hbmpUnchecked = item->bitmap; + info.wID = id; + + info.fMask = MIIM_ID | MIIM_TYPE | MIIM_CHECKMARKS; + info.fType = MFT_STRING; + } + else + { + info.fMask = MIIM_TYPE; + info.fType = MFT_SEPARATOR; + } + + return opMenu(menu, pos, TRUE, &info); } \ No newline at end of file diff --git a/src/drivers/win/memview.h b/src/drivers/win/memview.h index 0592e2f5..d943744f 100644 --- a/src/drivers/win/memview.h +++ b/src/drivers/win/memview.h @@ -1,6 +1,7 @@ #ifndef MEMVIEW_H #define MEMVIEW_H + void DoMemView(); void KillMemView(); void UpdateMemoryView(int draw_all); @@ -20,4 +21,15 @@ extern int EditingMode; extern char* EditString[4]; +struct COLORMENU { + char* text; + HBITMAP bitmap; + int *r, *g, *b; +}; +bool ChangeColor(HWND hwnd, COLORMENU* item); +BOOL OpColorMenu(HWND hwnd, HMENU menu, COLORMENU* item, int pos, int id, BOOL (WINAPI *opMenu)(HMENU hmenu, UINT item, BOOL byPos, LPCMENUITEMINFO info)); +#define InsertColorMenu(hwnd, menu, item, pos, id) OpColorMenu(hwnd, menu, item, pos, id, InsertMenuItem) +#define ModifyColorMenu(hwnd, menu, item, pos, id) OpColorMenu(hwnd, menu, item, pos, id, SetMenuItemInfo) +#define GetHexColorMenu(hwnd) (GetSubMenu(GetSubMenu(GetMenu(hwnd), HIGHLIGHTING_SUBMENU_POS), HEXEDITOR_COLOR_SUBMENU_POS)) +#define GetCdlColorMenu(hwnd) (GetSubMenu(GetSubMenu(GetMenu(hwnd), HIGHLIGHTING_SUBMENU_POS), CDLOGGER_COLOR_SUBMENU_POS)) #endif \ No newline at end of file diff --git a/src/drivers/win/ram_search.cpp b/src/drivers/win/ram_search.cpp index 823ccb65..6b64b901 100644 --- a/src/drivers/win/ram_search.cpp +++ b/src/drivers/win/ram_search.cpp @@ -1098,40 +1098,6 @@ void ResetResults() if (RamSearchHWnd) ListView_SetItemCount(GetDlgItem(RamSearchHWnd,IDC_RAMLIST),ResultCount); } -void CloseRamWindows() //Close the Ram Search & Watch windows when rom closes -{ - ResetWatches(); - ResetResults(); - if (RamSearchHWnd) - SendMessage(RamSearchHWnd,WM_CLOSE,NULL,NULL); - if (RamWatchHWnd) - SendMessage(RamWatchHWnd,WM_CLOSE,NULL,NULL); -} -void ReopenRamWindows() //Reopen them when a new Rom is loaded -{ - HWND hwnd = GetActiveWindow(); - - if(!RamSearchHWnd) - { - reset_address_info(); - INT_PTR CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); - RamSearchHWnd = CreateDialog(hInst, MAKEINTRESOURCE(IDD_RAMSEARCH), hWnd, RamSearchProc); - } - - if (AutoRWLoad) - OpenRWRecentFile(0); - - if (!RamWatchHWnd) - RamWatchHWnd = CreateDialog(hInst, MAKEINTRESOURCE(IDD_RAMWATCH), hWnd, RamWatchProc); - - if (hwnd == hWnd && hwnd != GetActiveWindow()) - SetActiveWindow(hWnd); // restore focus to the main window if it had it before -} - - - - - void RefreshRamListSelectedCountControlStatus(HWND hDlg) { diff --git a/src/drivers/win/ram_search.h b/src/drivers/win/ram_search.h index d3c96b36..2171783a 100644 --- a/src/drivers/win/ram_search.h +++ b/src/drivers/win/ram_search.h @@ -21,8 +21,6 @@ extern int curr_ram_size; extern bool noMisalign; void ResetResults(); -void CloseRamWindows(); //Close the Ram Search & Watch windows when rom closes -void ReopenRamWindows(); //Reopen them when a new Rom is loaded void Update_RAM_Search(); //keeps RAM values up to date in the search and watch windows void SetSearchType(int SearchType); //Set the search type diff --git a/src/drivers/win/ramwatch.cpp b/src/drivers/win/ramwatch.cpp index c8b78554..60a73af1 100644 --- a/src/drivers/win/ramwatch.cpp +++ b/src/drivers/win/ramwatch.cpp @@ -54,7 +54,7 @@ int SeparatorCache::sepOffY = 0; std::map separatorCache; HWND RamWatchHWnd; -#define gamefilename GetRomName() +#define gamefilename GetRomName().c_str() #define hWnd hAppWnd #define hInst fceu_hInstance // static char Str_Tmp [1024]; @@ -367,8 +367,9 @@ void RWAddRecentFile(const char *filename) void OpenRWRecentFile(int memwRFileNumber) { - if(!ResetWatches()) + if (!AskSaveRamWatch()) return; + ResetWatches(); int rnum = memwRFileNumber; if ((unsigned int)rnum >= MAX_RECENT_WATCHES) @@ -670,8 +671,6 @@ bool Load_Watches(bool clear) bool ResetWatches() { - if(!AskSaveRamWatch()) - return false; for (;WatchCount >= 0; WatchCount--) { free(rswatches[WatchCount].comment); @@ -1334,6 +1333,8 @@ INT_PTR CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam case RAMMENU_FILE_APPEND: return Load_Watches(false); case RAMMENU_FILE_NEW: + if (!AskSaveRamWatch()) + return true; ResetWatches(); return true; case IDC_C_WATCH_REMOVE: diff --git a/src/drivers/win/res.rc b/src/drivers/win/res.rc index 4790528b..bb107211 100644 --- a/src/drivers/win/res.rc +++ b/src/drivers/win/res.rc @@ -12,7 +12,7 @@ #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// -// Ó¢Óï(ÃÀ¹ú) resources +// English (U.S.) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US @@ -63,7 +63,7 @@ BEGIN END DIRCONFIG DIALOGEX 63, 7, 305, 255 -STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Directories Configuration" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN @@ -107,20 +107,20 @@ BEGIN PUSHBUTTON "Cancel",BTN_CANCEL,239,230,56,14 END -DWBDIALOG DIALOG 33, 99, 250, 56 -STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +DWBDIALOG DIALOGEX 33, 99, 250, 56 +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "DWB!" -FONT 8, "MS Shell Dlg" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Text",LBL_DWBDIALOG_TEXT,7,9,237,8 PUSHBUTTON "Clear",BTN_CLEAR,64,32,50,14 PUSHBUTTON "Close",BTN_CLOSE,188,33,50,14 END -FKBDIALOG DIALOG 13, 72, 402, 194 -STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +FKBDIALOG DIALOGEX 13, 72, 402, 194 +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Family Keyboard Configuration" -FONT 8, "MS Shell Dlg" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN DEFPUSHBUTTON "Close",BTN_CLOSE,320,170,56,14 LTEXT "Remember to push the ""Scroll Lock"" key during emulation to enable Family Keyboard input.",65503,18,6,370,12 @@ -200,7 +200,7 @@ BEGIN END GAMEPADDIALOG DIALOGEX 4, 109, 243, 220 -STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Gamepad Configuration" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN @@ -230,7 +230,7 @@ BEGIN END GUICONFIG DIALOGEX 16, 123, 184, 158 -STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "GUI Configuration" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN @@ -299,10 +299,10 @@ BEGIN "Button",BS_AUTOCHECKBOX,174,18,142,12 END -MAHJONGDIALOG DIALOG 65510, 106, 340, 110 -STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +MAHJONGDIALOG DIALOGEX 65510, 106, 340, 110 +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "mahjong" -FONT 8, "MS Shell Dlg" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN GROUPBOX "",321,8,8,324,73,WS_GROUP PUSHBUTTON "A",300,14,42,16,12 @@ -330,7 +330,7 @@ BEGIN END MAPINPUT DIALOGEX 0, 0, 318, 294 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Hotkeys" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN @@ -353,7 +353,7 @@ BEGIN END NETMOO DIALOGEX 44, 59, 365, 209 -STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Network Play" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN @@ -375,7 +375,7 @@ BEGIN END NEWINPUT DIALOGEX 0, 0, 186, 66 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Enter New Input" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN @@ -385,7 +385,7 @@ BEGIN END PALCONFIG DIALOGEX 16, 81, 228, 217 -STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Palette Configuration" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN @@ -416,10 +416,10 @@ BEGIN DEFPUSHBUTTON "Close",BUTTON_CLOSE,162,195,56,14 END -POWERPADDIALOG DIALOG 30, 123, 131, 119 -STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +POWERPADDIALOG DIALOGEX 30, 123, 131, 119 +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Power Pad Configuration" -FONT 8, "MS Shell Dlg" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN DEFPUSHBUTTON "Close",BTN_CLOSE,34,95,56,14 GROUPBOX "",312,8,10,114,74,WS_GROUP @@ -438,7 +438,7 @@ BEGIN END VIRTUALBOYDIALOG DIALOGEX 4, 109, 243, 121 -STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Virtual Boy Configuration" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN @@ -471,10 +471,10 @@ BEGIN PUSHBUTTON "Light Sensor",301,14,19,98,12 END -QUIZKINGDIALOG DIALOG 30, 123, 160, 74 -STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +QUIZKINGDIALOG DIALOGEX 30, 123, 160, 74 +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "quiz king" -FONT 8, "MS Shell Dlg" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN DEFPUSHBUTTON "Close",BTN_CLOSE,54,56,56,14 GROUPBOX "Buzzers",312,8,7,144,39,WS_GROUP @@ -487,7 +487,7 @@ BEGIN END SOUNDCONFIG DIALOGEX 8, 95, 334, 282 -STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Sound Configuration" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN @@ -530,7 +530,7 @@ BEGIN END SUBORKBDIALOG DIALOGEX 13, 72, 478, 171 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Subor Keyboard Configuration" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN @@ -658,7 +658,7 @@ BEGIN END MOVIEOPTIONS DIALOGEX 65520, 76, 147, 222 -STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Movie Options" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN @@ -685,7 +685,7 @@ BEGIN END DWBDIALOGSIMPLE DIALOGEX 33, 99, 250, 39 -STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "DWBS!" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN @@ -693,7 +693,7 @@ BEGIN END MEMWATCH DIALOGEX 0, 0, 261, 270 -STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_ACCEPTFILES CAPTION "Memory Watch" MENU MEMWATCHMENU @@ -784,87 +784,87 @@ BEGIN PUSHBUTTON "<",MEMW_EXPANDCOLLAPSE,1,259,11,10 END -DEBUGGER DIALOGEX 54, 74, 546, 334 -STYLE DS_SETFONT | DS_3DLOOK | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME +DEBUGGER DIALOGEX 54, 74, 557, 334 +STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME CAPTION "6502 Debugger" +MENU DEBUGGERMENU FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - CONTROL "",IDC_DEBUGGER_DISASSEMBLY,"RichEdit20A",ES_MULTILINE | ES_NOHIDESEL | ES_READONLY | WS_BORDER | WS_HSCROLL,18,5,316,317 - SCROLLBAR IDC_DEBUGGER_DISASSEMBLY_VSCR,334,5,11,317,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 - CONTROL "U",IDC_DEBUGGER_FLAG_U,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,491,149,18,12 - CONTROL "B",IDC_DEBUGGER_FLAG_B,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,516,149,18,12 - CONTROL "D",IDC_DEBUGGER_FLAG_D,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,440,161,18,12 - CONTROL "I",IDC_DEBUGGER_FLAG_I,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,466,161,18,12 - CONTROL "Z",IDC_DEBUGGER_FLAG_Z,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,491,161,18,12 - CONTROL "C",IDC_DEBUGGER_FLAG_C,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,516,161,18,12 - GROUPBOX "Breakpoints",IDC_DEBUGGER_BREAKPOINTS,434,2,106,138,WS_TABSTOP - LISTBOX IDC_DEBUGGER_BP_LIST,438,11,98,96,LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL - PUSHBUTTON "Add",IDC_DEBUGGER_BP_ADD,438,109,31,15 - PUSHBUTTON "Delete",IDC_DEBUGGER_BP_DEL,472,109,31,15,WS_DISABLED - PUSHBUTTON "Edit",IDC_DEBUGGER_BP_EDIT,505,109,31,15,WS_DISABLED + CONTROL "",IDC_DEBUGGER_DISASSEMBLY,"RichEdit20A",ES_MULTILINE | ES_NOHIDESEL | ES_READONLY | WS_BORDER | WS_HSCROLL,18,5,316,312 + SCROLLBAR IDC_DEBUGGER_DISASSEMBLY_VSCR,334,5,11,312,SBS_VERT PUSHBUTTON "Run",IDC_DEBUGGER_RUN,351,5,38,14 PUSHBUTTON "Step Into",IDC_DEBUGGER_STEP_IN,392,5,39,14 PUSHBUTTON "Step Out",IDC_DEBUGGER_STEP_OUT,351,21,38,14 PUSHBUTTON "Step Over",IDC_DEBUGGER_STEP_OVER,392,21,39,14 - LTEXT "A:",IDC_STATIC,351,92,9,8 - LTEXT "X:",65534,378,92,9,8 - LTEXT "Y:",65533,406,92,9,8 - LTEXT "PC:",65532,349,74,13,8 - EDITTEXT IDC_DEBUGGER_VAL_A,359,90,15,12,ES_UPPERCASE | ES_WANTRETURN - EDITTEXT IDC_DEBUGGER_VAL_X,387,90,15,12,ES_UPPERCASE | ES_WANTRETURN - EDITTEXT IDC_DEBUGGER_VAL_Y,415,90,15,12,ES_UPPERCASE | ES_WANTRETURN - EDITTEXT IDC_DEBUGGER_VAL_PC,361,72,27,12,ES_UPPERCASE | ES_WANTRETURN - GROUPBOX "Stack",IDC_DEBUGGER_VAL_S,349,104,81,71,WS_TABSTOP - EDITTEXT IDC_DEBUGGER_STACK_CONTENTS,353,113,73,58,ES_MULTILINE | ES_UPPERCASE | ES_NOHIDESEL | ES_READONLY | WS_VSCROLL - PUSHBUTTON "Seek PC",IDC_DEBUGGER_SEEK_PC,392,71,39,14 - PUSHBUTTON "Seek To:",IDC_DEBUGGER_SEEK_TO,351,54,38,14 - EDITTEXT IDC_DEBUGGER_VAL_PCSEEK,392,55,38,12,ES_UPPERCASE | ES_WANTRETURN - LTEXT "PPU:",65531,353,179,17,10 - LTEXT "Sprite:",65530,353,191,20,10 - LTEXT "Scanline:",IDC_STATIC,353,203,31,8 - LTEXT "Pixel:",IDC_STATIC,353,216,17,8 - EDITTEXT IDC_DEBUGGER_VAL_PPU,372,179,25,12,ES_UPPERCASE | ES_READONLY | ES_WANTRETURN | NOT WS_BORDER,WS_EX_TRANSPARENT - EDITTEXT IDC_DEBUGGER_VAL_SPR,375,191,15,12,ES_UPPERCASE | ES_READONLY | ES_WANTRETURN | NOT WS_BORDER,WS_EX_TRANSPARENT - EDITTEXT IDC_DEBUGGER_VAL_SLINE,384,203,14,12,ES_UPPERCASE | ES_READONLY | ES_WANTRETURN | NOT WS_BORDER,WS_EX_TRANSPARENT - EDITTEXT IDC_DEBUGGER_VAL_PPUPIXEL,373,216,14,12,ES_UPPERCASE | ES_READONLY | ES_WANTRETURN | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_TRANSPARENT - GROUPBOX "",IDC_DEBUGGER_VAL_S2,349,174,51,53,WS_TABSTOP - EDITTEXT IDC_DEBUGGER_VAL_CYCLES_COUNT,443,179,47,12,ES_NOHIDESEL | ES_READONLY | ES_WANTRETURN | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_TRANSPARENT - 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,323,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 - PUSHBUTTON "Reload Symbols",IDC_DEBUGGER_RELOAD_SYMS,472,283,64,14 - GROUPBOX "Address Bookmarks",45535,349,228,115,88 - LISTBOX LIST_DEBUGGER_BOOKMARKS,353,238,76,73,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_DEBUGGER_BOOKMARK,432,238,28,14,ES_AUTOHSCROLL - 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 "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,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 - EDITTEXT IDC_DEBUGGER_CYCLES_EXCEED,484,190,55,12,ES_UPPERCASE | ES_NOHIDESEL | ES_WANTRETURN | ES_NUMBER - LTEXT "Instructions:",IDC_STATIC,403,204,39,8 + PUSHBUTTON "Seek To:",IDC_DEBUGGER_SEEK_TO,351,54,38,14 + EDITTEXT IDC_DEBUGGER_VAL_PCSEEK,392,55,38,12,ES_UPPERCASE | ES_WANTRETURN + LTEXT "PC:",IDC_DEBUGGER_TEXT_PC,349,74,13,8 + EDITTEXT IDC_DEBUGGER_VAL_PC,361,72,27,12,ES_UPPERCASE | ES_WANTRETURN + PUSHBUTTON "Seek PC",IDC_DEBUGGER_SEEK_PC,392,71,39,14 + LTEXT "A:",IDC_DEBUGGER_TEXT_A,351,92,9,8 + EDITTEXT IDC_DEBUGGER_VAL_A,359,90,15,12,ES_UPPERCASE | ES_WANTRETURN + LTEXT "X:",IDC_DEBUGGER_TEXT_X,378,92,9,8 + EDITTEXT IDC_DEBUGGER_VAL_X,387,90,15,12,ES_UPPERCASE | ES_WANTRETURN + LTEXT "Y:",IDC_DEBUGGER_TEXT_Y,406,92,9,8 + EDITTEXT IDC_DEBUGGER_VAL_Y,415,90,15,12,ES_UPPERCASE | ES_WANTRETURN + GROUPBOX "Breakpoints",IDC_DEBUGGER_BREAKPOINTS,434,2,116,138,WS_TABSTOP + LISTBOX IDC_DEBUGGER_BP_LIST,438,11,107,96,LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL + PUSHBUTTON "Add",IDC_DEBUGGER_BP_ADD,438,109,31,15 + PUSHBUTTON "Delete",IDC_DEBUGGER_BP_DEL,476,109,31,15,WS_DISABLED + PUSHBUTTON "Edit",IDC_DEBUGGER_BP_EDIT,515,109,31,15,WS_DISABLED + CONTROL "Break on Bad Opcodes",IDC_DEBUGGER_BREAK_ON_BAD_OP, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,440,126,94,10 + GROUPBOX "Stack",IDC_DEBUGGER_VAL_S,349,104,81,71,WS_TABSTOP + EDITTEXT IDC_DEBUGGER_STACK_CONTENTS,353,113,73,58,ES_MULTILINE | ES_UPPERCASE | ES_NOHIDESEL | ES_READONLY | WS_VSCROLL + GROUPBOX "Status Flags",IDC_DEBUGGER_STATUSFLAGS,434,140,116,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,471,149,18,12 + CONTROL "U",IDC_DEBUGGER_FLAG_U,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,500,149,18,12 + CONTROL "B",IDC_DEBUGGER_FLAG_B,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,528,149,18,12 + CONTROL "D",IDC_DEBUGGER_FLAG_D,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,440,161,18,12 + CONTROL "I",IDC_DEBUGGER_FLAG_I,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,471,161,18,12 + CONTROL "Z",IDC_DEBUGGER_FLAG_Z,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,500,161,18,12 + CONTROL "C",IDC_DEBUGGER_FLAG_C,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,528,161,18,12 + GROUPBOX "",IDC_DEBUGGER_VAL_S2,349,174,55,53,WS_TABSTOP + LTEXT "PPU:",IDC_DEBUGGER_TEXT_PPU,352,180,16,8 + EDITTEXT IDC_DEBUGGER_VAL_PPU,371,180,28,12,ES_UPPERCASE | ES_READONLY | ES_WANTRETURN | NOT WS_BORDER,WS_EX_TRANSPARENT + LTEXT "Sprite:",IDC_DEBUGGER_TEXT_SPR,352,192,23,8 + EDITTEXT IDC_DEBUGGER_VAL_SPR,376,192,23,12,ES_UPPERCASE | ES_READONLY | ES_WANTRETURN | NOT WS_BORDER,WS_EX_TRANSPARENT + LTEXT "Scanline:",IDC_DEBUGGER_TEXT_SLINE,352,204,31,8 + EDITTEXT IDC_DEBUGGER_VAL_SLINE,384,204,15,12,ES_UPPERCASE | ES_READONLY | ES_WANTRETURN | NOT WS_BORDER,WS_EX_TRANSPARENT + LTEXT "Pixel:",IDC_DEBUGGER_TEXT_PPUPIXEL,352,217,19,8 + EDITTEXT IDC_DEBUGGER_VAL_PPUPIXEL,373,217,26,12,ES_UPPERCASE | ES_READONLY | ES_WANTRETURN | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_TRANSPARENT + LTEXT "CPU Cycles:",IDC_DEBUGGER_TEXT_CYCLES_COUNT,407,179,40,8 + EDITTEXT IDC_DEBUGGER_VAL_CYCLES_COUNT,450,179,47,12,ES_NOHIDESEL | ES_READONLY | ES_WANTRETURN | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_TRANSPARENT + EDITTEXT IDC_DEBUGGER_VAL_CYCLES_COUNT2,501,179,54,12,ES_READONLY | ES_WANTRETURN | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_TRANSPARENT + CONTROL "Break when exceed",IDC_DEBUGGER_BREAK_ON_CYCLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,418,191,78,10 + EDITTEXT IDC_DEBUGGER_CYCLES_EXCEED,497,190,55,12,ES_UPPERCASE | ES_NOHIDESEL | ES_WANTRETURN | ES_NUMBER + LTEXT "Instructions:",IDC_DEBUGGER_TEXT_INSTRUCTIONS_COUNT,405,204,43,8 + EDITTEXT IDC_DEBUGGER_VAL_INSTRUCTIONS_COUNT,449,204,47,12,ES_NOHIDESEL | ES_READONLY | ES_WANTRETURN | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_TRANSPARENT + EDITTEXT IDC_DEBUGGER_VAL_INSTRUCTIONS_COUNT2,500,204,55,12,ES_READONLY | ES_WANTRETURN | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_TRANSPARENT CONTROL "Break when exceed",IDC_DEBUGGER_BREAK_ON_INSTRUCTIONS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,405,216,78,10 - EDITTEXT IDC_DEBUGGER_INSTRUCTIONS_EXCEED,484,215,55,12,ES_UPPERCASE | ES_NOHIDESEL | ES_WANTRETURN | ES_NUMBER - GROUPBOX "",IDC_STATIC,468,241,72,75 - CONTROL "ROM offsets",IDC_DEBUGGER_ROM_OFFSETS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,473,249,62,10 - PUSHBUTTON "Edit",IDC_DEBUGGER_BOOKMARK_EDIT,431,288,30,14 - EDITTEXT IDC_DEBUGGER_DISASSEMBLY_LEFT_PANEL,4,5,14,317,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,506,319,38,13 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,418,216,78,10 + EDITTEXT IDC_DEBUGGER_INSTRUCTIONS_EXCEED,497,215,55,12,ES_UPPERCASE | ES_NOHIDESEL | ES_WANTRETURN | ES_NUMBER + GROUPBOX "Address Bookmarks",IDC_DEBUGGER_BOOKMARKS,349,228,121,88 + LISTBOX LIST_DEBUGGER_BOOKMARKS,354,238,78,73,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_DEBUGGER_BOOKMARK,437,238,28,14,ES_AUTOHSCROLL + PUSHBUTTON "Add",IDC_DEBUGGER_BOOKMARK_ADD,436,256,30,14 + PUSHBUTTON "Delete",IDC_DEBUGGER_BOOKMARK_DEL,436,273,30,14 + PUSHBUTTON "Edit",IDC_DEBUGGER_BOOKMARK_EDIT,436,290,30,14 + PUSHBUTTON "Reset counters",IDC_DEBUGGER_RESET_COUNTERS,479,229,68,14 + GROUPBOX "",IDC_DEBUGGER_VAL_S3,474,241,77,75 + CONTROL "ROM offsets",IDC_DEBUGGER_ROM_OFFSETS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,479,249,62,10 + CONTROL "Symbolic debug",IDC_DEBUGGER_ENABLE_SYMBOLIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,479,261,62,10 + CONTROL "Register names",IDC_DEBUGGER_PREDEFINED_REGS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,479,272,65,10 + PUSHBUTTON "Reload Symbols",IDC_DEBUGGER_RELOAD_SYMS,480,283,64,14 + PUSHBUTTON "Rom Patcher",IDC_DEBUGGER_ROM_PATCHER,480,299,64,14 + CONTROL "",IDC_DEBUGGER_ADDR_LINE,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,4,319,341,11 + EDITTEXT IDC_DEBUGGER_DISASSEMBLY_LEFT_PANEL,4,5,14,312,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | WS_DISABLED + CONTROL "Auto open on ROM load",DEBUGAUTOLOAD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,361,319,90,10 + CONTROL "Load .DEB file",DEBUGLOADDEB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,455,319,58,10 + CONTROL "IDA font",DEBUGIDAFONT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,514,319,42,10 END TRACER DIALOGEX 0, 0, 317, 181 @@ -961,7 +961,7 @@ BEGIN END ROMPATCHER DIALOGEX 84, 67, 304, 135 -STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Rom Data Editor" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN @@ -980,7 +980,7 @@ BEGIN END GGCONV DIALOGEX 84, 67, 186, 146 -STYLE DS_SYSMODAL | DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +STYLE DS_SYSMODAL | DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Game Genie Encoder/Decoder Tool" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN @@ -1351,7 +1351,7 @@ BEGIN END PPUVIEW DIALOGEX 44, 38, 353, 234 -STYLE DS_SETFONT | DS_MODALFRAME | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "PPU Viewer" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN @@ -1644,7 +1644,7 @@ BEGIN END DLG_SNESPAD DIALOGEX 4, 109, 243, 121 -STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Gamepad Configuration" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN @@ -1864,6 +1864,14 @@ BEGIN BEGIN END + "MAPINPUT", DIALOG + BEGIN + END + + "MESSAGELOG", DIALOG + BEGIN + END + "NETMOO", DIALOG BEGIN LEFTMARGIN, 10 @@ -1872,6 +1880,10 @@ BEGIN BOTTOMMARGIN, 201 END + "NEWINPUT", DIALOG + BEGIN + END + "PALCONFIG", DIALOG BEGIN LEFTMARGIN, 10 @@ -1936,6 +1948,7 @@ BEGIN "DEBUGGER", DIALOG BEGIN + RIGHTMARGIN, 555 BOTTOMMARGIN, 332 END @@ -2231,6 +2244,111 @@ BEGIN 0 END +DEBUGGER AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +DIRCONFIG AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +DWBDIALOG AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +DWBDIALOGSIMPLE AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +FKBDIALOG AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +GAMEPADDIALOG AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +GUICONFIG AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +IDD_RECORDINP AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +MAHJONGDIALOG AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +MAPINPUT AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +MOVIEOPTIONS AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +NETMOO AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +NEWINPUT AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +PALCONFIG AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +POWERPADDIALOG AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +PPUVIEW AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +QUIZKINGDIALOG AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +SOUNDCONFIG AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +SUBORKBDIALOG AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +VIRTUALBOYDIALOG AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +DLG_SNESPAD AFX_DIALOG_LAYOUT +BEGIN + 0 +END + #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// @@ -2626,6 +2744,17 @@ BEGIN MENUITEM "Highlight Activity", ID_HIGHLIGHTING_HIGHLIGHT_ACTIVITY MENUITEM "Set fading period...", ID_HIGHLIGHTING_SETFADINGPERIOD MENUITEM "Fade when paused", ID_HIGHLIGHTING_FADEWHENPAUSED + MENUITEM SEPARATOR + POPUP "Hex Editor colors" + BEGIN + MENUITEM SEPARATOR + MENUITEM "Restore defaults", ID_HEXEDITOR_DEFCOLOR + END + POPUP "Code / Data Logger colors" + BEGIN + MENUITEM SEPARATOR + MENUITEM "Restore defaults", ID_CDLOGGER_DEFCOLOR + END END POPUP "&Bookmarks" BEGIN @@ -2917,6 +3046,15 @@ BEGIN END END +DEBUGGERMENU MENU +BEGIN + POPUP "Syntax highlight" + BEGIN + MENUITEM SEPARATOR + MENUITEM "Restore default", ID_DEBUGGER_DEFCOLOR + END +END + ///////////////////////////////////////////////////////////////////////////// // @@ -3088,7 +3226,7 @@ IDB_BITMAP_SELECTED17 BITMAP "res\\te_17_selected.bmp" IDB_BITMAP_SELECTED18 BITMAP "res\\te_18_selected.bmp" IDB_BITMAP_SELECTED19 BITMAP "res\\te_19_selected.bmp" IDB_BRANCH_SPRITESHEET BITMAP "res\\branch_spritesheet.bmp" -#endif // Ó¢Óï(ÃÀ¹ú) resources +#endif // English (U.S.) resources ///////////////////////////////////////////////////////////////////////////// diff --git a/src/drivers/win/resource.h b/src/drivers/win/resource.h index 7c5d6080..d30454d1 100644 --- a/src/drivers/win/resource.h +++ b/src/drivers/win/resource.h @@ -418,6 +418,7 @@ #define IDC_DEBUGGER_VAL_SPR 311 #define IDC_BTN_CHEAT_ADDFROMFILE 311 #define IDC_DEBUGGER_BOOKMARK 312 +#define DEBUGGERMENU 312 #define IDC_DEBUGGER_CYCLES_EXCEED 313 #define IDC_DEBUGGER_INSTRUCTIONS_EXCEED 314 #define MENU_DIRECTORIES 320 @@ -431,6 +432,7 @@ #define IDC_CHEAT_CHECK_NE_BY 401 #define IDC_WINSIZE_MUL_Y 401 #define CHECK_ENABLE_FOURSCORE 401 +#define IDC_DEBUGGER_STATUSFLAGS 401 #define IDC_CHEAT_CHECK_GT_BY 402 #define IDC_FORCE_INT_VIDEO_SCALARS 402 #define IDC_DEBUGGER_BREAKPOINTS 402 @@ -592,14 +594,20 @@ #define MW_ADDR14 1043 #define IDC_SYSTEM_EXTEND_COMBO 1043 #define MW_VAL14 1044 +#define IDC_DEBUGGER_TEXT_SLINE 1044 #define MW_NAME15 1045 +#define IDC_DEBUGGER_TEXT_PPUPIXEL 1045 #define MW_ADDR15 1046 #define IDC_VS_SYSTEM_COMBO 1046 +#define IDC_DEBUGGER_TEXT_CYCLES_COUNT 1046 #define IDC_VS_PPU_COMBO 1047 #define MW_VAL15 1047 +#define IDC_DEBUGGER_TEXT_INSTRUCTIONS_COUNT 1047 #define MW_NAME16 1048 +#define IDC_DEBUGGER_VAL_S3 1048 #define MW_ADDR16 1049 #define IDC_MAPPER_TEXT 1049 +#define IDC_DEBUGGER_TEXT_A 1049 #define IDC_SUBMAPPER_TEXT 1050 #define MW_VAL16 1050 #define IDC_PRGROM_TEXT 1051 @@ -751,7 +759,6 @@ #define MEMW_EDIT01RMADDRESS 1189 #define MEMW_EDIT02RMADDRESS 1190 #define MEMW_EDIT03RMADDRESS 1191 -#define IDC_DEBUGGER_RESTORESIZE 1191 #define IDC_MOVIE_CLOSE 1192 #define EDIT00_RESULTS 1193 #define IDC_MOVIE_PAUSEAFTERPLAYBACK 1193 @@ -914,6 +921,9 @@ #define ID_BOOKMARKS_SAVEAS 40006 #define ID_BOOKMARKS_OPTION 40007 #define ID_BOOKMARKS_EXPORT 40008 +#define ID_HEXEDITOR_DEFCOLOR 40009 +#define ID_CDLOGGER_DEFCOLOR 40010 +#define ID_DEBUGGER_DEFCOLOR 40011 #define MENU_NETWORK 40040 #define MENU_PALETTE 40041 #define MENU_SOUND 40042 @@ -1197,21 +1207,27 @@ #define CHEAT_CONTEXT_POSSI_ADDTOMEMORYWATCH 40600 #define CHEAT_CONTEXT_POSSI_ADDCHEAT 40601 #define CHEAT_CONTEXT_POSSI_ADDTORAMWATCH 40603 +#define IDC_DEBUGGER_BOOKMARKS 45535 #define MW_VALUELABEL2 65423 #define MW_VALUELABEL1 65426 #define IDC_STATIC_SLASHTEXT 65442 +#define IDC_DEBUGGER_TEXT_SPR 65530 +#define IDC_DEBUGGER_TEXT_PPU 65531 #define IDC_BOOKMARK_NAME_TEXT 65532 +#define IDC_DEBUGGER_TEXT_PC 65532 #define IDC_BOOKMARK_ADDRESS_TEXT 65533 +#define IDC_DEBUGGER_TEXT_Y 65533 #define IDC_NTVIEW_SCANLINE_TEXT 65534 #define IDC_BOOKMARK_SHORTCUT_PREFIX_TEXT 65534 +#define IDC_DEBUGGER_TEXT_X 65534 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 312 -#define _APS_NEXT_COMMAND_VALUE 40009 -#define _APS_NEXT_CONTROL_VALUE 1043 +#define _APS_NEXT_RESOURCE_VALUE 313 +#define _APS_NEXT_COMMAND_VALUE 40012 +#define _APS_NEXT_CONTROL_VALUE 1050 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/src/drivers/win/taseditor/piano_roll.cpp b/src/drivers/win/taseditor/piano_roll.cpp index 91261bee..f260924f 100644 --- a/src/drivers/win/taseditor/piano_roll.cpp +++ b/src/drivers/win/taseditor/piano_roll.cpp @@ -426,6 +426,11 @@ void PIANO_ROLL::free() ImageList_Destroy(hImgList); hImgList = 0; } + if (hrMenu) + { + DestroyMenu(hrMenu); + hrMenu = 0; + } headerColors.resize(0); } void PIANO_ROLL::reset()