Reduce dependency from common/advancedDetector.h

svn-id: r25156
This commit is contained in:
Eugene Sandulenko 2007-01-21 20:24:38 +00:00
parent 01a5faa6a0
commit d3b0ff8ade
12 changed files with 139 additions and 82 deletions

View File

@ -441,12 +441,12 @@ int AgiEngine::agiDetectGame() {
assert(_gameDescription != NULL); assert(_gameDescription != NULL);
_opt.amigaMode = ((_gameDescription->features & AGI_AMIGA) == AGI_AMIGA); _opt.amigaMode = ((getFeatures() & AGI_AMIGA) == AGI_AMIGA);
_opt.agdsMode = ((_gameDescription->features & AGI_AGDS) == AGI_AGDS); _opt.agdsMode = ((getFeatures() & AGI_AGDS) == AGI_AGDS);
_opt.agimouse = ((_gameDescription->features & AGI_MOUSE) == AGI_MOUSE); _opt.agimouse = ((getFeatures() & AGI_MOUSE) == AGI_MOUSE);
if(_gameDescription->version <= 0x2999) { if(getVersion() <= 0x2999) {
_loader = new AgiLoader_v2(this); _loader = new AgiLoader_v2(this);
} else { } else {
_loader = new AgiLoader_v3(this); _loader = new AgiLoader_v3(this);

View File

@ -29,7 +29,6 @@
#include "common/scummsys.h" #include "common/scummsys.h"
#include "common/endian.h" #include "common/endian.h"
#include "common/util.h" #include "common/util.h"
#include "common/advancedDetector.h"
#include "common/file.h" #include "common/file.h"
#include "common/savefile.h" #include "common/savefile.h"
#include "common/system.h" #include "common/system.h"
@ -111,13 +110,7 @@ enum AgiGameFeatures {
}; };
struct AGIGameDescription { struct AGIGameDescription;
Common::ADGameDescription desc;
int gameType;
uint32 features;
uint16 version;
};
enum { enum {
NO_GAMEDIR = 0, NO_GAMEDIR = 0,
@ -531,6 +524,8 @@ public:
} }
const AGIGameDescription *_gameDescription; const AGIGameDescription *_gameDescription;
uint32 getFeatures() const;
uint16 getVersion() const;
private: private:

View File

@ -31,6 +31,23 @@
namespace Agi { namespace Agi {
struct AGIGameDescription {
Common::ADGameDescription desc;
int gameType;
uint32 features;
uint16 version;
};
uint32 AgiEngine::getFeatures() const {
return _gameDescription->features;
}
uint16 AgiEngine::getVersion() const {
return _gameDescription->version;
}
static GameList GAME_detectGames(const FSList &fslist); static GameList GAME_detectGames(const FSList &fslist);
} }
@ -834,12 +851,12 @@ static const AGIGameDescription gameDescriptions[] = {
FANMADE("Journey Of Chef", "aa0a0b5a6364801ae65fdb96d6741df5"), FANMADE("Journey Of Chef", "aa0a0b5a6364801ae65fdb96d6741df5"),
FANMADE("Jukebox (v1.0)", "c4b9c5528cc67f6ba777033830de7751"), FANMADE("Jukebox (v1.0)", "c4b9c5528cc67f6ba777033830de7751"),
FANMADE("Justin Quest (v1.0 in development)", "103050989da7e0ffdc1c5e1793a4e1ec"), FANMADE("Justin Quest (v1.0 in development)", "103050989da7e0ffdc1c5e1793a4e1ec"),
FANMADE("J<EFBFBD>ulumaa (v0.05) (Estonian)", "53982ecbfb907e41392b3961ad1c3475"), FANMADE("Jï ½ulumaa (v0.05) (Estonian)", "53982ecbfb907e41392b3961ad1c3475"),
FANMADE("Kings Quest 2 - Breast Intentions (v2.0)", "6b4f796d0421d2e12e501b511962e03a"), FANMADE("Kings Quest 2 - Breast Intentions (v2.0)", "6b4f796d0421d2e12e501b511962e03a"),
FANMADE("Lasse Holm: The Quest for Revenge (v1.0)", "f9fbcc8a4ef510bfbb92423296ff4abb"), FANMADE("Lasse Holm: The Quest for Revenge (v1.0)", "f9fbcc8a4ef510bfbb92423296ff4abb"),
FANMADE("Lawman for Hire", "c78b28bfd3767dd455b992cd8b7854fa"), FANMADE("Lawman for Hire", "c78b28bfd3767dd455b992cd8b7854fa"),
FANMADE("Lefty Goes on Vacation (Not in The Right Place)", "ccdc49a33870310b01f2c48b8a1f3c34"), FANMADE("Lefty Goes on Vacation (Not in The Right Place)", "ccdc49a33870310b01f2c48b8a1f3c34"),
FANMADE("Les Ins<EFBFBD>parables (v1.0)", "4b780887cab0ecabc5eca319acb3acf2"), FANMADE("Les Insï ½parables (v1.0)", "4b780887cab0ecabc5eca319acb3acf2"),
FANMADE("Little Pirate (Demo 2 v0.6)", "437068efe4ec32d436da09d6f2ea56e1"), FANMADE("Little Pirate (Demo 2 v0.6)", "437068efe4ec32d436da09d6f2ea56e1"),
FANMADE("Lost Eternity (v1.0)", "95f15c5632feb8a39e9ca3d9af35fcc9"), FANMADE("Lost Eternity (v1.0)", "95f15c5632feb8a39e9ca3d9af35fcc9"),
FANMADE("MD Quest - The Search for Michiel (v0.10)", "2a6fcb21d2b5e4144c38ed817fabe8ee"), FANMADE("MD Quest - The Search for Michiel (v0.10)", "2a6fcb21d2b5e4144c38ed817fabe8ee"),

View File

@ -32,7 +32,7 @@ namespace Agi {
int AgiEngine::v2IdGame() { int AgiEngine::v2IdGame() {
int ver; int ver;
ver = _gameDescription->version; ver = getVersion();
_game.ver = ver; _game.ver = ver;
debugC(2, kDebugLevelMain, "game.ver = 0x%x", _game.ver); debugC(2, kDebugLevelMain, "game.ver = 0x%x", _game.ver);
agiSetRelease(ver); agiSetRelease(ver);
@ -51,7 +51,7 @@ int AgiEngine::v2IdGame() {
int AgiEngine::v3IdGame() { int AgiEngine::v3IdGame() {
int ver; int ver;
ver = _gameDescription->version; ver = getVersion();
_game.ver = ver; _game.ver = ver;
debugC(2, kDebugLevelMain, "game.ver = 0x%x", _game.ver); debugC(2, kDebugLevelMain, "game.ver = 0x%x", _game.ver);
agiSetRelease(ver); agiSetRelease(ver);

View File

@ -28,7 +28,6 @@
#include "common/stdafx.h" #include "common/stdafx.h"
#include "common/scummsys.h" #include "common/scummsys.h"
#include "common/util.h" #include "common/util.h"
#include "common/advancedDetector.h"
#include "engines/engine.h" #include "engines/engine.h"
@ -59,12 +58,7 @@ enum CineGameFeatures {
GF_ALT_FONT = 1 << 2 GF_ALT_FONT = 1 << 2
}; };
struct CINEGameDescription { struct CINEGameDescription;
Common::ADGameDescription desc;
int gameType;
uint32 features;
};
class CineEngine : public Engine { class CineEngine : public Engine {
@ -79,10 +73,10 @@ public:
CineEngine(OSystem *syst); CineEngine(OSystem *syst);
virtual ~CineEngine(); virtual ~CineEngine();
int getGameType() const { return _gameDescription->gameType; } int getGameType() const;
uint32 getFeatures() const { return _gameDescription->features; } uint32 getFeatures() const;
Common::Language getLanguage() const { return _gameDescription->desc.language; } Common::Language getLanguage() const;
Common::Platform getPlatform() const { return _gameDescription->desc.platform; } Common::Platform getPlatform() const;
bool loadSaveDirectory(void); bool loadSaveDirectory(void);
void makeSystemMenu(void); void makeSystemMenu(void);

View File

@ -32,6 +32,19 @@
#include "cine/cine.h" #include "cine/cine.h"
namespace Cine { namespace Cine {
struct CINEGameDescription {
Common::ADGameDescription desc;
int gameType;
uint32 features;
};
int CineEngine::getGameType() const { return _gameDescription->gameType; }
uint32 CineEngine::getFeatures() const { return _gameDescription->features; }
Common::Language CineEngine::getLanguage() const { return _gameDescription->desc.language; }
Common::Platform CineEngine::getPlatform() const { return _gameDescription->desc.platform; }
static GameList GAME_detectGames(const FSList &fslist); static GameList GAME_detectGames(const FSList &fslist);
} }

View File

@ -30,6 +30,19 @@
#include "parallaction/parallaction.h" #include "parallaction/parallaction.h"
namespace Parallaction { namespace Parallaction {
struct PARALLACTIONGameDescription {
Common::ADGameDescription desc;
int gameType;
uint32 features;
};
int Parallaction::getGameType() const { return _gameDescription->gameType; }
uint32 Parallaction::getFeatures() const { return _gameDescription->features; }
Common::Language Parallaction::getLanguage() const { return _gameDescription->desc.language; }
Common::Platform Parallaction::getPlatform() const { return _gameDescription->desc.platform; }
static GameList GAME_detectGames(const FSList &fslist); static GameList GAME_detectGames(const FSList &fslist);
} }

View File

@ -26,7 +26,6 @@
#include "engines/engine.h" #include "engines/engine.h"
#include "parallaction/defs.h" #include "parallaction/defs.h"
#include "parallaction/inventory.h" #include "parallaction/inventory.h"
#include "common/advancedDetector.h"
namespace Parallaction { namespace Parallaction {
@ -59,12 +58,7 @@ enum ParallactionGameType {
GType_BRA GType_BRA
}; };
struct PARALLACTIONGameDescription { struct PARALLACTIONGameDescription;
Common::ADGameDescription desc;
int gameType;
uint32 features;
};
struct Job; struct Job;
typedef void (*JobFn)(void*, Job*); typedef void (*JobFn)(void*, Job*);
@ -226,10 +220,10 @@ public:
void changeCharacter(const char *name); void changeCharacter(const char *name);
public: public:
int getGameType() const { return _gameDescription->gameType; } int getGameType() const;
uint32 getFeatures() const { return _gameDescription->features; } uint32 getFeatures() const;
Common::Language getLanguage() const { return _gameDescription->desc.language; } Common::Language getLanguage() const;
Common::Platform getPlatform() const { return _gameDescription->desc.platform; } Common::Platform getPlatform() const;
private: private:
const PARALLACTIONGameDescription *_gameDescription; const PARALLACTIONGameDescription *_gameDescription;

View File

@ -39,6 +39,49 @@
namespace Saga { namespace Saga {
struct SAGAGameDescription {
Common::ADGameDescription desc;
int gameType;
int gameId;
uint32 features;
const GameDisplayInfo *gameDisplayInfo;
int startSceneNumber;
const GameResourceDescription *resourceDescription;
int fontsCount;
const GameFontDescription *fontDescriptions;
const GameSoundInfo *voiceInfo;
const GameSoundInfo *sfxInfo;
const GameSoundInfo *musicInfo;
int patchesCount;
const GamePatchDescription *patchDescriptions;
};
const bool SagaEngine::isBigEndian() const { return (_gameDescription->features & GF_BIG_ENDIAN_DATA) != 0; }
const bool SagaEngine::isMacResources() const { return (getPlatform() == Common::kPlatformMacintosh); }
const GameResourceDescription *SagaEngine::getResourceDescription() { return _gameDescription->resourceDescription; }
const GameSoundInfo *SagaEngine::getVoiceInfo() const { return _gameDescription->voiceInfo; }
const GameSoundInfo *SagaEngine::getSfxInfo() const { return _gameDescription->sfxInfo; }
const GameSoundInfo *SagaEngine::getMusicInfo() const { return _gameDescription->musicInfo; }
const GameFontDescription *SagaEngine::getFontDescription(int index) {
assert(index < _gameDescription->fontsCount);
return &_gameDescription->fontDescriptions[index];
}
int SagaEngine::getFontsCount() const { return _gameDescription->fontsCount; }
int SagaEngine::getGameId() const { return _gameDescription->gameId; }
int SagaEngine::getGameType() const { return _gameDescription->gameType; }
uint32 SagaEngine::getFeatures() const { return _gameDescription->features; }
Common::Language SagaEngine::getLanguage() const { return _gameDescription->desc.language; }
Common::Platform SagaEngine::getPlatform() const { return _gameDescription->desc.platform; }
int SagaEngine::getGameNumber() const { return _gameNumber; }
int SagaEngine::getStartSceneNumber() const { return _gameDescription->startSceneNumber; }
int SagaEngine::getPatchesCount() const { return _gameDescription->patchesCount; }
const GamePatchDescription *SagaEngine::getPatchDescriptions() const { return _gameDescription->patchDescriptions; }
const Common::ADGameFileDescription *SagaEngine::getFilesDescriptions() const { return _gameDescription->desc.filesDescriptions; }
static GameList GAME_detectGames(const FSList &fslist); static GameList GAME_detectGames(const FSList &fslist);
} }

View File

@ -34,6 +34,8 @@
#include "saga/sndres.h" #include "saga/sndres.h"
#include "saga/stream.h" #include "saga/stream.h"
#include "common/advancedDetector.h"
namespace Saga { namespace Saga {
struct MacResMap { struct MacResMap {
@ -317,8 +319,8 @@ bool Resource::loadContext(ResourceContext *context) {
} }
//process external patch files //process external patch files
for (j = 0; j < _vm->getGameDescription()->patchesCount; j++) { for (j = 0; j < _vm->getPatchesCount(); j++) {
patchDescription = &_vm->getGameDescription()->patchDescriptions[j]; patchDescription = &_vm->getPatchDescriptions()[j];
if ((patchDescription->fileType & context->fileType) != 0) { if ((patchDescription->fileType & context->fileType) != 0) {
if (patchDescription->resourceId < context->count) { if (patchDescription->resourceId < context->count) {
resourceData = &context->table[patchDescription->resourceId]; resourceData = &context->table[patchDescription->resourceId];
@ -342,7 +344,7 @@ bool Resource::createContexts() {
ResourceContext *context; ResourceContext *context;
_contextsCount = 0; _contextsCount = 0;
for (i = 0; _vm->getGameDescription()->desc.filesDescriptions[i].fileName; i++) for (i = 0; _vm->getFilesDescriptions()[i].fileName; i++)
_contextsCount++; _contextsCount++;
_contexts = (ResourceContext*)calloc(_contextsCount, sizeof(*_contexts)); _contexts = (ResourceContext*)calloc(_contextsCount, sizeof(*_contexts));
@ -350,8 +352,8 @@ bool Resource::createContexts() {
for (i = 0; i < _contextsCount; i++) { for (i = 0; i < _contextsCount; i++) {
context = &_contexts[i]; context = &_contexts[i];
context->file = new Common::File(); context->file = new Common::File();
context->fileName = _vm->getGameDescription()->desc.filesDescriptions[i].fileName; context->fileName = _vm->getFilesDescriptions()[i].fileName;
context->fileType = _vm->getGameDescription()->desc.filesDescriptions[i].fileType; context->fileType = _vm->getFilesDescriptions()[i].fileType;
context->serial = 0; context->serial = 0;
// IHNM has serveral different voice files, so we need to allow // IHNM has serveral different voice files, so we need to allow

View File

@ -31,7 +31,10 @@
#include "saga/gfx.h" #include "saga/gfx.h"
#include "saga/list.h" #include "saga/list.h"
#include "common/advancedDetector.h"
namespace Common {
struct ADGameFileDescription;
}
namespace Saga { namespace Saga {
@ -247,7 +250,6 @@ inline uint16 objectIndexToId(int type, int index) {
return (type << OBJECT_TYPE_SHIFT) | (OBJECT_TYPE_MASK & index); return (type << OBJECT_TYPE_SHIFT) | (OBJECT_TYPE_MASK & index);
} }
class SagaEngine : public Engine { class SagaEngine : public Engine {
friend class Scene; friend class Scene;
@ -372,29 +374,29 @@ public:
public: public:
bool initGame(void); bool initGame(void);
public:
const SAGAGameDescription *getGameDescription() const { return _gameDescription; }
const bool isBigEndian() const { return (_gameDescription->features & GF_BIG_ENDIAN_DATA) != 0; }
const bool isMacResources() const { return (getPlatform() == Common::kPlatformMacintosh); }
const GameResourceDescription *getResourceDescription() { return _gameDescription->resourceDescription; }
const GameSoundInfo *getVoiceInfo() const { return _gameDescription->voiceInfo; }
const GameSoundInfo *getSfxInfo() const { return _gameDescription->sfxInfo; }
const GameSoundInfo *getMusicInfo() const { return _gameDescription->musicInfo; }
const GameFontDescription *getFontDescription(int index) { const bool isBigEndian() const;
assert(index < _gameDescription->fontsCount); const bool isMacResources() const;
return &_gameDescription->fontDescriptions[index]; const GameResourceDescription *getResourceDescription();
} const GameSoundInfo *getVoiceInfo() const;
int getFontsCount() const { return _gameDescription->fontsCount; } const GameSoundInfo *getSfxInfo() const;
const GameSoundInfo *getMusicInfo() const;
int getGameId() const { return _gameDescription->gameId; } const GameFontDescription *getFontDescription(int index);
int getGameType() const { return _gameDescription->gameType; } int getFontsCount() const;
uint32 getFeatures() const { return _gameDescription->features; }
Common::Language getLanguage() const { return _gameDescription->desc.language; }
Common::Platform getPlatform() const { return _gameDescription->desc.platform; }
int getGameNumber() const { return _gameNumber; }
int getStartSceneNumber() const { return _gameDescription->startSceneNumber; }
int getGameId() const;
int getGameType() const;
uint32 getFeatures() const;
Common::Language getLanguage() const;
Common::Platform getPlatform() const;
int getGameNumber() const;
int getStartSceneNumber() const;
int getPatchesCount() const;
const GamePatchDescription *getPatchDescriptions() const;
const Common::ADGameFileDescription *getFilesDescriptions() const;
const Common::Rect &getDisplayClip() const { return _displayClip;} const Common::Rect &getDisplayClip() const { return _displayClip;}
int getDisplayWidth() const { return _gameDisplayInfo.logicalWidth; } int getDisplayWidth() const { return _gameDisplayInfo.logicalWidth; }

View File

@ -326,22 +326,6 @@ struct GamePatchDescription {
const GameSoundInfo *soundInfo; const GameSoundInfo *soundInfo;
}; };
struct SAGAGameDescription { struct SAGAGameDescription;
Common::ADGameDescription desc;
int gameType;
int gameId;
uint32 features;
const GameDisplayInfo *gameDisplayInfo;
int startSceneNumber;
const GameResourceDescription *resourceDescription;
int fontsCount;
const GameFontDescription *fontDescriptions;
const GameSoundInfo *voiceInfo;
const GameSoundInfo *sfxInfo;
const GameSoundInfo *musicInfo;
int patchesCount;
const GamePatchDescription *patchDescriptions;
};
#define FILE_MD5_BYTES 5000 #define FILE_MD5_BYTES 5000