[Scummvm-git-logs] scummvm master -> d30af5e9953751dc7167602ad93241c5e64de979
sev-
noreply at scummvm.org
Sun Jan 29 17:59:28 UTC 2023
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:
d30af5e995 SCUMM HE: Disable save compression for Moonbase.
Commit: d30af5e9953751dc7167602ad93241c5e64de979
https://github.com/scummvm/scummvm/commit/d30af5e9953751dc7167602ad93241c5e64de979
Author: Little Cat (toontownlittlecat at gmail.com)
Date: 2023-01-29T18:59:25+01:00
Commit Message:
SCUMM HE: Disable save compression for Moonbase.
Changed paths:
engines/scumm/he/intern_he.h
engines/scumm/he/script_v60he.cpp
engines/scumm/saveload.cpp
engines/scumm/scumm.h
diff --git a/engines/scumm/he/intern_he.h b/engines/scumm/he/intern_he.h
index 9925dc95fcf..96030d22f08 100644
--- a/engines/scumm/he/intern_he.h
+++ b/engines/scumm/he/intern_he.h
@@ -31,7 +31,7 @@
namespace Common {
class SeekableReadStream;
-class WriteStream;
+class SeekableWriteStream;
}
namespace Scumm {
@@ -50,7 +50,7 @@ protected:
public:
Common::SeekableReadStream *_hInFileTable[17];
- Common::WriteStream *_hOutFileTable[17];
+ Common::SeekableWriteStream *_hOutFileTable[17];
Common::Rect _actorClipOverride; // HE specific
@@ -91,14 +91,14 @@ protected:
Common::SeekableReadStream *openFileForReading(const byte *fileName);
Common::SeekableReadStream *openSaveFileForReading(const byte *fileName);
- Common::WriteStream *openSaveFileForWriting(const byte *fileName);
- Common::WriteStream *openSaveFileForAppending(const byte *fileName);
+ Common::SeekableWriteStream *openSaveFileForWriting(const byte *fileName);
+ Common::SeekableWriteStream *openSaveFileForAppending(const byte *fileName);
void deleteSaveFile(const byte *fileName);
void renameSaveFile(const byte *from, const byte *to);
void pauseEngineIntern(bool pause) override;
Common::SeekableReadStream *openSaveFileForReading(int slot, bool compat, Common::String &fileName) override;
- Common::WriteStream *openSaveFileForWriting(int slot, bool compat, Common::String &fileName) override;
+ Common::SeekableWriteStream *openSaveFileForWriting(int slot, bool compat, Common::String &fileName) override;
/* HE version 60 script opcodes */
void o60_setState();
diff --git a/engines/scumm/he/script_v60he.cpp b/engines/scumm/he/script_v60he.cpp
index ffa404c4601..be85fdf3e9b 100644
--- a/engines/scumm/he/script_v60he.cpp
+++ b/engines/scumm/he/script_v60he.cpp
@@ -208,8 +208,9 @@ Common::SeekableReadStream *ScummEngine_v60he::openSaveFileForReading(const byte
return _saveFileMan->openForLoading(convertSavePathOld(fileName));
}
-Common::WriteStream *ScummEngine_v60he::openSaveFileForWriting(const byte *fileName) {
- return _saveFileMan->openForSaving(convertSavePath(fileName));
+Common::SeekableWriteStream *ScummEngine_v60he::openSaveFileForWriting(const byte *fileName) {
+ // HACK: Disable compression for Moonbase. Fixes custom map saving.
+ return _saveFileMan->openForSaving(convertSavePath(fileName), _game.id != GID_MOONBASE);
}
void ScummEngine_v60he::deleteSaveFile(const byte *fileName) {
@@ -235,7 +236,7 @@ void ScummEngine_v60he::renameSaveFile(const byte *from, const byte *to) {
_saveFileMan->renameSavefile(convertSavePath(from), toName);
}
-Common::WriteStream *ScummEngine_v60he::openSaveFileForAppending(const byte *fileName) {
+Common::SeekableWriteStream *ScummEngine_v60he::openSaveFileForAppending(const byte *fileName) {
Common::SeekableReadStream *initialFile = openSaveFileForReading(fileName);
byte *initialData = nullptr;
uint32 initialDataSize = 0;
@@ -251,7 +252,7 @@ Common::WriteStream *ScummEngine_v60he::openSaveFileForAppending(const byte *fil
delete initialFile;
}
- Common::WriteStream *output = openSaveFileForWriting(fileName);
+ Common::SeekableWriteStream *output = openSaveFileForWriting(fileName);
if (!output) {
delete[] initialData;
@@ -289,7 +290,7 @@ Common::SeekableReadStream *ScummEngine_v60he::openSaveFileForReading(int slot,
return ScummEngine::openSaveFileForReading(slot, compat, fileName);
}
-Common::WriteStream *ScummEngine_v60he::openSaveFileForWriting(int slot, bool compat, Common::String &fileName) {
+Common::SeekableWriteStream *ScummEngine_v60he::openSaveFileForWriting(int slot, bool compat, Common::String &fileName) {
if (slot == 255) {
// HACK: Allow custom filenames for save game system in HE Games
fileName = convertSavePath((const byte *)_saveLoadFileName.c_str());
@@ -1045,21 +1046,28 @@ void ScummEngine_v60he::o60_seekFilePos() {
if (slot == -1)
return;
-
- assert(_hInFileTable[slot]);
- switch (mode) {
+
+ int whence;
+ switch(mode) {
case 1:
- _hInFileTable[slot]->seek(offset, SEEK_SET);
+ whence = SEEK_SET;
break;
case 2:
- _hInFileTable[slot]->seek(offset, SEEK_CUR);
+ whence = SEEK_CUR;
break;
case 3:
- _hInFileTable[slot]->seek(offset, SEEK_END);
+ whence = SEEK_END;
break;
default:
error("o60_seekFilePos: default case %d", mode);
}
+
+ if (_hInFileTable[slot])
+ _hInFileTable[slot]->seek(offset, whence);
+ else if (_hOutFileTable[slot])
+ _hOutFileTable[slot]->seek(offset, whence);
+ else
+ error("o60_seekFilePos: file slot %d not loaded", slot);
}
void ScummEngine_v60he::o60_readFilePos() {
diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp
index d1faf051879..ac8ada3f3b6 100644
--- a/engines/scumm/saveload.cpp
+++ b/engines/scumm/saveload.cpp
@@ -538,7 +538,7 @@ Common::SeekableReadStream *ScummEngine::openSaveFileForReading(int slot, bool c
return _saveFileMan->openForLoading(fileName);
}
-Common::WriteStream *ScummEngine::openSaveFileForWriting(int slot, bool compat, Common::String &fileName) {
+Common::SeekableWriteStream *ScummEngine::openSaveFileForWriting(int slot, bool compat, Common::String &fileName) {
fileName = makeSavegameName(slot, compat);
return _saveFileMan->openForSaving(fileName);
}
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 7abafbe822c..99c59d62781 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -63,6 +63,7 @@ using GUI::Dialog;
namespace Common {
class SeekableReadStream;
class WriteStream;
+class SeekableWriteStream;
}
namespace Graphics {
class FontSJIS;
@@ -889,7 +890,7 @@ protected:
void copyHeapSaveGameToFile(int slot, const char *saveName);
bool changeSavegameName(int slot, char *newName);
virtual Common::SeekableReadStream *openSaveFileForReading(int slot, bool compat, Common::String &fileName);
- virtual Common::WriteStream *openSaveFileForWriting(int slot, bool compat, Common::String &fileName);
+ virtual Common::SeekableWriteStream *openSaveFileForWriting(int slot, bool compat, Common::String &fileName);
Common::String makeSavegameName(int slot, bool temporary) const {
return makeSavegameName(_targetName, slot, temporary);
More information about the Scummvm-git-logs
mailing list