2008-11-10 20:38:54 +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.
|
|
|
|
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "common/config-manager.h"
|
2009-01-29 22:13:01 +00:00
|
|
|
#include "engines/advancedDetector.h"
|
2008-11-10 20:38:54 +00:00
|
|
|
#include "common/savefile.h"
|
|
|
|
#include "common/system.h"
|
2008-12-03 22:15:05 +00:00
|
|
|
#include "common/fs.h"
|
2008-11-10 20:38:54 +00:00
|
|
|
|
|
|
|
#include "base/plugins.h"
|
|
|
|
|
|
|
|
#include "tucker/tucker.h"
|
|
|
|
|
|
|
|
static const PlainGameDescriptor tuckerGames[] = {
|
|
|
|
{ "tucker", "Bud Tucker in Double Trouble" },
|
|
|
|
{ 0, 0 }
|
|
|
|
};
|
|
|
|
|
2009-01-29 22:13:01 +00:00
|
|
|
static const ADGameDescription tuckerGameDescriptions[] = {
|
2008-11-10 20:38:54 +00:00
|
|
|
{
|
|
|
|
"tucker",
|
|
|
|
"",
|
|
|
|
AD_ENTRY1s("infobar.txt", "f1e42a95972643462b9c3c2ea79d6683", 543),
|
|
|
|
Common::FR_FRA,
|
|
|
|
Common::kPlatformPC,
|
2009-06-06 17:56:41 +00:00
|
|
|
Tucker::kGameFlagNoSubtitles,
|
|
|
|
Common::GUIO_NONE
|
2008-11-10 20:38:54 +00:00
|
|
|
},
|
2008-11-10 22:08:52 +00:00
|
|
|
{
|
|
|
|
"tucker",
|
|
|
|
"",
|
|
|
|
AD_ENTRY1s("infobar.txt", "9c1ddeafc5283b90d1a284bd0924831c", 462),
|
|
|
|
Common::EN_ANY,
|
|
|
|
Common::kPlatformPC,
|
2009-06-06 17:56:41 +00:00
|
|
|
Tucker::kGameFlagEncodedData,
|
|
|
|
Common::GUIO_NONE
|
2008-11-10 22:08:52 +00:00
|
|
|
},
|
2008-11-14 09:45:42 +00:00
|
|
|
{
|
|
|
|
"tucker",
|
|
|
|
"",
|
|
|
|
AD_ENTRY1s("infobar.txt", "1b3ea79d8528ea3c7df83dd0ed345e37", 525),
|
|
|
|
Common::ES_ESP,
|
|
|
|
Common::kPlatformPC,
|
2008-12-17 21:29:56 +00:00
|
|
|
Tucker::kGameFlagEncodedData,
|
2009-06-06 17:56:41 +00:00
|
|
|
Common::GUIO_NONE
|
2008-11-14 09:45:42 +00:00
|
|
|
},
|
2008-11-30 11:30:29 +00:00
|
|
|
{
|
|
|
|
"tucker",
|
|
|
|
"",
|
|
|
|
AD_ENTRY1s("infobrgr.txt", "4df9eb65722418d1a1723508115b146c", 552),
|
2008-12-12 21:42:38 +00:00
|
|
|
Common::DE_DEU,
|
2008-11-30 11:30:29 +00:00
|
|
|
Common::kPlatformPC,
|
2009-06-06 17:56:41 +00:00
|
|
|
Tucker::kGameFlagEncodedData,
|
|
|
|
Common::GUIO_NONE
|
2008-11-30 11:30:29 +00:00
|
|
|
},
|
2008-12-16 22:05:16 +00:00
|
|
|
{
|
|
|
|
"tucker",
|
|
|
|
"",
|
|
|
|
AD_ENTRY1s("infobar.txt", "5f85285bbc23ce57cbc164021ee1f23c", 525),
|
|
|
|
Common::PL_POL,
|
|
|
|
Common::kPlatformPC,
|
2008-12-17 21:29:56 +00:00
|
|
|
0,
|
2009-06-06 17:56:41 +00:00
|
|
|
Common::GUIO_NONE
|
2008-12-16 22:05:16 +00:00
|
|
|
},
|
2008-12-16 22:09:55 +00:00
|
|
|
{
|
|
|
|
"tucker",
|
|
|
|
"",
|
|
|
|
AD_ENTRY1s("infobar.txt", "e548994877ff31ca304f6352ce022a8e", 497),
|
|
|
|
Common::CZ_CZE,
|
|
|
|
Common::kPlatformPC,
|
2009-06-06 17:56:41 +00:00
|
|
|
Tucker::kGameFlagEncodedData,
|
|
|
|
Common::GUIO_NONE
|
2008-12-16 22:09:55 +00:00
|
|
|
},
|
2009-01-24 21:03:44 +00:00
|
|
|
{
|
|
|
|
"tucker",
|
|
|
|
"Demo",
|
|
|
|
AD_ENTRY1s("infobar.txt", "010b055de42097b140d5bcb6e95a5c7c", 203),
|
|
|
|
Common::EN_ANY,
|
|
|
|
Common::kPlatformPC,
|
2009-01-29 22:13:01 +00:00
|
|
|
ADGF_DEMO | Tucker::kGameFlagDemo,
|
2009-06-06 17:56:41 +00:00
|
|
|
Common::GUIO_NONE
|
2009-01-24 21:03:44 +00:00
|
|
|
},
|
2008-11-10 20:38:54 +00:00
|
|
|
AD_TABLE_END_MARKER
|
|
|
|
};
|
|
|
|
|
2009-01-29 22:13:01 +00:00
|
|
|
static const ADGameDescription tuckerDemoGameDescription = {
|
2008-12-03 22:15:05 +00:00
|
|
|
"tucker",
|
2009-01-24 21:03:44 +00:00
|
|
|
"Non-Interactive Demo",
|
2008-12-03 22:15:05 +00:00
|
|
|
AD_ENTRY1(0, 0),
|
|
|
|
Common::EN_ANY,
|
|
|
|
Common::kPlatformPC,
|
2009-06-06 17:56:41 +00:00
|
|
|
ADGF_DEMO | Tucker::kGameFlagDemo | Tucker::kGameFlagIntroOnly,
|
|
|
|
Common::GUIO_NONE
|
2008-12-03 22:15:05 +00:00
|
|
|
};
|
|
|
|
|
2009-01-29 22:13:01 +00:00
|
|
|
class TuckerMetaEngine : public AdvancedMetaEngine {
|
2008-11-10 20:38:54 +00:00
|
|
|
public:
|
2011-06-10 13:53:58 +00:00
|
|
|
TuckerMetaEngine() : AdvancedMetaEngine(tuckerGameDescriptions, sizeof(ADGameDescription), tuckerGames) {
|
2011-06-11 15:52:32 +00:00
|
|
|
_md5Bytes = 512;
|
|
|
|
_singleid = "tucker";
|
2008-11-10 20:38:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual const char *getName() const {
|
2011-05-15 14:50:09 +00:00
|
|
|
return "Tucker";
|
2008-11-10 20:38:54 +00:00
|
|
|
}
|
|
|
|
|
2009-03-05 12:04:58 +00:00
|
|
|
virtual const char *getOriginalCopyright() const {
|
2008-11-10 20:38:54 +00:00
|
|
|
return "Bud Tucker in Double Trouble (C) Merit Studios";
|
|
|
|
}
|
|
|
|
|
2008-11-28 23:56:25 +00:00
|
|
|
virtual bool hasFeature(MetaEngineFeature f) const {
|
|
|
|
switch (f) {
|
|
|
|
case kSupportsListSaves:
|
2011-03-20 17:31:18 +00:00
|
|
|
case kSupportsLoadingDuringStartup:
|
2008-11-28 23:56:25 +00:00
|
|
|
case kSupportsDeleteSave:
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-29 22:13:01 +00:00
|
|
|
virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
|
2008-11-10 20:38:54 +00:00
|
|
|
if (desc) {
|
2008-12-17 21:29:56 +00:00
|
|
|
*engine = new Tucker::TuckerEngine(syst, desc->language, desc->flags);
|
2008-11-10 20:38:54 +00:00
|
|
|
}
|
|
|
|
return desc != 0;
|
|
|
|
}
|
2008-11-28 23:56:25 +00:00
|
|
|
|
2011-06-14 16:02:09 +00:00
|
|
|
virtual const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const {
|
2008-12-03 22:15:05 +00:00
|
|
|
for (Common::FSList::const_iterator d = fslist.begin(); d != fslist.end(); ++d) {
|
|
|
|
Common::FSList audiofslist;
|
2008-12-13 09:39:00 +00:00
|
|
|
if (d->isDirectory() && d->getName().equalsIgnoreCase("audio") && d->getChildren(audiofslist, Common::FSNode::kListFilesOnly)) {
|
2008-12-03 22:15:05 +00:00
|
|
|
for (Common::FSList::const_iterator f = audiofslist.begin(); f != audiofslist.end(); ++f) {
|
2008-12-13 09:39:00 +00:00
|
|
|
if (!f->isDirectory() && f->getName().equalsIgnoreCase("demorolc.raw")) {
|
2008-12-03 22:15:05 +00:00
|
|
|
return &tuckerDemoGameDescription;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-11-28 23:56:25 +00:00
|
|
|
virtual SaveStateList listSaves(const char *target) const {
|
|
|
|
Common::String pattern = Tucker::generateGameStateFileName(target, 0, true);
|
2010-03-18 15:54:40 +00:00
|
|
|
Common::StringArray filenames = g_system->getSavefileManager()->listSavefiles(pattern);
|
2008-11-30 12:23:24 +00:00
|
|
|
bool slotsTable[Tucker::kLastSaveSlot + 1];
|
|
|
|
memset(slotsTable, 0, sizeof(slotsTable));
|
2008-11-28 23:56:25 +00:00
|
|
|
SaveStateList saveList;
|
2010-03-18 15:54:40 +00:00
|
|
|
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
|
2008-11-28 23:56:25 +00:00
|
|
|
int slot;
|
|
|
|
const char *ext = strrchr(file->c_str(), '.');
|
2008-11-30 12:23:24 +00:00
|
|
|
if (ext && (slot = atoi(ext + 1)) >= 0 && slot <= Tucker::kLastSaveSlot) {
|
2009-05-29 14:38:22 +00:00
|
|
|
Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(*file);
|
2008-11-28 23:56:25 +00:00
|
|
|
if (in) {
|
2008-11-30 12:23:24 +00:00
|
|
|
slotsTable[slot] = true;
|
2008-11-28 23:56:25 +00:00
|
|
|
delete in;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-11-30 12:23:24 +00:00
|
|
|
for (int slot = 0; slot <= Tucker::kLastSaveSlot; ++slot) {
|
|
|
|
if (slotsTable[slot]) {
|
2011-06-02 17:02:12 +00:00
|
|
|
Common::String description = Common::String::format("savegm.%02d", slot);
|
2008-11-30 12:23:24 +00:00
|
|
|
saveList.push_back(SaveStateDescriptor(slot, description));
|
|
|
|
}
|
|
|
|
}
|
2008-11-28 23:56:25 +00:00
|
|
|
return saveList;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual int getMaximumSaveSlot() const {
|
2008-11-30 12:23:24 +00:00
|
|
|
return Tucker::kLastSaveSlot;
|
2008-11-28 23:56:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual void removeSaveState(const char *target, int slot) const {
|
|
|
|
Common::String filename = Tucker::generateGameStateFileName(target, slot);
|
2009-05-29 14:38:22 +00:00
|
|
|
g_system->getSavefileManager()->removeSavefile(filename);
|
2008-11-28 23:56:25 +00:00
|
|
|
}
|
2008-11-10 20:38:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#if PLUGIN_ENABLED_DYNAMIC(TUCKER)
|
|
|
|
REGISTER_PLUGIN_DYNAMIC(TUCKER, PLUGIN_TYPE_ENGINE, TuckerMetaEngine);
|
|
|
|
#else
|
|
|
|
REGISTER_PLUGIN_STATIC(TUCKER, PLUGIN_TYPE_ENGINE, TuckerMetaEngine);
|
|
|
|
#endif
|