From c0701bfcb670e43cf4a26bfefb94bf82a76f62b9 Mon Sep 17 00:00:00 2001 From: Kari Salminen Date: Fri, 8 Aug 2008 18:28:13 +0000 Subject: Added detection entry for the Sony published CD version of Future Wars. Also added decrypting of the crypted AUTO00.PRC for this particular version. Now this version should work but no CD audio support for it yet though. svn-id: r33703 --- engines/cine/cine.h | 3 ++- engines/cine/detection.cpp | 19 +++++++++++++++++++ engines/cine/part.cpp | 17 ++++++++++++++++- engines/cine/part.h | 2 +- engines/cine/prc.cpp | 2 +- 5 files changed, 39 insertions(+), 4 deletions(-) (limited to 'engines') diff --git a/engines/cine/cine.h b/engines/cine/cine.h index 431cdc2c22..6011036eb1 100644 --- a/engines/cine/cine.h +++ b/engines/cine/cine.h @@ -59,7 +59,8 @@ enum CineGameType { enum CineGameFeatures { GF_CD = 1 << 0, GF_DEMO = 1 << 1, - GF_ALT_FONT = 1 << 2 + GF_ALT_FONT = 1 << 2, + GF_CRYPTED_BOOT_PRC = 1 << 3 }; struct CINEGameDescription; diff --git a/engines/cine/detection.cpp b/engines/cine/detection.cpp index 2270cd781e..b15f30c35c 100644 --- a/engines/cine/detection.cpp +++ b/engines/cine/detection.cpp @@ -76,6 +76,25 @@ static const CINEGameDescription gameDescriptions[] = { 0, }, + // This is a CD version of Future Wars published by Sony. + // This version has a crypted AUTO00.PRC. + { + { + "fw", + "Sony CD version", + { + { "AUTO00.PRC", 0, "4fe1e7930b38e3c63f0f2474d471bf8f", -1}, + { "PART01", 0, "61d003202d301c29dd399acfb1354310", -1}, + { NULL, 0, NULL, 0} + }, + Common::EN_USA, + Common::kPlatformPC, + Common::ADGF_CD + }, + GType_FW, + GF_CD | GF_CRYPTED_BOOT_PRC, + }, + { // This is the version included in the UK "Classic Collection" { diff --git a/engines/cine/part.cpp b/engines/cine/part.cpp index 88f2dcef52..46f6bcb272 100644 --- a/engines/cine/part.cpp +++ b/engines/cine/part.cpp @@ -259,7 +259,12 @@ byte *readBundleSoundFile(const char *entryName, uint32 *size) { return data; } -byte *readFile(const char *filename) { +/*! \brief Rotate value to the left by n bits */ +byte rol(byte value, int n) { + return (byte) ((value << n) | (value >> (8 - n))); +} + +byte *readFile(const char *filename, bool crypted) { Common::File in; in.open(filename); @@ -272,6 +277,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] = rol(dataPtr[index], 1); + } + } + return dataPtr; } diff --git a/engines/cine/part.h b/engines/cine/part.h index 2a979e4879..72dc944db3 100644 --- a/engines/cine/part.h +++ b/engines/cine/part.h @@ -48,7 +48,7 @@ void readFromPart(int16 idx, byte *dataPtr); byte *readBundleFile(int16 foundFileIdx); byte *readBundleSoundFile(const char *entryName, uint32 *size = 0); -byte *readFile(const char *filename); +byte *readFile(const char *filename, bool crypted = false); void checkDataDisk(int16 param); diff --git a/engines/cine/prc.cpp b/engines/cine/prc.cpp index 27b1044620..5d789f9b3b 100644 --- a/engines/cine/prc.cpp +++ b/engines/cine/prc.cpp @@ -61,7 +61,7 @@ bool loadPrc(const char *pPrcName) { checkDataDisk(-1); if ((g_cine->getGameType() == Cine::GType_FW) && (!scumm_stricmp(pPrcName, BOOT_PRC_NAME) || !scumm_stricmp(pPrcName, "demo.prc"))) { - scriptPtr = dataPtr = readFile(pPrcName); + scriptPtr = dataPtr = readFile(pPrcName, (g_cine->getFeatures() & GF_CRYPTED_BOOT_PRC) != 0); } else { scriptPtr = dataPtr = readBundleFile(findFileInBundle(pPrcName)); } -- cgit v1.2.3