BURIED: Converted detection.cpp to the new plugin structure

This commit is contained in:
Eugene Sandulenko 2021-03-16 19:12:24 +01:00
parent 7725f0ceed
commit c529636463
6 changed files with 316 additions and 371 deletions

View File

@ -48,7 +48,7 @@
namespace Buried {
BuriedEngine::BuriedEngine(OSystem *syst, const BuriedGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
BuriedEngine::BuriedEngine(OSystem *syst, const Common::ADGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
_gfx = 0;
_mainEXE = 0;
_library = 0;

View File

@ -34,6 +34,7 @@
class OSystem;
namespace Common {
struct ADGameDescription;
class SeekableReadStream;
class Serializer;
class WriteStream;
@ -41,8 +42,14 @@ class WriteStream;
namespace Buried {
enum {
GF_TRUECOLOR = (1 << 1),
GF_WIN95 = (1 << 2),
GF_COMPRESSED = (1 << 3),
GF_TRIAL = (1 << 4)
};
class BuriedConsole;
struct BuriedGameDescription;
class Database;
struct GlobalFlags;
class GraphicsManager;
@ -57,11 +64,11 @@ protected:
Common::Error run();
public:
BuriedEngine(OSystem *syst, const BuriedGameDescription *gamedesc);
BuriedEngine(OSystem *syst, const Common::ADGameDescription *gamedesc);
virtual ~BuriedEngine();
// Detection related functions
const BuriedGameDescription *_gameDescription;
const Common::ADGameDescription *_gameDescription;
bool isDemo() const;
bool isTrial() const;
bool isTrueColor() const;

View File

@ -30,61 +30,6 @@
#include "buried/buried.h"
namespace Buried {
struct BuriedGameDescription {
ADGameDescription desc;
};
enum {
GF_TRUECOLOR = (1 << 1),
GF_WIN95 = (1 << 2),
GF_COMPRESSED = (1 << 3),
GF_TRIAL = (1 << 4)
};
bool BuriedEngine::hasFeature(EngineFeature f) const {
return
(f == kSupportsRTL)
|| (f == kSupportsLoadingDuringRuntime)
|| (f == kSupportsSavingDuringRuntime);
}
bool BuriedEngine::isDemo() const {
// The trial is a demo for the user's sake, but not internally.
return (_gameDescription->desc.flags & ADGF_DEMO) != 0 && !isTrial();
}
bool BuriedEngine::isTrial() const {
return (_gameDescription->desc.flags & GF_TRIAL) != 0;
}
bool BuriedEngine::isTrueColor() const {
return (_gameDescription->desc.flags & GF_TRUECOLOR) != 0;
}
bool BuriedEngine::isWin95() const {
return (_gameDescription->desc.flags & GF_WIN95) != 0;
}
bool BuriedEngine::isCompressed() const {
return (_gameDescription->desc.flags & GF_COMPRESSED) != 0;
}
Common::String BuriedEngine::getEXEName() const {
return _gameDescription->desc.filesDescriptions[0].fileName;
}
Common::String BuriedEngine::getLibraryName() const {
return _gameDescription->desc.filesDescriptions[1].fileName;
}
Common::Language BuriedEngine::getLanguage() const {
return _gameDescription->desc.language;
}
} // End of namespace Buried
static const PlainGameDescriptor buriedGames[] = {
{"buried", "The Journeyman Project 2: Buried in Time"},
{0, 0}
@ -103,73 +48,25 @@ static const char *directoryGlobs[] = {
} // End of namespace Buried
class BuriedMetaEngine : public AdvancedMetaEngine {
class BuriedMetaEngineDetection : public AdvancedMetaEngineDetection {
public:
BuriedMetaEngine() : AdvancedMetaEngine(Buried::gameDescriptions, sizeof(Buried::BuriedGameDescription), buriedGames) {
_singleid = "buried";
BuriedMetaEngineDetection() : AdvancedMetaEngineDetection(Buried::gameDescriptions, sizeof(ADGameDescription), buriedGames) {
_flags = kADFlagUseExtraAsHint;
_maxScanDepth = 3;
_directoryGlobs = Buried::directoryGlobs;
}
virtual const char *getName() const {
const char *getEngineId() const override {
return "buried";
}
virtual const char *getName() const override {
return "The Journeyman Project 2: Buried in Time";
}
virtual const char *getOriginalCopyright() const {
virtual const char *getOriginalCopyright() const override {
return "The Journeyman Project 2: Buried in Time (C) Presto Studios";
}
virtual bool hasFeature(MetaEngineFeature f) const;
virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
virtual SaveStateList listSaves(const char *target) const;
virtual int getMaximumSaveSlot() const { return 999; }
virtual void removeSaveState(const char *target, int slot) const;
};
bool BuriedMetaEngine::hasFeature(MetaEngineFeature f) const {
return
(f == kSupportsListSaves)
|| (f == kSupportsLoadingDuringStartup)
|| (f == kSupportsDeleteSave);
}
SaveStateList BuriedMetaEngine::listSaves(const char *target) const {
// The original had no pattern, so the user must rename theirs
// Note that we ignore the target because saves are compatible between
// all versions
Common::StringArray fileNames = Buried::BuriedEngine::listSaveFiles();
SaveStateList saveList;
for (uint32 i = 0; i < fileNames.size(); i++) {
// Isolate the description from the file name
Common::String desc = fileNames[i].c_str() + 7;
for (int j = 0; j < 4; j++)
desc.deleteLastChar();
saveList.push_back(SaveStateDescriptor(i, desc));
}
return saveList;
}
void BuriedMetaEngine::removeSaveState(const char *target, int slot) const {
// See listSaves() for info on the pattern
Common::StringArray fileNames = Buried::BuriedEngine::listSaveFiles();
g_system->getSavefileManager()->removeSavefile(fileNames[slot].c_str());
}
bool BuriedMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
const Buried::BuriedGameDescription *gd = (const Buried::BuriedGameDescription *)desc;
if (gd)
*engine = new Buried::BuriedEngine(syst, gd);
return (gd != 0);
}
#if PLUGIN_ENABLED_DYNAMIC(BURIED)
REGISTER_PLUGIN_DYNAMIC(BURIED, PLUGIN_TYPE_ENGINE, BuriedMetaEngine);
#else
REGISTER_PLUGIN_STATIC(BURIED, PLUGIN_TYPE_ENGINE, BuriedMetaEngine);
#endif
REGISTER_PLUGIN_STATIC(BURIED_DETEcTION, PLUGIN_TYPE_ENGINE_DETECTION, BuriedMetaEngineDetection);

View File

@ -22,372 +22,278 @@
namespace Buried {
static const BuriedGameDescription gameDescriptions[] = {
static const ADGameDescription gameDescriptions[] = {
// English Windows 3.11 8BPP
// Installed
// v1.01
{
{
"buried",
"v1.01 8BPP",
{
{ "BIT816.EXE", 0, "57a14461c77d9c77534bd418043db1ec", 1163776 },
{ "BIT8LIB.DLL", 0, "31bcd9e5cc32df00b09ce626e6d9106e", 2420480 },
{ 0, 0, 0, 0 },
},
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
GUIO0()
},
"buried",
"v1.01 8BPP",
AD_ENTRY2s("BIT816.EXE", "57a14461c77d9c77534bd418043db1ec", 1163776,
"BIT8LIB.DLL","31bcd9e5cc32df00b09ce626e6d9106e", 2420480),
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
GUIO0()
},
// English Windows 3.11 24BPP
// Installed
// v1.01
{
{
"buried",
"v1.01 24BPP",
{
{ "BIT2416.EXE", 0, "dcbfb3f2916ad902043942fc00d2017f", 1159680 },
{ "BIT24LIB.DLL", 0, "74ac9dae92f415fea8cdbd220ba8795c", 5211648 },
{ 0, 0, 0, 0 },
},
Common::EN_ANY,
Common::kPlatformWindows,
GF_TRUECOLOR,
GUIO0()
},
"buried",
"v1.01 24BPP",
AD_ENTRY2s("BIT2416.EXE", "dcbfb3f2916ad902043942fc00d2017f", 1159680,
"BIT24LIB.DLL","74ac9dae92f415fea8cdbd220ba8795c", 5211648),
Common::EN_ANY,
Common::kPlatformWindows,
GF_TRUECOLOR,
GUIO0()
},
// Japanese Windows 3.11 8BPP
// Installed
// v1.051
{
{
"buried",
"v1.051 8BPP",
{
{ "BIT816.EXE", 0, "decbf9a7d91803525137ffd980d16708", 1163264 },
{ "BIT8LIB.DLL", 0, "f5ccde0efccb95afe902627a35262568", 2418816 },
{ 0, 0, 0, 0 },
},
Common::JA_JPN,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
GUIO0()
},
"buried",
"v1.051 8BPP",
AD_ENTRY2s("BIT816.EXE", "decbf9a7d91803525137ffd980d16708", 1163264,
"BIT8LIB.DLL","f5ccde0efccb95afe902627a35262568", 2418816),
Common::JA_JPN,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
GUIO0()
},
// Japanese Windows 3.11 24BPP
// Installed
// v1.051
{
{
"buried",
"v1.051 24BPP",
{
{ "BIT2416.EXE", 0, "9435b9a40e3ac83e6fa1e83caaf57792", 1157632 },
{ "BIT24LIB.DLL", 0, "4d55802259d9648b9aa396461bfd53a3", 6576896 },
{ 0, 0, 0, 0 },
},
Common::JA_JPN,
Common::kPlatformWindows,
GF_TRUECOLOR,
GUIO0()
},
"buried",
"v1.051 24BPP",
AD_ENTRY2s("BIT2416.EXE", "9435b9a40e3ac83e6fa1e83caaf57792", 1157632,
"BIT24LIB.DLL","4d55802259d9648b9aa396461bfd53a3", 6576896),
Common::JA_JPN,
Common::kPlatformWindows,
GF_TRUECOLOR,
GUIO0()
},
// English Windows 3.11 8BPP
// Not Installed
// v1.01
{
{
"buried",
"v1.01 8BPP",
{
{ "BIT816.EX_", 0, "166b44e53350c19bb25ef93d2c2b8f79", 364490 },
{ "BIT8LIB.DL_", 0, "8a345993f60f6bed7c17fa9e7f2bc37d", 908854 },
{ 0, 0, 0, 0 },
},
Common::EN_ANY,
Common::kPlatformWindows,
GF_COMPRESSED,
GUIO0()
},
"buried",
"v1.01 8BPP",
AD_ENTRY2s("BIT816.EX_", "166b44e53350c19bb25ef93d2c2b8f79", 364490,
"BIT8LIB.DL_","8a345993f60f6bed7c17fa9e7f2bc37d", 908854),
Common::EN_ANY,
Common::kPlatformWindows,
GF_COMPRESSED,
GUIO0()
},
// English Windows 3.11 24BPP
// Not Installed
// v1.01
{
{
"buried",
"v1.01 24BPP",
{
{ "BIT2416.EX_", 0, "a9ac76610ba614b59235a7d5e00e4a62", 361816 },
{ "BIT24LIB.DL_", 0, "00e6eedbcef824988fbb01a87ca8f7fd", 2269314 },
{ 0, 0, 0, 0 },
},
Common::EN_ANY,
Common::kPlatformWindows,
GF_COMPRESSED | GF_TRUECOLOR,
GUIO0()
},
"buried",
"v1.01 24BPP",
AD_ENTRY2s("BIT2416.EX_", "a9ac76610ba614b59235a7d5e00e4a62", 361816,
"BIT24LIB.DL_","00e6eedbcef824988fbb01a87ca8f7fd", 2269314),
Common::EN_ANY,
Common::kPlatformWindows,
GF_COMPRESSED | GF_TRUECOLOR,
GUIO0()
},
// German Windows 3.11 8BPP
// Installed
// v1.05
{
{
"buried",
"v1.05 8BPP",
{
{ "BIT816.EXE", 0, "a039e9f1c569acc1cf80f6b549ce1e37", 1178112 },
{ "BIT8LIB.DLL", 0, "6b22f0b47efb29e45e9b2a336185d924", 2420608 },
{ 0, 0, 0, 0 },
},
Common::DE_DEU,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
GUIO0()
},
"buried",
"v1.05 8BPP",
AD_ENTRY2s("BIT816.EXE", "a039e9f1c569acc1cf80f6b549ce1e37", 1178112,
"BIT8LIB.DLL","6b22f0b47efb29e45e9b2a336185d924", 2420608),
Common::DE_DEU,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
GUIO0()
},
// German Windows 3.11 24BPP
// Installed
// v1.05
{
{
"buried",
"v1.05 24BPP",
{
{ "BIT2416.EXE", 0, "fbfd453cced2b14069fa32e3c8dd69e2", 1172480 },
{ "BIT24LIB.DLL", 0, "30e56210d3150b5fa41c9bd2c90754fe", 6581376 },
{ 0, 0, 0, 0 },
},
Common::DE_DEU,
Common::kPlatformWindows,
GF_TRUECOLOR,
GUIO0()
},
"buried",
"v1.05 24BPP",
AD_ENTRY2s("BIT2416.EXE", "fbfd453cced2b14069fa32e3c8dd69e2", 1172480,
"BIT24LIB.DLL","30e56210d3150b5fa41c9bd2c90754fe", 6581376),
Common::DE_DEU,
Common::kPlatformWindows,
GF_TRUECOLOR,
GUIO0()
},
// French Windows 3.11 8BPP
// Installed
// v1.05
{
{
"buried",
"v1.05 8BPP",
{
{ "BIT816.EXE", 0, "edea5331dc7cb0f3da7322691e12a18a", 1182720 },
{ "BIT8LIB.DLL", 0, "6b22f0b47efb29e45e9b2a336185d924", 2420608 },
{ 0, 0, 0, 0 },
},
Common::FR_FRA,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
GUIO0()
},
"buried",
"v1.05 8BPP",
AD_ENTRY2s("BIT816.EXE", "edea5331dc7cb0f3da7322691e12a18a", 1182720,
"BIT8LIB.DLL","6b22f0b47efb29e45e9b2a336185d924", 2420608),
Common::FR_FRA,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
GUIO0()
},
// French Windows 3.11 24BPP
// Installed
// v1.05
{
{
"buried",
"v1.05 24BPP",
{
{ "BIT2416.EXE", 0, "0adea8e1ad6fddad3b861be8a7bab340", 1177088 },
{ "BIT24LIB.DLL", 0, "30e56210d3150b5fa41c9bd2c90754fe", 6581376 },
{ 0, 0, 0, 0 },
},
Common::FR_FRA,
Common::kPlatformWindows,
GF_TRUECOLOR,
GUIO0()
},
"buried",
"v1.05 24BPP",
AD_ENTRY2s("BIT2416.EXE", "0adea8e1ad6fddad3b861be8a7bab340", 1177088,
"BIT24LIB.DLL","30e56210d3150b5fa41c9bd2c90754fe", 6581376),
Common::FR_FRA,
Common::kPlatformWindows,
GF_TRUECOLOR,
GUIO0()
},
// Italian Windows 3.11 8BPP
// Installed
// v1.05
{
{
"buried",
"v1.05 8BPP",
{
{ "BIT816.EXE", 0, "fb3e5c9198503bbb45b79150b511af5e", 1175040 },
{ "BIT8LIB.DLL", 0, "6b22f0b47efb29e45e9b2a336185d924", 2420608 },
{ 0, 0, 0, 0 },
},
Common::IT_ITA,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
GUIO0()
},
"buried",
"v1.05 8BPP",
AD_ENTRY2s("BIT816.EXE", "fb3e5c9198503bbb45b79150b511af5e", 1175040,
"BIT8LIB.DLL","6b22f0b47efb29e45e9b2a336185d924", 2420608),
Common::IT_ITA,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
GUIO0()
},
// Italian Windows 3.11 24BPP
// Installed
// v1.05
{
{
"buried",
"v1.05 24BPP",
{
{ "BIT2416.EXE", 0, "56bdd481b063c91b95c21f02faa450bb", 1169408 },
{ "BIT24LIB.DLL", 0, "30e56210d3150b5fa41c9bd2c90754fe", 6581376 },
{ 0, 0, 0, 0 },
},
Common::IT_ITA,
Common::kPlatformWindows,
GF_TRUECOLOR,
GUIO0()
},
"buried",
"v1.05 24BPP",
AD_ENTRY2s("BIT2416.EXE", "56bdd481b063c91b95c21f02faa450bb", 1169408,
"BIT24LIB.DLL","30e56210d3150b5fa41c9bd2c90754fe", 6581376),
Common::IT_ITA,
Common::kPlatformWindows,
GF_TRUECOLOR,
GUIO0()
},
// Spanish Windows 3.11 8BPP
// Installed
// v1.05
{
{
"buried",
"v1.05 8BPP",
{
{ "BIT816.EXE", 0, "f08c96347fcb83d92ae57de1fb578234", 1174528 },
{ "BIT8LIB.DLL", 0, "a80afdc20264e764e831ef5099cde623", 2420992 },
{ 0, 0, 0, 0 },
},
Common::ES_ESP,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
GUIO0()
},
"buried",
"v1.05 8BPP",
AD_ENTRY2s("BIT816.EXE", "f08c96347fcb83d92ae57de1fb578234", 1174528,
"BIT8LIB.DLL","a80afdc20264e764e831ef5099cde623", 2420992),
Common::ES_ESP,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
GUIO0()
},
// Spanish Windows 3.11 24BPP
// Installed
// v1.05
{
{
"buried",
"v1.05 24BPP",
{
{ "BIT2416.EXE", 0, "d409b59f124babc9b423793e762b7e03", 1168896 },
{ "BIT24LIB.DLL", 0, "c864bcd69d05532e0066b8db173a939b", 6582784 },
{ 0, 0, 0, 0 },
},
Common::ES_ESP,
Common::kPlatformWindows,
GF_TRUECOLOR,
GUIO0()
},
"buried",
"v1.05 24BPP",
AD_ENTRY2s("BIT2416.EXE", "d409b59f124babc9b423793e762b7e03", 1168896,
"BIT24LIB.DLL","c864bcd69d05532e0066b8db173a939b", 6582784),
Common::ES_ESP,
Common::kPlatformWindows,
GF_TRUECOLOR,
GUIO0()
},
// English Windows 95 8BPP
// v1.1
{
{
"buried",
"v1.1 8BPP",
{
{ "BIT832.EXE", 0, "f4f8007f49197ba40ea633eb113c0b6d", 1262592 },
{ "BIT8L32.DLL", 0, "addfef0420e1f41a7766ecc6baa58553", 2424832 },
{ 0, 0, 0, 0 },
},
Common::EN_ANY,
Common::kPlatformWindows,
GF_WIN95,
GUIO0()
},
"buried",
"v1.1 8BPP",
AD_ENTRY2s("BIT832.EXE", "f4f8007f49197ba40ea633eb113c0b6d", 1262592,
"BIT8L32.DLL","addfef0420e1f41a7766ecc6baa58553", 2424832),
Common::EN_ANY,
Common::kPlatformWindows,
GF_WIN95,
GUIO0()
},
// English Windows 95 24BPP
// v1.1
{
{
"buried",
"v1.1 24BPP",
{
{ "BIT2432.EXE", 0, "4086a8200938eac3e72d238a84f65618", 1257472 },
{ "BIT24L32.DLL", 0, "198bfd476d5228c4a7a63c029cffadfc", 5216256 },
{ 0, 0, 0, 0 },
},
Common::EN_ANY,
Common::kPlatformWindows,
GF_TRUECOLOR | GF_WIN95,
GUIO0()
},
"buried",
"v1.1 24BPP",
AD_ENTRY2s("BIT2432.EXE", "4086a8200938eac3e72d238a84f65618", 1257472,
"BIT24L32.DLL","198bfd476d5228c4a7a63c029cffadfc", 5216256),
Common::EN_ANY,
Common::kPlatformWindows,
GF_TRUECOLOR | GF_WIN95,
GUIO0()
},
// English Windows Demo 8BPP
{
{
"buried",
"Demo 8BPP",
AD_ENTRY1("BIT816.EXE", "a5bca831dac0903a304c29c320f881c5"),
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO,
GUIO1(GUIO_NOLAUNCHLOAD)
},
"buried",
"Demo 8BPP",
AD_ENTRY1("BIT816.EXE", "a5bca831dac0903a304c29c320f881c5"),
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO,
GUIO1(GUIO_NOLAUNCHLOAD)
},
// English Windows Demo 24BPP
{
{
"buried",
"Demo 24BPP",
AD_ENTRY1("BIT2416.EXE", "9857e2d2b7a63b1304058dabc5098249"),
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO | GF_TRUECOLOR,
GUIO1(GUIO_NOLAUNCHLOAD)
},
"buried",
"Demo 24BPP",
AD_ENTRY1("BIT2416.EXE", "9857e2d2b7a63b1304058dabc5098249"),
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO | GF_TRUECOLOR,
GUIO1(GUIO_NOLAUNCHLOAD)
},
// English Windows 3.11 Trial 8BPP
// v1.1
{
{
"buried",
"Trial 8BPP",
{
{ "BTV816.EXE", 0, "a3551483329816d8ddc8fa877113762c", 1170432 },
{ "BIT8LIB.DLL", 0, "6b22f0b47efb29e45e9b2a336185d924", 2420608 },
{ 0, 0, 0, 0 },
},
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO | GF_TRIAL,
GUIO0()
},
"buried",
"Trial 8BPP",
AD_ENTRY2s("BTV816.EXE", "a3551483329816d8ddc8fa877113762c", 1170432,
"BIT8LIB.DLL","6b22f0b47efb29e45e9b2a336185d924", 2420608),
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO | GF_TRIAL,
GUIO0()
},
// English Windows 3.11 Trial 24BPP
// v1.1
{
{
"buried",
"Trial 24BPP",
{
{ "BTV2416.EXE", 0, "e0783c5eda09176d414d3df4ada8fe89", 1164288 },
{ "BIT24LIB.DLL", 0, "74ac9dae92f415fea8cdbd220ba8795c", 5211648 },
{ 0, 0, 0, 0 },
},
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO | GF_TRUECOLOR | GF_TRIAL,
GUIO0()
},
"buried",
"Trial 24BPP",
AD_ENTRY2s("BTV2416.EXE", "e0783c5eda09176d414d3df4ada8fe89", 1164288,
"BIT24LIB.DLL","74ac9dae92f415fea8cdbd220ba8795c", 5211648),
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO | GF_TRUECOLOR | GF_TRIAL,
GUIO0()
},
{ AD_TABLE_END_MARKER }
AD_TABLE_END_MARKER
};
} // End of namespace Buried

View File

@ -0,0 +1,132 @@
/* 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 "base/plugins.h"
#include "common/savefile.h"
#include "common/system.h"
#include "buried/buried.h"
namespace Buried {
bool BuriedEngine::hasFeature(EngineFeature f) const {
return
(f == kSupportsRTL)
|| (f == kSupportsLoadingDuringRuntime)
|| (f == kSupportsSavingDuringRuntime);
}
bool BuriedEngine::isDemo() const {
// The trial is a demo for the user's sake, but not internally.
return (_gameDescription->flags & ADGF_DEMO) != 0 && !isTrial();
}
bool BuriedEngine::isTrial() const {
return (_gameDescription->flags & GF_TRIAL) != 0;
}
bool BuriedEngine::isTrueColor() const {
return (_gameDescription->flags & GF_TRUECOLOR) != 0;
}
bool BuriedEngine::isWin95() const {
return (_gameDescription->flags & GF_WIN95) != 0;
}
bool BuriedEngine::isCompressed() const {
return (_gameDescription->flags & GF_COMPRESSED) != 0;
}
Common::String BuriedEngine::getEXEName() const {
return _gameDescription->filesDescriptions[0].fileName;
}
Common::String BuriedEngine::getLibraryName() const {
return _gameDescription->filesDescriptions[1].fileName;
}
Common::Language BuriedEngine::getLanguage() const {
return _gameDescription->language;
}
} // End of namespace Buried
class BuriedMetaEngine : public AdvancedMetaEngine {
public:
const char *getName() const {
return "buried";
}
virtual bool hasFeature(MetaEngineFeature f) const;
virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
virtual SaveStateList listSaves(const char *target) const;
virtual int getMaximumSaveSlot() const { return 999; }
virtual void removeSaveState(const char *target, int slot) const;
};
bool BuriedMetaEngine::hasFeature(MetaEngineFeature f) const {
return
(f == kSupportsListSaves)
|| (f == kSupportsLoadingDuringStartup)
|| (f == kSupportsDeleteSave);
}
SaveStateList BuriedMetaEngine::listSaves(const char *target) const {
// The original had no pattern, so the user must rename theirs
// Note that we ignore the target because saves are compatible between
// all versions
Common::StringArray fileNames = Buried::BuriedEngine::listSaveFiles();
SaveStateList saveList;
for (uint32 i = 0; i < fileNames.size(); i++) {
// Isolate the description from the file name
Common::String desc = fileNames[i].c_str() + 7;
for (int j = 0; j < 4; j++)
desc.deleteLastChar();
saveList.push_back(SaveStateDescriptor(i, desc));
}
return saveList;
}
void BuriedMetaEngine::removeSaveState(const char *target, int slot) const {
// See listSaves() for info on the pattern
Common::StringArray fileNames = Buried::BuriedEngine::listSaveFiles();
g_system->getSavefileManager()->removeSavefile(fileNames[slot].c_str());
}
bool BuriedMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
const Buried::BuriedGameDescription *gd = (const Buried::BuriedGameDescription *)desc;
if (gd)
*engine = new Buried::BuriedEngine(syst, gd);
return (gd != 0);
}
#if PLUGIN_ENABLED_DYNAMIC(BURIED)
REGISTER_PLUGIN_DYNAMIC(BURIED, PLUGIN_TYPE_ENGINE, BuriedMetaEngine);
#else
REGISTER_PLUGIN_STATIC(BURIED, PLUGIN_TYPE_ENGINE, BuriedMetaEngine);
#endif

View File

@ -10,7 +10,6 @@ MODULE_OBJS = \
credits.o \
database.o \
death.o \
detection.o \
frame_window.o \
gameui.o \
graphics.o \
@ -18,6 +17,7 @@ MODULE_OBJS = \
inventory_window.o \
livetext.o \
main_menu.o \
metaengine.o \
navarrow.o \
overview.o \
saveload.o \
@ -48,3 +48,6 @@ endif
# Include common rules
include $(srcdir)/rules.mk
# Detection objects
DETECT_OBJS += $(MODULE)/detection.o