From 6e18d1b41ff9544f3d3c05f5a813d54ce22034b5 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Mon, 19 Jun 2023 06:45:25 +0200 Subject: [PATCH] ISLE and mingw32 fixes (#18) * ci: no need to do a final cd * MxDSAction has a setAtomId method * Implement the MxOmniCreateParamBase destructor inline Because of this, ISLE should no longer have to compile mxomnicreateparambase.obj. I didn't modify isle.mak, because I don't have the MSVC 4.20 GUI set-up. * Replace 256 with sizeof(...) * Format DefWndProc calls in WndProc * Replace magic mask in WNDPROC with macro's * Replace magic numbers in main.cpp with macro's * MOUSEMOVE notification id is 10 instead of 0x10 * Lowercase all windows includes such that mingw32 on Linux can find these * Convert ISLE/res/isle.rc to utf-8, and add a comma needed by mingw32 * mingw32 cannot use a enum without previous declaration * minor adjustments --------- Co-authored-by: itsmattkc <34096995+itsmattkc@users.noreply.github.com> --- .github/workflows/build.yml | 7 +++---- ISLE/isle.cpp | 16 +++++++++------- ISLE/isle.h | 2 +- ISLE/main.cpp | 10 +++++----- ISLE/res/isle.rc | Bin 1600 -> 761 bytes LEGO1/dllmain.cpp | 2 +- LEGO1/mxatomid.h | 4 +++- LEGO1/mxcriticalsection.h | 2 +- LEGO1/mxdsaction.h | 5 +++++ LEGO1/mxomnicreateparam.h | 2 +- 10 files changed, 29 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f07a7d26..3e98bafd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,8 +32,7 @@ jobs: C:\msys64\usr\bin\wget.exe https://archive.org/download/idx5sdk/idx5sdk.exe 7z x .\idx5sdk.exe 7z x .\DX5SDK.EXE - cd cdrom - + - name: Cache DX5 SDK if: steps.cache-dx5.outputs.cache-hit != 'true' id: save-dx5 @@ -41,13 +40,13 @@ jobs: with: path: dx5sdk key: dx5sdk - + - name: Setup DX5 SDK run: | cd dx5sdk cd cdrom .\SETUP.EXE /s - + - name: Build shell: cmd run: | diff --git a/ISLE/isle.cpp b/ISLE/isle.cpp index b2ab17a9..d3bd8f3d 100644 --- a/ISLE/isle.cpp +++ b/ISLE/isle.cpp @@ -254,7 +254,7 @@ void Isle::setupVideoFlags(BOOL fullScreen, BOOL flipSurfaces, BOOL backBuffers, BOOL Isle::setupLegoOmni() { char mediaPath[256]; - GetProfileStringA("LEGO Island", "MediaPath", "", mediaPath, 256); + GetProfileStringA("LEGO Island", "MediaPath", "", mediaPath, sizeof(mediaPath)); if (Lego()->Create(MxOmniCreateParam(mediaPath, (struct HWND__ *) m_windowHandle, m_videoParam, MxOmniCreateFlags())) != FAILURE) { VariableTable()->SetVariable("ACTOR_01", ""); @@ -348,13 +348,13 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) } return DefWindowProcA(hWnd,WM_SYSCOMMAND,wParam,lParam); case WM_EXITMENULOOP: - return DefWindowProcA(hWnd,WM_EXITMENULOOP,wParam,lParam); + return DefWindowProcA(hWnd, WM_EXITMENULOOP, wParam, lParam); case WM_MOVING: if (g_isle && g_isle->m_fullScreen) { GetWindowRect(hWnd, (LPRECT) lParam); return 0; } - return DefWindowProcA(hWnd,WM_MOVING,wParam,lParam); + return DefWindowProcA(hWnd, WM_MOVING, wParam, lParam); case WM_NCPAINT: if (g_isle && g_isle->m_fullScreen) { return 0; @@ -396,8 +396,10 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) switch (uMsg) { case WM_KEYDOWN: - if (lParam & 0x40000000) { - return DefWindowProcA(hWnd,WM_KEYDOWN,wParam,lParam); + // While this probably should be (HIWORD(lParam) & KF_REPEAT), this seems + // to be what the assembly is actually doing + if (lParam & (KF_REPEAT << 16)) { + return DefWindowProcA(hWnd, WM_KEYDOWN, wParam, lParam); } keyCode = wParam; type = KEYDOWN; @@ -603,7 +605,7 @@ void Isle::tick(BOOL sleepIfNotNextFrame) return; } - ds.m_atomId = stream->atom; + ds.setAtomId(stream->atom); ds.m_unk24 = 0xFFFF; ds.m_unk1c = 0; VideoManager()->EnableFullScreenMovie(TRUE, TRUE); @@ -612,7 +614,7 @@ void Isle::tick(BOOL sleepIfNotNextFrame) return; } } else { - ds.m_atomId = stream->atom; + ds.setAtomId(stream->atom); ds.m_unk24 = 0xFFFF; ds.m_unk1c = 0; if (Start(&ds) != SUCCESS) { diff --git a/ISLE/isle.h b/ISLE/isle.h index e23fb8cb..389e8630 100644 --- a/ISLE/isle.h +++ b/ISLE/isle.h @@ -1,7 +1,7 @@ #ifndef ISLE_H #define ISLE_H -#include +#include #include "mxresult.h" #include "mxvideoparam.h" diff --git a/ISLE/main.cpp b/ISLE/main.cpp index c4e9f4f3..651bfffc 100644 --- a/ISLE/main.cpp +++ b/ISLE/main.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include "define.h" #include "isle.h" @@ -21,7 +21,7 @@ BOOL findExistingInstance(void) // OFFSET: ISLE 0x401ce0 BOOL startDirectSound(void) { - LPDIRECTSOUND lpDS = 0; + LPDIRECTSOUND lpDS = NULL; HRESULT ret = DirectSoundCreate(NULL, &lpDS, NULL); if (ret == DS_OK && lpDS != NULL) { lpDS->Release(); @@ -52,7 +52,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine // Throw error if sound unavailable if (!soundReady) { MessageBoxA(NULL, "\"LEGO\xAE Island\" is not detecting a DirectSound compatible sound card. Please quit all other applications and try again.", - "Lego Island Error",0); + "Lego Island Error", MB_OK); return 0; } @@ -61,7 +61,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine // Create window if (g_isle->setupWindow(hInstance) != SUCCESS) { - MessageBoxA(NULL, "\"LEGO\xAE Island\" failed to start. Please quit all other applications and try again.", "LEGO\xAE Island Error",0); + MessageBoxA(NULL, "\"LEGO\xAE Island\" failed to start. Please quit all other applications and try again.", "LEGO\xAE Island Error", MB_OK); return 0; } diff --git a/ISLE/res/isle.rc b/ISLE/res/isle.rc index 59bd314b32dcd7d7adf78adba2263046f3b36e01..4534ea6436305d2e64cbb46997a0e76adedefdd3 100644 GIT binary patch literal 761 zcmaiyU2CI26o#*zUvaRvl8z8qa;e4ycda9uq!bEes|wt}?RirB)WRJzo(!VY>0v_po1}_)VBZ^};CLT%4{XQnBYvq}!8``HC)vb1$ literal 1600 zcmbu9?Q0rA5XR@Lh5irA^=nBK0wo_$O@eKzqQ+7vNTb#s*i$Z-Hlg%iPy3r$_nP&E z3T3&My`6dHnP+D1_tPuMB$ufy8* zWx(pm2fS+1k{fnI_5<4|5-d+Qh^O+Iw*urJU``F+;|9x#bn#cTr4k~dZOl5eVR zY~iFKukEVytea)uv~QDTOGZc72jm`c9T*RC#$DH06nTVZeHeI~hMoPidlP0oqP^oR z0i~pt+C2+cXO?Y;-Ipp`?^To7Pvh0)+~VGH_Z?7^U|l1Zlt?$mAtByMzOm+Dm#CVc zfW~jj70CKWiunjl#{icXic;mV@@I8Ha2Rl zI;>%r!8Nb&LJx!t521`fDZq)nwc@_+S_ysstJOA=>RuX34)f(sX8&Sxjqk!dRqZv} zXhsX>zO1s@J#q4hE=sAT@;qm~IjDSZgQ)$Y41({)83J0?wMRC{4|WSsx6)X@5Bin^*o6LvZ|8sB%dkMLOW v`DK&m@7jy;ER8`aDlPX@{PbdEBx3PYBcLr(btXzB!gg-)8d%+&R~< diff --git a/LEGO1/dllmain.cpp b/LEGO1/dllmain.cpp index 53650bd6..58d0149f 100644 --- a/LEGO1/dllmain.cpp +++ b/LEGO1/dllmain.cpp @@ -1,4 +1,4 @@ -#include +#include // OFFSET: LEGO1 0x10091ee0 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) diff --git a/LEGO1/mxatomid.h b/LEGO1/mxatomid.h index 3e3ce24b..537b097e 100644 --- a/LEGO1/mxatomid.h +++ b/LEGO1/mxatomid.h @@ -1,7 +1,9 @@ #ifndef MXATOMID_H #define MXATOMID_H -enum LookupMode; +enum LookupMode +{ +}; class MxAtomId { diff --git a/LEGO1/mxcriticalsection.h b/LEGO1/mxcriticalsection.h index bd84babb..81d96d37 100644 --- a/LEGO1/mxcriticalsection.h +++ b/LEGO1/mxcriticalsection.h @@ -1,7 +1,7 @@ #ifndef MXCRITICALSECTION_H #define MXCRITICALSECTION_H -#include +#include class MxCriticalSection { diff --git a/LEGO1/mxdsaction.h b/LEGO1/mxdsaction.h index d76f6930..aa5a7e4b 100644 --- a/LEGO1/mxdsaction.h +++ b/LEGO1/mxdsaction.h @@ -47,6 +47,11 @@ class MxDSAction int m_unk8c; int m_unk90; + void setAtomId(MxAtomId &atomId) + { + this->m_atomId = atomId; + } + }; #endif // MXDSACTION_H diff --git a/LEGO1/mxomnicreateparam.h b/LEGO1/mxomnicreateparam.h index d0439e26..31dcd447 100644 --- a/LEGO1/mxomnicreateparam.h +++ b/LEGO1/mxomnicreateparam.h @@ -1,7 +1,7 @@ #ifndef MXOMNICREATEPARAM_H #define MXOMNICREATEPARAM_H -#include +#include #include "mxomnicreateflags.h" #include "mxomnicreateparambase.h"