Fixing bug #1458388: "SIMON1: Game Detection fails".
Sometimes instead of "GAMEPC" we get "GAMEPC." (note trailing dot) svn-id: r21455
This commit is contained in:
parent
575c831684
commit
dd505ff6ae
2 changed files with 22 additions and 5 deletions
|
@ -221,6 +221,11 @@ bool File::open(const char *filename, AccessMode mode, const char *directory) {
|
||||||
} else if (_filesMap.contains(fname)) {
|
} else if (_filesMap.contains(fname)) {
|
||||||
debug(3, "Opening hashed: %s", _filesMap[fname].c_str());
|
debug(3, "Opening hashed: %s", _filesMap[fname].c_str());
|
||||||
_handle = fopen(_filesMap[fname].c_str(), modeStr);
|
_handle = fopen(_filesMap[fname].c_str(), modeStr);
|
||||||
|
} else if (_filesMap.contains(fname + ".")) {
|
||||||
|
// WORKAROUND: Bug #1458388: "SIMON1: Game Detection fails"
|
||||||
|
// sometimes instead of "GAMEPC" we get "GAMEPC." (note trailing dot)
|
||||||
|
debug(3, "Opening hashed: %s", _filesMap[fname].c_str());
|
||||||
|
_handle = fopen(_filesMap[fname].c_str(), modeStr);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
StringList::const_iterator x;
|
StringList::const_iterator x;
|
||||||
|
|
|
@ -1344,7 +1344,7 @@ int detectGame(const FSList &fslist, bool mode, int start) {
|
||||||
Common::File test_file;
|
Common::File test_file;
|
||||||
bool file_missing;
|
bool file_missing;
|
||||||
|
|
||||||
Common::String tstr, tstr1;
|
Common::String tstr, tstr1, tstr2;
|
||||||
char md5str[32+1];
|
char md5str[32+1];
|
||||||
uint8 md5sum[16];
|
uint8 md5sum[16];
|
||||||
|
|
||||||
|
@ -1352,11 +1352,16 @@ int detectGame(const FSList &fslist, bool mode, int start) {
|
||||||
for (int i = 0; i < ARRAYSIZE(gameMD5); i++) {
|
for (int i = 0; i < ARRAYSIZE(gameMD5); i++) {
|
||||||
tstr = Common::String(gameMD5[i].filename);
|
tstr = Common::String(gameMD5[i].filename);
|
||||||
tstr.toLowercase();
|
tstr.toLowercase();
|
||||||
|
// WORKAROUND: Bug #1458388: "SIMON1: Game Detection fails"
|
||||||
|
// sometimes instead of "GAMEPC" we get "GAMEPC." (note trailing dot)
|
||||||
|
tstr2 = tstr + ".";
|
||||||
|
|
||||||
if (gameMD5[i].caseSensitive && !mode)
|
if (gameMD5[i].caseSensitive && !mode)
|
||||||
filesList[Common::String(gameMD5[i].filename)] = true;
|
filesList[Common::String(gameMD5[i].filename)] = true;
|
||||||
else
|
else {
|
||||||
filesList[tstr] = true;
|
filesList[tstr] = true;
|
||||||
|
filesList[tstr2] = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode) {
|
if (mode) {
|
||||||
|
@ -1368,14 +1373,17 @@ int detectGame(const FSList &fslist, bool mode, int start) {
|
||||||
// makes tstr1 lowercase as well
|
// makes tstr1 lowercase as well
|
||||||
tstr1 = Common::String(file->displayName().c_str());
|
tstr1 = Common::String(file->displayName().c_str());
|
||||||
tstr.toLowercase();
|
tstr.toLowercase();
|
||||||
|
// WORKAROUND: Bug #1458388: "SIMON1: Game Detection fails"
|
||||||
|
tstr2 = tstr + ".";
|
||||||
|
|
||||||
if (filesList.contains(tstr) || filesList.contains(tstr1)) {
|
if (filesList.contains(tstr) || filesList.contains(tstr1) || filesList.contains(tstr2)) {
|
||||||
if (Common::md5_file(file->path().c_str(), md5sum, NULL, FILE_MD5_BYTES)) {
|
if (Common::md5_file(file->path().c_str(), md5sum, NULL, FILE_MD5_BYTES)) {
|
||||||
for (int j = 0; j < 16; j++) {
|
for (int j = 0; j < 16; j++) {
|
||||||
sprintf(md5str + j*2, "%02x", (int)md5sum[j]);
|
sprintf(md5str + j*2, "%02x", (int)md5sum[j]);
|
||||||
}
|
}
|
||||||
filesMD5[tstr] = Common::String(md5str);
|
filesMD5[tstr] = Common::String(md5str);
|
||||||
filesMD5[tstr1] = Common::String(md5str);
|
filesMD5[tstr1] = Common::String(md5str);
|
||||||
|
filesMD5[tstr2] = Common::String(md5str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1403,8 +1411,10 @@ int detectGame(const FSList &fslist, bool mode, int start) {
|
||||||
// Try to open all files for this game
|
// Try to open all files for this game
|
||||||
for (file_n = 0; file_n < file_count; file_n++) {
|
for (file_n = 0; file_n < file_count; file_n++) {
|
||||||
tstr = gameDescriptions[game_n].filesDescriptions[file_n].fileName;
|
tstr = gameDescriptions[game_n].filesDescriptions[file_n].fileName;
|
||||||
|
// WORKAROUND: Bug #1458388: "SIMON1: Game Detection fails"
|
||||||
|
tstr2 = tstr + ".";
|
||||||
|
|
||||||
if (!filesMD5.contains(tstr)) {
|
if (!filesMD5.contains(tstr) && !filesMD5.contains(tstr2)) {
|
||||||
file_missing = true;
|
file_missing = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1422,8 +1432,10 @@ int detectGame(const FSList &fslist, bool mode, int start) {
|
||||||
for (int i = 0; i < ARRAYSIZE(gameMD5); i++) {
|
for (int i = 0; i < ARRAYSIZE(gameMD5); i++) {
|
||||||
if (gameMD5[i].id == gameDescriptions[game_n].gameId) {
|
if (gameMD5[i].id == gameDescriptions[game_n].gameId) {
|
||||||
tstr = gameMD5[i].filename;
|
tstr = gameMD5[i].filename;
|
||||||
|
// WORKAROUND: Bug #1458388: "SIMON1: Game Detection fails"
|
||||||
|
tstr2 = tstr + ".";
|
||||||
|
|
||||||
if (strcmp(gameMD5[i].md5, filesMD5[tstr].c_str())) {
|
if (strcmp(gameMD5[i].md5, filesMD5[tstr].c_str()) && strcmp(gameMD5[i].md5, filesMD5[tstr2].c_str())) {
|
||||||
match = false;
|
match = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue