[Scummvm-cvs-logs] SF.net SVN: scummvm: [23514] scummvm/trunk/engines/kyra

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Thu Jul 20 22:50:02 CEST 2006


Revision: 23514
          http://svn.sourceforge.net/scummvm/?rev=23514&view=rev
Author:   lordhoto
Date:     2006-07-15 13:46:27 -0700 (Sat, 15 Jul 2006)

Log Message:
-----------
Adds filesize check for kyra.dat, this forces to upgrade always to the newest version though.

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/resource.cpp
    scummvm/trunk/engines/kyra/resource.h
    scummvm/trunk/engines/kyra/staticres.cpp

Modified: scummvm/trunk/engines/kyra/resource.cpp
===================================================================
--- scummvm/trunk/engines/kyra/resource.cpp	2006-07-15 20:37:32 UTC (rev 23513)
+++ scummvm/trunk/engines/kyra/resource.cpp	2006-07-15 20:46:27 UTC (rev 23514)
@@ -39,10 +39,10 @@
 
 	if (_engine->game() == GI_KYRA1) {
 		// we're loading KYRA.DAT here too (but just for Kyrandia 1)
-		if (!loadPakFile("KYRA.DAT")) {
-			GUI::MessageDialog errorMsg("You're missing the 'KYRA.DAT' file, get it from the ScummVM website");
+		if (!loadPakFile("KYRA.DAT") || !StaticResource::checkKyraDat()) {
+			GUI::MessageDialog errorMsg("You're missing the 'KYRA.DAT' file or it got corrupted, (re)get it from the ScummVM website");
 			errorMsg.runModal();
-			error("couldn't open Kyrandia resource file ('KYRA.DAT') make sure you got one file for your version");
+			error("You're missing the 'KYRA.DAT' file or it got corrupted, (re)get it from the ScummVM website");
 		}
 
 		// We only need kyra.dat for the demo.
@@ -51,7 +51,7 @@
 
 		// only VRM file we need in the *whole* game for kyra1
 		if (_engine->features() & GF_TALKIE) {
-			if !(loadPakFile("CHAPTER1.VRM"))
+			if (!loadPakFile("CHAPTER1.VRM"))
 				error("couldn't open pakfile 'CHAPTER1.VRM'");
 		}
 	} else if (_engine->game() == GI_KYRA3) {
@@ -72,7 +72,7 @@
 
 	for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
 		if (file->displayName().hasSuffix("PAK") || file->displayName().hasSuffix("APK")) {
-			if (loadPakFile(file->displayName()) {
+			if (!loadPakFile(file->displayName())) {
 				error("couldn't open pakfile '%s'", file->displayName().c_str());
 			}
 		}

Modified: scummvm/trunk/engines/kyra/resource.h
===================================================================
--- scummvm/trunk/engines/kyra/resource.h	2006-07-15 20:37:32 UTC (rev 23513)
+++ scummvm/trunk/engines/kyra/resource.h	2006-07-15 20:46:27 UTC (rev 23514)
@@ -199,6 +199,8 @@
 public:
 	StaticResource(KyraEngine *engine) : _engine(engine), _resList(), _fileLoader(0), _builtIn(0), _filenameTable(0) {}
 	~StaticResource() { deinit(); }
+	
+	static bool checkKyraDat();
 
 	bool init();
 	void deinit();

Modified: scummvm/trunk/engines/kyra/staticres.cpp
===================================================================
--- scummvm/trunk/engines/kyra/staticres.cpp	2006-07-15 20:37:32 UTC (rev 23513)
+++ scummvm/trunk/engines/kyra/staticres.cpp	2006-07-15 20:46:27 UTC (rev 23514)
@@ -29,7 +29,19 @@
 namespace Kyra {
 
 #define RESFILE_VERSION 12
+#define KYRADAT_FILESIZE 67227
 
+bool StaticResource::checkKyraDat() {
+	Common::File kyraDat;
+	if (!kyraDat.open("KYRA.DAT"))
+		return false;
+	
+	if (kyraDat.size() != KYRADAT_FILESIZE)
+		return false;
+	
+	return true;
+}
+
 #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)
 






More information about the Scummvm-git-logs mailing list