[Scummvm-cvs-logs] scummvm master -> 0a07ef2361f28f3d9fe4ec113c44c34f346b7db2
sev-
sev at scummvm.org
Sun Mar 6 12:28:23 CET 2016
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
5ad4eca257 WINTERMUTE: Use array to store known broken absolute paths
891986fd2b WINTERMUTE: Use C strings in absolute path workaround array
0a07ef2361 Merge pull request #696 from tobiatesan/fix_7067_broken_abs
Commit: 5ad4eca257c975a895153d162ff6f3cdc1ef4afb
https://github.com/scummvm/scummvm/commit/5ad4eca257c975a895153d162ff6f3cdc1ef4afb
Author: Tobia Tesan (tobia.tesan at gmail.com)
Date: 2016-03-06T11:36:46+01:00
Commit Message:
WINTERMUTE: Use array to store known broken absolute paths
Avoids an if() block that is getting longer
Changed paths:
engines/wintermute/base/file/base_disk_file.cpp
diff --git a/engines/wintermute/base/file/base_disk_file.cpp b/engines/wintermute/base/file/base_disk_file.cpp
index b474c06..74ed796 100644
--- a/engines/wintermute/base/file/base_disk_file.cpp
+++ b/engines/wintermute/base/file/base_disk_file.cpp
@@ -113,15 +113,28 @@ Common::SeekableReadStream *openDiskFile(const Common::String &filename) {
Common::String fixedFilename = filename;
correctSlashes(fixedFilename);
- // Absolute path: TODO: Add specific fallbacks here.
+ // HACK: There are a few games around which mistakenly refer to absolute paths in the scripts.
+ // The original interpreter on Windows usually simply ignores them when it can't find them.
+ // We try to turn the known ones into relative paths.
if (fixedFilename.contains(':')) {
- if (fixedFilename.hasPrefix("c:/windows/fonts/")) { // East Side Story refers to "c:\windows\fonts\framd.ttf"
- fixedFilename = filename.c_str() + 14;
- } else if (fixedFilename.hasPrefix("c:/carol6/svn/data/")) { // Carol Reed 6: Black Circle refers to "c:\carol6\svn\data\sprites\system\help.png"
- fixedFilename = fixedFilename.c_str() + 19;
- } else if (fixedFilename.hasPrefix("f:/dokument/spel 5/demo/data/")) { // Carol Reed 5 (non-demo) refers to "f:\dokument\spel 5\demo\data\scenes\credits\op_cred_00\op_cred_00.jpg"
- fixedFilename = fixedFilename.c_str() + 29;
- } else {
+ Common::String knownPrefixes[] = { // Known absolute paths
+ "c:/windows/fonts/", // East Side Story refers to "c:\windows\fonts\framd.ttf"
+ "c:/carol6/svn/data/", // Carol Reed 6: Black Circle refers to "c:\carol6\svn\data\sprites\system\help.png"
+ "f:/dokument/spel 5/demo/data/" // Carol Reed 5 (non-demo) refers to "f:\dokument\spel 5\demo\data\scenes\credits\op_cred_00\op_cred_00.jpg"
+ };
+
+ bool matched = false;
+
+ for (uint i = 0; i < ARRAYSIZE(knownPrefixes); i++) {
+ if (fixedFilename.hasPrefix(knownPrefixes[i])) {
+ fixedFilename = filename.c_str() + knownPrefixes[i].size();
+ matched = true;
+ }
+ }
+
+ if (!matched) {
+ // fixedFilename is unchanged and thus still broken, none of the above workarounds worked.
+ // We can only bail out
error("openDiskFile::Absolute path or invalid filename used in %s", filename.c_str());
}
}
Commit: 891986fd2be496834ce5c8dc54f0dd09d3271f95
https://github.com/scummvm/scummvm/commit/891986fd2be496834ce5c8dc54f0dd09d3271f95
Author: Tobia Tesan (tobia.tesan at gmail.com)
Date: 2016-03-06T11:36:49+01:00
Commit Message:
WINTERMUTE: Use C strings in absolute path workaround array
Changed paths:
engines/wintermute/base/file/base_disk_file.cpp
diff --git a/engines/wintermute/base/file/base_disk_file.cpp b/engines/wintermute/base/file/base_disk_file.cpp
index 74ed796..d0c5161 100644
--- a/engines/wintermute/base/file/base_disk_file.cpp
+++ b/engines/wintermute/base/file/base_disk_file.cpp
@@ -117,7 +117,7 @@ Common::SeekableReadStream *openDiskFile(const Common::String &filename) {
// The original interpreter on Windows usually simply ignores them when it can't find them.
// We try to turn the known ones into relative paths.
if (fixedFilename.contains(':')) {
- Common::String knownPrefixes[] = { // Known absolute paths
+ const char* const knownPrefixes[] = { // Known absolute paths
"c:/windows/fonts/", // East Side Story refers to "c:\windows\fonts\framd.ttf"
"c:/carol6/svn/data/", // Carol Reed 6: Black Circle refers to "c:\carol6\svn\data\sprites\system\help.png"
"f:/dokument/spel 5/demo/data/" // Carol Reed 5 (non-demo) refers to "f:\dokument\spel 5\demo\data\scenes\credits\op_cred_00\op_cred_00.jpg"
@@ -127,7 +127,7 @@ Common::SeekableReadStream *openDiskFile(const Common::String &filename) {
for (uint i = 0; i < ARRAYSIZE(knownPrefixes); i++) {
if (fixedFilename.hasPrefix(knownPrefixes[i])) {
- fixedFilename = filename.c_str() + knownPrefixes[i].size();
+ fixedFilename = fixedFilename.c_str() + strlen(knownPrefixes[i]);
matched = true;
}
}
Commit: 0a07ef2361f28f3d9fe4ec113c44c34f346b7db2
https://github.com/scummvm/scummvm/commit/0a07ef2361f28f3d9fe4ec113c44c34f346b7db2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-03-06T12:28:20+01:00
Commit Message:
Merge pull request #696 from tobiatesan/fix_7067_broken_abs
WINTERMUTE: Rewrite absolute prefix workarounds block with loop
Changed paths:
engines/wintermute/base/file/base_disk_file.cpp
More information about the Scummvm-git-logs
mailing list