diff options
Diffstat (limited to 'engines/cine/part.cpp')
-rw-r--r-- | engines/cine/part.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/engines/cine/part.cpp b/engines/cine/part.cpp index 88f2dcef52..d605bdd623 100644 --- a/engines/cine/part.cpp +++ b/engines/cine/part.cpp @@ -259,7 +259,13 @@ byte *readBundleSoundFile(const char *entryName, uint32 *size) { return data; } -byte *readFile(const char *filename) { +/*! \brief Rotate byte value to the left by n bits */ +byte rolByte(byte value, uint n) { + n %= 8; + return (byte) ((value << n) | (value >> (8 - n))); +} + +byte *readFile(const char *filename, bool crypted) { Common::File in; in.open(filename); @@ -272,6 +278,16 @@ byte *readFile(const char *filename) { byte *dataPtr = (byte *)malloc(size); in.read(dataPtr, size); + // The Sony published CD version of Future Wars has its + // AUTO00.PRC file's bytes rotated to the right by one. + // So we decode the so called crypting by rotating all + // the bytes to the left by one. + if (crypted) { + for (uint index = 0; index < size; index++) { + dataPtr[index] = rolByte(dataPtr[index], 1); + } + } + return dataPtr; } |