scummvm/engines/grim/detection.cpp

446 lines
9.7 KiB
C++
Raw Normal View History

2009-05-26 14:13:08 +00:00
/* Residual - A 3D game interpreter
*
* Residual is the legal property of its developers, whose names
2011-04-16 14:12:44 +02:00
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library 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
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
#include "engines/advancedDetector.h"
#include "engines/grim/grim.h"
2011-04-10 11:24:03 +02:00
#include "engines/grim/colormap.h"
#include "engines/grim/savegame.h"
#include "common/system.h"
#include "common/savefile.h"
namespace Grim {
struct GrimGameDescription {
ADGameDescription desc;
GrimGameType gameType;
};
static const PlainGameDescriptor grimGames[] = {
{"grim", "Grim Fandango"},
{"monkey4", "Escape From Monkey Island"},
{0, 0}
};
2009-06-21 08:12:49 +00:00
using Common::GUIO_NONE;
static const GrimGameDescription gameDescriptions[] = {
{
// Grim Fandango English version
{
"grim",
"",
AD_ENTRY1s("grim.tab", "cfb333d6aec260c905151b6b98ef71e8", 362212),
Common::EN_ANY,
Common::kPlatformWindows,
2009-06-21 08:12:49 +00:00
ADGF_NO_FLAGS,
GUIO_NONE
},
GType_GRIM
},
{
// Grim Fandango English version (Adventure-bundle, possibly patched)
{
"grim",
"",
AD_ENTRY1s("grim.tab", "cfb333d6aec260c905151b6b98ef71e8", 362164),
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
GUIO_NONE
},
GType_GRIM
},
{
// Grim Fandango German version
{
"grim",
"",
AD_ENTRY1s("grim.tab", "464138caf47e580cbb237dee10674b16", 398592),
Common::DE_DEU,
Common::kPlatformWindows,
2009-06-21 08:12:49 +00:00
ADGF_NO_FLAGS,
GUIO_NONE
},
GType_GRIM
},
2011-05-18 07:18:25 +08:00
{
// Grim Fandango German version (patched)
{
"grim",
"",
AD_ENTRY1s("grim.tab", "464138caf47e580cbb237dee10674b16", 398671),
Common::DE_DEU,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
GUIO_NONE
},
GType_GRIM
},
{
// Grim Fandango Spanish version
{
"grim",
"",
2009-05-27 18:07:10 +00:00
AD_ENTRY1s("grim.tab", "b1460cd029f13718f7f62c2403e047ec", 372709),
Common::ES_ESP,
Common::kPlatformWindows,
2009-06-21 08:12:49 +00:00
ADGF_NO_FLAGS,
GUIO_NONE
},
GType_GRIM
},
{
// Grim Fandango Spanish version (patched)
{
"grim",
"",
AD_ENTRY1s("grim.tab", "b1460cd029f13718f7f62c2403e047ec", 372020),
Common::ES_ESP,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
GUIO_NONE
},
GType_GRIM
},
{
// Grim Fandango Italian version
{
"grim",
"",
AD_ENTRY1s("grim.tab", "2d99c796b7a4e5c421cae49dc29dab6c", 369071),
Common::IT_ITA,
Common::kPlatformWindows,
2009-06-21 08:12:49 +00:00
ADGF_NO_FLAGS,
GUIO_NONE
},
GType_GRIM
},
2011-05-05 18:51:45 +02:00
{
// Grim Fandango patched Italian version
{
"grim",
"",
AD_ENTRY1s("grim.tab", "2d99c796b7a4e5c421cae49dc29dab6c", 369242),
Common::IT_ITA,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
GUIO_NONE
},
GType_GRIM
},
2011-04-06 17:00:53 +08:00
{
// Grim Fandango French version
{
"grim",
"",
AD_ENTRY1s("grim.tab", "3bd00ca87214862c012ac99e1758dd83", 386292),
Common::FR_FRA,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
GUIO_NONE
},
GType_GRIM
},
{
// Grim Fandango Portuguese version (patched)
{
"grim",
"",
AD_ENTRY1s("grim.tab", "4dc16be476bb6036b423bc331ca8281a", 362994),
Common::PT_BRA,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
GUIO_NONE
2011-04-06 17:00:53 +08:00
},
GType_GRIM
},
2009-06-13 16:11:11 +00:00
{
// Grim Fandango English demo version
2009-06-13 16:11:11 +00:00
{
"grim",
"Demo",
2009-06-13 16:11:11 +00:00
AD_ENTRY1s("gfdemo01.lab", "755cdac083f7f751bec7506402278f1a", 29489930),
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO,
2009-06-21 08:12:49 +00:00
GUIO_NONE
2009-06-13 16:11:11 +00:00
},
GType_GRIM
2009-06-13 16:11:11 +00:00
},
2011-04-30 22:28:54 +02:00
{
// Escape from Monkey Island English
{
"monkey4",
"",
AD_ENTRY1s("artAll.m4b", "61959da91d864bf5f4588daa4a5a3019", 18515664),
2011-04-30 22:28:54 +02:00
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
GUIO_NONE
},
GType_MONKEY4
},
2011-05-05 18:44:53 +02:00
{
// Escape from Monkey Island German
{
"monkey4",
"",
AD_ENTRY1s("artAll.m4b", "007a33881478be6b6e0228d8888536ae", 18512568),
2011-05-05 18:44:53 +02:00
Common::DE_DEU,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
GUIO_NONE
},
GType_MONKEY4
},
2011-05-01 16:45:04 +08:00
{
// Escape from Monkey Island Italian
{
"monkey4",
"",
AD_ENTRY1s("artAll.m4b", "d2f010c1cd1fd002eea403282a6b9a1e", 18513451),
2011-05-01 16:45:04 +08:00
Common::IT_ITA,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
GUIO_NONE
},
GType_MONKEY4
},
{
// Escape from Monkey Island Spanish
{
"monkey4",
"",
AD_ENTRY1s("artAll.m4b", "0d459954031c086a0448d2eb3fa068a1", 18514404),
2011-05-01 16:45:04 +08:00
Common::ES_ESP,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
GUIO_NONE
},
GType_MONKEY4
},
{
// Escape from Monkey Island French
{
"monkey4",
"",
AD_ENTRY1s("artAll.m4b", "151af0a694382af873f325fcea293bb1", 18514420),
2011-05-01 16:45:04 +08:00
Common::FR_FRA,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
GUIO_NONE
},
GType_MONKEY4
},
2011-03-25 06:15:54 +08:00
{
// Escape from Monkey Island English PS2
{
"monkey4",
"",
AD_ENTRY1s("artAll.m4b", "0dc9a4df0d8553f277d8dc8e23b6249d", 34593974),
2011-03-25 06:15:54 +08:00
Common::EN_ANY,
Common::kPlatformPS2,
2011-03-25 06:15:54 +08:00
ADGF_NO_FLAGS,
GUIO_NONE
},
2011-05-05 18:44:53 +02:00
GType_MONKEY4
},
{
// Escape from Monkey Island German PS2
{
"monkey4",
"",
AD_ENTRY1s("artAll.m4b", "5b5c7a3964c168eab44b82981db357d8", 34642186),
2011-05-05 18:44:53 +02:00
Common::DE_DEU,
Common::kPlatformPS2,
ADGF_NO_FLAGS,
GUIO_NONE
},
2011-03-25 06:15:54 +08:00
GType_MONKEY4
},
{
// Escape from Monkey Island Italian PS2
{
"monkey4",
"",
AD_ENTRY1s("artAll.m4b", "2de68c8fd955c1a3c50202b072bde0cb", 34642651),
Common::IT_ITA,
Common::kPlatformPS2,
ADGF_NO_FLAGS,
GUIO_NONE
},
GType_MONKEY4
},
{
// Escape from Monkey Island Spanish PS2
{
"monkey4",
"",
AD_ENTRY1s("artAll.m4b", "ff6689dcca36c249ec834a3019aeb397", 34642656),
Common::ES_ESP,
Common::kPlatformPS2,
ADGF_NO_FLAGS,
GUIO_NONE
},
GType_MONKEY4
},
{
// Escape from Monkey Island French PS2
{
"monkey4",
"",
AD_ENTRY1s("artAll.m4b", "5ce964a19a8672944b9b62170e45ce28", 34593681),
Common::FR_FRA,
Common::kPlatformPS2,
ADGF_NO_FLAGS,
GUIO_NONE
},
GType_MONKEY4
},
2011-03-24 22:11:32 +08:00
{
// Escape from Monkey Island demo
{
"monkey4",
"Demo",
AD_ENTRY1s("magdemo.lab", "9e7eaa1b9317ff47d5deeda0b2c42ce3", 19826116),
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO,
GUIO_NONE
},
GType_MONKEY4
2011-03-24 22:11:32 +08:00
},
{ AD_TABLE_END_MARKER, GType_GRIM }
};
static const ADObsoleteGameID obsoleteGameIDsTable[] = {
{"grimdemo", "grim", Common::kPlatformWindows},
{0, 0, Common::kPlatformUnknown}
};
static const ADParams detectionParams = {
// Pointer to ADGameDescription or its superset structure
(const byte *)gameDescriptions,
// Size of that superset structure
sizeof(GrimGameDescription),
// Number of bytes to compute MD5 sum for
5000,
// List of all engine targets
grimGames,
// Structure for autoupgrading obsolete targets
obsoleteGameIDsTable,
// Name of single gameid (optional)
0,
// List of files for file-based fallback detection (optional)
0,
// Flags
2009-06-21 08:12:49 +00:00
0,
// Additional GUI options (for every game}
Common::GUIO_NOMIDI,
// Maximum directory depth
1,
// List of directory globs
0
};
class GrimMetaEngine : public AdvancedMetaEngine {
public:
GrimMetaEngine() : AdvancedMetaEngine(detectionParams) {}
virtual const char *getName() const {
return "Grim Engine";
}
virtual const char *getOriginalCopyright() const {
return "LucasArts GrimE Games (C) LucasArts";
}
virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
virtual bool hasFeature(MetaEngineFeature f) const;
virtual SaveStateList listSaves(const char *target) const;
};
bool GrimMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
const GrimGameDescription *gd = (const GrimGameDescription *)desc;
if (gd)
*engine = new GrimEngine(syst, gd->desc.flags, gd->gameType, gd->desc.platform, gd->desc.language);
return gd != 0;
}
bool GrimMetaEngine::hasFeature(MetaEngineFeature f) const {
return
(f == kSupportsListSaves) ||
(f == kSupportsLoadingDuringStartup);
}
SaveStateList GrimMetaEngine::listSaves(const char *target) const {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Common::StringArray filenames;
Common::String saveDesc;
Common::String pattern = "grim??.gsv";
filenames = saveFileMan->listSavefiles(pattern);
sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
SaveStateList saveList;
char str[256];
int32 strSize;
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
// Obtain the last 2 digits of the filename, since they correspond to the save slot
int slotNum = atoi(file->c_str() + 4);
if (slotNum >= 0 && slotNum <= 99) {
SaveGame *savedState = new SaveGame((*file).c_str(), false);
if (savedState) {
if (savedState->saveVersion() != SaveGame::SAVEGAME_VERSION) {
delete savedState;
continue;
}
savedState->beginSection('SUBS');
strSize = savedState->readLESint32();
savedState->read(str, strSize);
saveDesc = str;
saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
delete savedState;
}
}
}
return saveList;
}
} // End of namespace Grim
#if PLUGIN_ENABLED_DYNAMIC(GRIM)
REGISTER_PLUGIN_DYNAMIC(GRIM, PLUGIN_TYPE_ENGINE, Grim::GrimMetaEngine);
#else
REGISTER_PLUGIN_STATIC(GRIM, PLUGIN_TYPE_ENGINE, Grim::GrimMetaEngine);
#endif