From 577a84a24cf6676c7c170e143b4d4933751b09ac Mon Sep 17 00:00:00 2001 From: Peter Kohaut Date: Thu, 4 Jul 2019 00:07:28 +0200 Subject: BLADERUNNER: Explicit message about missing game files --- engines/bladerunner/archive.cpp | 2 +- engines/bladerunner/bladerunner.cpp | 61 ++++++++++++++++++++++++++++++++ engines/bladerunner/bladerunner.h | 2 ++ engines/bladerunner/slice_animations.cpp | 2 +- 4 files changed, 65 insertions(+), 2 deletions(-) diff --git a/engines/bladerunner/archive.cpp b/engines/bladerunner/archive.cpp index 8435a9d91d..0b2ac97ca1 100644 --- a/engines/bladerunner/archive.cpp +++ b/engines/bladerunner/archive.cpp @@ -44,7 +44,7 @@ bool MIXArchive::exists(const Common::String &filename) { bool MIXArchive::open(const Common::String &filename) { if (!_fd.open(filename)) { - warning("MIXArchive::open(): Can not open %s", filename.c_str()); + error("MIXArchive::open(): Can not open %s", filename.c_str()); return false; } diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp index 7362291c74..ecb4048233 100644 --- a/engines/bladerunner/bladerunner.cpp +++ b/engines/bladerunner/bladerunner.cpp @@ -310,6 +310,20 @@ void BladeRunnerEngine::pauseEngineIntern(bool pause) { } Common::Error BladeRunnerEngine::run() { + + Common::Array missingFiles; + if (!checkFiles(missingFiles)) { + Common::String missingFileStr = ""; + for (uint i = 0; i < missingFiles.size(); ++i) { + if (i > 0) { + missingFileStr += ", "; + } + missingFileStr += missingFiles[i]; + } + + return Common::Error(Common::kNoGameDataFoundError, missingFileStr); + } + Graphics::PixelFormat format = screenPixelFormat(); initGraphics(640, 480, &format); @@ -386,6 +400,53 @@ Common::Error BladeRunnerEngine::run() { return Common::kNoError; } +bool BladeRunnerEngine::checkFiles(Common::Array &missingFiles) { + missingFiles.clear(); + + Common::Array requiredFiles; + requiredFiles.push_back("1.TLK"); + requiredFiles.push_back("2.TLK"); + requiredFiles.push_back("3.TLK"); + requiredFiles.push_back("A.TLK"); + requiredFiles.push_back("COREANIM.DAT"); + requiredFiles.push_back("MODE.MIX"); + requiredFiles.push_back("MUSIC.MIX"); + requiredFiles.push_back("OUTTAKE1.MIX"); + requiredFiles.push_back("OUTTAKE2.MIX"); + requiredFiles.push_back("OUTTAKE3.MIX"); + requiredFiles.push_back("OUTTAKE4.MIX"); + requiredFiles.push_back("SFX.MIX"); + requiredFiles.push_back("SPCHSFX.TLK"); + requiredFiles.push_back("STARTUP.MIX"); + requiredFiles.push_back("VQA1.MIX"); + requiredFiles.push_back("VQA2.MIX"); + requiredFiles.push_back("VQA3.MIX"); + + for (uint i = 0; i < requiredFiles.size(); ++i) { + if (!Common::File::exists(requiredFiles[i])) { + missingFiles.push_back(requiredFiles[i]); + } + } + + bool hasHdFrames = Common::File::exists("HDFRAMES.DAT"); + + if (!hasHdFrames) { + requiredFiles.clear(); + requiredFiles.push_back("CDFRAMES1.DAT"); + requiredFiles.push_back("CDFRAMES2.DAT"); + requiredFiles.push_back("CDFRAMES3.DAT"); + requiredFiles.push_back("CDFRAMES4.DAT"); + + for (uint i = 0; i < requiredFiles.size(); ++i) { + if (!Common::File::exists(requiredFiles[i])) { + missingFiles.push_back(requiredFiles[i]); + } + } + } + + return missingFiles.empty(); +} + bool BladeRunnerEngine::startup(bool hasSavegames) { // These are static objects in original game diff --git a/engines/bladerunner/bladerunner.h b/engines/bladerunner/bladerunner.h index 2c1aec4c1b..ceff3d70c4 100644 --- a/engines/bladerunner/bladerunner.h +++ b/engines/bladerunner/bladerunner.h @@ -251,6 +251,8 @@ public: Common::Error run() override; + bool checkFiles(Common::Array &missingFiles); + bool startup(bool hasSavegames = false); void initChapterAndScene(); void shutdown(); diff --git a/engines/bladerunner/slice_animations.cpp b/engines/bladerunner/slice_animations.cpp index 553f153356..55a3d13e34 100644 --- a/engines/bladerunner/slice_animations.cpp +++ b/engines/bladerunner/slice_animations.cpp @@ -111,7 +111,7 @@ bool SliceAnimations::openFrames(int fileNumber) { return true; } else { - warning("SliceAnimations::openFrames: HDFRAMES.DAT resource not found. Falling back to using CDFRAMESx.DAT files instead..."); + debug("SliceAnimations::openFrames: HDFRAMES.DAT resource not found. Falling back to using CDFRAMESx.DAT files instead..."); } } -- cgit v1.2.3