From 339c39f8b7dcc2d245ba936f332592490f0bac3d Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sat, 28 Apr 2007 21:16:13 +0000 Subject: Possible fix for bug #1709124 ("GOB3: (dos/russian) just dont run") svn-id: r26665 --- engines/gob/dataio.cpp | 8 ++++++++ engines/gob/util.cpp | 5 +++++ engines/gob/util.h | 1 + 3 files changed, 14 insertions(+) diff --git a/engines/gob/dataio.cpp b/engines/gob/dataio.cpp index 3d4610d961..63c25b4659 100644 --- a/engines/gob/dataio.cpp +++ b/engines/gob/dataio.cpp @@ -27,6 +27,7 @@ #include "gob/gob.h" #include "gob/dataio.h" #include "gob/global.h" +#include "gob/util.h" namespace Gob { @@ -305,6 +306,13 @@ void DataIO::openDataFile(const char *src, bool itk) { dataDesc[i].size = file_getHandle(_dataFileHandles[file])->readUint32LE(); dataDesc[i].offset = file_getHandle(_dataFileHandles[file])->readUint32LE(); dataDesc[i].packed = file_getHandle(_dataFileHandles[file])->readByte(); + + // Replacing cyrillic characters + Util::replaceChar(dataDesc[i].chunkName, (char) 0x85, 'E'); + Util::replaceChar(dataDesc[i].chunkName, (char) 0x8A, 'K'); + Util::replaceChar(dataDesc[i].chunkName, (char) 0x8E, 'O'); + Util::replaceChar(dataDesc[i].chunkName, (char) 0x91, 'C'); + Util::replaceChar(dataDesc[i].chunkName, (char) 0x92, 'T'); } for (int i = 0; i < _numDataChunks[file]; i++) diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp index 4970aee2e9..ad10381dac 100644 --- a/engines/gob/util.cpp +++ b/engines/gob/util.cpp @@ -393,6 +393,11 @@ void Util::cutFromStr(char *str, int16 from, int16 cutlen) { } while (str[i] != 0); } +void Util::replaceChar(char *str, char c1, char c2) { + while ((str = strchr(str, c1))) + *str = c2; +} + static const char trStr1[] = " ' + - :0123456789: <=> abcdefghijklmnopqrstuvwxyz " "abcdefghijklmnopqrstuvwxyz "; diff --git a/engines/gob/util.h b/engines/gob/util.h index e6145fcde7..3adc26385a 100644 --- a/engines/gob/util.h +++ b/engines/gob/util.h @@ -77,6 +77,7 @@ public: static void insertStr(const char *str1, char *str2, int16 pos); static void cutFromStr(char *str, int16 from, int16 cutlen); static void prepareStr(char *str); + static void replaceChar(char *str, char c1, char c2); static void listInsertFront(List *list, void *data); static void listInsertBack(List *list, void *data); -- cgit v1.2.3