[Scummvm-git-logs] scummvm master -> 453f7cfffe564fe0e08e1fa9262c007b9bb5b4a8

digitall noreply at scummvm.org
Tue Jan 18 15:32:03 UTC 2022


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
453f7cfffe COMMON: Fix BufferedWriteStream::pos() method


Commit: 453f7cfffe564fe0e08e1fa9262c007b9bb5b4a8
    https://github.com/scummvm/scummvm/commit/453f7cfffe564fe0e08e1fa9262c007b9bb5b4a8
Author: hackingdemon (79503829+hackingdemon at users.noreply.github.com)
Date: 2022-01-18T15:31:59Z

Commit Message:
COMMON: Fix BufferedWriteStream::pos() method

The pos() method of BufferedWriteStream should return the stream position
but actually returns the buffer position. That completely breaks saving
the game in AGS engine on the platforms using BufferedWriteStream wrapper
for savefile handling, such as Nintendo Switch. AGS engine's save file
writing functions use GetPosition() with later Seek() on stream,
so an invalid return value from GetPosition() results in invalid save files
that cannot be loaded and are skipped by the engine.

Changed paths:
    common/stream.cpp


diff --git a/common/stream.cpp b/common/stream.cpp
index 46fc58cee05..9fe7c69f759 100644
--- a/common/stream.cpp
+++ b/common/stream.cpp
@@ -550,7 +550,7 @@ public:
 
 	bool flush() override { return flushBuffer(); }
 
-	int64 pos() const override { return _pos; }
+	int64 pos() const override { return _pos + _parentStream->pos(); }
 
 	bool seek(int64 offset, int whence) override {
 		flush();




More information about the Scummvm-git-logs mailing list