[Scummvm-git-logs] scummvm master -> 4d1107d99209a7ed8e34dd712959b7e342e1bfdd
sluicebox
noreply at scummvm.org
Sun Jan 8 19:41:56 UTC 2023
This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
a316bde435 SCI: Use default parameter in Path::toString()
3f3344a8c5 SCI32: Remove incorrect GK2 German detection entry
d18f24f4a6 SCI: Improve fallback language detection
ad63bed648 SCI: Include matched files in fallback detection
4d1107d992 ENGINES: Sort game file listings
Commit: a316bde435e430a94a118e14a85bade8a914b39e
https://github.com/scummvm/scummvm/commit/a316bde435e430a94a118e14a85bade8a914b39e
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-01-08T11:41:01-08:00
Commit Message:
SCI: Use default parameter in Path::toString()
Changed paths:
engines/sci/graphics/macfont.cpp
diff --git a/engines/sci/graphics/macfont.cpp b/engines/sci/graphics/macfont.cpp
index 206aeb95207..12feefa4730 100644
--- a/engines/sci/graphics/macfont.cpp
+++ b/engines/sci/graphics/macfont.cpp
@@ -81,7 +81,7 @@ GfxMacFontManager::~GfxMacFontManager() {
bool GfxMacFontManager::initFromFontTable(Common::MacResManager *macExecutable) {
Common::SeekableReadStream *table = macExecutable->getResource(MKTAG('f', 't', 'b', 'l'), 128);
if (table == nullptr) {
- warning("Mac font table not found in \"%s\"", macExecutable->getBaseFileName().toString(':').c_str());
+ warning("Mac font table not found in \"%s\"", macExecutable->getBaseFileName().toString().c_str());
return false;
}
@@ -89,14 +89,14 @@ bool GfxMacFontManager::initFromFontTable(Common::MacResManager *macExecutable)
uint16 defaultFontIndex = table->readUint16BE();
uint16 numberOfFonts = table->readUint16BE();
if (table->eos() || table->size() < 4 + numberOfFonts * 10) {
- warning("Invalid mac font table in \"%s\"", macExecutable->getBaseFileName().toString(':').c_str());
+ warning("Invalid mac font table in \"%s\"", macExecutable->getBaseFileName().toString().c_str());
return false;
}
for (uint16 i = 0; i < numberOfFonts; ++i) {
uint16 sciFontId = table->readUint16BE();
if (_macFonts.contains(sciFontId)) {
- warning("Duplicate Mac font table entry for %d in \"%s\"", sciFontId, macExecutable->getBaseFileName().toString(':').c_str());
+ warning("Duplicate Mac font table entry for %d in \"%s\"", sciFontId, macExecutable->getBaseFileName().toString().c_str());
return false;
}
uint16 macFontId = table->readUint16BE();
@@ -107,7 +107,7 @@ bool GfxMacFontManager::initFromFontTable(Common::MacResManager *macExecutable)
const Graphics::Font *smallFont = getMacFont(macFontId, smallFontSize);
const Graphics::Font *largeFont = getMacFont(macFontId, MAX(mediumFontSize, largeFontSize));
if (smallFont == nullptr || largeFont == nullptr) {
- warning("Mac font %d not found in \"%s\"", macFontId, macExecutable->getBaseFileName().toString(':').c_str());
+ warning("Mac font %d not found in \"%s\"", macFontId, macExecutable->getBaseFileName().toString().c_str());
return false;
}
Commit: 3f3344a8c52e096d31488a2377d3cdd79498eeeb
https://github.com/scummvm/scummvm/commit/3f3344a8c52e096d31488a2377d3cdd79498eeeb
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-01-08T11:41:02-08:00
Commit Message:
SCI32: Remove incorrect GK2 German detection entry
These files were mistaken as a pirate release, but they're just the
output of the popular "GK2 HD/DVD Installer" fan tool when used on
GK2 German. Anyone can produce these files from original files.
They are not the "GOG.com version with German data", GOG just used
the same tool to produce their version from GK2 English files.
Changed paths:
engines/sci/detection_tables.h
diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h
index ae04b3f5e26..22ebff1cb8f 100644
--- a/engines/sci/detection_tables.h
+++ b/engines/sci/detection_tables.h
@@ -1135,15 +1135,6 @@ static const struct ADGameDescription SciGameDescriptions[] = {
AD_LISTEND},
Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK | ADGF_UNSTABLE, GUIO_GK2_MAC },
- // Gabriel Knight 2 - PIRATED US English GOG.com version with German data
- // From Trac#9744
- {"gk2", "", {
- {"resource.aud", 0, "3812e15c3a187f5b633bde3a4832b2cf", 167630831},
- {"ressci.000", 0, "a19fc3604c6e5407abcf03d59ee87217", 169500205},
- {"resmap.000", 0, "e6bab045e2b5eb205e150338e74d8641", 8092},
- AD_LISTEND},
- Common::DE_DEU, Common::kPlatformDOS, ADGF_PIRATED, GUIO_GK2 },
-
#undef GUIO_GK2_DEMO
#undef GUIO_GK2
#undef GUIO_GK2_MAC
Commit: d18f24f4a61d575e220167a8409c5348b1ddc5b6
https://github.com/scummvm/scummvm/commit/d18f24f4a61d575e220167a8409c5348b1ddc5b6
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-01-08T11:41:02-08:00
Commit Message:
SCI: Improve fallback language detection
RESOURCE.CFG and RESOURCE.WIN are now parsed for language codes
Changed paths:
engines/sci/metaengine.cpp
diff --git a/engines/sci/metaengine.cpp b/engines/sci/metaengine.cpp
index b7397a2eee1..b42d0544790 100644
--- a/engines/sci/metaengine.cpp
+++ b/engines/sci/metaengine.cpp
@@ -497,6 +497,19 @@ Common::Language charToScummVMLanguage(const char c) {
}
}
+Common::Language sciToScummVMLanguage(const int sciLanguage) {
+ switch (sciLanguage) {
+ case K_LANG_ENGLISH: return Common::EN_ANY;
+ case K_LANG_FRENCH: return Common::FR_FRA;
+ case K_LANG_SPANISH: return Common::ES_ESP;
+ case K_LANG_ITALIAN: return Common::IT_ITA;
+ case K_LANG_GERMAN: return Common::DE_DEU;
+ case K_LANG_JAPANESE: return Common::JA_JPN;
+ case K_LANG_PORTUGUESE: return Common::PT_BRA;
+ default: return Common::UNK_LANG;
+ }
+}
+
static char s_fallbackGameIdBuf[256];
/**
@@ -703,6 +716,35 @@ ADDetectedGame SciMetaEngine::fallbackDetectExtern(uint md5Bytes, const FileMap
}
}
+ // Try to determine the game language from config file (SCI1.1 and later)
+ const char *configNames[] = { "resource.cfg", "resource.win" };
+ for (int i = 0; i < ARRAYSIZE(configNames) && language == Common::EN_ANY; i++) {
+ Common::File file;
+ if (allFiles.contains(configNames[i]) && file.open(allFiles[configNames[i]])) {
+ while (true) {
+ Common::String line = file.readLine();
+ if (file.eos()) {
+ break;
+ }
+ uint32 separatorPos = line.find('=');
+ if (separatorPos == Common::String::npos) {
+ continue;
+ }
+ Common::String key = line.substr(0, separatorPos);
+ key.trim();
+ if (key.equalsIgnoreCase("language")) {
+ Common::String val = line.substr(separatorPos + 1);
+ val.trim();
+ Common::Language parsedLanguage = sciToScummVMLanguage(atoi(val.c_str()));
+ if (parsedLanguage != Common::UNK_LANG) {
+ language = parsedLanguage;
+ }
+ break;
+ }
+ }
+ }
+ }
+
constructFallbackDetectionEntry(gameId, platform, sciVersion, language, gameViews == kViewEga, isCD, isDemo);
return ADDetectedGame(&s_fallbackDesc);
Commit: ad63bed648105167d31d50dfdf7ee6e3d2b9ceaf
https://github.com/scummvm/scummvm/commit/ad63bed648105167d31d50dfdf7ee6e3d2b9ceaf
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-01-08T11:41:19-08:00
Commit Message:
SCI: Include matched files in fallback detection
SCI's fallback detection didn't populate ADDetectedGame::matchedFiles.
Now it does, and the Unknown Game report that it generates includes all
the relevant files.
Changed paths:
engines/sci/detection.cpp
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index d79c849ab41..4a5a712e5cf 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -209,6 +209,9 @@ public:
}
ADDetectedGame fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist, ADDetectedGameExtraInfo **extra) const override;
+
+private:
+ void addFileToDetectedGame(const Common::String &name, const FileMap &allFiles, MD5Properties md5Prop, ADDetectedGame &game) const;
};
ADDetectedGame SciMetaEngineDetection::fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist, ADDetectedGameExtraInfo **extra) const {
@@ -225,21 +228,71 @@ ADDetectedGame SciMetaEngineDetection::fallbackDetect(const FileMap &allFiles, c
}
const Plugin *metaEnginePlugin = EngineMan.findPlugin(getName());
+ if (!metaEnginePlugin) {
+ return ADDetectedGame();
+ }
- if (metaEnginePlugin) {
- const Plugin *enginePlugin = PluginMan.getEngineFromMetaEngine(metaEnginePlugin);
- if (enginePlugin) {
- return enginePlugin->get<AdvancedMetaEngine>().fallbackDetectExtern(_md5Bytes, allFiles, fslist);
- } else {
- static bool warn = true;
- if (warn) {
- warning("Engine plugin for SCI not present. Fallback detection is disabled.");
- warn = false;
- }
+ const Plugin *enginePlugin = PluginMan.getEngineFromMetaEngine(metaEnginePlugin);
+ if (!enginePlugin) {
+ static bool warn = true;
+ if (warn) {
+ warning("Engine plugin for SCI not present. Fallback detection is disabled.");
+ warn = false;
}
+ return ADDetectedGame();
+ }
+
+ ADDetectedGame game = enginePlugin->get<AdvancedMetaEngine>().fallbackDetectExtern(_md5Bytes, allFiles, fslist);
+ if (!game.desc) {
+ return game;
}
- return ADDetectedGame();
+ // detect all the matched files here in SciMetaEngineDetection, instead of
+ // external fallback detection, so that we can use AdvancedMetaEngineDetection
+ // methods instead of duplicating code. fallback detection has identified the
+ // game, platform, and language. now we want a full list of all resource map
+ // and volume files in the directory. this code attempts to add all possible
+ // files, even if there are gaps, because we want to be able to identify
+ // incomplete directories when users submit unknown-game reports.
+ MD5Properties md5Prop = kMD5Head;
+ if (allFiles.contains("resource.map")) {
+ // add the map and volumes
+ addFileToDetectedGame("resource.map", allFiles, md5Prop, game);
+ for (int i = 0; i <= 11; i++) {
+ Common::String volume = Common::String::format("resource.%03d", i);
+ addFileToDetectedGame(volume, allFiles, md5Prop, game);
+ }
+
+ // add message and audio volumes.
+ // sometimes we need these to differentiate between localized versions.
+ addFileToDetectedGame("resource.aud", allFiles, md5Prop, game);
+ addFileToDetectedGame("resource.msg", allFiles, md5Prop, game);
+ } else if (allFiles.contains("resmap.000") || allFiles.contains("resmap.001")) {
+ // add maps and volumes
+ for (int i = 0; i <= 7; i++) {
+ Common::String map = Common::String::format("resmap.%03d", i);
+ Common::String volume = Common::String::format("ressci.%03d", i);
+ addFileToDetectedGame(map, allFiles, md5Prop, game);
+ addFileToDetectedGame(volume, allFiles, md5Prop, game);
+ }
+ } else if (allFiles.contains("Data1")) {
+ // add Mac volumes
+ md5Prop = (MD5Properties)(md5Prop | kMD5MacResOrDataFork);
+ for (int i = 1; i <= 13; i++) {
+ Common::String volume = Common::String::format("Data%d", i);
+ addFileToDetectedGame(volume, allFiles, md5Prop, game);
+ }
+ }
+
+ return game;
+}
+
+void SciMetaEngineDetection::addFileToDetectedGame(const Common::String &name, const FileMap &allFiles, MD5Properties md5Prop, ADDetectedGame &game) const {
+ FileProperties fileProperties;
+ if (getFileProperties(allFiles, md5Prop, name, fileProperties)) {
+ game.hasUnknownFiles = true;
+ game.matchedFiles[name] = fileProperties;
+ }
}
} // End of namespace Sci
Commit: 4d1107d99209a7ed8e34dd712959b7e342e1bfdd
https://github.com/scummvm/scummvm/commit/4d1107d99209a7ed8e34dd712959b7e342e1bfdd
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-01-08T11:41:19-08:00
Commit Message:
ENGINES: Sort game file listings
The Unknown Game report and AdvancedMetaEngineDetection
logging statements are now sorted by file name, instead
of the HashMap iteration order.
Changed paths:
engines/advancedDetector.cpp
engines/game.cpp
diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp
index 33c5dcdf5ba..931bd9965ac 100644
--- a/engines/advancedDetector.cpp
+++ b/engines/advancedDetector.cpp
@@ -431,8 +431,14 @@ Common::Error AdvancedMetaEngineDetection::createInstance(OSystem *syst, Engine
}
debug("Running %s", gameDescriptor.description.c_str());
+ Common::StringArray filenames;
for (FilePropertiesMap::const_iterator i = gameDescriptor.matchedFiles.begin(); i != gameDescriptor.matchedFiles.end(); ++i) {
- debug("%s: %s, %llu bytes.", i->_key.c_str(), i->_value.md5.c_str(), (unsigned long long)i->_value.size);
+ filenames.push_back(i->_key);
+ }
+ Common::sort(filenames.begin(), filenames.end());
+ for (uint i = 0; i < filenames.size(); ++i) {
+ const FileProperties &file = gameDescriptor.matchedFiles[filenames[i]];
+ debug("%s: %s, %llu bytes.", filenames[i].c_str(), file.md5.c_str(), (unsigned long long)file.size);
}
initSubSystems(agdDesc.desc);
diff --git a/engines/game.cpp b/engines/game.cpp
index 78100b60162..d450dc6d21e 100644
--- a/engines/game.cpp
+++ b/engines/game.cpp
@@ -251,17 +251,23 @@ Common::U32String generateUnknownGameReport(const DetectedGames &detectedGames,
report += Common::U32String("\n\n");
+ Common::StringArray filenames;
for (FilePropertiesMap::const_iterator file = matchedFiles.begin(); file != matchedFiles.end(); ++file) {
+ filenames.push_back(file->_key);
+ }
+ Common::sort(filenames.begin(), filenames.end());
+ for (uint i = 0; i < filenames.size(); ++i) {
+ const FileProperties &file = matchedFiles[filenames[i]];
Common::String addon;
- if (file->_value.md5prop & kMD5MacResFork)
+ if (file.md5prop & kMD5MacResFork)
addon += ", ADGF_MACRESFORK";
- if (file->_value.md5prop & kMD5Tail)
+ if (file.md5prop & kMD5Tail)
addon += ", ADGF_TAILMD5";
report += Common::String::format(" {\"%s\", 0, \"%s\", %lld}%s,\n",
- Common::punycode_encodefilename(Common::U32String(&file->_key.c_str()[2])).c_str(), // Skip the md5 prefix
- file->_value.md5.c_str(), (long long)file->_value.size, addon.c_str());
+ Common::punycode_encodefilename(Common::U32String(&filenames[i].c_str()[2])).c_str(), // Skip the md5 prefix
+ file.md5.c_str(), (long long)file.size, addon.c_str());
}
report += Common::U32String("\n");
More information about the Scummvm-git-logs
mailing list