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>
This commit is contained in:
Anonymous Maarten 2023-06-19 06:45:25 +02:00 committed by GitHub
parent bba513c525
commit 6e18d1b41f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 29 additions and 21 deletions

View file

@ -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: |

View file

@ -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) {

View file

@ -1,7 +1,7 @@
#ifndef ISLE_H
#define ISLE_H
#include <Windows.h>
#include <windows.h>
#include "mxresult.h"
#include "mxvideoparam.h"

View file

@ -1,5 +1,5 @@
#include <DSOUND.H>
#include <Windows.h>
#include <dsound.h>
#include <windows.h>
#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;
}

Binary file not shown.

View file

@ -1,4 +1,4 @@
#include <Windows.h>
#include <windows.h>
// OFFSET: LEGO1 0x10091ee0
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)

View file

@ -1,7 +1,9 @@
#ifndef MXATOMID_H
#define MXATOMID_H
enum LookupMode;
enum LookupMode
{
};
class MxAtomId
{

View file

@ -1,7 +1,7 @@
#ifndef MXCRITICALSECTION_H
#define MXCRITICALSECTION_H
#include <Windows.h>
#include <windows.h>
class MxCriticalSection
{

View file

@ -47,6 +47,11 @@ class MxDSAction
int m_unk8c;
int m_unk90;
void setAtomId(MxAtomId &atomId)
{
this->m_atomId = atomId;
}
};
#endif // MXDSACTION_H

View file

@ -1,7 +1,7 @@
#ifndef MXOMNICREATEPARAM_H
#define MXOMNICREATEPARAM_H
#include <Windows.h>
#include <windows.h>
#include "mxomnicreateflags.h"
#include "mxomnicreateparambase.h"