mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-31 07:53:36 +00:00
BASS: Fix savegame corruption
When using the GMM or autosaves, _savedMouse and _savedCharSet were never set. See bug #3487117.
This commit is contained in:
parent
c7a5d31f05
commit
87e85e17cb
@ -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);
|
||||
|
||||
|
@ -190,7 +190,7 @@ public:
|
||||
bool loadSaveAllowed();
|
||||
|
||||
uint16 _selectedGame;
|
||||
uint16 saveGameToFile();
|
||||
uint16 saveGameToFile(bool fromControlPanel);
|
||||
|
||||
void loadDescriptions(Common::StringArray &list);
|
||||
void saveDescriptions(const Common::StringArray &list);
|
||||
|
@ -286,7 +286,7 @@ Common::Error SkyEngine::saveGameState(int slot, const Common::String &desc) {
|
||||
|
||||
// Set the save slot and save the game
|
||||
_skyControl->_selectedGame = slot - 1;
|
||||
if (_skyControl->saveGameToFile() != GAME_SAVED)
|
||||
if (_skyControl->saveGameToFile(false) != GAME_SAVED)
|
||||
return Common::kWritePermissionDenied;
|
||||
|
||||
// Load current save game descriptions
|
||||
|
Loading…
x
Reference in New Issue
Block a user