diff options
author | Willem Jan Palenstijn | 2012-02-13 21:28:32 +0100 |
---|---|---|
committer | Willem Jan Palenstijn | 2012-02-13 21:28:32 +0100 |
commit | 87e85e17cbe95821899bee76d978924760d76f89 (patch) | |
tree | 06278335301a89a19715f7b0900e39880977fb91 /engines/sky/control.cpp | |
parent | c7a5d31f0576fe6ced0ac3170ab89c5df13135ba (diff) | |
download | scummvm-rg350-87e85e17cbe95821899bee76d978924760d76f89.tar.gz scummvm-rg350-87e85e17cbe95821899bee76d978924760d76f89.tar.bz2 scummvm-rg350-87e85e17cbe95821899bee76d978924760d76f89.zip |
BASS: Fix savegame corruption
When using the GMM or autosaves, _savedMouse and _savedCharSet were
never set. See bug #3487117.
Diffstat (limited to 'engines/sky/control.cpp')
-rw-r--r-- | engines/sky/control.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/engines/sky/control.cpp b/engines/sky/control.cpp index 7741f1080e..fd2f2b92d3 100644 --- a/engines/sky/control.cpp +++ b/engines/sky/control.cpp @@ -535,7 +535,7 @@ uint16 Control::handleClick(ConResource *pButton) { return saveRestorePanel(true); // texts can be edited case SAVE_A_GAME: animClick(pButton); - return saveGameToFile(); + return saveGameToFile(true); case RESTORE_A_GAME: animClick(pButton); return restoreGameFromFile(false); @@ -1101,6 +1101,10 @@ void Control::doAutoSave() { displayMessage(0, "Unable to create autosave file '%s'. (%s)", fName, _saveFileMan->popErrorDesc().c_str()); return; } + + _savedCharSet = _skyText->giveCurrentCharSet(); + _savedMouse = _skyMouse->giveCurrentMouseType(); + uint8 *saveData = (uint8 *)malloc(0x20000); uint32 fSize = prepareSaveData(saveData); @@ -1114,7 +1118,7 @@ void Control::doAutoSave() { free(saveData); } -uint16 Control::saveGameToFile() { +uint16 Control::saveGameToFile(bool fromControlPanel) { char fName[20]; sprintf(fName,"SKY-VM.%03d", _selectedGame); @@ -1123,6 +1127,13 @@ uint16 Control::saveGameToFile() { if (outf == NULL) return NO_DISK_SPACE; + if (!fromControlPanel) { + // These variables are usually set when entering the control panel, + // but not when using the GMM. + _savedCharSet = _skyText->giveCurrentCharSet(); + _savedMouse = _skyMouse->giveCurrentMouseType(); + } + uint8 *saveData = (uint8 *)malloc(0x20000); uint32 fSize = prepareSaveData(saveData); |