NEVERHOOD: Simplified detection tables

This commit is contained in:
Eugene Sandulenko 2020-08-24 23:24:10 +02:00
parent 4d0530117e
commit 1aa0367b8a
3 changed files with 81 additions and 107 deletions

View file

@ -28,33 +28,30 @@
#include "neverhood/neverhood.h" #include "neverhood/neverhood.h"
enum NeverhoodGameFeatures {
GF_BIG_DEMO = (1 << 0)
};
namespace Neverhood { namespace Neverhood {
struct NeverhoodGameDescription {
ADGameDescription desc;
uint32 features;
};
const char *NeverhoodEngine::getGameId() const { const char *NeverhoodEngine::getGameId() const {
return _gameDescription->desc.gameId; return _gameDescription->gameId;
} }
Common::Platform NeverhoodEngine::getPlatform() const { Common::Platform NeverhoodEngine::getPlatform() const {
return _gameDescription->desc.platform; return _gameDescription->platform;
} }
Common::Language NeverhoodEngine::getLanguage() const { Common::Language NeverhoodEngine::getLanguage() const {
return _gameDescription->desc.language; return _gameDescription->language;
} }
bool NeverhoodEngine::isDemo() const { bool NeverhoodEngine::isDemo() const {
return _gameDescription->desc.flags & ADGF_DEMO; return _gameDescription->flags & ADGF_DEMO;
} }
bool NeverhoodEngine::isBigDemo() const { bool NeverhoodEngine::isBigDemo() const {
return _gameDescription->features & GF_BIG_DEMO; return _gameDescription->flags & GF_BIG_DEMO;
} }
bool NeverhoodEngine::applyResourceFixes() const { bool NeverhoodEngine::applyResourceFixes() const {
@ -70,9 +67,8 @@ static const PlainGameDescriptor neverhoodGames[] = {
namespace Neverhood { namespace Neverhood {
static const NeverhoodGameDescription gameDescriptions[] = { static const ADGameDescription gameDescriptions[] = {
{
// Neverhood English version // Neverhood English version
{ {
"neverhood", "neverhood",
@ -83,10 +79,7 @@ static const NeverhoodGameDescription gameDescriptions[] = {
ADGF_DROPPLATFORM, ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE) GUIO1(GUIO_NONE)
}, },
0
},
{
// Neverhood English big demo version // Neverhood English big demo version
{ {
"neverhood", "neverhood",
@ -94,13 +87,10 @@ static const NeverhoodGameDescription gameDescriptions[] = {
AD_ENTRY1s("nevdemo.blb", "e637221d296f9a25ff22eaed96b07519", 117274189), AD_ENTRY1s("nevdemo.blb", "e637221d296f9a25ff22eaed96b07519", 117274189),
Common::EN_ANY, Common::EN_ANY,
Common::kPlatformWindows, Common::kPlatformWindows,
ADGF_DEMO | ADGF_DROPPLATFORM, GF_BIG_DEMO | ADGF_DEMO | ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE) GUIO1(GUIO_NONE)
}, },
GF_BIG_DEMO
},
{
// Neverhood English demo version // Neverhood English demo version
{ {
"neverhood", "neverhood",
@ -111,10 +101,7 @@ static const NeverhoodGameDescription gameDescriptions[] = {
ADGF_DEMO | ADGF_DROPPLATFORM, ADGF_DEMO | ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE) GUIO1(GUIO_NONE)
}, },
0
},
{
// Neverhood earlier English demo version // Neverhood earlier English demo version
{ {
"neverhood", "neverhood",
@ -125,10 +112,7 @@ static const NeverhoodGameDescription gameDescriptions[] = {
ADGF_DEMO | ADGF_DROPPLATFORM, ADGF_DEMO | ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE) GUIO1(GUIO_NONE)
}, },
0
},
{
// Neverhood Russian version. Dyadyushka Risech // Neverhood Russian version. Dyadyushka Risech
{ {
"neverhood", "neverhood",
@ -139,10 +123,7 @@ static const NeverhoodGameDescription gameDescriptions[] = {
ADGF_DROPPLATFORM, ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE) GUIO1(GUIO_NONE)
}, },
0
},
{
// Neverhood Russian version. Fargus // Neverhood Russian version. Fargus
{ {
"neverhood", "neverhood",
@ -153,10 +134,8 @@ static const NeverhoodGameDescription gameDescriptions[] = {
ADGF_DROPPLATFORM, ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE) GUIO1(GUIO_NONE)
}, },
0,
},
{ AD_TABLE_END_MARKER, 0 } AD_TABLE_END_MARKER
}; };
} // End of namespace Neverhood } // End of namespace Neverhood
@ -185,7 +164,7 @@ static const ExtraGuiOption neverhoodExtraGuiOption3 = {
class NeverhoodMetaEngine : public AdvancedMetaEngine { class NeverhoodMetaEngine : public AdvancedMetaEngine {
public: public:
NeverhoodMetaEngine() : AdvancedMetaEngine(Neverhood::gameDescriptions, sizeof(Neverhood::NeverhoodGameDescription), neverhoodGames) { NeverhoodMetaEngine() : AdvancedMetaEngine(Neverhood::gameDescriptions, sizeof(ADGameDescription), neverhoodGames) {
_guiOptions = GUIO2(GUIO_NOSUBTITLES, GUIO_NOMIDI); _guiOptions = GUIO2(GUIO_NOSUBTITLES, GUIO_NOMIDI);
} }
@ -231,11 +210,10 @@ bool Neverhood::NeverhoodEngine::hasFeature(EngineFeature f) const {
} }
bool NeverhoodMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { bool NeverhoodMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
const Neverhood::NeverhoodGameDescription *gd = (const Neverhood::NeverhoodGameDescription *)desc; if (desc) {
if (gd) { *engine = new Neverhood::NeverhoodEngine(syst, desc);
*engine = new Neverhood::NeverhoodEngine(syst, gd);
} }
return gd != 0; return desc != 0;
} }
const ExtraGuiOptions NeverhoodMetaEngine::getExtraGuiOptions(const Common::String &target) const { const ExtraGuiOptions NeverhoodMetaEngine::getExtraGuiOptions(const Common::String &target) const {

View file

@ -47,7 +47,7 @@
namespace Neverhood { namespace Neverhood {
NeverhoodEngine::NeverhoodEngine(OSystem *syst, const NeverhoodGameDescription *gameDesc) : NeverhoodEngine::NeverhoodEngine(OSystem *syst, const ADGameDescription *gameDesc) :
Engine(syst), _gameDescription(gameDesc) { Engine(syst), _gameDescription(gameDesc) {
// Setup mixer // Setup mixer
if (!_mixer->isReady()) { if (!_mixer->isReady()) {

View file

@ -35,14 +35,10 @@
#include "neverhood/console.h" #include "neverhood/console.h"
#include "neverhood/messages.h" #include "neverhood/messages.h"
struct ADGameDescription;
namespace Neverhood { namespace Neverhood {
enum NeverhoodGameFeatures {
GF_BIG_DEMO = (1 << 0)
};
struct NeverhoodGameDescription;
class GameModule; class GameModule;
class GameVars; class GameVars;
class ResourceMan; class ResourceMan;
@ -64,11 +60,11 @@ protected:
void mainLoop(); void mainLoop();
public: public:
NeverhoodEngine(OSystem *syst, const NeverhoodGameDescription *gameDesc); NeverhoodEngine(OSystem *syst, const ADGameDescription *gameDesc);
~NeverhoodEngine() override; ~NeverhoodEngine() override;
// Detection related functions // Detection related functions
const NeverhoodGameDescription *_gameDescription; const ADGameDescription *_gameDescription;
const char *getGameId() const; const char *getGameId() const;
Common::Platform getPlatform() const; Common::Platform getPlatform() const;
Common::Language getLanguage() const; Common::Language getLanguage() const;