From 23f2bf5e03fe8313cee263fd64e6c39e157882db Mon Sep 17 00:00:00 2001 From: itsmattkc <34096995+itsmattkc@users.noreply.github.com> Date: Sat, 29 Apr 2023 20:37:12 -0700 Subject: [PATCH] implemented WM_DISPLAYCHANGE code --- app/define.cpp | 4 ++++ app/define.h | 4 ++++ app/isle.cpp | 24 ++++++++++-------------- lib/legovideomanager.h | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 51 insertions(+), 14 deletions(-) diff --git a/app/define.cpp b/app/define.cpp index 882368b3..24288885 100644 --- a/app/define.cpp +++ b/app/define.cpp @@ -9,6 +9,10 @@ const char *WINDOW_TITLE = "LEGO unsigned char g_mousedown = 0; unsigned char g_mousemoved = 0; int _DAT_00410050 = 0; +int _DAT_00410054 = 1; +int g_targetWidth = 640; +int g_targetHeight = 480; +unsigned int g_targetDepth = 16; int _DAT_00410064 = 0; int _DAT_004101bc = 200; long g_lastFrameTime = 0; diff --git a/app/define.h b/app/define.h index 4b002051..e09a934a 100644 --- a/app/define.h +++ b/app/define.h @@ -10,6 +10,10 @@ extern const char *WINDOW_TITLE; extern unsigned char g_mousedown; extern unsigned char g_mousemoved; extern int _DAT_00410050; +extern int _DAT_00410054; +extern int g_targetWidth; +extern int g_targetHeight; +extern unsigned int g_targetDepth; extern int _DAT_00410064; extern int _DAT_004101bc; extern long g_lastFrameTime; diff --git a/app/isle.cpp b/app/isle.cpp index 26cc68dc..c8089444 100644 --- a/app/isle.cpp +++ b/app/isle.cpp @@ -355,31 +355,27 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) } return DefWindowProcA(hWnd, WM_NCPAINT, wParam, lParam); case WM_DISPLAYCHANGE: - /* FIXME: Untangle - if (g_isle && VideoManager() && g_isle->m_fullScreen && ((pLVar7 = VideoManager(), *(int *)(pLVar7 + 0x74) != 0 && (pLVar7 = VideoManager(), *(int *)(*(int *)(pLVar7 + 0x74) + 0x880) != 0))) { + if (g_isle && VideoManager() && g_isle->m_fullScreen && VideoManager()->m_unk74 && VideoManager()->m_unk74[0x220]) { if (_DAT_00410054 == 0) { - unsigned char bVar1 = FALSE; - if (LOWORD(lParam) == _DAT_00410058 && HIWORD(lParam) == _DAT_0041005c && _DAT_00410060 == wParam) { - bVar1 = TRUE; + unsigned char valid = FALSE; + if (LOWORD(lParam) == g_targetWidth && HIWORD(lParam) == g_targetHeight && g_targetDepth == wParam) { + valid = TRUE; } if (_DAT_00410050 == 0) { - if (!bVar1) { + if (!valid) { _DAT_00410050 = 1; Lego()->vtable38(); VideoManager()->DisableRMDevice(); } - } - else if (bVar1) { + } else if (valid) { _DAT_00410064 = 1; } - } - else { + } else { _DAT_00410054 = 0; - _DAT_00410060 = wParam; + g_targetDepth = wParam; } - }*/ - return DefWindowProcA(hWnd,WM_DISPLAYCHANGE,wParam,lParam); - + } + return DefWindowProcA(hWnd, WM_DISPLAYCHANGE, wParam, lParam); case WM_SETCURSOR: case WM_KEYDOWN: case WM_MOUSEMOVE: diff --git a/lib/legovideomanager.h b/lib/legovideomanager.h index 0dc4ba53..fd370715 100644 --- a/lib/legovideomanager.h +++ b/lib/legovideomanager.h @@ -6,10 +6,43 @@ class LegoVideoManager public: __declspec(dllexport) int EnableRMDevice(); + __declspec(dllexport) int DisableRMDevice(); + __declspec(dllexport) void EnableFullScreenMovie(unsigned char a, unsigned char b); __declspec(dllexport) void MoveCursor(int x, int y); + int m_unk00; + int m_unk04; + int m_unk08; + int m_unk0c; + int m_unk10; + int m_unk14; + int m_unk18; + int m_unk1c; + int m_unk20; + int m_unk24; + int m_unk28; + int m_unk2c; + int m_unk30; + int m_unk34; + int m_unk38; + int m_unk3c; + int m_unk40; + int m_unk44; + int m_unk48; + int m_unk4c; + int m_unk50; + int m_unk54; + int m_unk58; + int m_unk5c; + int m_unk60; + int m_unk64; + int m_unk68; + int m_unk6c; + int m_unk70; + int *m_unk74; + }; #endif // LEGOVIDEOMANAGER_H