SCUMM: Fix bug #6009 "DC: FT/Dig - Sound disappears when VMU save fails"
This was introduced by fd3970aa52
:
Apply patch #2984508 - "GSoC: SCUMM stopped audio from playing while
saving"
This was not quite correct as if the save fails, the function exits
without unpausing the engine, which resulted in sound and music
remaining muted. This corrects the logic to unpause in all cases.
This commit is contained in:
parent
c7d1ca9f65
commit
f4e7b593dc
1 changed files with 15 additions and 16 deletions
|
@ -188,32 +188,31 @@ bool ScummEngine::saveState(Common::WriteStream *out, bool writeHeader) {
|
|||
}
|
||||
|
||||
bool ScummEngine::saveState(int slot, bool compat, Common::String &filename) {
|
||||
bool saveFailed;
|
||||
bool saveFailed = false;
|
||||
|
||||
pauseEngine(true);
|
||||
|
||||
Common::WriteStream *out = openSaveFileForWriting(slot, compat, filename);
|
||||
if (!out)
|
||||
return false;
|
||||
|
||||
saveFailed = false;
|
||||
if (!saveState(out))
|
||||
if (!out) {
|
||||
saveFailed = true;
|
||||
} else {
|
||||
if (!saveState(out))
|
||||
saveFailed = true;
|
||||
|
||||
out->finalize();
|
||||
if (out->err())
|
||||
saveFailed = true;
|
||||
delete out;
|
||||
|
||||
if (saveFailed) {
|
||||
debug(1, "State save as '%s' FAILED", filename.c_str());
|
||||
return false;
|
||||
out->finalize();
|
||||
if (out->err())
|
||||
saveFailed = true;
|
||||
delete out;
|
||||
}
|
||||
debug(1, "State saved as '%s'", filename.c_str());
|
||||
|
||||
if (saveFailed)
|
||||
debug(1, "State save as '%s' FAILED", filename.c_str());
|
||||
else
|
||||
debug(1, "State saved as '%s'", filename.c_str());
|
||||
|
||||
pauseEngine(false);
|
||||
|
||||
return true;
|
||||
return !saveFailed;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue