BLADERUNNER: Support merging of CDs in original layout.

Right now we ask user to reshuffle files. After this commit it's
possible to just merge contents of all CDs.
This commit is contained in:
Vladimir Serbinenko 2023-05-19 23:46:36 +02:00 committed by Eugene Sandulenko
parent 421295bdc6
commit 91ab581ede
3 changed files with 22 additions and 9 deletions

View File

@ -352,6 +352,12 @@ void BladeRunnerEngine::pauseEngineIntern(bool pause) {
Common::Error BladeRunnerEngine::run() {
Common::Array<Common::String> missingFiles;
const Common::FSNode gameDataDir(ConfMan.get("path"));
SearchMan.addSubDirectoryMatching(gameDataDir, "base");
SearchMan.addSubDirectoryMatching(gameDataDir, "cd1");
SearchMan.addSubDirectoryMatching(gameDataDir, "cd2");
SearchMan.addSubDirectoryMatching(gameDataDir, "cd3");
SearchMan.addSubDirectoryMatching(gameDataDir, "cd4");
if (!_isNonInteractiveDemo && !checkFiles(missingFiles)) {
Common::String missingFileStr = "";
for (uint i = 0; i < missingFiles.size(); ++i) {
@ -558,15 +564,9 @@ bool BladeRunnerEngine::checkFiles(Common::Array<Common::String> &missingFiles)
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]);
for (uint i = 1; i <= 4; ++i) {
if (!Common::File::exists(Common::String::format("CDFRAMES%d.DAT", i)) && !Common::File::exists(Common::String::format("CD%d/CDFRAMES.DAT", i))) {
missingFiles.push_back(Common::String::format("CD%d/CDFRAMES.DAT", i));
}
}
}

View File

@ -46,6 +46,10 @@ static const PlainGameDescriptor bladeRunnerGames[] = {
{nullptr, nullptr}
};
static const char *const directoryGlobs[] = {
"BASE",
nullptr
};
} // End of namespace BladeRunner
class BladeRunnerMetaEngineDetection : public AdvancedMetaEngineDetection {
@ -72,6 +76,8 @@ BladeRunnerMetaEngineDetection::BladeRunnerMetaEngineDetection()
// and expects ScummVM to detect both, offer a choice on which to add,
// and finally launch the proper one depending on which was added.
_flags = kADFlagUseExtraAsHint;
_maxScanDepth = 2;
_directoryGlobs = BladeRunner::directoryGlobs;
}
const char *BladeRunnerMetaEngineDetection::getName() const {

View File

@ -135,6 +135,11 @@ bool SliceAnimations::openFrames(int fileNumber) {
_framesPageFile.close(_framesPageFile._fileNumber);
}
_framesPageFile._fileNumber = fileNumber;
if (_framesPageFile.open(Common::String::format("CD%d/CDFRAMES.DAT", fileNumber), fileNumber)) {
return true;
}
// For Chapter1 we try both CDFRAMES.DAT and CDFRAMES1.DAT
if (fileNumber == 1 && _framesPageFile.open("CDFRAMES.DAT", fileNumber)) {
return true;
@ -151,11 +156,13 @@ bool SliceAnimations::openFrames(int fileNumber) {
_framesPageFile.close(i);
if (i == 1
&& (!_framesPageFile.open("CDFRAMES.DAT", i))
&& (!_framesPageFile.open(Common::String::format("CD%d/CDFRAMES.DAT", i), i))
&& (!_framesPageFile.open(Common::String::format("CDFRAMES%d.DAT", i), i))
) {
// For Chapter1 we try both CDFRAMES.DAT and CDFRAMES1.DAT
return false;
} else if (i != 1 &&
(!_framesPageFile.open(Common::String::format("CD%d/CDFRAMES.DAT", i), i)) &&
!_framesPageFile.open(Common::String::format("CDFRAMES%d.DAT", i), i)
) {
return false;