diff options
author | David Corrales | 2007-05-26 20:23:24 +0000 |
---|---|---|
committer | David Corrales | 2007-05-26 20:23:24 +0000 |
commit | 3646c968c9578c2a94d65ebd5fb06ec835f8c51d (patch) | |
tree | 8b57b339ebb31a1d7a67f1678aa5dc5c7759070a /engines/saga/detection.cpp | |
parent | d1f56d93f934150f4b579c2e90564e2bf035f113 (diff) | |
parent | ac45c5b33d834acbc9718f89be76e49d403a4d2c (diff) | |
download | scummvm-rg350-3646c968c9578c2a94d65ebd5fb06ec835f8c51d.tar.gz scummvm-rg350-3646c968c9578c2a94d65ebd5fb06ec835f8c51d.tar.bz2 scummvm-rg350-3646c968c9578c2a94d65ebd5fb06ec835f8c51d.zip |
Merged the fs branch with trunk. r26472:26948
svn-id: r26949
Diffstat (limited to 'engines/saga/detection.cpp')
-rw-r--r-- | engines/saga/detection.cpp | 150 |
1 files changed, 150 insertions, 0 deletions
diff --git a/engines/saga/detection.cpp b/engines/saga/detection.cpp new file mode 100644 index 0000000000..15c6a47682 --- /dev/null +++ b/engines/saga/detection.cpp @@ -0,0 +1,150 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2004-2007 The ScummVM project + * + * The ReInherit Engine is (C)2000-2003 by Daniel Balsom. + * + * 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. + * + * $URL$ + * $Id$ + * + */ + +// Game detection, general game parameters + +#include "saga/saga.h" + +#include "common/config-manager.h" +#include "common/advancedDetector.h" + +#include "saga/displayinfo.h" +#include "saga/rscfile.h" +#include "saga/interface.h" +#include "saga/scene.h" +#include "saga/sagaresnames.h" + +namespace Saga { +struct SAGAGameDescription { + Common::ADGameDescription desc; + + int gameType; + int gameId; + uint32 features; + 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 const PlainGameDescriptor sagaGames[] = { + {"saga", "SAGA Engine game"}, + {"ite", "Inherit the Earth: Quest for the Orb"}, + {"ihnm", "I Have No Mouth and I Must Scream"}, + {0, 0} +}; + +static const Common::ADObsoleteGameID obsoleteGameIDsTable[] = { + {"ite", "saga", Common::kPlatformUnknown}, + {"ihnm", "saga", Common::kPlatformUnknown}, + {0, 0, Common::kPlatformUnknown} +}; + +#include "saga/detection_tables.h" + +static const Common::ADParams detectionParams = { + // Pointer to ADGameDescription or its superset structure + (const byte *)Saga::gameDescriptions, + // Size of that superset structure + sizeof(Saga::SAGAGameDescription), + // Number of bytes to compute MD5 sum for + 5000, + // List of all engine targets + sagaGames, + // Structure for autoupgrading obsolete targets + obsoleteGameIDsTable, + // Name of single gameid (optional) + "saga", + // List of files for file-based fallback detection (optional) + 0, + // Fallback callback + 0, + // Flags + Common::kADFlagAugmentPreferredTarget +}; + +ADVANCED_DETECTOR_DEFINE_PLUGIN(SAGA, Saga::SagaEngine, detectionParams); + +REGISTER_PLUGIN(SAGA, "SAGA Engine", "Inherit the Earth (C) Wyrmkeep Entertainment"); + +namespace Saga { + +bool SagaEngine::initGame() { + _gameDescription = (const SAGAGameDescription *)Common::AdvancedDetector::detectBestMatchingGame(detectionParams); + if (_gameDescription == 0) + return false; + + _displayClip.right = getDisplayInfo().logicalWidth; + _displayClip.bottom = getDisplayInfo().logicalHeight; + + return _resource->createContexts(); +} + +const GameDisplayInfo &SagaEngine::getDisplayInfo() { + return _gameDescription->gameType == GType_ITE ? ITE_DisplayInfo : IHNM_DisplayInfo; +} + +int SagaEngine::getDisplayWidth() const { + const GameDisplayInfo &di = _gameDescription->gameType == GType_ITE ? ITE_DisplayInfo : IHNM_DisplayInfo; + return di.logicalWidth; +} + +int SagaEngine::getDisplayHeight() const { + const GameDisplayInfo &di = _gameDescription->gameType == GType_ITE ? ITE_DisplayInfo : IHNM_DisplayInfo; + return di.logicalHeight; +} + +} // End of namespace Saga |