[Scummvm-git-logs] scummvm master -> bc8aea4b60472aca3b238b9accbf0df4d0ceb53f
csnover
csnover at users.noreply.github.com
Mon Dec 19 02:13:06 CET 2016
This automated email contains information about 10 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
e828deaa46 SCI32: Fix overwriting of file content when opened in append mode
c816657e56 SCI32: Add workaround for bad kArraySetElements call at end of Phant1
f52c03cd2c SCI32: Simplify workaround comment
b011af9485 SCI: Remove unused second parameter to SegManager::getString
1a3d47bcb5 SCI: Remove restriction on backwards seeking
274ce59699 SCI: Fail gracefully when attempting to write to a read-only fd
0015f39742 SCI32: Disable launcher load for Phantasmagoria
df38f24c77 SCI32: Fix handling of rewritable files opened with mode 1
8bda50fb08 SCI: Clarify the SciEngine::canSaveGameStateCurrently situation
bc8aea4b60 SCI32: Disable load button in F5 menu for Phant1 & Hoyle5
Commit: e828deaa46aeae2f8930187dcdc92f140b0cedcd
https://github.com/scummvm/scummvm/commit/e828deaa46aeae2f8930187dcdc92f140b0cedcd
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-18T19:02:40-06:00
Commit Message:
SCI32: Fix overwriting of file content when opened in append mode
Fixes Trac#9586, Trac#9587.
Changed paths:
engines/sci/engine/file.cpp
diff --git a/engines/sci/engine/file.cpp b/engines/sci/engine/file.cpp
index d46d68d..a20fd78 100644
--- a/engines/sci/engine/file.cpp
+++ b/engines/sci/engine/file.cpp
@@ -102,6 +102,7 @@ SaveFileRewriteStream::SaveFileRewriteStream(Common::String fileName,
unsigned int s = inFile->size();
ensureCapacity(s);
inFile->read(_data, s);
+ seek(0, SEEK_END);
_changed = false;
} else {
_changed = true;
Commit: c816657e567aba2dfe0dfd17265ed588b701d0b2
https://github.com/scummvm/scummvm/commit/c816657e567aba2dfe0dfd17265ed588b701d0b2
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-18T19:02:40-06:00
Commit Message:
SCI32: Add workaround for bad kArraySetElements call at end of Phant1
Changed paths:
engines/sci/engine/workarounds.cpp
diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index 0c8ff27..aac05a2 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -422,6 +422,7 @@ const SciWorkaroundEntry kAbs_workarounds[] = {
const SciWorkaroundEntry kArraySetElements_workarounds[] = {
{ GID_GK1, 302, 64918, 0, "Str", "callKernel", NULL, 0, { WORKAROUND_FAKE, 0 } }, // when erasing a letter on the wall in St Louis Cemetery
{ GID_PHANTASMAGORIA,902, 64918, 0, "Str", "callKernel", NULL, 0, { WORKAROUND_FAKE, 0 } }, // tries to set an element of a string array to the ego object when starting a new game and selecting a chapter above 1
+ { GID_PHANTASMAGORIA,47480, 64918,0, "Str", "callKernel", NULL, 0, { WORKAROUND_FAKE, 0 } }, // after completing the chase successfully
SCI_WORKAROUNDENTRY_TERMINATOR
};
Commit: f52c03cd2c0f0ec3d8aef6d8600e3416c775f5a7
https://github.com/scummvm/scummvm/commit/f52c03cd2c0f0ec3d8aef6d8600e3416c775f5a7
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-18T19:02:40-06:00
Commit Message:
SCI32: Simplify workaround comment
It is not necessary to explain what is happening, just how to
reproduce it.
Changed paths:
engines/sci/engine/workarounds.cpp
diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index aac05a2..68243d1 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -421,7 +421,7 @@ const SciWorkaroundEntry kAbs_workarounds[] = {
// gameID, room,script,lvl, object-name, method-name, local-call-signature, index, workaround
const SciWorkaroundEntry kArraySetElements_workarounds[] = {
{ GID_GK1, 302, 64918, 0, "Str", "callKernel", NULL, 0, { WORKAROUND_FAKE, 0 } }, // when erasing a letter on the wall in St Louis Cemetery
- { GID_PHANTASMAGORIA,902, 64918, 0, "Str", "callKernel", NULL, 0, { WORKAROUND_FAKE, 0 } }, // tries to set an element of a string array to the ego object when starting a new game and selecting a chapter above 1
+ { GID_PHANTASMAGORIA,902, 64918, 0, "Str", "callKernel", NULL, 0, { WORKAROUND_FAKE, 0 } }, // when starting a new game and selecting a chapter above 1
{ GID_PHANTASMAGORIA,47480, 64918,0, "Str", "callKernel", NULL, 0, { WORKAROUND_FAKE, 0 } }, // after completing the chase successfully
SCI_WORKAROUNDENTRY_TERMINATOR
};
Commit: b011af94855ba48b866ad866ae40dde40669607d
https://github.com/scummvm/scummvm/commit/b011af94855ba48b866ad866ae40dde40669607d
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-18T19:02:41-06:00
Commit Message:
SCI: Remove unused second parameter to SegManager::getString
Changed paths:
engines/sci/engine/seg_manager.cpp
engines/sci/engine/seg_manager.h
diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp
index 35a655f..159d317 100644
--- a/engines/sci/engine/seg_manager.cpp
+++ b/engines/sci/engine/seg_manager.cpp
@@ -796,7 +796,7 @@ size_t SegManager::strlen(reg_t str) {
}
-Common::String SegManager::getString(reg_t pointer, int entries) {
+Common::String SegManager::getString(reg_t pointer) {
Common::String ret;
if (pointer.isNull())
return ret; // empty text
@@ -806,10 +806,7 @@ Common::String SegManager::getString(reg_t pointer, int entries) {
warning("SegManager::getString(): Attempt to dereference invalid pointer %04x:%04x", PRINT_REG(pointer));
return ret;
}
- if (entries > src_r.maxSize) {
- warning("Trying to dereference pointer %04x:%04x beyond end of segment", PRINT_REG(pointer));
- return ret;
- }
+
if (src_r.isRaw)
ret = (char *)src_r.raw;
else {
diff --git a/engines/sci/engine/seg_manager.h b/engines/sci/engine/seg_manager.h
index c409744..e3ccb9a 100644
--- a/engines/sci/engine/seg_manager.h
+++ b/engines/sci/engine/seg_manager.h
@@ -304,11 +304,10 @@ public:
* Return the string referenced by pointer.
* pointer can point to either a raw or non-raw segment.
* @param pointer The pointer to dereference
- * @parm entries The number of values expected (for checking)
* @return The string referenced, or an empty string if not enough
* entries were available.
*/
- Common::String getString(reg_t pointer, int entries = 0);
+ Common::String getString(reg_t pointer);
/**
Commit: 1a3d47bcb5d4318424d309bb659e1fe4655e2175
https://github.com/scummvm/scummvm/commit/1a3d47bcb5d4318424d309bb659e1fe4655e2175
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-18T19:02:41-06:00
Commit Message:
SCI: Remove restriction on backwards seeking
SaveFileRewriteStream enables backwards seeking, which is necessary
for the chase.dat in Phant1 to be parsed correctly by the game.
Changed paths:
engines/sci/engine/kfile.cpp
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index 6aad256..995f421 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -659,22 +659,21 @@ reg_t kFileIOWriteString(EngineState *s, int argc, reg_t *argv) {
reg_t kFileIOSeek(EngineState *s, int argc, reg_t *argv) {
uint16 handle = argv[0].toUint16();
- uint16 offset = ABS<int16>(argv[1].toSint16()); // can be negative
+ int16 offset = argv[1].toSint16();
uint16 whence = argv[2].toUint16();
debugC(kDebugLevelFile, "kFileIO(seek): %d, %d, %d", handle, offset, whence);
FileHandle *f = getFileFromHandle(s, handle);
if (f && f->_in) {
- // Backward seeking isn't supported in zip file streams, thus adapt the
- // parameters accordingly if games ask for such a seek mode. A known
- // case where this is requested is the save file manager in Phantasmagoria
- if (whence == SEEK_END) {
- whence = SEEK_SET;
- offset = f->_in->size() - offset;
+ const bool success = f->_in->seek(offset, whence);
+ if (getSciVersion() >= SCI_VERSION_2) {
+ if (success) {
+ return make_reg(0, f->_in->pos());
+ }
+ return SIGNAL_REG;
}
-
- return make_reg(0, f->_in->seek(offset, whence));
+ return make_reg(0, success);
} else if (f && f->_out) {
error("kFileIOSeek: Unsupported seek operation on a writeable stream (offset: %d, whence: %d)", offset, whence);
}
Commit: 274ce596993be9551db4415c3f6f4db0558aa7f6
https://github.com/scummvm/scummvm/commit/274ce596993be9551db4415c3f6f4db0558aa7f6
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-18T19:03:30-06:00
Commit Message:
SCI: Fail gracefully when attempting to write to a read-only fd
Changed paths:
engines/sci/engine/kfile.cpp
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index 995f421..3454358 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -645,7 +645,7 @@ reg_t kFileIOWriteString(EngineState *s, int argc, reg_t *argv) {
FileHandle *f = getFileFromHandle(s, handle);
- if (f) {
+ if (f && f->_out) {
f->_out->write(str.c_str(), str.size());
if (getSciVersion() <= SCI_VERSION_0_LATE)
return s->r_acc; // SCI0 semantics: no value returned
Commit: 0015f397428d2f59e393801aa03b9c9b2c84a443
https://github.com/scummvm/scummvm/commit/0015f397428d2f59e393801aa03b9c9b2c84a443
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-18T19:03:30-06:00
Commit Message:
SCI32: Disable launcher load for Phantasmagoria
This game has its own custom save/load system that bypasses the
normal SCI save game system and performs raw file IO, so its save
files are not identifiable as ScummVM saves.
Changed paths:
engines/sci/detection_tables.h
diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h
index 68dad83..0709bd4 100644
--- a/engines/sci/detection_tables.h
+++ b/engines/sci/detection_tables.h
@@ -2889,14 +2889,14 @@ static const struct ADGameDescription SciGameDescriptions[] = {
#define GUIO_PHANTASMAGORIA_DEMO GUIO6(GAMEOPTION_ENABLE_BLACK_LINED_VIDEO, \
GUIO_NOSPEECH, \
GUIO_NOASPECT, \
+ GUIO_NOLAUNCHLOAD, \
GAMEOPTION_PREFER_DIGITAL_SFX, \
- GAMEOPTION_ORIGINAL_SAVELOAD, \
GAMEOPTION_FB01_MIDI)
#define GUIO_PHANTASMAGORIA GUIO_PHANTASMAGORIA_DEMO
#define GUIO_PHANTASMAGORIA_MAC GUIO5(GAMEOPTION_ENABLE_BLACK_LINED_VIDEO, \
GUIO_NOASPECT, \
+ GUIO_NOLAUNCHLOAD, \
GAMEOPTION_PREFER_DIGITAL_SFX, \
- GAMEOPTION_ORIGINAL_SAVELOAD, \
GAMEOPTION_FB01_MIDI)
// Phantasmagoria - English DOS/Windows (from csnover)
Commit: df38f24c77bac3b1a8958a1bac301d82a43c35c4
https://github.com/scummvm/scummvm/commit/df38f24c77bac3b1a8958a1bac301d82a43c35c4
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-18T19:03:30-06:00
Commit Message:
SCI32: Fix handling of rewritable files opened with mode 1
In SSCI, all files opened through kFileIO are writable. Most of
the time this does not matter and the engine can get away with
using read-only streams, but when chase.dat is opened by Phant1
from the retry dialogue during the chase, it needs to be writable
because game code puts a '98' marker in the chase data. If this
write does not occur, the game gets stuck in a loop looking for
the marker.
Changed paths:
engines/sci/engine/file.cpp
engines/sci/engine/file.h
engines/sci/engine/kfile.cpp
diff --git a/engines/sci/engine/file.cpp b/engines/sci/engine/file.cpp
index a20fd78..da1d00f 100644
--- a/engines/sci/engine/file.cpp
+++ b/engines/sci/engine/file.cpp
@@ -78,7 +78,7 @@ class SaveFileRewriteStream : public MemoryDynamicRWStream {
public:
SaveFileRewriteStream(Common::String fileName,
Common::SeekableReadStream *inFile,
- bool truncate, bool compress);
+ kFileOpenMode mode, bool compress);
virtual ~SaveFileRewriteStream();
virtual uint32 write(const void *dataPtr, uint32 dataSize) { _changed = true; return MemoryDynamicRWStream::write(dataPtr, dataSize); }
@@ -93,16 +93,21 @@ protected:
SaveFileRewriteStream::SaveFileRewriteStream(Common::String fileName,
Common::SeekableReadStream *inFile,
- bool truncate,
+ kFileOpenMode mode,
bool compress)
: MemoryDynamicRWStream(DisposeAfterUse::YES),
_fileName(fileName), _compress(compress)
{
+ const bool truncate = mode == _K_FILE_MODE_CREATE;
+ const bool seekToEnd = mode == _K_FILE_MODE_OPEN_OR_CREATE;
+
if (!truncate && inFile) {
unsigned int s = inFile->size();
ensureCapacity(s);
inFile->read(_data, s);
- seek(0, SEEK_END);
+ if (seekToEnd) {
+ seek(0, SEEK_END);
+ }
_changed = false;
} else {
_changed = true;
@@ -163,7 +168,7 @@ uint findFreeFileHandle(EngineState *s) {
* for reading only.
*/
-reg_t file_open(EngineState *s, const Common::String &filename, int mode, bool unwrapFilename) {
+reg_t file_open(EngineState *s, const Common::String &filename, kFileOpenMode mode, bool unwrapFilename) {
Common::String englishName = g_sci->getSciLanguageString(filename, K_LANG_ENGLISH);
englishName.toLowercase();
@@ -200,9 +205,8 @@ reg_t file_open(EngineState *s, const Common::String &filename, int mode, bool u
}
#ifdef ENABLE_SCI32
- if (mode != _K_FILE_MODE_OPEN_OR_FAIL && (
- (g_sci->getGameId() == GID_PHANTASMAGORIA && (filename == "phantsg.dir" || filename == "chase.dat")) ||
- (g_sci->getGameId() == GID_PQSWAT && filename == "swat.dat"))) {
+ if ((g_sci->getGameId() == GID_PHANTASMAGORIA && (filename == "phantsg.dir" || filename == "chase.dat" || filename == "tmp.dat")) ||
+ (g_sci->getGameId() == GID_PQSWAT && filename == "swat.dat")) {
debugC(kDebugLevelFile, " -> file_open opening %s for rewriting", wrappedName.c_str());
inFile = saveFileMan->openForLoading(wrappedName);
@@ -211,8 +215,13 @@ reg_t file_open(EngineState *s, const Common::String &filename, int mode, bool u
if (!inFile)
inFile = SearchMan.createReadStreamForMember(englishName);
+ if (mode == _K_FILE_MODE_OPEN_OR_FAIL && !inFile) {
+ debugC(kDebugLevelFile, " -> file_open(_K_FILE_MODE_OPEN_OR_FAIL): failed to open file '%s'", englishName.c_str());
+ return SIGNAL_REG;
+ }
+
SaveFileRewriteStream *stream;
- stream = new SaveFileRewriteStream(wrappedName, inFile, mode == _K_FILE_MODE_CREATE, isCompressed);
+ stream = new SaveFileRewriteStream(wrappedName, inFile, mode, isCompressed);
delete inFile;
diff --git a/engines/sci/engine/file.h b/engines/sci/engine/file.h
index 0154338..1c9a092 100644
--- a/engines/sci/engine/file.h
+++ b/engines/sci/engine/file.h
@@ -28,7 +28,7 @@
namespace Sci {
-enum {
+enum kFileOpenMode {
_K_FILE_MODE_OPEN_OR_CREATE = 0,
_K_FILE_MODE_OPEN_OR_FAIL = 1,
_K_FILE_MODE_CREATE = 2
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index 3454358..796eb08 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -46,7 +46,7 @@
namespace Sci {
-extern reg_t file_open(EngineState *s, const Common::String &filename, int mode, bool unwrapFilename);
+extern reg_t file_open(EngineState *s, const Common::String &filename, kFileOpenMode mode, bool unwrapFilename);
extern FileHandle *getFileFromHandle(EngineState *s, uint handle);
extern int fgets_wrapper(EngineState *s, char *dest, int maxsize, int handle);
extern void listSavegames(Common::Array<SavegameDesc> &saves);
@@ -283,7 +283,7 @@ reg_t kFileIOOpen(EngineState *s, int argc, reg_t *argv) {
return SIGNAL_REG;
}
- int mode = argv[1].toUint16();
+ kFileOpenMode mode = (kFileOpenMode)argv[1].toUint16();
bool unwrapFilename = true;
// SQ4 floppy prepends /\ to the filenames
Commit: 8bda50fb08f893c9a29332f78917d20a963aab77
https://github.com/scummvm/scummvm/commit/8bda50fb08f893c9a29332f78917d20a963aab77
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-18T19:03:30-06:00
Commit Message:
SCI: Clarify the SciEngine::canSaveGameStateCurrently situation
Changed paths:
engines/sci/detection.cpp
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index e316750..a3b15b2 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -887,7 +887,8 @@ bool SciEngine::canLoadGameStateCurrently() {
}
bool SciEngine::canSaveGameStateCurrently() {
- return !_gamestate->executionStackBase;
+ // see comment about kSupportsSavingDuringRuntime in SciEngine::hasFeature
+ return false;
}
} // End of namespace Sci
Commit: bc8aea4b60472aca3b238b9accbf0df4d0ceb53f
https://github.com/scummvm/scummvm/commit/bc8aea4b60472aca3b238b9accbf0df4d0ceb53f
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-18T19:03:30-06:00
Commit Message:
SCI32: Disable load button in F5 menu for Phant1 & Hoyle5
These games either don't have saves (Hoyle) or the saves bypass
the normal save game system so are unidentifiable by ScummVM
(Phant1).
Changed paths:
engines/sci/detection.cpp
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index a3b15b2..5270398 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -883,6 +883,18 @@ Common::Error SciEngine::saveGameState(int slot, const Common::String &desc) {
}
bool SciEngine::canLoadGameStateCurrently() {
+#ifdef ENABLE_SCI32
+ if (getSciVersion() >= SCI_VERSION_2) {
+ switch (getGameId()) {
+ case GID_PHANTASMAGORIA:
+ case GID_HOYLE5:
+ return false;
+ default:
+ break;
+ }
+ }
+#endif
+
return !_gamestate->executionStackBase;
}
More information about the Scummvm-git-logs
mailing list