Window title

This commit is contained in:
Christian Semmler 2025-06-25 17:44:39 -07:00
parent 0db0b6eacb
commit 83e5958e32
5 changed files with 34 additions and 42 deletions

View File

@ -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<SDL_Window*>(m_windowHandle), "Lego Island");
}
else {
SDL_Log("Detected game version 1.1");
}
}
IDirect3DRMMiniwinDevice* GetD3DRMMiniwinDevice()
{
LegoVideoManager* videoManager = LegoOmni::GetInstance()->GetVideoManager();

View File

@ -56,6 +56,7 @@ class IsleApp {
MxResult ParseArguments(int argc, char** argv);
MxResult VerifyFilesystem();
void DetectGameVersion();
private:
char* m_hdPath; // 0x00

View File

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

View File

@ -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;
}

View File

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