From 83e5958e32857a4c520e527d2c09a3130adcaee2 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 25 Jun 2025 17:44:39 -0700 Subject: [PATCH] Window title --- ISLE/isleapp.cpp | 29 +++++++++++++++ ISLE/isleapp.h | 1 + LEGO1/lego/legoomni/include/infocenter.h | 2 -- LEGO1/lego/legoomni/src/worlds/infocenter.cpp | 36 ------------------- LEGO1/omni/include/mxstring.h | 8 ++--- 5 files changed, 34 insertions(+), 42 deletions(-) diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index b097eb3b..503e2f91 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -703,6 +703,7 @@ MxResult IsleApp::SetupWindow() return FAILURE; } + DetectGameVersion(); GameState()->SerializePlayersInfo(LegoStorage::c_read); GameState()->SerializeScoreHistory(LegoStorage::c_read); @@ -1098,6 +1099,34 @@ MxResult IsleApp::VerifyFilesystem() return SUCCESS; } +void IsleApp::DetectGameVersion() +{ + const char* file = "/lego/scripts/infocntr/infomain.si"; + SDL_PathInfo info; + bool success = false; + + MxString path = MxString(m_hdPath) + file; + path.MapPathToFilesystem(); + if (!(success = SDL_GetPathInfo(path.GetData(), &info))) { + path = MxString(m_cdPath) + file; + path.MapPathToFilesystem(); + success = SDL_GetPathInfo(path.GetData(), &info); + } + + assert(success); + + // File sizes of INFOMAIN.SI in English 1.0 and Japanese 1.0 + Lego()->SetIs10(info.size == 58130432 || info.size == 57737216); + + if (Lego()->GetIs10()) { + SDL_Log("Detected game version 1.0"); + SDL_SetWindowTitle(reinterpret_cast(m_windowHandle), "Lego Island"); + } + else { + SDL_Log("Detected game version 1.1"); + } +} + IDirect3DRMMiniwinDevice* GetD3DRMMiniwinDevice() { LegoVideoManager* videoManager = LegoOmni::GetInstance()->GetVideoManager(); diff --git a/ISLE/isleapp.h b/ISLE/isleapp.h index d76a291b..2766607f 100644 --- a/ISLE/isleapp.h +++ b/ISLE/isleapp.h @@ -56,6 +56,7 @@ class IsleApp { MxResult ParseArguments(int argc, char** argv); MxResult VerifyFilesystem(); + void DetectGameVersion(); private: char* m_hdPath; // 0x00 diff --git a/LEGO1/lego/legoomni/include/infocenter.h b/LEGO1/lego/legoomni/include/infocenter.h index 20b5d73f..470bdc31 100644 --- a/LEGO1/lego/legoomni/include/infocenter.h +++ b/LEGO1/lego/legoomni/include/infocenter.h @@ -165,8 +165,6 @@ class Infocenter : public LegoWorld { void PlayBookAnimation(); void StopBookAnimation(); - void DetectGameVersion(); - InfomainScript::Script m_currentInfomainScript; // 0xf8 MxS16 m_selectedCharacter; // 0xfc InfocenterState* m_infocenterState; // 0x100 diff --git a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp index 4e32493c..5e16f02a 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp @@ -446,8 +446,6 @@ MxLong Infocenter::HandleEndAction(MxEndActionNotificationParam& p_param) // FUNCTION: LEGO1 0x1006f4e0 void Infocenter::ReadyWorld() { - DetectGameVersion(); - m_infoManDialogueTimer = 0; m_bookAnimationTimer = 0; m_unk0x1d4 = 0; @@ -1606,37 +1604,3 @@ InfocenterState::~InfocenterState() i++; } while (i < GetMaxNameLength()); } - -void Infocenter::DetectGameVersion() -{ - static bool done = false; - if (done) { - return; - } - - const char* file = "/lego/scripts/infocntr/infomain.si"; - SDL_PathInfo info; - bool success = false; - - MxString path = MxString(MxOmni::GetHD()) + file; - path.MapPathToFilesystem(); - if (!(success = SDL_GetPathInfo(path.GetData(), &info))) { - path = MxString(MxOmni::GetCD()) + file; - path.MapPathToFilesystem(); - success = SDL_GetPathInfo(path.GetData(), &info); - } - - assert(success); - - // File sizes of INFOMAIN.SI in English 1.0 and Japanese 1.0 - Lego()->SetIs10(info.size == 58130432 || info.size == 57737216); - - if (Lego()->GetIs10()) { - SDL_Log("Detected game version 1.0"); - } - else { - SDL_Log("Detected game version 1.1"); - } - - done = true; -} diff --git a/LEGO1/omni/include/mxstring.h b/LEGO1/omni/include/mxstring.h index eaa58181..b4b25262 100644 --- a/LEGO1/omni/include/mxstring.h +++ b/LEGO1/omni/include/mxstring.h @@ -20,10 +20,10 @@ class MxString : public MxCore { void ToLowerCase(); void MapPathToFilesystem() { MapPathToFilesystem(m_data); } - MxString& operator=(const MxString& p_str); - const MxString& operator=(const char* p_str); - MxString operator+(const MxString& p_str) const; - MxString operator+(const char* p_str) const; + LEGO1_EXPORT MxString& operator=(const MxString& p_str); + LEGO1_EXPORT const MxString& operator=(const char* p_str); + LEGO1_EXPORT MxString operator+(const MxString& p_str) const; + LEGO1_EXPORT MxString operator+(const char* p_str) const; LEGO1_EXPORT MxString& operator+=(const char* p_str); static void CharSwap(char* p_a, char* p_b);