From baea8d5c9c35aed1ebfde4891c9130dc550a58ad Mon Sep 17 00:00:00 2001 From: sluicebox Date: Mon, 9 Dec 2019 22:50:28 -0800 Subject: COMMON: Make save compression optional when copying Allows for copying or renaming uncompressed save files, such as in Phantasmagoria 1, without compressing them in the process. --- backends/saves/savefile.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'backends') diff --git a/backends/saves/savefile.cpp b/backends/saves/savefile.cpp index 059b7dba8d..d3de5f2fbd 100644 --- a/backends/saves/savefile.cpp +++ b/backends/saves/savefile.cpp @@ -56,7 +56,7 @@ int32 OutSaveFile::pos() const { return _wrapped->pos(); } -bool SaveFileManager::copySavefile(const String &oldFilename, const String &newFilename) { +bool SaveFileManager::copySavefile(const String &oldFilename, const String &newFilename, bool compress) { InSaveFile *inFile = 0; OutSaveFile *outFile = 0; uint32 size = 0; @@ -70,7 +70,7 @@ bool SaveFileManager::copySavefile(const String &oldFilename, const String &newF buffer = malloc(size); assert(buffer); - outFile = openForSaving(newFilename); + outFile = openForSaving(newFilename, compress); if (buffer && outFile) { inFile->read(buffer, size); @@ -94,8 +94,8 @@ bool SaveFileManager::copySavefile(const String &oldFilename, const String &newF return success; } -bool SaveFileManager::renameSavefile(const String &oldFilename, const String &newFilename) { - if (!copySavefile(oldFilename, newFilename)) +bool SaveFileManager::renameSavefile(const String &oldFilename, const String &newFilename, bool compress) { + if (!copySavefile(oldFilename, newFilename, compress)) return false; return removeSavefile(oldFilename); -- cgit v1.2.3