From 4ddc238e7007af27c86faa5380ee6641a3893ca1 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Tue, 10 Nov 2026 12:31:02 +0000 Subject: [PATCH] Decompile fn_24372 (WindowProc) Batch #15900 by Yommy: 0 byte-identical, 1 confirmed by peer review. - fn_24372 WindowProc: logic confirmed by peer review Peer-reviewed-by: ragnarok-clanker, eAthena Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- .../Client/Application/ApplicationWindow.cpp | 96 +++++++++---------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/Source/Client/Application/ApplicationWindow.cpp b/Source/Client/Application/ApplicationWindow.cpp index 3a6ba177b..94060d753 100644 --- a/Source/Client/Application/ApplicationWindow.cpp +++ b/Source/Client/Application/ApplicationWindow.cpp @@ -67,9 +67,7 @@ LRESULT CALLBACK WindowProc(HWND window, UINT message, WPARAM wParam, LPARAM lPa std::uint8_t handled = 0; const LRESULT result = g_serverLanguage->Message(window, message, wParam, lParam, handled); if (handled) { - if (g_serverLanguage->candidateCount == 0) { - g_windowMgr.CloseWindow(WID_CANDIDATEWND); - } else { + if (g_serverLanguage->candidateCount != 0) { std::string candidates[9]; int info[4]; info[0] = g_serverLanguage->selection % 9; @@ -86,6 +84,8 @@ LRESULT CALLBACK WindowProc(HWND window, UINT message, WPARAM wParam, LPARAM lPa candidates[i] = g_serverLanguage->Candidate(first + i); } g_windowMgr.EnsureWindow(WID_CANDIDATEWND)->SendMsg(nullptr, UM_IME_SET_CANDIDATE, reinterpret_cast(candidates), reinterpret_cast(info), 0, 0); + } else { + g_windowMgr.CloseWindow(WID_CANDIDATEWND); } if (g_serverLanguage->DisplayLength()) { @@ -105,16 +105,17 @@ LRESULT CALLBACK WindowProc(HWND window, UINT message, WPARAM wParam, LPARAM lPa switch (message) { case WM_CREATE: return 0; - case WM_DESTROY: - if (std::strlen(g_homepageUrl) != 0) { - ShellExecuteA(hWnd, "open", g_homepageUrl, nullptr, nullptr, SW_SHOWNORMAL); - } - return 0; case WM_MOVE: if (g_isAppActive != 1 && !GetRenderSystemHolder()->IsWindowed()) { GetRenderSystemHolder()->Present(true); } return 0; + case WM_NCACTIVATE: + SetApplicationActive(LOWORD(wParam)); + if (wParam) { + ResetTimer(); + } + break; case WM_ACTIVATE: { const short state = static_cast(wParam); if (state == WA_INACTIVE) { @@ -148,8 +149,15 @@ LRESULT CALLBACK WindowProc(HWND window, UINT message, WPARAM wParam, LPARAM lPa } case WM_ERASEBKGND: return 1; - case WM_PAINT: - ValidateRect(window, nullptr); + case WM_GETMINMAXINFO: + if (hWnd) { + MINMAXINFO* info = reinterpret_cast(lParam); + const RECT bounds = Rect; + info->ptMinTrackSize.x = bounds.right - bounds.left; + info->ptMaxTrackSize.x = bounds.right - bounds.left; + info->ptMinTrackSize.y = bounds.bottom - bounds.top; + info->ptMaxTrackSize.y = bounds.bottom - bounds.top; + } return 0; case WM_CLOSE: g_modalImmediate = 1; @@ -175,22 +183,14 @@ LRESULT CALLBACK WindowProc(HWND window, UINT message, WPARAM wParam, LPARAM lPa } } return 0; - case WM_GETMINMAXINFO: - if (hWnd) { - MINMAXINFO* info = reinterpret_cast(lParam); - const RECT bounds = Rect; - info->ptMinTrackSize.x = bounds.right - bounds.left; - info->ptMaxTrackSize.x = bounds.right - bounds.left; - info->ptMinTrackSize.y = bounds.bottom - bounds.top; - info->ptMaxTrackSize.y = bounds.bottom - bounds.top; + case WM_PAINT: + ValidateRect(window, nullptr); + return 0; + case WM_DESTROY: + if (std::strlen(g_homepageUrl) != 0) { + ShellExecuteA(hWnd, "open", g_homepageUrl, nullptr, nullptr, SW_SHOWNORMAL); } return 0; - case WM_NCACTIVATE: - SetApplicationActive(LOWORD(wParam)); - if (wParam) { - ResetTimer(); - } - break; case WM_KEYDOWN: if (UIWindow* target = g_windowMgr.LookupWindow(WID_VIDEOWND)) { target->SendMsg(nullptr, UM_DEFPUSH, wParam, 0, 0, 0); @@ -213,20 +213,6 @@ LRESULT CALLBACK WindowProc(HWND window, UINT message, WPARAM wParam, LPARAM lPa g_windowMgr.RefreshWindow01C8Edits(); } return 0; - case WM_KEYUP: - g_session.m_automaticSkills.DisableAll(); - if (wParam == VK_SNAPSHOT) { - g_windowMgr.ProcessKeyDown(VK_SNAPSHOT, lParam, 1); - } - return 0; - case WM_CHAR: - if (!g_windowMgr.LookupWindow(WID_VIDEOWND) && g_windowMgr.imeInputActive) { - if (g_windowMgr.GetHoverWindow() && g_windowMgr.GetHoverWindow()->SendMsg(nullptr, WM_CHAR, wParam, lParam, 0, 0) == 3) { - return 0; - } - g_serverLanguage->Character(wParam, lParam); - } - return 0; case WM_SYSKEYDOWN: if (g_windowMgr.ProcessKeyDown(wParam, lParam, ~(static_cast(lParam) >> 30) & 1)) { return 0; @@ -263,16 +249,20 @@ LRESULT CALLBACK WindowProc(HWND window, UINT message, WPARAM wParam, LPARAM lPa return 0; } break; - case WM_MOUSEMOVE: - case WM_LBUTTONDOWN: - case WM_LBUTTONUP: - case WM_LBUTTONDBLCLK: - case WM_RBUTTONDOWN: - case WM_RBUTTONUP: - case WM_RBUTTONDBLCLK: - case WM_MOUSEWHEEL: - g_mouse.Message(window, message, wParam, lParam); - break; + case WM_CHAR: + if (!g_windowMgr.LookupWindow(WID_VIDEOWND) && g_windowMgr.imeInputActive) { + if (g_windowMgr.GetHoverWindow() && g_windowMgr.GetHoverWindow()->SendMsg(nullptr, WM_CHAR, wParam, lParam, 0, 0) == 3) { + return 0; + } + g_serverLanguage->Character(wParam, lParam); + } + return 0; + case WM_KEYUP: + g_session.m_automaticSkills.DisableAll(); + if (wParam == VK_SNAPSHOT) { + g_windowMgr.ProcessKeyDown(VK_SNAPSHOT, lParam, 1); + } + return 0; case WM_ENTERMENULOOP: case WM_ENTERSIZEMOVE: g_isAppActive = 0; @@ -288,6 +278,16 @@ LRESULT CALLBACK WindowProc(HWND window, UINT message, WPARAM wParam, LPARAM lPa SetApplicationActive(0); } break; + case WM_MOUSEMOVE: + case WM_LBUTTONDOWN: + case WM_LBUTTONUP: + case WM_LBUTTONDBLCLK: + case WM_RBUTTONDOWN: + case WM_RBUTTONUP: + case WM_RBUTTONDBLCLK: + case WM_MOUSEWHEEL: + g_mouse.Message(window, message, wParam, lParam); + break; case WM_IME_SETCONTEXT: wParam = 1; lParam = 0;