diff options
-rw-r--r-- | csrc/main.c | 141 |
1 files changed, 141 insertions, 0 deletions
diff --git a/csrc/main.c b/csrc/main.c index abd670e..94f98b2 100644 --- a/csrc/main.c +++ b/csrc/main.c @@ -78,6 +78,147 @@ LRESULT CALLBACK windowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara } } +LRESULT CALLBACK entryCallback(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + if (message >= 0x200) { + if (message == 0x200) { + edx = (u16)lParam; + ecx = (lParam >> 16) & 0xffff; + int var_54 = dw_48a184; + RECT r0; // @ esp + 0x40 + + int i; + for (i = 0; i < 5; i++) { + edi = (i * 2 + 2) * 12; + eax = dw_48a180; + ebx = i * 4; + r0.left = (s16)word [ebx + 0x46cb28] - (s16)word [edi + eax + 0x10]; + r0.top = (s16)word [ebx + 0x46cb2a] - (s16)word [edi + eax + 0x12]; + r0.right = r0.left + (s16)word [edi + eax + 0xc]; + r0.bottom = r0.top + (s16)word [edi + eax + 0xe]; + if (edx < r0.left) + continue; + if (ecx < r0.top) + continue; + if (edx >= r0.right) + continue; + if (ecx >= r0.bottom) + continue; + if (i == dw_48a184) + break; + dw_48a184 = i; + IDirectDrawSurface_Lock(pddrawsf2, NULL, &sfdesc1, 1, 0); + fcn_456418(sfdesc1.lpSurface, dw_48a180 + 12 + edi, (s16)word [ebx + 0x46cb28], (s16)word [ebx + 0x46cb2a]); + IDirectDrawSurface_Unlock(pddrawsf2, NULL); + InvalidateRect(hWnd, &r0, FALSE); + fcn_4542ce(0x48231a, 0); + break; + } + if (i == 5) + dw_48a184 = -1; + if (var_54 == dw_48a184) + return 0; + if (var_54 == -1) + return 0; + edx = dw_48a180; + eax = dw_48a180 + (var_54 * 2 + 2) * 12; + r0.left = (s16)word [var_54*4 + 0x46cb28] - (s16)word [eax + 0x10]; + r0.top = (s16)word [var_54*4 + 0x46cb2a] - (s16)word [eax + 0x12]; + r0.right = r0.left + (s16)word [eax + 0xc]; + r0.bottom = r0.top + (s16)word [eax + 0xe]; + IDirectDrawSurface_Lock(pddrawsf2, NULL, &sfdesc1, 1, 0); + int t1 = r0.bottom - r0.top; + int t0 = r0.right - r0.left; + fcn.0045643d(sfdesc1.lpSurface, dw_48a180+12, r0.left, r0.top, r0.left, r0.top, t0, t1); + IDirectDrawSurface_Unlock(pddrawsf2, NULL); + InvalidateRect(hWnd, &r0, FALSE); + return 0; + } + if (message == 0x201) { + if (dw_48a184 != -1) { + fcn_4542ce(0x482322, 0); + } + // 0x402638 + switch (dw_48a184) { + case 1: + fcn.00402460(0); + eax = process_checkpoint(0); + if (eax != -1) { + Post_0402_Message(dw_48a184); + break; + } + IDirectDrawSurface_Lock(pddrawsf2, NULL, &sfdesc1, 1, 0); + fcn.004563f5(sfdesc1.lpSurface, dw_48a180 + 12, 0, 0); + IDirectDrawSurface_Unlock(pddrawsf2, NULL); + fcn.00402460(1); + InvalidateRect(hWnd, NULL, FALSE); + break; + case 2: + fcn.00402460(0); + sub.WINMM.dll_mciSendStringA_acb(); + fcn.00411b53(0); + sub.WINMM.dll_mciSendStringA_9cf(0); + IDirectDrawSurface_Lock(pddrawsf2, NULL, &sfdesc1, 1, 0); + fcn.004563f5(sfdesc1.lpSurface, dw_48a180 + 12, 0, 0); + IDirectDrawSurface_Unlock(pddrawsf2, NULL); + fcn.00402460(1); + return 0; + case 0: + case 3: + case 4: + fcn.00402460(0); + Post_0402_Message(dw_48a184); + break; + default: + break; + } + return 0; + } + if (message == 0x401) { + dw_48a184 = -1; + IDirectDrawSurface_Lock(pddrawsf2, NULL, &sfdesc1, 1, 0); + fcn.004563f5(sfdesc1.lpSurface, dw_48a180 + 12, 0, 0); + IDirectDrawSurface_Unlock(pddrawsf2, NULL); + InvalidateRect(hWnd, NULL, FALSE); + fcn.00402460(1); + return 0; + } + return DefWindowProcA(hWnd, message, wParam, lParam); + } + if (message == 15) { + PAINTSTRUCT ps; + BeginPaint(hWnd, &ps); + GetCursorPos_35d(&ps.rcPaint); + IDirectDrawSurface_BltFast(pddrawsf1, ps.rcPaint.left, ps.rcPaint.top, pddrawsf2, &ps.rcPaint, DDBLTFAST_WAIT); + GetCursorPos_250(&ps.rcPaint); + EndPaint(hWnd, &ps); + return 0; + } + return DefWindowProcA(hWnd, message, wParam, lParam); +} + +int fcn_004029fd() +{ + dw_48a180 = read_mkf(mkf_data, 1, NULL, NULL); + + for (int i = 0; i < 5; i++) { // i in ebx + int t1 = (signed short)word [ebx*4 + 0x46cb28]; + int t2 = (signed short)word [ebx*4 + 0x46cb2a]; + edx = (i * 2 + 1) * 12; + eax = dw_48a180 + 12; + edx += eax; + fcn_4562a5(eax, edx, t1, t2); + } + + create_some_font(0x10, 0xf0f0f0, 0x101010, 3, 1); + draw_some_text(dw_48a180 + 12, "V3.11", 638, 470, 6); + sub.WINMM.dll_mciSendStringA_9cf(0); + ebx = fcn_4018e7(entryCallback, 0); + sub.WINMM.dll_mciSendStringA_acb(); + free(dw_48a180); + return ebx; +} + int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, |