Removed the now unused GF_SCI0_OLDGETTIME flag and simplified all of the game entries in the detector

svn-id: r44856
This commit is contained in:
Filippos Karapetis 2009-10-09 23:19:53 +00:00
parent d95ed75789
commit b91ae69ad2
4 changed files with 1071 additions and 867 deletions

View File

@ -33,8 +33,6 @@
namespace Sci { namespace Sci {
#define GF_FOR_SCI0_BEFORE_629 GF_SCI0_OLDGETTIME
// Titles of the games // Titles of the games
static const PlainGameDescriptor SciGameTitles[] = { static const PlainGameDescriptor SciGameTitles[] = {
{"sci", "Sierra SCI Game"}, {"sci", "Sierra SCI Game"},
@ -113,17 +111,14 @@ static const PlainGameDescriptor SciGameTitles[] = {
* The fallback game descriptor used by the SCI engine's fallbackDetector. * The fallback game descriptor used by the SCI engine's fallbackDetector.
* Contents of this struct are to be overwritten by the fallbackDetector. * Contents of this struct are to be overwritten by the fallbackDetector.
*/ */
static SciGameDescription s_fallbackDesc = { static ADGameDescription s_fallbackDesc = {
{ "",
"", "",
"", AD_ENTRY1(0, 0), // This should always be AD_ENTRY1(0, 0) in the fallback descriptor
AD_ENTRY1(0, 0), // This should always be AD_ENTRY1(0, 0) in the fallback descriptor Common::UNK_LANG,
Common::UNK_LANG, Common::kPlatformPC,
Common::kPlatformPC, ADGF_NO_FLAGS,
ADGF_NO_FLAGS, Common::GUIO_NONE
Common::GUIO_NONE
},
0
}; };
@ -131,7 +126,7 @@ static const ADParams detectionParams = {
// Pointer to ADGameDescription or its superset structure // Pointer to ADGameDescription or its superset structure
(const byte *)Sci::SciGameDescriptions, (const byte *)Sci::SciGameDescriptions,
// Size of that superset structure // Size of that superset structure
sizeof(SciGameDescription), sizeof(ADGameDescription),
// Number of bytes to compute MD5 sum for // Number of bytes to compute MD5 sum for
5000, 5000,
// List of all engine targets // List of all engine targets
@ -196,11 +191,11 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl
bool smallResource000Size = false; bool smallResource000Size = false;
// Set some defaults // Set some defaults
s_fallbackDesc.desc.extra = ""; s_fallbackDesc.extra = "";
s_fallbackDesc.desc.language = Common::EN_ANY; s_fallbackDesc.language = Common::EN_ANY;
s_fallbackDesc.desc.flags = ADGF_NO_FLAGS; s_fallbackDesc.flags = ADGF_NO_FLAGS;
s_fallbackDesc.desc.platform = Common::kPlatformPC; // default to PC platform s_fallbackDesc.platform = Common::kPlatformPC; // default to PC platform
s_fallbackDesc.desc.gameid = "sci"; s_fallbackDesc.gameid = "sci";
// First grab all filenames // First grab all filenames
for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) { for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
@ -236,8 +231,8 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl
Common::SeekableReadStream *tmpStream = file->createReadStream(); Common::SeekableReadStream *tmpStream = file->createReadStream();
if (tmpStream->size() > 10 * 1024 * 1024) { if (tmpStream->size() > 10 * 1024 * 1024) {
// We got a CD version, so set the CD flag accordingly // We got a CD version, so set the CD flag accordingly
s_fallbackDesc.desc.flags |= ADGF_CD; s_fallbackDesc.flags |= ADGF_CD;
s_fallbackDesc.desc.extra = "CD"; s_fallbackDesc.extra = "CD";
} }
delete tmpStream; delete tmpStream;
} }
@ -257,11 +252,11 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl
// The existence of any of these files indicates an Amiga game // The existence of any of these files indicates an Amiga game
if (filename.contains("9.pat") || filename.contains("spal") || if (filename.contains("9.pat") || filename.contains("spal") ||
filename.contains("patch.005") || filename.contains("bank.001")) filename.contains("patch.005") || filename.contains("bank.001"))
s_fallbackDesc.desc.platform = Common::kPlatformAmiga; s_fallbackDesc.platform = Common::kPlatformAmiga;
// The existence of 7.pat indicates a Mac game // The existence of 7.pat indicates a Mac game
if (filename.contains("7.pat")) if (filename.contains("7.pat"))
s_fallbackDesc.desc.platform = Common::kPlatformMacintosh; s_fallbackDesc.platform = Common::kPlatformMacintosh;
// The data files for Atari ST versions are the same as their DOS counterparts // The data files for Atari ST versions are the same as their DOS counterparts
} }
@ -293,12 +288,12 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl
#endif #endif
// EGA views // EGA views
if (gameViews == kViewEga && s_fallbackDesc.desc.platform != Common::kPlatformAmiga) if (gameViews == kViewEga && s_fallbackDesc.platform != Common::kPlatformAmiga)
s_fallbackDesc.desc.extra = "EGA"; s_fallbackDesc.extra = "EGA";
// Set the platform to Amiga if the game is using Amiga views // Set the platform to Amiga if the game is using Amiga views
if (gameViews == kViewAmiga) if (gameViews == kViewAmiga)
s_fallbackDesc.desc.platform = Common::kPlatformAmiga; s_fallbackDesc.platform = Common::kPlatformAmiga;
// Determine the game id // Determine the game id
SegManager *segMan = new SegManager(resMan); SegManager *segMan = new SegManager(resMan);
@ -312,7 +307,7 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl
reg_t game_obj = segMan->lookupScriptExport(0, 0); reg_t game_obj = segMan->lookupScriptExport(0, 0);
const char *gameName = segMan->getObjectName(game_obj); const char *gameName = segMan->getObjectName(game_obj);
debug(2, "Detected ID: \"%s\" at %04x:%04x", gameName, PRINT_REG(game_obj)); debug(2, "Detected ID: \"%s\" at %04x:%04x", gameName, PRINT_REG(game_obj));
s_fallbackDesc.desc.gameid = convertSierraGameId(gameName, &s_fallbackDesc.desc.flags); s_fallbackDesc.gameid = convertSierraGameId(gameName, &s_fallbackDesc.flags);
delete segMan; delete segMan;
// Try to determine the game language // Try to determine the game language
@ -329,7 +324,7 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl
if (text) { if (text) {
while (seeker < text->size) { while (seeker < text->size) {
if (text->data[seeker] == '#') { if (text->data[seeker] == '#') {
s_fallbackDesc.desc.language = charToScummVMLanguage(text->data[seeker + 1]); s_fallbackDesc.language = charToScummVMLanguage(text->data[seeker + 1]);
break; break;
} }
seeker++; seeker++;
@ -339,31 +334,31 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl
delete resMan; delete resMan;
// Distinguish demos from full versions // Distinguish demos from full versions
if (!strcmp(s_fallbackDesc.desc.gameid, "castlebrain") && !Common::File::exists("resource.002")) { if (!strcmp(s_fallbackDesc.gameid, "castlebrain") && !Common::File::exists("resource.002")) {
// The Spanish full version doesn't have resource.002, but we can distinguish it from the // The Spanish full version doesn't have resource.002, but we can distinguish it from the
// demo from the size of resource.000 // demo from the size of resource.000
if (smallResource000Size) if (smallResource000Size)
s_fallbackDesc.desc.flags |= ADGF_DEMO; s_fallbackDesc.flags |= ADGF_DEMO;
} }
if (!strcmp(s_fallbackDesc.desc.gameid, "islandbrain") && smallResource000Size) if (!strcmp(s_fallbackDesc.gameid, "islandbrain") && smallResource000Size)
s_fallbackDesc.desc.flags |= ADGF_DEMO; s_fallbackDesc.flags |= ADGF_DEMO;
if (!strcmp(s_fallbackDesc.desc.gameid, "kq6") && smallResource000Size) if (!strcmp(s_fallbackDesc.gameid, "kq6") && smallResource000Size)
s_fallbackDesc.desc.flags |= ADGF_DEMO; s_fallbackDesc.flags |= ADGF_DEMO;
// Fill in extras field // Fill in extras field
if (!strcmp(s_fallbackDesc.desc.gameid, "lsl1sci") || if (!strcmp(s_fallbackDesc.gameid, "lsl1sci") ||
!strcmp(s_fallbackDesc.desc.gameid, "pq1sci") || !strcmp(s_fallbackDesc.gameid, "pq1sci") ||
!strcmp(s_fallbackDesc.desc.gameid, "sq1sci")) !strcmp(s_fallbackDesc.gameid, "sq1sci"))
s_fallbackDesc.desc.extra = "VGA Remake"; s_fallbackDesc.extra = "VGA Remake";
if (!strcmp(s_fallbackDesc.desc.gameid, "qfg1") && !Common::File::exists("resource.001")) if (!strcmp(s_fallbackDesc.gameid, "qfg1") && !Common::File::exists("resource.001"))
s_fallbackDesc.desc.extra = "VGA Remake"; s_fallbackDesc.extra = "VGA Remake";
// Add "demo" to the description for demos // Add "demo" to the description for demos
if (s_fallbackDesc.desc.flags & ADGF_DEMO) if (s_fallbackDesc.flags & ADGF_DEMO)
s_fallbackDesc.desc.extra = "demo"; s_fallbackDesc.extra = "demo";
SearchMan.remove("SCI_detection"); SearchMan.remove("SCI_detection");
@ -371,7 +366,7 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl
} }
bool SciMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const { bool SciMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const {
const SciGameDescription *desc = (const SciGameDescription *)gd; const ADGameDescription *desc = (const ADGameDescription *)gd;
*engine = new SciEngine(syst, desc); *engine = new SciEngine(syst, desc);

File diff suppressed because it is too large Load Diff

View File

@ -49,7 +49,7 @@ namespace Sci {
class GfxDriver; class GfxDriver;
SciEngine::SciEngine(OSystem *syst, const SciGameDescription *desc) SciEngine::SciEngine(OSystem *syst, const ADGameDescription *desc)
: Engine(syst), _gameDescription(desc), _system(syst) { : Engine(syst), _gameDescription(desc), _system(syst) {
// Put your engine in a sane state, but do nothing big yet; // Put your engine in a sane state, but do nothing big yet;
// in particular, do not load data from files; rather, if you // in particular, do not load data from files; rather, if you
@ -236,15 +236,15 @@ Console *SciEngine::getSciDebugger() {
} }
const char* SciEngine::getGameID() const { const char* SciEngine::getGameID() const {
return _gameDescription->desc.gameid; return _gameDescription->gameid;
} }
Common::Language SciEngine::getLanguage() const { Common::Language SciEngine::getLanguage() const {
return _gameDescription->desc.language; return _gameDescription->language;
} }
Common::Platform SciEngine::getPlatform() const { Common::Platform SciEngine::getPlatform() const {
return _gameDescription->desc.platform; return _gameDescription->platform;
} }
uint32 SciEngine::getFlags() const { uint32 SciEngine::getFlags() const {

View File

@ -63,22 +63,8 @@ enum kDebugLevels {
kDebugLevelSci0Pic = 1 << 21 kDebugLevelSci0Pic = 1 << 21
}; };
struct SciGameDescription {
ADGameDescription desc;
uint32 flags;
};
extern const char *versionNames[]; extern const char *versionNames[];
enum SciGameFlags {
// SCI0 flags
/* Applies to all versions before 0.000.629
* Older SCI versions had simpler code for GetTime()
*/
GF_SCI0_OLDGETTIME = (1 << 0)
};
/** SCI versions */ /** SCI versions */
enum SciVersion { enum SciVersion {
SCI_VERSION_AUTODETECT, SCI_VERSION_AUTODETECT,
@ -104,7 +90,7 @@ enum MoveCountType {
class SciEngine : public Engine { class SciEngine : public Engine {
friend class Console; friend class Console;
public: public:
SciEngine(OSystem *syst, const SciGameDescription *desc); SciEngine(OSystem *syst, const ADGameDescription *desc);
~SciEngine(); ~SciEngine();
// Engine APIs // Engine APIs
@ -132,7 +118,7 @@ public:
Common::String unwrapFilename(const Common::String &name) const; Common::String unwrapFilename(const Common::String &name) const;
private: private:
const SciGameDescription *_gameDescription; const ADGameDescription *_gameDescription;
ResourceManager *_resMan; ResourceManager *_resMan;
EngineState *_gamestate; EngineState *_gamestate;
Kernel *_kernel; Kernel *_kernel;