From cd13ee29f7d714fd96433bf9bcbc8019b26f4be2 Mon Sep 17 00:00:00 2001 From: warmCabin Date: Mon, 28 Jun 2021 06:29:57 -0400 Subject: [PATCH] revive that "dead" EN_CHANGE code in a new callback I have absolutely no idea how the old version ever worked! Seriously, it makes no sense. It checked if the HIWORD of wParam equaled EN_CHANGE even though it was in a BN_CLICKED case...but it still got the events. This implies that BN_CLICKED == EN_CHANGE, but 0 very much does not equal 0x300. --- src/drivers/win/debugger.cpp | 43 ++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/src/drivers/win/debugger.cpp b/src/drivers/win/debugger.cpp index 0aed2a2d..4e03bc95 100644 --- a/src/drivers/win/debugger.cpp +++ b/src/drivers/win/debugger.cpp @@ -1831,30 +1831,6 @@ void DebuggerBnClicked(HWND hwndDlg, uint16 btnId, HWND hwndBtn) SendDlgItemMessage(hwndDlg, IDC_DEBUGGER_DISASSEMBLY, WM_SETFONT, (WPARAM)debugSystem->hDisasmFont, FALSE); UpdateDebugger(false); break; - case IDC_DEBUGGER_CYCLES_EXCEED: - { - // Pretty sure this was dead code. BN_CLICKED is not equal to EN_CHANGE. - // Does it need to be moved to an EN_CHANGED callback? - //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: - { - // Pretty sure this was dead code. BN_CLICKED is not equal to EN_CHANGE. - // Does it need to be moved to an EN_CHANGED callback? - //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) @@ -2470,6 +2446,22 @@ void DebuggerMButtonDown(HWND hwndDlg, int cursorX, int cursorY, int vkFlags) } } +void DebuggerEnChange(HWND hwndDlg, uint16 textBoxId, HWND hwndTextbox) +{ + char str[16]; + switch (textBoxId) + { + case IDC_DEBUGGER_CYCLES_EXCEED: + GetDlgItemText(hwndDlg, IDC_DEBUGGER_CYCLES_EXCEED, str, 16); + break_cycles_limit = strtoul(str, NULL, 10); + break; + case IDC_DEBUGGER_INSTRUCTIONS_EXCEED: + GetDlgItemText(hwndDlg, IDC_DEBUGGER_INSTRUCTIONS_EXCEED, str, 16); + break_instructions_limit = strtoul(str, NULL, 10); + break; + } +} + INT_PTR CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) @@ -2504,6 +2496,9 @@ INT_PTR CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP case LBN_SELCHANGE: DebuggerSelChange(hwndDlg, LOWORD(wParam), (HWND)lParam); break; + case EN_CHANGE: + DebuggerEnChange(hwndDlg, LOWORD(wParam), (HWND)lParam); + break; } case WM_INITMENUPOPUP: DebuggerInitMenuPopup(hwndDlg, (HMENU)wParam, LOWORD(lParam), HIWORD(lParam));