match WinProc

This commit is contained in:
Christian Semmler 2023-06-24 17:12:58 +02:00
parent 579ee84049
commit 0e73b85f33
No known key found for this signature in database
GPG Key ID: 086DAA1360BEEE5C

View File

@ -141,6 +141,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
// OFFSET: ISLE 0x401d20 // OFFSET: ISLE 0x401d20
LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
NotificationId type;
unsigned char keyCode = 0;
if (!g_isle) { if (!g_isle) {
return DefWindowProcA(hWnd, uMsg, wParam, lParam); return DefWindowProcA(hWnd, uMsg, wParam, lParam);
} }
@ -235,18 +238,14 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
return DefWindowProcA(hWnd, WM_DISPLAYCHANGE, wParam, lParam); return DefWindowProcA(hWnd, WM_DISPLAYCHANGE, wParam, lParam);
case WM_SETCURSOR: case WM_SETCURSOR:
case WM_KEYDOWN: if (g_isle) {
case WM_MOUSEMOVE: HCURSOR hCursor = g_isle->m_cursorCurrent;
case WM_TIMER: if (hCursor == g_isle->m_cursorBusy || hCursor == g_isle->m_cursorNo || !hCursor) {
case WM_LBUTTONDOWN: SetCursor(hCursor);
case WM_LBUTTONUP: return 0;
case 0x5400: }
{ }
break;
NotificationId type = NONE;
unsigned char keyCode = 0;
switch (uMsg) {
case WM_KEYDOWN: case WM_KEYDOWN:
// While this probably should be (HIWORD(lParam) & KF_REPEAT), this seems // While this probably should be (HIWORD(lParam) & KF_REPEAT), this seems
// to be what the assembly is actually doing // to be what the assembly is actually doing
@ -263,15 +262,6 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_TIMER: case WM_TIMER:
type = TIMER; type = TIMER;
break; break;
case WM_SETCURSOR:
if (g_isle) {
HCURSOR hCursor = g_isle->m_cursorCurrent;
if (hCursor == g_isle->m_cursorBusy || hCursor == g_isle->m_cursorNo || !hCursor) {
SetCursor(hCursor);
return 0;
}
}
break;
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
g_mousedown = 1; g_mousedown = 1;
type = MOUSEDOWN; type = MOUSEDOWN;
@ -285,6 +275,9 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
g_isle->SetupCursor(wParam); g_isle->SetupCursor(wParam);
return 0; return 0;
} }
break;
default:
return DefWindowProcA(hWnd,uMsg,wParam,lParam);
} }
if (g_isle) { if (g_isle) {
@ -292,8 +285,8 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
InputManager()->QueueEvent(type, wParam, LOWORD(lParam), HIWORD(lParam), keyCode); InputManager()->QueueEvent(type, wParam, LOWORD(lParam), HIWORD(lParam), keyCode);
} }
if (g_isle && g_isle->m_drawCursor && type == MOUSEMOVE) { if (g_isle && g_isle->m_drawCursor && type == MOUSEMOVE) {
unsigned short x = LOWORD(lParam); unsigned int x = LOWORD(lParam);
unsigned short y = HIWORD(lParam); unsigned int y = HIWORD(lParam);
if (639 < x) { if (639 < x) {
x = 639; x = 639;
} }
@ -303,9 +296,6 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
VideoManager()->MoveCursor(x,y); VideoManager()->MoveCursor(x,y);
} }
} }
return 0; return 0;
} }
}
return DefWindowProcA(hWnd,uMsg,wParam,lParam);
}