[Scummvm-cvs-logs] SF.net SVN: scummvm: [23515] scummvm/branches/branch-0-9-0/engines/kyra

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


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

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

Modified Paths:
--------------
    scummvm/branches/branch-0-9-0/engines/kyra/resource.cpp
    scummvm/branches/branch-0-9-0/engines/kyra/resource.h
    scummvm/branches/branch-0-9-0/engines/kyra/staticres.cpp

Modified: scummvm/branches/branch-0-9-0/engines/kyra/resource.cpp
===================================================================
--- scummvm/branches/branch-0-9-0/engines/kyra/resource.cpp	2006-07-15 20:46:27 UTC (rev 23514)
+++ scummvm/branches/branch-0-9-0/engines/kyra/resource.cpp	2006-07-15 20:53:17 UTC (rev 23515)
@@ -134,10 +134,10 @@
 
 	// we're loading KYRA.DAT here too (but just for Kyrandia 1)
 	if (_engine->game() == GI_KYRA1) {
-		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");
 		}
 	}
 	

Modified: scummvm/branches/branch-0-9-0/engines/kyra/resource.h
===================================================================
--- scummvm/branches/branch-0-9-0/engines/kyra/resource.h	2006-07-15 20:46:27 UTC (rev 23514)
+++ scummvm/branches/branch-0-9-0/engines/kyra/resource.h	2006-07-15 20:53:17 UTC (rev 23515)
@@ -173,6 +173,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/branches/branch-0-9-0/engines/kyra/staticres.cpp
===================================================================
--- scummvm/branches/branch-0-9-0/engines/kyra/staticres.cpp	2006-07-15 20:46:27 UTC (rev 23514)
+++ scummvm/branches/branch-0-9-0/engines/kyra/staticres.cpp	2006-07-15 20:53:17 UTC (rev 23515)
@@ -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