2007-05-30 21:56:52 +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.
|
2005-11-12 06:01:24 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
|
|
|
|
* 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.
|
|
|
|
|
|
|
|
* 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.
|
|
|
|
*
|
2006-02-11 12:46:41 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2005-11-12 06:01:24 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "base/plugins.h"
|
|
|
|
|
2009-01-29 22:13:01 +00:00
|
|
|
#include "engines/advancedDetector.h"
|
2007-04-15 05:04:48 +00:00
|
|
|
#include "common/config-manager.h"
|
2008-07-24 20:16:21 +00:00
|
|
|
#include "common/savefile.h"
|
2008-10-06 12:48:52 +00:00
|
|
|
#include "common/system.h"
|
2005-11-12 06:01:24 +00:00
|
|
|
|
2009-05-16 05:34:16 +00:00
|
|
|
#include "agos/intern.h"
|
2006-09-29 08:14:27 +00:00
|
|
|
#include "agos/agos.h"
|
2006-03-09 14:30:43 +00:00
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
namespace AGOS {
|
2007-01-21 16:57:13 +00:00
|
|
|
|
|
|
|
struct AGOSGameDescription {
|
2009-01-29 22:13:01 +00:00
|
|
|
ADGameDescription desc;
|
2007-01-21 16:57:13 +00:00
|
|
|
|
|
|
|
int gameType;
|
|
|
|
int gameId;
|
|
|
|
uint32 features;
|
|
|
|
};
|
|
|
|
|
2006-03-09 14:30:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Conversion table mapping old obsolete target names to the
|
|
|
|
* corresponding new target and platform combination.
|
|
|
|
*
|
|
|
|
*/
|
2009-01-29 22:13:01 +00:00
|
|
|
static const ADObsoleteGameID obsoleteGameIDsTable[] = {
|
2006-03-09 14:30:43 +00:00
|
|
|
{"simon1acorn", "simon1", Common::kPlatformAcorn},
|
|
|
|
{"simon1amiga", "simon1", Common::kPlatformAmiga},
|
|
|
|
{"simon1cd32", "simon1", Common::kPlatformAmiga},
|
2006-05-04 06:55:35 +00:00
|
|
|
{"simon1demo", "simon1", Common::kPlatformPC},
|
2006-03-09 14:30:43 +00:00
|
|
|
{"simon1dos", "simon1", Common::kPlatformPC},
|
|
|
|
{"simon1talkie", "simon1", Common::kPlatformPC},
|
|
|
|
{"simon1win", "simon1", Common::kPlatformWindows},
|
2009-02-07 01:11:51 +00:00
|
|
|
{"simon2dos", "simon2", Common::kPlatformPC},
|
2006-03-09 14:30:43 +00:00
|
|
|
{"simon2talkie", "simon2", Common::kPlatformPC},
|
|
|
|
{"simon2mac", "simon2", Common::kPlatformMacintosh},
|
2009-02-07 01:11:51 +00:00
|
|
|
{"simon2win", "simon2", Common::kPlatformWindows},
|
2006-11-12 03:23:29 +00:00
|
|
|
{0, 0, Common::kPlatformUnknown}
|
2006-03-09 14:30:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const PlainGameDescriptor simonGames[] = {
|
2009-03-08 08:45:21 +00:00
|
|
|
{"pn", "Personal Nightmare"},
|
2006-10-06 05:17:54 +00:00
|
|
|
{"elvira1", "Elvira - Mistress of the Dark"},
|
2006-10-06 09:21:34 +00:00
|
|
|
{"elvira2", "Elvira II - The Jaws of Cerberus"},
|
2006-09-29 03:44:55 +00:00
|
|
|
{"waxworks", "Waxworks"},
|
|
|
|
{"simon1", "Simon the Sorcerer 1"},
|
|
|
|
{"simon2", "Simon the Sorcerer 2"},
|
2009-08-11 14:42:44 +00:00
|
|
|
#ifdef ENABLE_AGOS2
|
2006-09-29 03:44:55 +00:00
|
|
|
{"feeble", "The Feeble Files"},
|
2006-09-29 05:33:22 +00:00
|
|
|
{"dimp", "Demon in my Pocket"},
|
2006-09-28 23:22:07 +00:00
|
|
|
{"jumble", "Jumble"},
|
2006-09-29 04:48:04 +00:00
|
|
|
{"puzzle", "NoPatience"},
|
2006-09-28 23:22:07 +00:00
|
|
|
{"swampy", "Swampy Adventures"},
|
2009-08-11 14:42:44 +00:00
|
|
|
#endif
|
2006-11-12 03:23:29 +00:00
|
|
|
{0, 0}
|
2006-03-09 14:30:43 +00:00
|
|
|
};
|
|
|
|
|
2007-04-27 22:42:02 +00:00
|
|
|
#include "agos/detection_tables.h"
|
2007-01-24 22:24:52 +00:00
|
|
|
|
2009-01-29 22:13:01 +00:00
|
|
|
static const ADParams detectionParams = {
|
2007-01-24 22:24:52 +00:00
|
|
|
// Pointer to ADGameDescription or its superset structure
|
|
|
|
(const byte *)AGOS::gameDescriptions,
|
|
|
|
// Size of that superset structure
|
|
|
|
sizeof(AGOS::AGOSGameDescription),
|
|
|
|
// Number of bytes to compute MD5 sum for
|
|
|
|
5000,
|
|
|
|
// List of all engine targets
|
|
|
|
simonGames,
|
|
|
|
// Structure for autoupgrading obsolete targets
|
2007-01-28 07:31:26 +00:00
|
|
|
obsoleteGameIDsTable,
|
|
|
|
// Name of single gameid (optional)
|
|
|
|
0,
|
2007-02-04 03:10:27 +00:00
|
|
|
// List of files for file-based fallback detection (optional)
|
|
|
|
0,
|
2007-01-28 07:31:26 +00:00
|
|
|
// Flags
|
2009-06-06 17:56:41 +00:00
|
|
|
0,
|
|
|
|
// Additional GUI options (for every game}
|
2009-06-06 17:59:04 +00:00
|
|
|
Common::GUIO_NOLAUNCHLOAD
|
2007-01-24 22:24:52 +00:00
|
|
|
};
|
|
|
|
|
2009-05-16 05:34:16 +00:00
|
|
|
using namespace AGOS;
|
|
|
|
|
2009-01-29 22:13:01 +00:00
|
|
|
class AgosMetaEngine : public AdvancedMetaEngine {
|
2008-02-02 02:35:13 +00:00
|
|
|
public:
|
2009-01-29 22:13:01 +00:00
|
|
|
AgosMetaEngine() : AdvancedMetaEngine(detectionParams) {}
|
2009-01-01 15:06:43 +00:00
|
|
|
|
2008-02-02 02:35:13 +00:00
|
|
|
virtual const char *getName() const {
|
|
|
|
return "AGOS";
|
|
|
|
}
|
|
|
|
|
2009-03-05 12:04:58 +00:00
|
|
|
virtual const char *getOriginalCopyright() const {
|
2008-02-02 02:35:13 +00:00
|
|
|
return "AGOS (C) Adventure Soft";
|
|
|
|
}
|
2009-01-01 15:06:43 +00:00
|
|
|
|
2008-08-15 18:26:59 +00:00
|
|
|
virtual bool hasFeature(MetaEngineFeature f) const;
|
2009-01-29 22:13:01 +00:00
|
|
|
virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
|
2008-07-24 20:16:21 +00:00
|
|
|
virtual SaveStateList listSaves(const char *target) const;
|
2008-11-09 16:13:34 +00:00
|
|
|
virtual int getMaximumSaveSlot() const;
|
2008-02-02 02:35:13 +00:00
|
|
|
};
|
|
|
|
|
2008-08-15 18:26:59 +00:00
|
|
|
bool AgosMetaEngine::hasFeature(MetaEngineFeature f) const {
|
|
|
|
return
|
|
|
|
(f == kSupportsListSaves);
|
|
|
|
}
|
|
|
|
|
2008-11-04 16:11:40 +00:00
|
|
|
bool AGOS::AGOSEngine::hasFeature(EngineFeature f) const {
|
|
|
|
return
|
|
|
|
(f == kSupportsRTL);
|
|
|
|
}
|
|
|
|
|
2009-01-29 22:13:01 +00:00
|
|
|
bool AgosMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
|
2008-03-14 17:31:04 +00:00
|
|
|
const AGOS::AGOSGameDescription *gd = (const AGOS::AGOSGameDescription *)desc;
|
2007-08-13 08:59:38 +00:00
|
|
|
bool res = true;
|
2006-03-09 14:30:43 +00:00
|
|
|
|
2007-08-13 08:59:38 +00:00
|
|
|
switch (gd->gameType) {
|
2009-03-08 08:45:21 +00:00
|
|
|
case AGOS::GType_PN:
|
|
|
|
*engine = new AGOS::AGOSEngine_PN(syst);
|
|
|
|
break;
|
2007-08-13 08:59:38 +00:00
|
|
|
case AGOS::GType_ELVIRA1:
|
2007-04-15 05:04:48 +00:00
|
|
|
*engine = new AGOS::AGOSEngine_Elvira1(syst);
|
2007-08-13 08:59:38 +00:00
|
|
|
break;
|
|
|
|
case AGOS::GType_ELVIRA2:
|
2007-04-15 05:04:48 +00:00
|
|
|
*engine = new AGOS::AGOSEngine_Elvira2(syst);
|
2007-08-13 08:59:38 +00:00
|
|
|
break;
|
|
|
|
case AGOS::GType_WW:
|
2007-04-15 05:04:48 +00:00
|
|
|
*engine = new AGOS::AGOSEngine_Waxworks(syst);
|
2007-08-13 08:59:38 +00:00
|
|
|
break;
|
|
|
|
case AGOS::GType_SIMON1:
|
2007-04-15 05:04:48 +00:00
|
|
|
*engine = new AGOS::AGOSEngine_Simon1(syst);
|
2007-08-13 08:59:38 +00:00
|
|
|
break;
|
|
|
|
case AGOS::GType_SIMON2:
|
2007-04-15 05:04:48 +00:00
|
|
|
*engine = new AGOS::AGOSEngine_Simon2(syst);
|
2007-08-13 08:59:38 +00:00
|
|
|
break;
|
2009-08-11 14:42:44 +00:00
|
|
|
#ifdef ENABLE_AGOS2
|
2007-08-13 08:59:38 +00:00
|
|
|
case AGOS::GType_FF:
|
2009-05-16 05:34:16 +00:00
|
|
|
if (gd->features & GF_DEMO)
|
|
|
|
*engine = new AGOS::AGOSEngine_FeebleDemo(syst);
|
|
|
|
else
|
|
|
|
*engine = new AGOS::AGOSEngine_Feeble(syst);
|
2007-08-13 08:59:38 +00:00
|
|
|
break;
|
|
|
|
case AGOS::GType_PP:
|
2007-04-15 05:04:48 +00:00
|
|
|
*engine = new AGOS::AGOSEngine_PuzzlePack(syst);
|
2007-08-13 08:59:38 +00:00
|
|
|
break;
|
2009-08-11 14:42:44 +00:00
|
|
|
#endif
|
2007-08-13 08:59:38 +00:00
|
|
|
default:
|
|
|
|
res = false;
|
|
|
|
error("AGOS engine: unknown gameType");
|
2007-04-15 05:04:48 +00:00
|
|
|
}
|
2007-11-03 21:06:58 +00:00
|
|
|
if (res) {
|
|
|
|
((AGOS::AGOSEngine *)*engine)->_gameDescription = gd;
|
|
|
|
}
|
2007-04-15 05:04:48 +00:00
|
|
|
|
2007-08-13 08:59:38 +00:00
|
|
|
return res;
|
2007-04-15 05:04:48 +00:00
|
|
|
}
|
2007-08-13 08:59:38 +00:00
|
|
|
|
2008-07-24 20:16:21 +00:00
|
|
|
SaveStateList AgosMetaEngine::listSaves(const char *target) const {
|
|
|
|
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
|
|
|
|
Common::StringList filenames;
|
|
|
|
Common::String saveDesc;
|
|
|
|
Common::String pattern = target;
|
|
|
|
pattern += ".???";
|
|
|
|
|
2009-05-29 14:38:22 +00:00
|
|
|
filenames = saveFileMan->listSavefiles(pattern);
|
2008-07-24 20:16:21 +00:00
|
|
|
sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
|
|
|
|
|
|
|
|
SaveStateList saveList;
|
|
|
|
for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); file++) {
|
|
|
|
// Obtain the last 3 digits of the filename, since they correspond to the save slot
|
|
|
|
int slotNum = atoi(file->c_str() + file->size() - 3);
|
|
|
|
|
|
|
|
if (slotNum >= 0 && slotNum <= 999) {
|
2009-05-29 14:38:22 +00:00
|
|
|
Common::InSaveFile *in = saveFileMan->openForLoading(*file);
|
2008-07-24 20:16:21 +00:00
|
|
|
if (in) {
|
|
|
|
saveDesc = file->c_str();
|
2008-11-05 15:41:12 +00:00
|
|
|
saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
|
2008-07-24 20:16:21 +00:00
|
|
|
delete in;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return saveList;
|
|
|
|
}
|
|
|
|
|
2008-11-09 16:13:34 +00:00
|
|
|
int AgosMetaEngine::getMaximumSaveSlot() const { return 999; }
|
|
|
|
|
2008-05-06 03:00:26 +00:00
|
|
|
#if PLUGIN_ENABLED_DYNAMIC(AGOS)
|
|
|
|
REGISTER_PLUGIN_DYNAMIC(AGOS, PLUGIN_TYPE_ENGINE, AgosMetaEngine);
|
|
|
|
#else
|
|
|
|
REGISTER_PLUGIN_STATIC(AGOS, PLUGIN_TYPE_ENGINE, AgosMetaEngine);
|
|
|
|
#endif
|
2006-03-09 14:30:43 +00:00
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
namespace AGOS {
|
2005-11-12 06:01:24 +00:00
|
|
|
|
2007-01-21 16:57:13 +00:00
|
|
|
int AGOSEngine::getGameId() const {
|
|
|
|
return _gameDescription->gameId;
|
|
|
|
}
|
|
|
|
|
|
|
|
int AGOSEngine::getGameType() const {
|
|
|
|
return _gameDescription->gameType;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 AGOSEngine::getFeatures() const {
|
|
|
|
return _gameDescription->features;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *AGOSEngine::getExtra() const {
|
|
|
|
return _gameDescription->desc.extra;
|
|
|
|
}
|
|
|
|
|
|
|
|
Common::Language AGOSEngine::getLanguage() const {
|
|
|
|
return _gameDescription->desc.language;
|
|
|
|
}
|
|
|
|
|
|
|
|
Common::Platform AGOSEngine::getPlatform() const {
|
|
|
|
return _gameDescription->desc.platform;
|
|
|
|
}
|
|
|
|
|
2007-09-19 08:40:12 +00:00
|
|
|
const char *AGOSEngine::getFileName(int type) const {
|
2007-01-21 16:57:13 +00:00
|
|
|
for (int i = 0; _gameDescription->desc.filesDescriptions[i].fileType; i++) {
|
|
|
|
if (_gameDescription->desc.filesDescriptions[i].fileType == type)
|
2007-09-19 08:40:12 +00:00
|
|
|
return _gameDescription->desc.filesDescriptions[i].fileName;
|
2007-01-21 16:57:13 +00:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
} // End of namespace AGOS
|