aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorJohannes Schickel2007-02-02 16:02:59 +0000
committerJohannes Schickel2007-02-02 16:02:59 +0000
commit4387a851a2d11db7464009d58f738c084c308fd2 (patch)
tree7615c12cd542056d1b8e7beef14dc4eeeb26fc6f /engines
parent013f1711c48edcebc3215fb5cfd1aaf1a796701a (diff)
downloadscummvm-rg350-4387a851a2d11db7464009d58f738c084c308fd2.tar.gz
scummvm-rg350-4387a851a2d11db7464009d58f738c084c308fd2.tar.bz2
scummvm-rg350-4387a851a2d11db7464009d58f738c084c308fd2.zip
Replace filesize based kyra.dat check with a md5 based.
svn-id: r25337
Diffstat (limited to 'engines')
-rw-r--r--engines/kyra/staticres.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index 00007ddc49..2367a8e268 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -22,6 +22,7 @@
#include "common/stdafx.h"
#include "common/endian.h"
+#include "common/md5.h"
#include "kyra/kyra.h"
#include "kyra/kyra2.h"
#include "kyra/kyra3.h"
@@ -30,17 +31,27 @@
namespace Kyra {
-#define RESFILE_VERSION 13
-#define KYRADAT_FILESIZE 142510
+#define RESFILE_VERSION 14
bool StaticResource::checkKyraDat() {
Common::File kyraDat;
if (!kyraDat.open("KYRA.DAT"))
return false;
- if (kyraDat.size() != KYRADAT_FILESIZE)
+ uint32 size = kyraDat.size() - 16;
+ uint8 digest[16];
+ kyraDat.seek(size, SEEK_SET);
+ if (kyraDat.read(digest, 16) != 16)
return false;
+ kyraDat.close();
+ uint8 digestCalc[16];
+ if (!Common::md5_file("KYRA.DAT", digestCalc, size))
+ return false;
+
+ for (int i = 0; i < 16; ++i)
+ if (digest[i] != digestCalc[i])
+ return false;
return true;
}
@@ -57,13 +68,14 @@ enum {
GF_GERMAN = 1 << 6,
GF_SPANISH = 1 << 7,
GF_ITALIAN = 1 << 8,
+ GF_JAPANESE = 1 << 9,
// other languages here
GF_LNGUNK = 1 << 16, // also used for multi language in kyra3
GF_AMIGA = 1 << 17 // this is no special version flag yet!
};
#define GAME_FLAGS (GF_FLOPPY | GF_TALKIE | GF_DEMO/* | GF_AUDIOCD*/)
-#define LANGUAGE_FLAGS (GF_ENGLISH | GF_FRENCH | GF_GERMAN | GF_SPANISH | GF_ITALIAN | GF_LNGUNK)
+#define LANGUAGE_FLAGS (GF_ENGLISH | GF_FRENCH | GF_GERMAN | GF_SPANISH | GF_ITALIAN | GF_JAPANESE | GF_LNGUNK)
uint32 createFeatures(const GameFlags &flags) {
if (flags.isTalkie)