aboutsummaryrefslogtreecommitdiff
path: root/engines/cryomni3d
diff options
context:
space:
mode:
authorLe Philousophe2019-10-20 17:40:36 +0200
committerLe Philousophe2019-11-16 20:42:50 +0100
commit8254524d9ed8c33cb1a5c22a65c281372fac4c69 (patch)
treee6523c4df37a481ba7080b862434ed47b0b1a132 /engines/cryomni3d
parent3906d716daf3c634d84b8eff6ede31367516fb3f (diff)
downloadscummvm-rg350-8254524d9ed8c33cb1a5c22a65c281372fac4c69.tar.gz
scummvm-rg350-8254524d9ed8c33cb1a5c22a65c281372fac4c69.tar.bz2
scummvm-rg350-8254524d9ed8c33cb1a5c22a65c281372fac4c69.zip
CRYOMNI3D: Rewrite path handling to be more agnostic to installation
That simplifies fallback detection too
Diffstat (limited to 'engines/cryomni3d')
-rw-r--r--engines/cryomni3d/detection.cpp149
-rw-r--r--engines/cryomni3d/detection_tables.h103
-rw-r--r--engines/cryomni3d/versailles/engine.cpp85
-rw-r--r--engines/cryomni3d/versailles/engine.h2
-rw-r--r--engines/cryomni3d/versailles/saveload.cpp18
5 files changed, 94 insertions, 263 deletions
diff --git a/engines/cryomni3d/detection.cpp b/engines/cryomni3d/detection.cpp
index 11c78ba303..1a47b0d6cb 100644
--- a/engines/cryomni3d/detection.cpp
+++ b/engines/cryomni3d/detection.cpp
@@ -45,24 +45,6 @@ struct CryOmni3DGameDescription {
uint32 features;
};
-/**
- * The fallback game descriptor used by the meta engine's fallbackDetector.
- * Contents of this struct are overwritten by the fallbackDetector.
- */
-static CryOmni3DGameDescription s_fallbackDesc = {
- {
- "",
- "",
- AD_ENTRY1(0, 0), // This should always be AD_ENTRY1(0, 0) in the fallback descriptor
- Common::UNK_LANG,
- Common::kPlatformUnknown,
- ADGF_UNSTABLE,
- GUIO0()
- },
- 0,
- 0
-};
-
const char *CryOmni3DEngine::getGameId() const {
return _gameDescription->desc.gameId;
}
@@ -104,28 +86,13 @@ class CryOmni3DMetaEngine : public AdvancedMetaEngine {
public:
CryOmni3DMetaEngine() : AdvancedMetaEngine(CryOmni3D::gameDescriptions,
sizeof(CryOmni3DGameDescription), cryomni3DGames, optionsList) {
- _maxScanDepth = 1;
+ _directoryGlobs = directoryGlobs;
+ _maxScanDepth = 5;
}
ADDetectedGame fallbackDetect(const FileMap &allFiles,
const Common::FSList &fslist) const override {
-
- ADDetectedGame game;
-
- SearchMan.addDirectory("CryOmni3DMetaEngine::fallbackDetect", fslist.begin()->getParent());
- debug("Adding to SearchMan: %s", fslist.begin()->getParent().getPath().c_str());
-
- // Detect Versailles
- game = fallbackDetectVersailles(fslist.begin()->getParent());
- if (game.desc) {
- SearchMan.remove("CryOmni3DMetaEngine::fallbackDetect");
- return game;
- }
-
- SearchMan.remove("CryOmni3DMetaEngine::fallbackDetect");
-
- // Fallback to standard fallback detection
- return detectGameFilebased(allFiles, fslist, CryOmni3D::fileBased);
+ return detectGameFilebased(allFiles, fslist, fileBased);
}
const char *getEngineId() const {
@@ -145,118 +112,8 @@ public:
virtual SaveStateList listSaves(const char *target) const;
virtual int getMaximumSaveSlot() const { return 999; }
virtual void removeSaveState(const char *target, int slot) const;
-
- bool addUnknownFile(const Common::FSNode &node, ADDetectedGame &game) const;
-
- ADDetectedGame fallbackDetectVersailles(const Common::FSNode &root) const;
};
-bool CryOmni3DMetaEngine::addUnknownFile(const Common::FSNode &node, ADDetectedGame &game) const {
- Common::File testFile;
- FileProperties fileProps;
-
- if (!testFile.open(node)) {
- return false;
- }
-
- fileProps.size = (int32)testFile.size();
- fileProps.md5 = Common::computeStreamMD5AsString(testFile, _md5Bytes);
-
- game.hasUnknownFiles = true;
- game.matchedFiles[node.getName()] = fileProps;
-
- return true;
-}
-
-ADDetectedGame CryOmni3DMetaEngine::fallbackDetectVersailles(const Common::FSNode &root) const {
- debug("Checking for OBJETS/VS1.HLZ");
- if (!root.getChild("OBJETS").getChild("VS1.HLZ").exists()) {
- debug("not found");
- return ADDetectedGame();
- }
- debug("found !");
-
- Common::FSNode node;
- const ADGameDescription *gameDesc = &s_fallbackDesc.desc;
- ADDetectedGame game(gameDesc);
-
- s_fallbackDesc.desc.gameId = "versailles";
- s_fallbackDesc.desc.extra = "fallback";
- s_fallbackDesc.desc.language = Common::UNK_LANG;
- s_fallbackDesc.desc.flags = ADGF_UNSTABLE;
- s_fallbackDesc.desc.platform = Common::kPlatformUnknown;
- s_fallbackDesc.desc.guiOptions = GUI_OPTIONS_VERSAILLES;
-
- s_fallbackDesc.gameType = GType_VERSAILLES;
-
- // Sounds good, determine platform
- node = root.getChild("VERSAILL.PGM");
- if (node.exists()) {
- addUnknownFile(node, game);
-
- s_fallbackDesc.desc.platform = Common::kPlatformDOS;
- }
- node = root.getChild("VERSAILL.EXE");
- if (node.exists()) {
- addUnknownFile(node, game);
-
- s_fallbackDesc.desc.platform = Common::kPlatformWindows;
- }
- node = root.getChild("PROGRAM.Z");
- if (node.exists()) {
- addUnknownFile(node, game);
-
- s_fallbackDesc.desc.platform = Common::kPlatformWindows;
- }
- node = root.getChild("Versailles");
- if (node.exists()) {
- addUnknownFile(node, game);
-
- s_fallbackDesc.desc.platform = Common::kPlatformMacintosh;
- }
-
- // Determine language
- // Use fonts set C as helvet12 contains more characters than fruitL
- uint8 fontsSet = GF_VERSAILLES_FONTS_SET_B;
- node = root.getChild("GTO").getChild("DIALOG1.GTO");
- if (node.getChild("DIALOG1.GTO").exists()) {
- s_fallbackDesc.desc.language = Common::FR_FRA;
- } else if (node.getChild("DIALOG1.ALM").exists()) {
- s_fallbackDesc.desc.language = Common::DE_DEU;
- } else if (node.getChild("DIALOG1.GB").exists()) {
- s_fallbackDesc.desc.language = Common::EN_ANY;
- } else if (node.getChild("DIALOG1.SP").exists()) {
- s_fallbackDesc.desc.language = Common::ES_ESP;
- } else if (node.getChild("DIALOG1.ITA").exists()) {
- s_fallbackDesc.desc.language = Common::IT_ITA;
- fontsSet = GF_VERSAILLES_FONTS_SET_C;
- }
-
- // Determine game flags
- s_fallbackDesc.features = 0;
- node = root.getChild("FONTS").getChild("FONT01.CRF");
- if (node.exists()) {
- // Add file to report to let developers set appropriate game flags
- addUnknownFile(node, game);
-
- s_fallbackDesc.features |= GF_VERSAILLES_FONTS_NUMERIC;
- } else {
- s_fallbackDesc.features |= fontsSet;
- }
-
- node = root.getChild("DIAL").getChild("VOIX").getChild("ALI001__.WAV");
- if (node.exists()) {
- // Add file to report to let developers set appropriate game flags
- addUnknownFile(node, game);
-
- s_fallbackDesc.features |= GF_VERSAILLES_AUDIOPADDING_YES;
- } else {
- s_fallbackDesc.features |= GF_VERSAILLES_AUDIOPADDING_NO;
- }
-
- return game;
-}
-
bool CryOmni3DMetaEngine::hasFeature(MetaEngineFeature f) const {
return
(f == kSupportsListSaves)
diff --git a/engines/cryomni3d/detection_tables.h b/engines/cryomni3d/detection_tables.h
index 1435c25560..01fce77d81 100644
--- a/engines/cryomni3d/detection_tables.h
+++ b/engines/cryomni3d/detection_tables.h
@@ -20,10 +20,27 @@
*
*/
-namespace CryOmni3D {
+// This file is included in CryOmni3D namespace
#define GUI_OPTIONS_VERSAILLES GUIO3(GUIO_NOMIDI, GUIO_NOSFX, GUIO_NOASPECT)
+// To correctly detect root we need files from various places: CD1, CD2, HDD, on-CD install files
+// We use files common to all installations except the documentation links and the binary
+// We only check the file presence to simplify and use program to discriminate the version
+#define VERSAILLES_ENTRY(f, x, s, lien_doc_ext) { \
+ { "11D_LEB1.HNM", 0, nullptr, -1}, \
+ { "COFBOUM.HNM", 0, nullptr, -1}, \
+ { "lien_doc." lien_doc_ext, 0, nullptr, -1}, \
+ { f, 0, x, s}, \
+ AD_LISTEND}
+
+#define VERSAILLES_ENTRY_DEF(f, x, s) VERSAILLES_ENTRY(f, x, s, "txt")
+
+
+// To add new entries, you should check which fonts are loaded by the binary by looking at strings in it
+// and you should check if audio files have underscores to pad to 8.3 format
+// The simplest is to request a "tree /f" or "find ." and check which files are present
+// From experience, numeric should be used when available
static const CryOmni3DGameDescription gameDescriptions[] = {
// Versailles 1685
// French Windows 95 from hybrid Win95/DOS CD
@@ -32,7 +49,7 @@ static const CryOmni3DGameDescription gameDescriptions[] = {
{
"versailles",
"",
- AD_ENTRY1s("VERSAILL.EXE", "3775004b96f056716ce615b458b1f394", 372736),
+ VERSAILLES_ENTRY_DEF("VERSAILL.EXE", "3775004b96f056716ce615b458b1f394", 372736),
Common::FR_FRA,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
@@ -49,7 +66,7 @@ static const CryOmni3DGameDescription gameDescriptions[] = {
{
"versailles",
"",
- AD_ENTRY1s("PROGRAM.Z", "a07b5d86af5f3a8883ba97db2bade87d", 293223),
+ VERSAILLES_ENTRY_DEF("PROGRAM.Z", "a07b5d86af5f3a8883ba97db2bade87d", 293223),
Common::FR_FRA,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
@@ -66,7 +83,7 @@ static const CryOmni3DGameDescription gameDescriptions[] = {
{
"versailles",
"",
- AD_ENTRY1s("VERSAILL.PGM", "1c992f034f43418a5da2e8ebd0b92620", 630431),
+ VERSAILLES_ENTRY_DEF("VERSAILL.PGM", "1c992f034f43418a5da2e8ebd0b92620", 630431),
Common::FR_FRA,
Common::kPlatformDOS,
ADGF_NO_FLAGS,
@@ -83,7 +100,7 @@ static const CryOmni3DGameDescription gameDescriptions[] = {
{
"versailles",
"",
- AD_ENTRY1s("VERSAILL.PGM", "1c992f034f43418a5da2e8ebd0b92620", 598767),
+ VERSAILLES_ENTRY_DEF("VERSAILL.PGM", "1c992f034f43418a5da2e8ebd0b92620", 598767),
Common::FR_FRA,
Common::kPlatformDOS,
ADGF_NO_FLAGS,
@@ -100,7 +117,7 @@ static const CryOmni3DGameDescription gameDescriptions[] = {
{
"versailles",
"",
- AD_ENTRY1s("Versaill.exe", "09b4734ce473e4cb78738677ce39f536", 346624),
+ VERSAILLES_ENTRY_DEF("Versaill.exe", "09b4734ce473e4cb78738677ce39f536", 346624),
Common::FR_FRA,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
@@ -117,7 +134,7 @@ static const CryOmni3DGameDescription gameDescriptions[] = {
{
"versailles",
"",
- AD_ENTRY1s("PROGRAM.Z", "167ac4d6e60856ee84d7369107d858d4", 230056),
+ VERSAILLES_ENTRY_DEF("PROGRAM.Z", "167ac4d6e60856ee84d7369107d858d4", 230056),
Common::FR_FRA,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
@@ -134,7 +151,7 @@ static const CryOmni3DGameDescription gameDescriptions[] = {
{
"versailles",
"",
- AD_ENTRY1s("Versailles", "f81935517b1bbb58acf70f25efa5c7f3", 375868),
+ VERSAILLES_ENTRY_DEF("Versailles", "f81935517b1bbb58acf70f25efa5c7f3", 375868),
Common::FR_FRA,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
@@ -151,7 +168,7 @@ static const CryOmni3DGameDescription gameDescriptions[] = {
{
"versailles",
"",
- AD_ENTRY1s("Versaill.exe", "5c3c10ec821b8d96016041ab649af8c7", 377856),
+ VERSAILLES_ENTRY_DEF("Versaill.exe", "5c3c10ec821b8d96016041ab649af8c7", 377856),
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
@@ -168,7 +185,7 @@ static const CryOmni3DGameDescription gameDescriptions[] = {
{
"versailles",
"",
- AD_ENTRY1s("Versailles", "7fa3cb6a3c18f6b4ba6be85dcd433cff", 366199),
+ VERSAILLES_ENTRY_DEF("Versailles", "7fa3cb6a3c18f6b4ba6be85dcd433cff", 366199),
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
@@ -185,7 +202,7 @@ static const CryOmni3DGameDescription gameDescriptions[] = {
{
"versailles",
"",
- AD_ENTRY1s("VERSAILL.PGM", "1c992f034f43418a5da2e8ebd0b92620", 598639),
+ VERSAILLES_ENTRY_DEF("VERSAILL.PGM", "1c992f034f43418a5da2e8ebd0b92620", 598639),
Common::EN_ANY,
Common::kPlatformDOS,
ADGF_NO_FLAGS,
@@ -202,7 +219,7 @@ static const CryOmni3DGameDescription gameDescriptions[] = {
{
"versailles",
"",
- AD_ENTRY1s("PROGRAM.Z", "f5327cb860a67a24a52b6125ddc5e00b", 256146),
+ VERSAILLES_ENTRY_DEF("PROGRAM.Z", "f5327cb860a67a24a52b6125ddc5e00b", 256146),
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
@@ -219,7 +236,7 @@ static const CryOmni3DGameDescription gameDescriptions[] = {
{
"versailles",
"",
- AD_ENTRY1s("VERSAILL.PGM", "1c992f034f43418a5da2e8ebd0b92620", 710467),
+ VERSAILLES_ENTRY_DEF("VERSAILL.PGM", "1c992f034f43418a5da2e8ebd0b92620", 710467),
Common::EN_ANY,
Common::kPlatformDOS,
ADGF_NO_FLAGS,
@@ -236,7 +253,7 @@ static const CryOmni3DGameDescription gameDescriptions[] = {
{
"versailles",
"",
- AD_ENTRY1s("PROGRAM.Z", "daeeb8bce80fe74fe28ecc22b6a97f83", 237679),
+ VERSAILLES_ENTRY_DEF("PROGRAM.Z", "daeeb8bce80fe74fe28ecc22b6a97f83", 237679),
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
@@ -253,7 +270,7 @@ static const CryOmni3DGameDescription gameDescriptions[] = {
{
"versailles",
"",
- AD_ENTRY1s("VERSAILL.PGM", "1c992f034f43418a5da2e8ebd0b92620", 603023),
+ VERSAILLES_ENTRY_DEF("VERSAILL.PGM", "1c992f034f43418a5da2e8ebd0b92620", 603023),
Common::IT_ITA,
Common::kPlatformDOS,
ADGF_NO_FLAGS,
@@ -270,7 +287,7 @@ static const CryOmni3DGameDescription gameDescriptions[] = {
{
"versailles",
"",
- AD_ENTRY1s("PROGRAM.Z", "8b0dcf71a7eb21b8378add8b16857bae", 237878),
+ VERSAILLES_ENTRY_DEF("PROGRAM.Z", "8b0dcf71a7eb21b8378add8b16857bae", 237878),
Common::IT_ITA,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
@@ -287,7 +304,7 @@ static const CryOmni3DGameDescription gameDescriptions[] = {
{
"versailles",
"",
- AD_ENTRY1s("Versailles", "f1aa0603e7f71404f936e4189b4c5b2b", 348614),
+ VERSAILLES_ENTRY("Versailles", "f1aa0603e7f71404f936e4189b4c5b2b", 348614, "ALM"),
Common::DE_DEU,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
@@ -304,7 +321,7 @@ static const CryOmni3DGameDescription gameDescriptions[] = {
{
"versailles",
"",
- AD_ENTRY1s("PROGRAM.Z", "2e1a40237f8b28cb6ef29cff137fa561", 238041),
+ VERSAILLES_ENTRY("PROGRAM.Z", "2e1a40237f8b28cb6ef29cff137fa561", 238041, "ALM"),
Common::DE_DEU,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
@@ -321,7 +338,7 @@ static const CryOmni3DGameDescription gameDescriptions[] = {
{
"versailles",
"",
- AD_ENTRY1s("VERSAILL.EXE", "78d90d656ec3b76f158721d38bc68083", 346112),
+ VERSAILLES_ENTRY_DEF("VERSAILL.EXE", "78d90d656ec3b76f158721d38bc68083", 346112),
Common::ES_ESP,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
@@ -338,7 +355,7 @@ static const CryOmni3DGameDescription gameDescriptions[] = {
{
"versailles",
"",
- AD_ENTRY1s("PROGRAM.Z", "9e7c0c3125124010d45dde9dc62744ef", 237800),
+ VERSAILLES_ENTRY_DEF("PROGRAM.Z", "9e7c0c3125124010d45dde9dc62744ef", 237800),
Common::ES_ESP,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
@@ -355,7 +372,7 @@ static const CryOmni3DGameDescription gameDescriptions[] = {
{
"versailles",
"",
- AD_ENTRY1s("VERSAILL.PGM", "1c992f034f43418a5da2e8ebd0b92620", 715887),
+ VERSAILLES_ENTRY_DEF("VERSAILL.PGM", "1c992f034f43418a5da2e8ebd0b92620", 715887),
Common::ES_ESP,
Common::kPlatformDOS,
ADGF_NO_FLAGS,
@@ -372,7 +389,7 @@ static const CryOmni3DGameDescription gameDescriptions[] = {
{
"versailles",
"",
- AD_ENTRY1s("Versaill.exe", "49aa4581b8c652aa88c633b6c5fe84ea", 346112),
+ VERSAILLES_ENTRY_DEF("Versaill.exe", "49aa4581b8c652aa88c633b6c5fe84ea", 346112),
Common::PT_BRA,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
@@ -389,7 +406,7 @@ static const CryOmni3DGameDescription gameDescriptions[] = {
{
"versailles",
"",
- AD_ENTRY1s("PROGRAM.Z", "013eabf30fdec7bb7302a5312d094c64", 237952),
+ VERSAILLES_ENTRY_DEF("PROGRAM.Z", "013eabf30fdec7bb7302a5312d094c64", 237952),
Common::PT_BRA,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
@@ -398,10 +415,40 @@ static const CryOmni3DGameDescription gameDescriptions[] = {
GType_VERSAILLES,
GF_VERSAILLES_FONTS_NUMERIC | GF_VERSAILLES_AUDIOPADDING_YES,
},
-
{ AD_TABLE_END_MARKER, 0, 0 }
};
+static const char *directoryGlobs[] = {
+ /** Versailles 1685 **/
+ /* DATAS_V/ANIMACTI/LEVEL1/11D_LEB1.HNM
+ * DATAS_V/ANIMACTI/LEVEL7/COFBOUM.HNM */
+ "DATAS_V",
+ /* When user doesn't want to overwrite */
+ "DATAS_V1",
+ "DATAS_V2",
+ "ANIMACTI",
+ "LEVEL1",
+ "LEVEL7",
+ /* PC Setup */
+ /* INSTALL/DATA/TEXTES/LIEN_DOC.TXT
+ * INSTALL/WIN/PROGRAM.Z
+ * INSTALL/DOS/VERSAILL.PGM */
+ "INSTALL",
+ "DATA",
+ "WIN",
+ "DOS",
+ /* Mac Setup */
+ /* Versailles Folder/DATAV_HD/TEXTES/LIEN_DOC.TXT
+ * Versailles Folder/Versailles */
+ "*Versailles*",
+ "DATAV_HD",
+ /* lien_doc.* */
+ "TEXTES",
+
+ /** End of list **/
+ nullptr
+};
+
//////////////////////////////
//Fallback detection
//////////////////////////////
@@ -409,7 +456,7 @@ static const CryOmni3DGameDescription gameDescriptions[] = {
static const CryOmni3DGameDescription fallbackDescs[] = {
{
{
- "",
+ "versailles",
"",
AD_ENTRY1(0, 0),
Common::UNK_LANG,
@@ -423,7 +470,9 @@ static const CryOmni3DGameDescription fallbackDescs[] = {
};
static const ADFileBasedFallback fileBased[] = {
+ { &fallbackDescs[0].desc, { "11D_LEB1.HNM", "COFBOUM.HNM", "VERSAILL.PGM", 0 } },
+ { &fallbackDescs[0].desc, { "11D_LEB1.HNM", "COFBOUM.HNM", "PROGRAM.Z", 0 } },
+ { &fallbackDescs[0].desc, { "11D_LEB1.HNM", "COFBOUM.HNM", "VERSAILL.EXE", 0 } },
+ { &fallbackDescs[0].desc, { "11D_LEB1.HNM", "COFBOUM.HNM", "Versailles", 0 } },
{ 0, { 0 } }
};
-
-} // End of Namespace CryOmni3D
diff --git a/engines/cryomni3d/versailles/engine.cpp b/engines/cryomni3d/versailles/engine.cpp
index ea0d2a8702..e8f7728359 100644
--- a/engines/cryomni3d/versailles/engine.cpp
+++ b/engines/cryomni3d/versailles/engine.cpp
@@ -74,54 +74,16 @@ bool CryOmni3DEngine_Versailles::hasFeature(EngineFeature f) const {
|| (f == kSupportsLoadingDuringRuntime);
}
+void CryOmni3DEngine_Versailles::initializePath(const Common::FSNode &gamePath) {
+ // All files are named uniquely so just add the main directory with a large enough depth and in flat mode
+ // That should do it
+ SearchMan.setIgnoreClashes(true);
+ SearchMan.addDirectory(gamePath.getPath(), gamePath, 0, 5, true);
+}
+
Common::Error CryOmni3DEngine_Versailles::run() {
CryOmni3DEngine::run();
- const Common::FSNode gameDataDir(ConfMan.get("path"));
- SearchMan.addSubDirectoryMatching(gameDataDir, "sc_trans", 1);
- SearchMan.addSubDirectoryMatching(gameDataDir, "menu", 1);
- SearchMan.addSubDirectoryMatching(gameDataDir, "basedoc/fonds", 1);
- SearchMan.addSubDirectoryMatching(gameDataDir, "fonts", 1);
- SearchMan.addSubDirectoryMatching(gameDataDir, "spr8col", 1);
- SearchMan.addSubDirectoryMatching(gameDataDir, "spr8col/bmpok", 1);
- SearchMan.addSubDirectoryMatching(gameDataDir, "wam", 1);
- SearchMan.addSubDirectoryMatching(gameDataDir, "objets", 1);
- SearchMan.addSubDirectoryMatching(gameDataDir, "gto", 1);
- SearchMan.addSubDirectoryMatching(gameDataDir, "dial/flc_dial", 1);
- SearchMan.addSubDirectoryMatching(gameDataDir, "dial/voix", 1);
- SearchMan.addSubDirectoryMatching(gameDataDir, "textes", 1);
- SearchMan.addSubDirectoryMatching(gameDataDir, "music", 1);
- SearchMan.addSubDirectoryMatching(gameDataDir, "sound", 1);
-
- // Sometimes files are taken from other levels
- // Original game has a logic based on the first character of the file name.
- // We can't do this here so we put in lower priority all the levels as a fallback
-
- // Create a first SearchSet in which we will add all others to group everything
- Common::SearchSet *fallbackFiles = new Common::SearchSet();
-
- for (uint lvl = 1; lvl <= 7; lvl++) {
- Common::SearchSet *fallbackFilesAnimacti = new Common::SearchSet();
- Common::SearchSet *fallbackFilesWarp = new Common::SearchSet();
- Common::SearchSet *fallbackFilesImgFix = new Common::SearchSet();
-
- fallbackFilesAnimacti->addSubDirectoryMatching(gameDataDir, Common::String::format(
- "animacti/level%d", lvl), 2);
- fallbackFilesWarp->addSubDirectoryMatching(gameDataDir, Common::String::format(
- "warp/level%d/cyclo", lvl), 2);
- fallbackFilesWarp->addSubDirectoryMatching(gameDataDir, Common::String::format(
- "warp/level%d/hnm", lvl), 2);
- fallbackFilesImgFix->addSubDirectoryMatching(gameDataDir, Common::String::format(
- "img_fix/level%d", lvl), 2);
-
- fallbackFiles->add(Common::String::format("__fallbackFiles_animacti_%d", lvl),
- fallbackFilesAnimacti);
- fallbackFiles->add(Common::String::format("__fallbackFiles_warp_%d", lvl), fallbackFilesWarp);
- fallbackFiles->add(Common::String::format("__fallbackFiles_img_fix_%d", lvl), fallbackFilesImgFix);
- }
-
- SearchMan.add("__fallbackFiles", fallbackFiles);
-
// First thing, load all data that was originally in the executable
// We don't need anything prepared for that
loadStaticData();
@@ -744,37 +706,8 @@ void CryOmni3DEngine_Versailles::changeLevel(int level) {
}
void CryOmni3DEngine_Versailles::initNewLevel(int level) {
- // SearchMan can't add several times the same basename
- // We create several SearchSet with different names that we add to SearchMan instead
-
- SearchMan.remove("__levelFiles_animacti");
- SearchMan.remove("__levelFiles_warp");
- SearchMan.remove("__levelFiles_img_fix");
-
- const Common::FSNode gameDataDir(ConfMan.get("path"));
- if (level >= 1 && level <= 7) {
- // Add current level directories to the search set to be looked up first
- // If a file is not found in the current level, find it with the fallback
-
- Common::SearchSet *levelFilesAnimacti = new Common::SearchSet();
- Common::SearchSet *levelFilesWarp = new Common::SearchSet();
- Common::SearchSet *levelFilesImgFix = new Common::SearchSet();
-
- levelFilesAnimacti->addSubDirectoryMatching(gameDataDir, Common::String::format(
- "animacti/level%d", level), 1);
- levelFilesWarp->addSubDirectoryMatching(gameDataDir, Common::String::format(
- "warp/level%d/cyclo", level), 1);
- levelFilesWarp->addSubDirectoryMatching(gameDataDir, Common::String::format(
- "warp/level%d/hnm", level), 1);
- levelFilesImgFix->addSubDirectoryMatching(gameDataDir, Common::String::format(
- "img_fix/level%d", level), 1);
-
- SearchMan.add("__levelFiles_animacti", levelFilesAnimacti);
- SearchMan.add("__levelFiles_warp", levelFilesWarp);
- SearchMan.add("__levelFiles_img_fix", levelFilesImgFix);
- } else if (level == 8 && _isVisiting) {
- // In visit mode, we take files from all levels so we use the fallback mechanism
- } else {
+ if (level < 1 || level > 8 ||
+ (level == 8 && !_isVisiting)) {
error("Invalid level %d", level);
}
diff --git a/engines/cryomni3d/versailles/engine.h b/engines/cryomni3d/versailles/engine.h
index 95747ced42..d3cc4c644b 100644
--- a/engines/cryomni3d/versailles/engine.h
+++ b/engines/cryomni3d/versailles/engine.h
@@ -228,6 +228,8 @@ public:
CryOmni3DEngine_Versailles(OSystem *syst, const CryOmni3DGameDescription *gamedesc);
virtual ~CryOmni3DEngine_Versailles();
+ virtual void initializePath(const Common::FSNode &gamePath) override;
+
bool hasFeature(EngineFeature f) const override;
virtual Common::Error loadGameState(int slot) override;
virtual Common::Error saveGameState(int slot, const Common::String &desc) override;
diff --git a/engines/cryomni3d/versailles/saveload.cpp b/engines/cryomni3d/versailles/saveload.cpp
index 813dc7669d..521bebe226 100644
--- a/engines/cryomni3d/versailles/saveload.cpp
+++ b/engines/cryomni3d/versailles/saveload.cpp
@@ -46,11 +46,7 @@ Common::String CryOmni3DEngine_Versailles::getSaveFileName(bool visit, uint save
}
bool CryOmni3DEngine_Versailles::canVisit() const {
- // Build a custom SearchSet
- const Common::FSNode gameDataDir(ConfMan.get("path"));
- Common::SearchSet visitsSearchSet;
- visitsSearchSet.addSubDirectoryMatching(gameDataDir, "savegame/visite", 1);
- return visitsSearchSet.hasFile("game0001.sav");
+ return Common::File::exists("game0001.sav");
}
void CryOmni3DEngine_Versailles::getSavesList(bool visit, Common::StringArray &saveNames) {
@@ -69,12 +65,9 @@ void CryOmni3DEngine_Versailles::getSavesList(bool visit, Common::StringArray &s
if (visit) {
// Add bootstrap visit
- const Common::FSNode gameDataDir(ConfMan.get("path"));
- Common::SearchSet visitsSearchSet;
- visitsSearchSet.addSubDirectoryMatching(gameDataDir, "savegame/visite", 1);
- if (visitsSearchSet.hasFile("game0001.sav")) {
+ if (Common::File::exists("game0001.sav")) {
Common::File visitFile;
- if (!visitFile.open("game0001.sav", visitsSearchSet)) {
+ if (!visitFile.open("game0001.sav")) {
error("Can't load visit file");
}
visitFile.read(saveName, kSaveDescriptionLen);
@@ -201,11 +194,8 @@ bool CryOmni3DEngine_Versailles::loadGame(bool visit, uint saveNum) {
if (visit && saveNum == 1) {
// Load bootstrap visit
- const Common::FSNode gameDataDir(ConfMan.get("path"));
- Common::SearchSet visitsSearchSet;
- visitsSearchSet.addSubDirectoryMatching(gameDataDir, "savegame/visite", 1);
Common::File *visitFile = new Common::File();
- if (!visitFile->open("game0001.sav", visitsSearchSet)) {
+ if (!visitFile->open("game0001.sav")) {
delete visitFile;
error("Can't load visit file");
}