2012-04-19 18:48:48 +02: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.
|
2012-05-11 16:03:59 +02:00
|
|
|
|
2012-04-19 18:48:48 +02: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.
|
2012-05-11 16:03:59 +02:00
|
|
|
|
2012-04-19 18:48:48 +02: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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2012-05-31 23:35:46 +02:00
|
|
|
#include "engines/advancedDetector.h"
|
2012-04-19 18:48:48 +02:00
|
|
|
#include "engines/wintermute/wintermute.h"
|
2012-07-21 18:19:07 +02:00
|
|
|
#include "engines/wintermute/base/base_persistence_manager.h"
|
2012-04-19 18:48:48 +02:00
|
|
|
|
|
|
|
#include "common/config-manager.h"
|
|
|
|
#include "common/error.h"
|
|
|
|
#include "common/fs.h"
|
|
|
|
|
|
|
|
#include "engines/metaengine.h"
|
|
|
|
|
2012-07-20 02:26:20 +02:00
|
|
|
#include "engines/wintermute/detection_tables.h"
|
2012-05-31 23:35:46 +02:00
|
|
|
|
|
|
|
class WinterMuteMetaEngine : public AdvancedMetaEngine {
|
2012-04-19 18:48:48 +02:00
|
|
|
public:
|
2012-07-18 16:15:31 +02:00
|
|
|
WinterMuteMetaEngine() : AdvancedMetaEngine(WinterMute::gameDescriptions, sizeof(ADGameDescription), WinterMute::wintermuteGames) {
|
|
|
|
_singleid = "wintermute";
|
2012-05-31 23:35:46 +02:00
|
|
|
}
|
2012-04-19 18:48:48 +02:00
|
|
|
virtual const char *getName() const {
|
2012-05-31 23:35:46 +02:00
|
|
|
return "Wintermute";
|
2012-04-19 18:48:48 +02:00
|
|
|
}
|
2012-05-11 16:03:59 +02:00
|
|
|
|
2012-04-19 18:48:48 +02:00
|
|
|
virtual const char *getOriginalCopyright() const {
|
|
|
|
return "Copyright (c) 2011 Jan Nedoma";
|
|
|
|
}
|
2012-05-11 16:03:59 +02:00
|
|
|
|
2012-05-31 23:35:46 +02:00
|
|
|
/* virtual GameList getSupportedGames() const {
|
2012-04-19 18:48:48 +02:00
|
|
|
GameList games;
|
2012-05-31 23:35:46 +02:00
|
|
|
const PlainGameDescriptor *g = wintermuteGames;
|
2012-04-19 18:48:48 +02:00
|
|
|
while (g->gameid) {
|
|
|
|
games.push_back(*g);
|
|
|
|
g++;
|
|
|
|
}
|
2012-05-11 16:03:59 +02:00
|
|
|
|
2012-04-19 18:48:48 +02:00
|
|
|
return games;
|
|
|
|
}
|
2012-05-11 16:03:59 +02:00
|
|
|
|
2012-04-19 18:48:48 +02:00
|
|
|
virtual GameDescriptor findGame(const char *gameid) const {
|
2012-05-31 23:35:46 +02:00
|
|
|
const PlainGameDescriptor *g = wintermuteGames;
|
2012-04-19 18:48:48 +02:00
|
|
|
while (g->gameid) {
|
|
|
|
if (0 == scumm_stricmp(gameid, g->gameid))
|
|
|
|
break;
|
|
|
|
g++;
|
|
|
|
}
|
|
|
|
return GameDescriptor(g->gameid, g->description);
|
2012-05-31 23:35:46 +02:00
|
|
|
}*/
|
2012-05-11 16:03:59 +02:00
|
|
|
|
2012-05-31 23:35:46 +02:00
|
|
|
/* virtual GameList detectGames(const Common::FSList &fslist) const {
|
2012-04-19 18:48:48 +02:00
|
|
|
GameList detectedGames;
|
2012-05-11 16:03:59 +02:00
|
|
|
|
2012-04-19 18:48:48 +02:00
|
|
|
// Iterate over all files in the given directory
|
|
|
|
for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
|
|
|
|
if (!file->isDirectory()) {
|
|
|
|
const char *gameName = file->getName().c_str();
|
2012-05-11 16:03:59 +02:00
|
|
|
|
2012-03-13 16:19:32 +01:00
|
|
|
if (0 == scumm_stricmp("data.dcp", gameName)) {
|
2012-04-19 18:48:48 +02:00
|
|
|
// You could check the contents of the file now if you need to.
|
|
|
|
detectedGames.push_back(WinterMute_setting[0]);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return detectedGames;
|
2012-05-31 23:35:46 +02:00
|
|
|
}*/
|
|
|
|
virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
|
2012-04-19 18:48:48 +02:00
|
|
|
assert(syst);
|
|
|
|
assert(engine);
|
2012-05-11 16:03:59 +02:00
|
|
|
|
2012-07-18 16:15:31 +02:00
|
|
|
*engine = new WinterMute::WinterMuteEngine(syst, desc);
|
|
|
|
return true;
|
2012-04-19 18:48:48 +02:00
|
|
|
}
|
2012-06-19 02:02:20 +02:00
|
|
|
|
|
|
|
bool hasFeature(MetaEngineFeature f) const {
|
|
|
|
switch (f) {
|
|
|
|
case MetaEngine::kSupportsListSaves:
|
|
|
|
return true;
|
|
|
|
case MetaEngine::kSupportsLoadingDuringStartup:
|
|
|
|
return true;
|
|
|
|
case MetaEngine::kSupportsDeleteSave:
|
|
|
|
return true;
|
|
|
|
case MetaEngine::kSavesSupportCreationDate:
|
|
|
|
return true;
|
|
|
|
case MetaEngine::kSavesSupportMetaInfo:
|
|
|
|
return true;
|
|
|
|
case MetaEngine::kSavesSupportThumbnail:
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SaveStateList listSaves(const char *target) const {
|
|
|
|
SaveStateList saves;
|
2012-07-21 21:01:47 +02:00
|
|
|
WinterMute::BasePersistenceManager pm(NULL, target);
|
2012-06-19 02:02:20 +02:00
|
|
|
for (int i = 0; i < getMaximumSaveSlot(); i++) {
|
|
|
|
if (pm.getSaveExists(i)) {
|
|
|
|
SaveStateDescriptor desc;
|
|
|
|
pm.getSaveStateDesc(i, desc);
|
|
|
|
saves.push_back(desc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return saves;
|
|
|
|
}
|
|
|
|
|
|
|
|
int getMaximumSaveSlot() const {
|
2012-07-18 19:25:27 +02:00
|
|
|
return 100;
|
2012-06-19 02:02:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void removeSaveState(const char *target, int slot) const {
|
2012-07-21 21:01:47 +02:00
|
|
|
WinterMute::BasePersistenceManager pm(NULL, target);
|
2012-06-19 02:02:20 +02:00
|
|
|
pm.deleteSaveSlot(slot);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const {
|
2012-07-21 21:01:47 +02:00
|
|
|
WinterMute::BasePersistenceManager pm(NULL, target);
|
2012-06-19 02:02:20 +02:00
|
|
|
SaveStateDescriptor retVal;
|
|
|
|
retVal.setDescription("Invalid savegame");
|
|
|
|
pm.getSaveStateDesc(slot, retVal);
|
|
|
|
return retVal;
|
|
|
|
}
|
2012-04-19 18:48:48 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#if PLUGIN_ENABLED_DYNAMIC(WINTERMUTE)
|
|
|
|
REGISTER_PLUGIN_DYNAMIC(WINTERMUTE, PLUGIN_TYPE_ENGINE, WinterMuteMetaEngine);
|
|
|
|
#else
|
|
|
|
REGISTER_PLUGIN_STATIC(WINTERMUTE, PLUGIN_TYPE_ENGINE, WinterMuteMetaEngine);
|
2012-06-01 13:51:06 +02:00
|
|
|
#endif
|