aboutsummaryrefslogtreecommitdiff
path: root/engines/hugo/file.cpp
diff options
context:
space:
mode:
authorArnaud Boutonné2010-09-02 10:52:29 +0000
committerArnaud Boutonné2010-09-02 10:52:29 +0000
commitd74e82fe7fdc467dbebab704a7ace2de57395147 (patch)
tree6be5fdc50e0102fe9fbcf857749ffdb06ba9b01b /engines/hugo/file.cpp
parentfd23ab2e17da6f74efdc94ed1b19ec4dd81da558 (diff)
downloadscummvm-rg350-d74e82fe7fdc467dbebab704a7ace2de57395147.tar.gz
scummvm-rg350-d74e82fe7fdc467dbebab704a7ace2de57395147.tar.bz2
scummvm-rg350-d74e82fe7fdc467dbebab704a7ace2de57395147.zip
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 svn-id: r52493
Diffstat (limited to 'engines/hugo/file.cpp')
-rw-r--r--engines/hugo/file.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp
index 172b1687cb..150ad2d2b8 100644
--- a/engines/hugo/file.cpp
+++ b/engines/hugo/file.cpp
@@ -826,8 +826,12 @@ void FileManager::readConfig() {
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();
}