mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-12 20:17:49 +00:00
- Fix finding versions from exe's
- Fix fallback detection - Make getVersion() return an int instead of a uint16 which makes the version lose precision and the "major" version can get lost. svn-id: r38529
This commit is contained in:
parent
5778350053
commit
ee16e35bb6
@ -105,7 +105,7 @@ uint32 SciEngine::getFlags() const {
|
||||
return _gameDescription->desc.flags;
|
||||
}
|
||||
|
||||
uint16 SciEngine::getVersion() const {
|
||||
int SciEngine::getVersion() const {
|
||||
return _gameDescription->version;
|
||||
}
|
||||
|
||||
@ -1320,6 +1320,24 @@ static const struct SciGameDescription SciGameDescriptions[] = {
|
||||
{AD_TABLE_END_MARKER, {}, SCI_VERSION(0, 000, 000)}
|
||||
};
|
||||
|
||||
/**
|
||||
* The fallback game descriptor used by the SCI engine's fallbackDetector.
|
||||
* Contents of this struct are to be overwritten by the fallbackDetector.
|
||||
*/
|
||||
static SciGameDescription g_fallbackDesc = {
|
||||
{
|
||||
"",
|
||||
"",
|
||||
AD_ENTRY1(0, 0), // This should always be AD_ENTRY1(0, 0) in the fallback descriptor
|
||||
Common::UNK_LANG,
|
||||
Common::kPlatformPC,
|
||||
ADGF_NO_FLAGS
|
||||
},
|
||||
{},
|
||||
SCI_VERSION(0, 000, 000)
|
||||
};
|
||||
|
||||
|
||||
static const ADParams detectionParams = {
|
||||
// Pointer to ADGameDescription or its superset structure
|
||||
(const byte *)SciGameDescriptions,
|
||||
@ -1358,6 +1376,8 @@ public:
|
||||
|
||||
const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fslist) const {
|
||||
int exeVersion = 0;
|
||||
bool foundResMap = false;
|
||||
bool foundRes000 = false;
|
||||
|
||||
// First grab all filenames
|
||||
for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
|
||||
@ -1365,13 +1385,33 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl
|
||||
Common::String filename = file->getName();
|
||||
filename.toLowercase();
|
||||
|
||||
if (filename.contains("resource.map") || filename.contains("resmap.000"))
|
||||
foundResMap = true;
|
||||
|
||||
if (filename.contains("resource.000") || filename.contains("resource.001")
|
||||
|| filename.contains("ressci.000") || filename.contains("ressci.001"))
|
||||
foundRes000 = true;
|
||||
|
||||
// FIXME: This is all quite hackish
|
||||
if (filename.contains("scidhuv")) {
|
||||
if (filename.contains("scidhuv") || filename.contains("sciv") ||
|
||||
filename.contains("sierra") || filename.contains("sciw")) {
|
||||
exeVersion = version_detect_from_executable((char *)file->getPath().c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If these files aren't found, it can't be SCI
|
||||
if (!foundResMap && !foundRes000)
|
||||
return 0;
|
||||
|
||||
// Set some defaults
|
||||
g_fallbackDesc.desc.gameid = "sci";
|
||||
g_fallbackDesc.desc.extra = "";
|
||||
g_fallbackDesc.desc.language = Common::UNK_LANG;
|
||||
g_fallbackDesc.desc.platform = Common::kPlatformPC;
|
||||
g_fallbackDesc.desc.flags = ADGF_NO_FLAGS;
|
||||
g_fallbackDesc.version = exeVersion;
|
||||
|
||||
printf("If this is *NOT* a fan-modified version (in particular, not a fan-made\n");
|
||||
printf("translation), please, report the data above, including the following\n");
|
||||
printf("version number, from the game's executable:\n");
|
||||
@ -1381,7 +1421,7 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl
|
||||
SCI_VERSION_MINOR(exeVersion),
|
||||
SCI_VERSION_PATCHLEVEL(exeVersion));
|
||||
|
||||
return 0;
|
||||
return (const ADGameDescription *)&g_fallbackDesc;
|
||||
}
|
||||
|
||||
bool SciMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const {
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
|
||||
const SciGameDescription *_gameDescription;
|
||||
const char* getGameID() const;
|
||||
uint16 getVersion() const;
|
||||
int getVersion() const;
|
||||
Common::Language getLanguage() const;
|
||||
Common::Platform getPlatform() const;
|
||||
uint32 getFlags() const;
|
||||
|
@ -217,7 +217,7 @@ lzexe_open(const char *filename) {
|
||||
guint8 size[2];
|
||||
off_t fpos;
|
||||
|
||||
FILE *f = sci_fopen(filename, "rb");
|
||||
FILE *f = fopen(filename, "rb");
|
||||
|
||||
if (!f)
|
||||
return NULL;
|
||||
|
@ -33,7 +33,7 @@ struct _exe_handle {
|
||||
|
||||
static exe_handle_t *
|
||||
raw_open(const char *filename) {
|
||||
FILE *f = sci_fopen(filename, "rb");
|
||||
FILE *f = fopen(filename, "rb");
|
||||
exe_handle_t *handle;
|
||||
|
||||
if (!f)
|
||||
|
Loading…
Reference in New Issue
Block a user