From 50bbacfb4deba90aa0c62478b094edb01c23d61c Mon Sep 17 00:00:00 2001 From: owomomo Date: Fri, 12 Jul 2019 13:07:50 +0800 Subject: [PATCH] Detail --- src/drivers/win/ramwatch.cpp | 9 +++++---- src/drivers/win/window.cpp | 15 +++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/drivers/win/ramwatch.cpp b/src/drivers/win/ramwatch.cpp index d9433ed3..eaf109c3 100644 --- a/src/drivers/win/ramwatch.cpp +++ b/src/drivers/win/ramwatch.cpp @@ -787,8 +787,12 @@ INT_PTR CALLBACK EditWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara { case WM_INITDIALOG: { + + HWND parent = GetParent(hDlg); + indexes[GetDlgStoreIndex(parent)] = lParam; + RECT r; - GetWindowRect(hWnd, &r); + GetWindowRect(hDlg, &r); SetWindowPos(hDlg, NULL, r.left, r.top, NULL, NULL, SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW); AddressWatcher& watcher = rswatches[lParam]; @@ -836,9 +840,6 @@ INT_PTR CALLBACK EditWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara if (watcher.comment != NULL) SetDlgItemText(hDlg, IDC_PROMPT_EDIT, watcher.comment); - HWND parent = GetParent(hDlg); - indexes[GetDlgStoreIndex(parent)] = lParam; - if (watcher.Type == 'S' || parent == RamSearchHWnd || parent == hCheat) { EnableWindow(GetDlgItem(hDlg, IDC_SPECIFICADDRESS), FALSE); diff --git a/src/drivers/win/window.cpp b/src/drivers/win/window.cpp index eee138b5..ae70b7fa 100644 --- a/src/drivers/win/window.cpp +++ b/src/drivers/win/window.cpp @@ -3272,7 +3272,7 @@ LRESULT APIENTRY FilterEditCtrlProc(HWND hwnd, UINT msg, WPARAM wP, LPARAM lP) case WM_PASTE: { - bool(*IsLetterLegal)(char) = GetIsLetterLegal(GetDlgCtrlID(hwnd)); + bool (*IsLetterLegal)(char) = GetIsLetterLegal(GetDlgCtrlID(hwnd)); if (IsLetterLegal) { @@ -3299,7 +3299,6 @@ LRESULT APIENTRY FilterEditCtrlProc(HWND hwnd, UINT msg, WPARAM wP, LPARAM lP) } GlobalUnlock(handle); CloseClipboard(); - } } } @@ -3308,7 +3307,7 @@ LRESULT APIENTRY FilterEditCtrlProc(HWND hwnd, UINT msg, WPARAM wP, LPARAM lP) case WM_CHAR: { bool(*IsLetterLegal)(char) = GetIsLetterLegal(GetDlgCtrlID(hwnd)); - through = IsInputLegal(GetIsLetterLegal(GetDlgCtrlID(hwnd)), wP); + through = IsInputLegal(IsLetterLegal, wP); if (!through) ShowLetterIllegalError(hwnd, IsLetterLegal); } @@ -3322,9 +3321,6 @@ bool inline (*GetIsLetterLegal(UINT id))(char letter) { switch (id) { - // owomomo TODO: RAM Search is a bit complicated, - // I'll handle it in later development - // Game genie text in Cheat and Game Genie Encoder/Decoder case IDC_CHEAT_GAME_GENIE_TEXT: @@ -3418,16 +3414,19 @@ void ShowLetterIllegalBalloonTip(HWND hwnd, bool(*IsLetterLegal)(char letter)) tip.ttiIcon = TTI_ERROR; SendMessage(hwnd, EM_SHOWBALLOONTIP, 0, (LPARAM)&tip); + // make a sound + MessageBeep(0xFFFFFFFF); + free(titleW); free(msgW); } inline void ShowLetterIllegalMessageBox(HWND hwnd, bool(*IsLetterLegal)(char letter)) { - MessageBox(hwnd, GetLetterIllegalErrMsg(IsLetterLegal), "Unacceptable Character", MB_OK | MB_ICONERROR); + MessageBox(hwnd, GetLetterIllegalErrMsg(IsLetterLegal), _T("Unacceptable Character"), MB_OK | MB_ICONERROR); } -inline char* GetLetterIllegalErrMsg(bool(*IsLetterLegal)(char letter)) +inline TCHAR* GetLetterIllegalErrMsg(bool(*IsLetterLegal)(char letter)) { if (IsLetterLegal == IsLetterLegalGG) return "You can only type Game Genie characters:\nA P Z L G I T Y E O X U K S V N";