[Scummvm-cvs-logs] scummvm master -> 1ac8533b1f60d5695fb7095d7da9157689bdef6e
m-kiewitz
m_kiewitz at users.sourceforge.net
Sun Feb 21 20:33:14 CET 2016
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:
1ac8533b1f SCI32: Fix save patching for ScummVM dialog
Commit: 1ac8533b1f60d5695fb7095d7da9157689bdef6e
https://github.com/scummvm/scummvm/commit/1ac8533b1f60d5695fb7095d7da9157689bdef6e
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2016-02-21T20:33:17+01:00
Commit Message:
SCI32: Fix save patching for ScummVM dialog
- Patch game super object for saving instead of game object
- Remove re-adding planes+screen items, game::replay does that
We would only have to do that for soft-failing on restore
- Change debug levels of kNumLoops/kNumCels to 9
- Add special comment about -info- selector in syncWithScripts()
This should now make ScummVM menu saving work properly at
least in SQ6.
Changed paths:
engines/sci/engine/kgraphics.cpp
engines/sci/engine/savegame.cpp
engines/sci/graphics/frameout.cpp
engines/sci/sci.cpp
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 0b945c1..91d241f 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -492,7 +492,7 @@ reg_t kNumLoops(EngineState *s, int argc, reg_t *argv) {
loopCount = g_sci->_gfxCache->kernelViewGetLoopCount(viewId);
- debugC(kDebugLevelGraphics, "NumLoops(view.%d) = %d", viewId, loopCount);
+ debugC(9, kDebugLevelGraphics, "NumLoops(view.%d) = %d", viewId, loopCount);
return make_reg(0, loopCount);
}
@@ -505,7 +505,7 @@ reg_t kNumCels(EngineState *s, int argc, reg_t *argv) {
celCount = g_sci->_gfxCache->kernelViewGetCelCount(viewId, loopNo);
- debugC(kDebugLevelGraphics, "NumCels(view.%d, %d) = %d", viewId, loopNo, celCount);
+ debugC(9, kDebugLevelGraphics, "NumCels(view.%d, %d) = %d", viewId, loopNo, celCount);
return make_reg(0, celCount);
}
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 1b56e66..851e4fc 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -1096,11 +1096,12 @@ void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
if (g_sci->_gfxPorts)
g_sci->_gfxPorts->saveLoadWithSerializer(ser);
-#ifdef ENABLE_SCI32
- // Add current planes/screen elements of freshly loaded VM, only when our ScummVM dialogs are patched in
- if (getSciVersion() >= SCI_VERSION_2)
- g_sci->_gfxFrameout->syncWithScripts(true);
-#endif
+ // SCI32:
+ // Current planes/screen elements of freshly loaded VM are re-added by scripts in [gameID]::replay
+ // We don't have to do that in here.
+ // But we may have to do it ourselves in case we ever implement some soft-error handling in case
+ // a saved game can't be restored. That way we can restore the game screen.
+ // see _gfxFrameout->syncWithScripts()
Vocabulary *voc = g_sci->getVocabulary();
if (ser.getVersion() >= 30 && voc)
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index 8a7a485..260bd27 100644
--- a/engines/sci/graphics/frameout.cpp
+++ b/engines/sci/graphics/frameout.cpp
@@ -210,6 +210,8 @@ void GfxFrameout::syncWithScripts(bool addElements) {
// read selector "-info-" of this object
// TODO: Seems to have been changed for SCI3
+ // Do NOT use getInfoSelector in here. SCI3 games did not use infoToa, but an actual selector.
+ // Maybe that selector is just a straight copy, but it needs to get verified/checked.
uint16 castInfoSelector = readSelectorValue(segMan, castObject, SELECTOR(_info_));
if (castInfoSelector & kInfoFlagViewInserted) {
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 49eb31d..cce0235 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -576,17 +576,29 @@ void SciEngine::patchGameSaveRestore() {
}
}
+ const Object *patchObjectSave = nullptr;
+
+ if (getSciVersion() < SCI_VERSION_2) {
+ // Patch gameobject ::save for now for SCI0 - SCI1.1
+ // TODO: It seems this was never adjusted to superclass, but adjusting it now may cause
+ // issues with some game. Needs to get checked and then possibly changed.
+ patchObjectSave = gameObject;
+ } else {
+ // Patch superclass ::save for SCI32
+ patchObjectSave = gameSuperObject;
+ }
+
// Search for gameobject ::save, if there is one patch that one too
- uint16 gameObjectMethodCount = gameObject->getMethodCount();
- for (uint16 methodNr = 0; methodNr < gameObjectMethodCount; methodNr++) {
- uint16 selectorId = gameObject->getFuncSelector(methodNr);
+ uint16 patchObjectMethodCount = patchObjectSave->getMethodCount();
+ for (uint16 methodNr = 0; methodNr < patchObjectMethodCount; methodNr++) {
+ uint16 selectorId = patchObjectSave->getFuncSelector(methodNr);
Common::String methodName = _kernel->getSelectorName(selectorId);
if (methodName == "save") {
if (_gameId != GID_FAIRYTALES) { // Fairy Tales saves automatically without a dialog
if (kernelIdSave != kernelIdRestore)
- patchGameSaveRestoreCode(segMan, gameObject->getFunction(methodNr), kernelIdSave);
+ patchGameSaveRestoreCode(segMan, patchObjectSave->getFunction(methodNr), kernelIdSave);
else
- patchGameSaveRestoreCodeSci21(segMan, gameObject->getFunction(methodNr), kernelIdSave, false);
+ patchGameSaveRestoreCodeSci21(segMan, patchObjectSave->getFunction(methodNr), kernelIdSave, false);
}
break;
}
More information about the Scummvm-git-logs
mailing list