From 2d577b556cf015110b767d3fb5d2ca03a5a1fc9f Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 21 Jun 2023 14:42:30 +0200 Subject: [PATCH] match Isle::Tick and FindExistingInstance --- ISLE/define.cpp | 3 --- ISLE/define.h | 2 +- ISLE/isle.cpp | 6 +++--- ISLE/mx.cpp | 9 +++++---- LEGO1/mxdsobject.cpp | 14 ++++++-------- LEGO1/mxdsobject.h | 13 ++++--------- 6 files changed, 19 insertions(+), 28 deletions(-) diff --git a/ISLE/define.cpp b/ISLE/define.cpp index a5122188..b5501b08 100644 --- a/ISLE/define.cpp +++ b/ISLE/define.cpp @@ -38,6 +38,3 @@ int g_startupDelay = 200; // 0x4101c0 long g_lastFrameTime = 0; - -// 0x4101dc -const char *WINDOW_TITLE = "LEGO\xAE"; diff --git a/ISLE/define.h b/ISLE/define.h index 36f69993..fee70817 100644 --- a/ISLE/define.h +++ b/ISLE/define.h @@ -8,7 +8,7 @@ class Isle; extern Isle *g_isle; extern int g_closed; #define WNDCLASS_NAME "Lego Island MainNoM App" -extern const char *WINDOW_TITLE; +#define WINDOW_TITLE "LEGO\xAE" extern unsigned char g_mousedown; extern unsigned char g_mousemoved; extern RECT g_windowRect; diff --git a/ISLE/isle.cpp b/ISLE/isle.cpp index a58ad707..bfb41e03 100644 --- a/ISLE/isle.cpp +++ b/ISLE/isle.cpp @@ -78,7 +78,7 @@ Isle::~Isle() void Isle::Close() { MxDSAction ds; - ds.SetUnknown24(0xFFFE); + ds.SetUnknown24(-2); if (Lego()) { GameState()->Save(0); @@ -615,7 +615,7 @@ void Isle::Tick(BOOL sleepIfNotNextFrame) } ds.SetAtomId(stream->atom); - ds.SetUnknown24(0xFFFF); + ds.SetUnknown24(-1); ds.SetUnknown1c(0); VideoManager()->EnableFullScreenMovie(TRUE, TRUE); @@ -624,7 +624,7 @@ void Isle::Tick(BOOL sleepIfNotNextFrame) } } else { ds.SetAtomId(stream->atom); - ds.SetUnknown24(0xFFFF); + ds.SetUnknown24(-1); ds.SetUnknown1c(0); if (Start(&ds) != SUCCESS) { return; diff --git a/ISLE/mx.cpp b/ISLE/mx.cpp index c0417e5a..a3843a7e 100644 --- a/ISLE/mx.cpp +++ b/ISLE/mx.cpp @@ -1,7 +1,8 @@ #include "mxdsobject.h" +// This function exists both inlined and @ ISLE 0x00401c40 // OFFSET: ISLE 0x00401c40 -void MxDSObject::SetAtomId(MxAtomId p_atomId) -{ - this->m_atomId = p_atomId; -} \ No newline at end of file +// void MxDSObject::SetAtomId(MxAtomId p_atomId) +// { +// this->m_atomId = p_atomId; +// } \ No newline at end of file diff --git a/LEGO1/mxdsobject.cpp b/LEGO1/mxdsobject.cpp index 5e7d7103..0f8dafe6 100644 --- a/LEGO1/mxdsobject.cpp +++ b/LEGO1/mxdsobject.cpp @@ -6,14 +6,11 @@ // OFFSET: LEGO1 0x100bf6a0 MxDSObject::MxDSObject() { - // The following code yields 100% matching assembly if m_unk24 is declared as (signed) short. - // However, in other areas m_unk24 (notably, ISLE.EXE) is treated as unsigned short. - // Since we don't have a proper solution yet, we are using a union to work around this discrepancy. this->m_unk0c = 0; this->m_unk10 = 0; this->m_unk14 = 0; this->m_name = NULL; - this->m_unk24signed = -1; + this->m_unk24 = -1; this->m_unk1c = -1; this->m_unk28 = 0; } @@ -38,8 +35,9 @@ void MxDSObject::SetObjectName(const char *p_name) } } +// This function exists both inlined and @ LEGO1 0x10005530 // OFFSET: LEGO1 0x10005530 -void MxDSObject::SetAtomId(MxAtomId p_atomId) -{ - this->m_atomId = p_atomId; -} +// void MxDSObject::SetAtomId(MxAtomId p_atomId) +// { +// this->m_atomId = p_atomId; +// } diff --git a/LEGO1/mxdsobject.h b/LEGO1/mxdsobject.h index 99c62dd2..dde84301 100644 --- a/LEGO1/mxdsobject.h +++ b/LEGO1/mxdsobject.h @@ -15,9 +15,10 @@ class MxDSObject : public MxCore inline int GetUnknown1c() { return this->m_unk1c; } inline void SetUnknown1c(int p_unk1c) { this->m_unk1c = p_unk1c; } - inline void SetUnknown24(unsigned short p_unk24) { this->m_unk24 = p_unk24; } + inline void SetUnknown24(short p_unk24) { this->m_unk24 = p_unk24; } - void SetAtomId(MxAtomId p_atomId); + // void SetAtomId(MxAtomId p_atomId); + inline void SetAtomId(MxAtomId p_atomId) { this->m_atomId = p_atomId; } private: int m_unk08; @@ -27,13 +28,7 @@ class MxDSObject : public MxCore char *m_name; int m_unk1c; MxAtomId m_atomId; - // So far, implementing MxDSObject::MxDSObject correctly required that m_unk24 is declared a (signed) short. - // Most of the other game's code appears to treat it as unsigned short, however. - // This union is a workaround until we have figured this out. - union { - unsigned short m_unk24; - short m_unk24signed; - }; + short m_unk24; unsigned short m_unk26; int m_unk28; };