From 57e1c6451dc928f4162de019486e3af259d39423 Mon Sep 17 00:00:00 2001 From: Marcus Comstedt Date: Thu, 13 Oct 2005 18:50:53 +0000 Subject: Improved savefile error handling: * New flush() method in WriteStream class to flush pending I/O, in order to detect any I/O errors * Use of flush() and ioFailed() added to scumm engine save function * Dreamcast backend extended to support the new checks svn-id: r19066 --- scumm/saveload.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'scumm') diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp index 5252402ec8..3b426358c7 100644 --- a/scumm/saveload.cpp +++ b/scumm/saveload.cpp @@ -109,6 +109,12 @@ bool ScummEngine::saveState(int slot, bool compat) { Serializer ser(0, out, CURRENT_VER); saveOrLoad(&ser, CURRENT_VER); + out->flush(); + if(out->ioFailed()) { + delete out; + debug(1, "State save as '%s' FAILED", filename); + return false; + } delete out; debug(1, "State saved as '%s'", filename); return true; -- cgit v1.2.3