[Scummvm-cvs-logs] SF.net SVN: scummvm:[52493] scummvm/trunk/engines/hugo/file.cpp
strangerke at users.sourceforge.net
strangerke at users.sourceforge.net
Thu Sep 2 12:52:30 CEST 2010
Revision: 52493
http://scummvm.svn.sourceforge.net/scummvm/?rev=52493&view=rev
Author: strangerke
Date: 2010-09-02 10:52:29 +0000 (Thu, 02 Sep 2010)
Log Message:
-----------
HUGO: Fix loading of config file during game init
Add a check on CONFIG.DAT size in order to avoid loading crap into
the _config structure during the initialization of the engine.
The game no longer starts in turbo & mute mode
Modified Paths:
--------------
scummvm/trunk/engines/hugo/file.cpp
Modified: scummvm/trunk/engines/hugo/file.cpp
===================================================================
--- scummvm/trunk/engines/hugo/file.cpp 2010-09-02 10:41:26 UTC (rev 52492)
+++ scummvm/trunk/engines/hugo/file.cpp 2010-09-02 10:52:29 UTC (rev 52493)
@@ -826,8 +826,12 @@
sprintf(path, "%s%s", _vm.getGameStatus().path, CONFIGFILE);
if (f.open(path)) {
// If config format changed, ignore it and use defaults
- if (f.read(&_config, sizeof(_config)) != sizeof(_config))
- _config = tmpConfig;
+ if (f.size() != sizeof(_config)) {
+ warning("Incompatible %s: file size:%d expected size: %d. Skipping loading.", CONFIGFILE, f.size(), sizeof(_config));
+ } else {
+ if (f.read(&_config, sizeof(_config)) != sizeof(_config))
+ _config = tmpConfig;
+ }
f.close();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list