diff options
Diffstat (limited to 'engines/mohawk/detection.cpp')
-rw-r--r-- | engines/mohawk/detection.cpp | 54 |
1 files changed, 39 insertions, 15 deletions
diff --git a/engines/mohawk/detection.cpp b/engines/mohawk/detection.cpp index 986b35c85e..7c202998eb 100644 --- a/engines/mohawk/detection.cpp +++ b/engines/mohawk/detection.cpp @@ -26,6 +26,7 @@ #include "common/savefile.h" #include "common/system.h" #include "common/textconsole.h" +#include "common/translation.h" #include "mohawk/livingbooks.h" @@ -53,7 +54,7 @@ struct MohawkGameDescription { }; const char* MohawkEngine::getGameId() const { - return _gameDescription->desc.gameid; + return _gameDescription->desc.gameId; } uint32 MohawkEngine::getFeatures() const { @@ -160,10 +161,24 @@ static const char *directoryGlobs[] = { 0 }; +static const ADExtraGuiOptionsMap optionsList[] = { + { + GAMEOPTION_PLAY_MYST_FLYBY, + { + _s("Play the Myst fly by movie"), + _s("The Myst fly by movie was not played by the original engine."), + "playmystflyby", + false + } + }, + + AD_EXTRA_GUI_OPTIONS_TERMINATOR +}; + class MohawkMetaEngine : public AdvancedMetaEngine { public: - MohawkMetaEngine() : AdvancedMetaEngine(Mohawk::gameDescriptions, sizeof(Mohawk::MohawkGameDescription), mohawkGames) { - _singleid = "mohawk"; + MohawkMetaEngine() : AdvancedMetaEngine(Mohawk::gameDescriptions, sizeof(Mohawk::MohawkGameDescription), mohawkGames, optionsList) { + _singleId = "mohawk"; _maxScanDepth = 2; _directoryGlobs = directoryGlobs; } @@ -206,10 +221,25 @@ SaveStateList MohawkMetaEngine::listSaves(const char *target) const { // Loading games is only supported in Myst/Riven currently. #ifdef ENABLE_MYST if (strstr(target, "myst")) { - filenames = Mohawk::MystGameState::generateSaveGameList(); + filenames = g_system->getSavefileManager()->listSavefiles("myst-###.mys"); + size_t prefixLen = sizeof("myst") - 1; + + for (Common::StringArray::const_iterator filename = filenames.begin(); filename != filenames.end(); ++filename) { + // Extract the slot number from the filename + char slot[4]; + slot[0] = (*filename)[prefixLen + 1]; + slot[1] = (*filename)[prefixLen + 2]; + slot[2] = (*filename)[prefixLen + 3]; + slot[3] = '\0'; + + int slotNum = atoi(slot); + + // Read the description from the save + Common::String description = Mohawk::MystGameState::querySaveDescription(slotNum); + saveList.push_back(SaveStateDescriptor(slotNum, description)); + } - for (uint32 i = 0; i < filenames.size(); i++) - saveList.push_back(SaveStateDescriptor(i, filenames[i])); + Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator()); } else #endif if (strstr(target, "riven")) { @@ -223,11 +253,11 @@ SaveStateList MohawkMetaEngine::listSaves(const char *target) const { } void MohawkMetaEngine::removeSaveState(const char *target, int slot) const { + // Removing saved games is only supported in Myst/Riven currently. #ifdef ENABLE_MYST if (strstr(target, "myst")) { - Common::StringArray filenames = Mohawk::MystGameState::generateSaveGameList(); - Mohawk::MystGameState::deleteSave(filenames[slot]); + Mohawk::MystGameState::deleteSave(slot); } else #endif if (strstr(target, "riven")) { @@ -239,13 +269,7 @@ void MohawkMetaEngine::removeSaveState(const char *target, int slot) const { SaveStateDescriptor MohawkMetaEngine::querySaveMetaInfos(const char *target, int slot) const { #ifdef ENABLE_MYST if (strstr(target, "myst")) { - Common::StringArray filenames = Mohawk::MystGameState::generateSaveGameList(); - - if (slot >= (int) filenames.size()) { - return SaveStateDescriptor(); - } - - return Mohawk::MystGameState::querySaveMetaInfos(filenames[slot]); + return Mohawk::MystGameState::querySaveMetaInfos(slot); } else #endif { |