2009-12-29 23:18:24 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2014-02-18 02:34:22 +01:00
|
|
|
*
|
2009-12-29 23:18:24 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2014-02-18 02:34:22 +01:00
|
|
|
*
|
2009-12-29 23:18:24 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "base/plugins.h"
|
|
|
|
|
|
|
|
#include "engines/advancedDetector.h"
|
|
|
|
#include "common/savefile.h"
|
2011-04-24 11:34:27 +03:00
|
|
|
#include "common/system.h"
|
2011-04-28 20:24:24 +03:00
|
|
|
#include "common/textconsole.h"
|
2016-02-28 09:28:18 +01:00
|
|
|
#include "common/translation.h"
|
2009-12-29 23:18:24 +00:00
|
|
|
|
|
|
|
#include "mohawk/livingbooks.h"
|
2011-03-28 15:31:14 -04:00
|
|
|
|
|
|
|
#ifdef ENABLE_CSTIME
|
2011-01-20 21:35:00 +00:00
|
|
|
#include "mohawk/cstime.h"
|
2011-03-28 15:31:14 -04:00
|
|
|
#endif
|
2009-12-29 23:18:24 +00:00
|
|
|
|
2011-03-28 15:20:30 -04:00
|
|
|
#ifdef ENABLE_MYST
|
|
|
|
#include "mohawk/myst.h"
|
2016-02-22 08:31:02 +01:00
|
|
|
#include "mohawk/myst_state.h"
|
2011-03-28 15:20:30 -04:00
|
|
|
#endif
|
|
|
|
|
2011-03-28 15:43:57 -04:00
|
|
|
#ifdef ENABLE_RIVEN
|
|
|
|
#include "mohawk/riven.h"
|
2016-07-10 20:43:34 +02:00
|
|
|
#include "mohawk/riven_saveload.h"
|
2011-03-28 15:43:57 -04:00
|
|
|
#endif
|
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
namespace Mohawk {
|
|
|
|
|
|
|
|
const char* MohawkEngine::getGameId() const {
|
2016-03-08 18:53:55 +01:00
|
|
|
return _gameDescription->desc.gameId;
|
2009-12-29 23:18:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32 MohawkEngine::getFeatures() const {
|
|
|
|
return _gameDescription->features;
|
|
|
|
}
|
|
|
|
|
|
|
|
Common::Platform MohawkEngine::getPlatform() const {
|
|
|
|
return _gameDescription->desc.platform;
|
|
|
|
}
|
|
|
|
|
2010-11-24 21:12:21 +00:00
|
|
|
const char *MohawkEngine::getAppName() const {
|
|
|
|
return _gameDescription->appName;
|
2009-12-29 23:18:24 +00:00
|
|
|
}
|
|
|
|
|
2009-12-30 23:02:14 +00:00
|
|
|
uint8 MohawkEngine::getGameType() const {
|
2009-12-29 23:18:24 +00:00
|
|
|
return _gameDescription->gameType;
|
|
|
|
}
|
|
|
|
|
2009-12-30 23:02:14 +00:00
|
|
|
Common::String MohawkEngine_LivingBooks::getBookInfoFileName() const {
|
2009-12-29 23:18:24 +00:00
|
|
|
return _gameDescription->desc.filesDescriptions[0].fileName;
|
|
|
|
}
|
|
|
|
|
2009-12-30 23:02:14 +00:00
|
|
|
Common::Language MohawkEngine::getLanguage() const {
|
2009-12-29 23:18:24 +00:00
|
|
|
return _gameDescription->desc.language;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool MohawkEngine::hasFeature(EngineFeature f) const {
|
|
|
|
return
|
|
|
|
(f == kSupportsRTL);
|
|
|
|
}
|
|
|
|
|
2011-03-28 15:20:30 -04:00
|
|
|
#ifdef ENABLE_MYST
|
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
bool MohawkEngine_Myst::hasFeature(EngineFeature f) const {
|
2010-01-25 01:39:44 +00:00
|
|
|
return
|
2009-12-29 23:18:24 +00:00
|
|
|
MohawkEngine::hasFeature(f)
|
|
|
|
|| (f == kSupportsLoadingDuringRuntime)
|
|
|
|
|| (f == kSupportsSavingDuringRuntime);
|
|
|
|
}
|
|
|
|
|
2011-03-28 15:20:30 -04:00
|
|
|
#endif
|
|
|
|
|
2011-03-28 15:43:57 -04:00
|
|
|
#ifdef ENABLE_RIVEN
|
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
bool MohawkEngine_Riven::hasFeature(EngineFeature f) const {
|
2010-01-25 01:39:44 +00:00
|
|
|
return
|
2009-12-29 23:18:24 +00:00
|
|
|
MohawkEngine::hasFeature(f)
|
|
|
|
|| (f == kSupportsLoadingDuringRuntime)
|
|
|
|
|| (f == kSupportsSavingDuringRuntime);
|
|
|
|
}
|
|
|
|
|
2011-03-28 15:43:57 -04:00
|
|
|
#endif
|
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
} // End of Namespace Mohawk
|
|
|
|
|
|
|
|
static const PlainGameDescriptor mohawkGames[] = {
|
|
|
|
{"mohawk", "Mohawk Game"},
|
|
|
|
{"myst", "Myst"},
|
2016-09-15 09:22:47 +02:00
|
|
|
{"makingofmyst", "The Making of Myst"},
|
2009-12-29 23:18:24 +00:00
|
|
|
{"riven", "Riven: The Sequel to Myst"},
|
2011-01-03 22:53:12 +00:00
|
|
|
{"cstime", "Where in Time is Carmen Sandiego?"},
|
2011-01-31 23:10:18 +00:00
|
|
|
{"carmentq", "Carmen Sandiego's ThinkQuick Challenge"},
|
2011-04-07 18:13:32 -04:00
|
|
|
{"carmentqc", "Carmen Sandiego's ThinkQuick Challenge Custom Question Creator"},
|
2010-11-29 06:35:50 +00:00
|
|
|
{"maggiesfa", "Maggie's Farmyard Adventure"},
|
2009-12-29 23:18:24 +00:00
|
|
|
{"greeneggs", "Green Eggs and Ham"},
|
2011-03-27 11:44:02 -04:00
|
|
|
{"seussabc", "Dr Seuss's ABC"},
|
2009-12-29 23:18:24 +00:00
|
|
|
{"tortoise", "Aesop's Fables: The Tortoise and the Hare"},
|
2011-04-02 11:08:05 -04:00
|
|
|
{"arthur", "Arthur's Teacher Trouble"},
|
2009-12-29 23:18:24 +00:00
|
|
|
{"grandma", "Just Grandma and Me"},
|
|
|
|
{"ruff", "Ruff's Bone"},
|
|
|
|
{"newkid", "The New Kid on the Block"},
|
|
|
|
{"arthurrace", "Arthur's Reading Race"},
|
2010-07-09 22:10:22 +00:00
|
|
|
{"arthurbday", "Arthur's Birthday"},
|
|
|
|
{"lilmonster", "Little Monster at School"},
|
2011-01-26 18:40:28 +00:00
|
|
|
{"catinthehat", "The Cat in the Hat"},
|
2010-12-25 18:45:29 +00:00
|
|
|
{"rugrats", "Rugrats Adventure Game"},
|
2011-01-27 19:20:27 +00:00
|
|
|
{"lbsampler", "Living Books Sampler"},
|
2011-02-01 02:47:24 +00:00
|
|
|
{"bearfight", "The Berenstain Bears Get in a Fight"},
|
2011-04-24 12:10:07 +02:00
|
|
|
{"beardark", "The Berenstain Bears In The Dark"},
|
2011-02-01 02:54:51 +00:00
|
|
|
{"arthurcomp", "Arthur's Computer Adventure"},
|
2011-02-20 11:54:45 +01:00
|
|
|
{"harryhh","Harry and the Haunted House"},
|
2011-03-29 23:53:10 +02:00
|
|
|
{"stellaluna", "Stellaluna"},
|
|
|
|
{"sheila", "Sheila Rae, the Brave"},
|
2012-11-04 21:26:09 -05:00
|
|
|
{"rugratsps", "Rugrats Print Shop" },
|
2018-03-31 12:52:08 +02:00
|
|
|
{nullptr, nullptr}
|
2009-12-29 23:18:24 +00:00
|
|
|
};
|
|
|
|
|
2010-06-14 14:52:49 +00:00
|
|
|
#include "mohawk/detection_tables.h"
|
2009-12-29 23:18:24 +00:00
|
|
|
|
2010-06-15 10:59:43 +00:00
|
|
|
static const char *directoryGlobs[] = {
|
|
|
|
"all",
|
|
|
|
"assets1",
|
|
|
|
"data",
|
2010-12-25 18:45:29 +00:00
|
|
|
"program",
|
2011-01-31 23:10:18 +00:00
|
|
|
"95instal",
|
2010-12-25 18:45:29 +00:00
|
|
|
"Rugrats Adventure Game",
|
2018-03-31 12:52:08 +02:00
|
|
|
nullptr
|
2010-06-15 10:59:43 +00:00
|
|
|
};
|
|
|
|
|
2016-02-28 09:28:18 +01:00
|
|
|
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
|
|
|
|
};
|
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
class MohawkMetaEngine : public AdvancedMetaEngine {
|
|
|
|
public:
|
2016-02-28 09:28:18 +01:00
|
|
|
MohawkMetaEngine() : AdvancedMetaEngine(Mohawk::gameDescriptions, sizeof(Mohawk::MohawkGameDescription), mohawkGames, optionsList) {
|
2016-03-08 18:30:58 +01:00
|
|
|
_singleId = "mohawk";
|
2011-06-11 17:52:32 +02:00
|
|
|
_maxScanDepth = 2;
|
|
|
|
_directoryGlobs = directoryGlobs;
|
2011-06-10 15:53:54 +02:00
|
|
|
}
|
2011-06-14 18:11:14 +02:00
|
|
|
|
2017-12-02 17:14:22 +01:00
|
|
|
ADDetectedGame fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const override {
|
2012-06-27 04:42:36 +02:00
|
|
|
return detectGameFilebased(allFiles, fslist, Mohawk::fileBased);
|
2011-06-14 18:11:14 +02:00
|
|
|
}
|
|
|
|
|
2018-03-31 12:52:08 +02:00
|
|
|
const char *getName() const override {
|
2011-05-15 15:50:09 +01:00
|
|
|
return "Mohawk";
|
2009-12-29 23:18:24 +00:00
|
|
|
}
|
|
|
|
|
2018-03-31 12:52:08 +02:00
|
|
|
const char *getOriginalCopyright() const override {
|
2009-12-29 23:18:24 +00:00
|
|
|
return "Myst and Riven (C) Cyan Worlds\nMohawk OS (C) Ubisoft";
|
|
|
|
}
|
|
|
|
|
2018-03-31 12:52:08 +02:00
|
|
|
bool hasFeature(MetaEngineFeature f) const override;
|
|
|
|
bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;
|
|
|
|
SaveStateList listSaves(const char *target) const override;
|
2016-07-10 21:20:49 +02:00
|
|
|
SaveStateList listSavesForPrefix(const char *prefix, const char *extension) const;
|
2018-03-31 12:52:08 +02:00
|
|
|
int getMaximumSaveSlot() const override { return 999; }
|
|
|
|
void removeSaveState(const char *target, int slot) const override;
|
|
|
|
SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const override;
|
2009-12-29 23:18:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
bool MohawkMetaEngine::hasFeature(MetaEngineFeature f) const {
|
2010-01-25 01:39:44 +00:00
|
|
|
return
|
2009-12-29 23:18:24 +00:00
|
|
|
(f == kSupportsListSaves)
|
|
|
|
|| (f == kSupportsLoadingDuringStartup)
|
2016-02-22 08:31:02 +01:00
|
|
|
|| (f == kSupportsDeleteSave)
|
|
|
|
|| (f == kSavesSupportMetaInfo)
|
|
|
|
|| (f == kSavesSupportThumbnail)
|
|
|
|
|| (f == kSavesSupportCreationDate)
|
|
|
|
|| (f == kSavesSupportPlayTime);
|
2009-12-29 23:18:24 +00:00
|
|
|
}
|
|
|
|
|
2016-07-10 21:20:49 +02:00
|
|
|
SaveStateList MohawkMetaEngine::listSavesForPrefix(const char *prefix, const char *extension) const {
|
|
|
|
Common::String pattern = Common::String::format("%s-###.%s", prefix, extension);
|
|
|
|
Common::StringArray filenames = g_system->getSavefileManager()->listSavefiles(pattern);
|
|
|
|
size_t prefixLen = strlen(prefix);
|
|
|
|
|
|
|
|
SaveStateList saveList;
|
|
|
|
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);
|
|
|
|
|
|
|
|
saveList.push_back(SaveStateDescriptor(slotNum, ""));
|
|
|
|
}
|
|
|
|
|
|
|
|
Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
|
|
|
|
|
|
|
|
return saveList;
|
|
|
|
}
|
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
SaveStateList MohawkMetaEngine::listSaves(const char *target) const {
|
|
|
|
SaveStateList saveList;
|
|
|
|
|
|
|
|
// Loading games is only supported in Myst/Riven currently.
|
2016-02-22 08:31:02 +01:00
|
|
|
#ifdef ENABLE_MYST
|
2009-12-29 23:18:24 +00:00
|
|
|
if (strstr(target, "myst")) {
|
2016-07-10 21:20:49 +02:00
|
|
|
saveList = listSavesForPrefix("myst", "mys");
|
2016-04-03 07:48:50 +02:00
|
|
|
|
2016-07-10 21:20:49 +02:00
|
|
|
for (SaveStateList::iterator save = saveList.begin(); save != saveList.end(); ++save) {
|
2016-04-03 07:48:50 +02:00
|
|
|
// Read the description from the save
|
2016-07-10 21:20:49 +02:00
|
|
|
int slot = save->getSaveSlot();
|
|
|
|
Common::String description = Mohawk::MystGameState::querySaveDescription(slot);
|
|
|
|
save->setDescription(description);
|
2016-04-03 07:48:50 +02:00
|
|
|
}
|
2016-07-10 20:43:34 +02:00
|
|
|
}
|
2016-02-22 08:31:02 +01:00
|
|
|
#endif
|
2016-07-10 20:43:34 +02:00
|
|
|
#ifdef ENABLE_RIVEN
|
2016-02-22 08:31:02 +01:00
|
|
|
if (strstr(target, "riven")) {
|
2016-07-10 21:20:49 +02:00
|
|
|
saveList = listSavesForPrefix("riven", "rvn");
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2016-07-10 21:20:49 +02:00
|
|
|
for (SaveStateList::iterator save = saveList.begin(); save != saveList.end(); ++save) {
|
|
|
|
// Read the description from the save
|
|
|
|
int slot = save->getSaveSlot();
|
|
|
|
Common::String description = Mohawk::RivenSaveLoad::querySaveDescription(slot);
|
|
|
|
save->setDescription(description);
|
2016-07-10 20:43:34 +02:00
|
|
|
}
|
2010-01-25 01:39:44 +00:00
|
|
|
}
|
2016-07-10 20:43:34 +02:00
|
|
|
#endif
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
return saveList;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MohawkMetaEngine::removeSaveState(const char *target, int slot) const {
|
2016-04-03 07:48:50 +02:00
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
// Removing saved games is only supported in Myst/Riven currently.
|
2016-02-22 08:31:02 +01:00
|
|
|
#ifdef ENABLE_MYST
|
2009-12-29 23:18:24 +00:00
|
|
|
if (strstr(target, "myst")) {
|
2016-04-03 07:48:50 +02:00
|
|
|
Mohawk::MystGameState::deleteSave(slot);
|
2016-07-10 21:20:49 +02:00
|
|
|
}
|
2016-02-22 08:31:02 +01:00
|
|
|
#endif
|
2016-07-10 21:20:49 +02:00
|
|
|
#ifdef ENABLE_RIVEN
|
2016-02-22 08:31:02 +01:00
|
|
|
if (strstr(target, "riven")) {
|
2016-07-10 21:20:49 +02:00
|
|
|
Mohawk::RivenSaveLoad::deleteSave(slot);
|
2009-12-29 23:18:24 +00:00
|
|
|
}
|
2016-07-10 21:20:49 +02:00
|
|
|
#endif
|
2009-12-29 23:18:24 +00:00
|
|
|
}
|
|
|
|
|
2016-02-22 08:31:02 +01:00
|
|
|
SaveStateDescriptor MohawkMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
|
|
|
|
#ifdef ENABLE_MYST
|
|
|
|
if (strstr(target, "myst")) {
|
2016-04-03 07:48:50 +02:00
|
|
|
return Mohawk::MystGameState::querySaveMetaInfos(slot);
|
2016-07-10 20:43:34 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#ifdef ENABLE_RIVEN
|
|
|
|
if (strstr(target, "riven")) {
|
2016-07-10 21:20:49 +02:00
|
|
|
return Mohawk::RivenSaveLoad::querySaveMetaInfos(slot);
|
2016-02-22 08:31:02 +01:00
|
|
|
} else
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
return SaveStateDescriptor();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
bool MohawkMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
|
|
|
|
const Mohawk::MohawkGameDescription *gd = (const Mohawk::MohawkGameDescription *)desc;
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
if (gd) {
|
|
|
|
switch (gd->gameType) {
|
|
|
|
case Mohawk::GType_MYST:
|
|
|
|
case Mohawk::GType_MAKINGOF:
|
2011-03-28 15:20:30 -04:00
|
|
|
#ifdef ENABLE_MYST
|
2009-12-29 23:18:24 +00:00
|
|
|
*engine = new Mohawk::MohawkEngine_Myst(syst, gd);
|
|
|
|
break;
|
2011-03-28 15:20:30 -04:00
|
|
|
#else
|
|
|
|
warning("Myst support not compiled in");
|
|
|
|
return false;
|
|
|
|
#endif
|
2009-12-29 23:18:24 +00:00
|
|
|
case Mohawk::GType_RIVEN:
|
2011-03-28 15:43:57 -04:00
|
|
|
#ifdef ENABLE_RIVEN
|
2009-12-29 23:18:24 +00:00
|
|
|
*engine = new Mohawk::MohawkEngine_Riven(syst, gd);
|
|
|
|
break;
|
2011-03-28 15:43:57 -04:00
|
|
|
#else
|
|
|
|
warning("Riven support not compiled in");
|
|
|
|
return false;
|
|
|
|
#endif
|
2010-01-22 03:43:57 +00:00
|
|
|
case Mohawk::GType_LIVINGBOOKSV1:
|
2010-11-29 12:51:53 +00:00
|
|
|
case Mohawk::GType_LIVINGBOOKSV2:
|
2010-01-22 03:43:57 +00:00
|
|
|
case Mohawk::GType_LIVINGBOOKSV3:
|
2011-01-31 23:10:18 +00:00
|
|
|
case Mohawk::GType_LIVINGBOOKSV4:
|
|
|
|
case Mohawk::GType_LIVINGBOOKSV5:
|
2009-12-29 23:18:24 +00:00
|
|
|
*engine = new Mohawk::MohawkEngine_LivingBooks(syst, gd);
|
|
|
|
break;
|
2011-01-03 22:53:12 +00:00
|
|
|
case Mohawk::GType_CSTIME:
|
2011-03-28 15:31:14 -04:00
|
|
|
#ifdef ENABLE_CSTIME
|
2011-01-20 21:35:00 +00:00
|
|
|
*engine = new Mohawk::MohawkEngine_CSTime(syst, gd);
|
|
|
|
break;
|
2011-03-28 15:31:14 -04:00
|
|
|
#else
|
|
|
|
warning("CSTime support not compiled in");
|
|
|
|
return false;
|
|
|
|
#endif
|
2009-12-29 23:18:24 +00:00
|
|
|
default:
|
2011-03-28 15:20:30 -04:00
|
|
|
error("Unknown Mohawk Engine");
|
2009-12-29 23:18:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-31 12:52:08 +02:00
|
|
|
return (gd != nullptr);
|
2009-12-29 23:18:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#if PLUGIN_ENABLED_DYNAMIC(MOHAWK)
|
|
|
|
REGISTER_PLUGIN_DYNAMIC(MOHAWK, PLUGIN_TYPE_ENGINE, MohawkMetaEngine);
|
|
|
|
#else
|
|
|
|
REGISTER_PLUGIN_STATIC(MOHAWK, PLUGIN_TYPE_ENGINE, MohawkMetaEngine);
|
|
|
|
#endif
|