From 1059de9c548e6dd8ab13926464cbb4036df1da4c Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 21 May 2025 15:59:35 -0700 Subject: [PATCH] Add message box errors for missing files --- LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp | 7 +++++++ LEGO1/lego/sources/misc/legostorage.cpp | 9 +++++++++ LEGO1/omni/src/stream/mxio.cpp | 10 ++++++++++ 3 files changed, 26 insertions(+) diff --git a/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp b/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp index 2145b191..045052bd 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp @@ -27,6 +27,7 @@ #include "mxstl/stlcompat.h" #include "mxutilities.h" +#include #include #include @@ -187,6 +188,12 @@ MxResult LegoWorldPresenter::LoadWorld(char* p_worldName, LegoWorld* p_world) MxString::MapPathToFilesystem(wdbPath); if ((wdbFile = SDL_IOFromFile(wdbPath, "rb")) == NULL) { + SDL_ShowSimpleMessageBox( + SDL_MESSAGEBOX_ERROR, + "LEGO® Island Error", + "\"LEGO® Island\" failed to load world.wdb.\nPlease make sure this file is available on HD/CD.", + NULL + ); return FAILURE; } } diff --git a/LEGO1/lego/sources/misc/legostorage.cpp b/LEGO1/lego/sources/misc/legostorage.cpp index 6004977c..3ddcbf0c 100644 --- a/LEGO1/lego/sources/misc/legostorage.cpp +++ b/LEGO1/lego/sources/misc/legostorage.cpp @@ -2,6 +2,7 @@ #include "decomp.h" +#include #include #include @@ -127,6 +128,14 @@ LegoResult LegoFile::Open(const char* p_name, LegoU32 p_mode) path.MapPathToFilesystem(); if (!(m_file = SDL_IOFromFile(path.GetData(), mode))) { + char buffer[256]; + SDL_snprintf( + buffer, + sizeof(buffer), + "\"LEGO® Island\" failed to load %s.\nPlease make sure this file is available on HD/CD.", + path.GetData() + ); + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "LEGO® Island Error", buffer, NULL); return FAILURE; } return SUCCESS; diff --git a/LEGO1/omni/src/stream/mxio.cpp b/LEGO1/omni/src/stream/mxio.cpp index 87cdaf8b..9227dc06 100644 --- a/LEGO1/omni/src/stream/mxio.cpp +++ b/LEGO1/omni/src/stream/mxio.cpp @@ -3,6 +3,7 @@ #include "decomp.h" #include "mxstring.h" +#include #include #include @@ -72,6 +73,15 @@ MxU16 MXIOINFO::Open(const char* p_filename, MxULong p_flags) } } else { + char buffer[256]; + SDL_snprintf( + buffer, + sizeof(buffer), + "\"LEGO® Island\" failed to load %s.\nPlease make sure this file is available on HD/CD.", + path.GetData() + ); + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "LEGO® Island Error", buffer, NULL); + result = MMIOERR_CANNOTOPEN; }