Simplify the detection code
This commit is contained in:
parent
18e3e02316
commit
27cc3ca035
3 changed files with 42 additions and 111 deletions
|
@ -23,132 +23,70 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "base/plugins.h"
|
||||
#include "engines/advancedDetector.h"
|
||||
|
||||
#include "engines/stark/stark.h"
|
||||
|
||||
|
||||
namespace Stark {
|
||||
|
||||
struct StarkGameDescription {
|
||||
ADGameDescription desc;
|
||||
|
||||
uint8 gameType;
|
||||
uint32 features;
|
||||
uint16 version;
|
||||
};
|
||||
|
||||
uint32 StarkEngine::getFeatures() const {
|
||||
return _gameDescription->features;
|
||||
}
|
||||
|
||||
Common::Platform StarkEngine::getPlatform() const {
|
||||
return _gameDescription->desc.platform;
|
||||
}
|
||||
|
||||
uint16 StarkEngine::getVersion() const {
|
||||
return _gameDescription->version;
|
||||
}
|
||||
|
||||
int StarkEngine::getGameID() const {
|
||||
return _gameDescription->gameType;
|
||||
}
|
||||
|
||||
Common::Language StarkEngine::getLanguage() const {
|
||||
return _gameDescription->desc.language;
|
||||
}
|
||||
|
||||
} // End of Namespace Stark
|
||||
|
||||
static const PlainGameDescriptor starkGames[] = {
|
||||
{"stark", "Stark Game"},
|
||||
{"tlj", "The Longest Journey"},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
|
||||
namespace Stark {
|
||||
|
||||
static const StarkGameDescription gameDescriptions[] = {
|
||||
static const ADGameDescription gameDescriptions[] = {
|
||||
// The Longest Journey
|
||||
// English 4CD
|
||||
{
|
||||
{
|
||||
"tlj",
|
||||
"",
|
||||
"tlj", "",
|
||||
AD_ENTRY1("x.xarc", "a0559457126caadab0cadac02d35f26f"),
|
||||
Common::EN_ANY,
|
||||
Common::kPlatformWindows,
|
||||
ADGF_NO_FLAGS,
|
||||
Common::GUIO_NONE
|
||||
},
|
||||
GID_TLJ,
|
||||
0,
|
||||
0
|
||||
},
|
||||
|
||||
// The Longest Journey
|
||||
// English DVD
|
||||
{
|
||||
{
|
||||
"tlj",
|
||||
"DVD",
|
||||
"tlj", "DVD",
|
||||
AD_ENTRY1("x.xarc", "de8327850d7bba90b690b141eaa23f61"),
|
||||
Common::EN_ANY,
|
||||
Common::kPlatformWindows,
|
||||
ADGF_NO_FLAGS,
|
||||
Common::GUIO_NONE
|
||||
},
|
||||
GID_TLJ,
|
||||
GF_DVD,
|
||||
0
|
||||
Common::GUIO_NONE
|
||||
},
|
||||
|
||||
// The Longest Journey
|
||||
// English Demo
|
||||
{
|
||||
{
|
||||
"tlj",
|
||||
"",
|
||||
"tlj", "",
|
||||
AD_ENTRY1("x.xarc", "97abc1bb9239dee4c208e533f3c97e1c"),
|
||||
Common::EN_ANY,
|
||||
Common::kPlatformWindows,
|
||||
ADGF_NO_FLAGS,
|
||||
ADGF_DEMO,
|
||||
Common::GUIO_NONE
|
||||
},
|
||||
GID_TLJ,
|
||||
GF_DEMO,
|
||||
0
|
||||
},
|
||||
|
||||
// The Longest Journey
|
||||
// English DVD Demo
|
||||
{
|
||||
{
|
||||
"tlj",
|
||||
"",
|
||||
"tlj", "DVD",
|
||||
AD_ENTRY1("x.xarc", "61093bcd499b386ed5c0345c52f48909"),
|
||||
Common::EN_ANY,
|
||||
Common::kPlatformWindows,
|
||||
ADGF_NO_FLAGS,
|
||||
ADGF_DEMO | GF_DVD,
|
||||
Common::GUIO_NONE
|
||||
},
|
||||
GID_TLJ,
|
||||
GF_DVD | GF_DEMO,
|
||||
0
|
||||
},
|
||||
|
||||
{ AD_TABLE_END_MARKER, 0, 0, 0 }
|
||||
AD_TABLE_END_MARKER
|
||||
};
|
||||
|
||||
} // End of namespace Stark
|
||||
|
||||
static const ADParams detectionParams = {
|
||||
// Pointer to ADGameDescription or its superset structure
|
||||
(const byte *)Stark::gameDescriptions,
|
||||
(const byte *)gameDescriptions,
|
||||
// Size of that superset structure
|
||||
sizeof(Stark::StarkGameDescription),
|
||||
sizeof(ADGameDescription),
|
||||
// Number of bytes to compute MD5 sum for
|
||||
5000,
|
||||
// List of all engine targets
|
||||
|
@ -181,16 +119,16 @@ public:
|
|||
};
|
||||
|
||||
bool StarkMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
|
||||
const Stark::StarkGameDescription *gd = (const Stark::StarkGameDescription *)desc;
|
||||
if (desc)
|
||||
*engine = new StarkEngine(syst, desc);
|
||||
|
||||
if (gd)
|
||||
*engine = new Stark::StarkEngine(syst, gd);
|
||||
|
||||
return gd != 0;
|
||||
return desc != 0;
|
||||
}
|
||||
|
||||
} // End of namespace Stark
|
||||
|
||||
#if PLUGIN_ENABLED_DYNAMIC(STARK)
|
||||
REGISTER_PLUGIN_DYNAMIC(STARK, PLUGIN_TYPE_ENGINE, StarkMetaEngine);
|
||||
REGISTER_PLUGIN_DYNAMIC(STARK, PLUGIN_TYPE_ENGINE, Stark::StarkMetaEngine);
|
||||
#else
|
||||
REGISTER_PLUGIN_STATIC(STARK, PLUGIN_TYPE_ENGINE, StarkMetaEngine);
|
||||
REGISTER_PLUGIN_STATIC(STARK, PLUGIN_TYPE_ENGINE, Stark::StarkMetaEngine);
|
||||
#endif
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace Stark {
|
|||
StarkEngine *g_stark = NULL;
|
||||
GfxBase *g_driver = NULL;
|
||||
|
||||
StarkEngine::StarkEngine(OSystem *syst, const StarkGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
|
||||
StarkEngine::StarkEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
|
||||
_mixer->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, 127);
|
||||
_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
|
||||
_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, ConfMan.getInt("speech_volume"));
|
||||
|
|
21
stark.h
21
stark.h
|
@ -26,6 +26,7 @@
|
|||
#ifndef STARK_H
|
||||
#define STARK_H
|
||||
|
||||
#include "engines/advancedDetector.h"
|
||||
#include "engines/engine.h"
|
||||
|
||||
#include "engines/stark/archive.h"
|
||||
|
@ -33,34 +34,25 @@
|
|||
|
||||
namespace Stark {
|
||||
|
||||
/*
|
||||
enum StarkGameID {
|
||||
GID_TLJ = 0,
|
||||
GID_DREAM
|
||||
};
|
||||
*/
|
||||
|
||||
enum StarkGameFeatures {
|
||||
GF_DEMO = (1 << 0),
|
||||
GF_DVD = (1 << 1)
|
||||
GF_DVD = (1 << 31)
|
||||
};
|
||||
|
||||
struct StarkGameDescription;
|
||||
|
||||
class StarkEngine : public Engine {
|
||||
public:
|
||||
StarkEngine(OSystem *syst, const StarkGameDescription *gameDesc);
|
||||
StarkEngine(OSystem *syst, const ADGameDescription *gameDesc);
|
||||
virtual ~StarkEngine();
|
||||
|
||||
void updateDisplayScene();
|
||||
void doFlip();
|
||||
|
||||
int getGameID() const;
|
||||
uint16 getVersion() const;
|
||||
uint32 getFeatures() const;
|
||||
Common::Language getLanguage() const;
|
||||
Common::Platform getPlatform() const;
|
||||
|
||||
const StarkGameDescription *_gameDescription;
|
||||
|
||||
void mainLoop();
|
||||
|
||||
protected:
|
||||
|
@ -68,8 +60,9 @@ protected:
|
|||
virtual Common::Error run();
|
||||
|
||||
private:
|
||||
XARCArchive _xArchive;
|
||||
const ADGameDescription *_gameDescription;
|
||||
|
||||
XARCArchive _xArchive;
|
||||
};
|
||||
|
||||
} // end of namespace Stark
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue