[Scummvm-git-logs] scummvm master -> e40a392582282ab9629afd2ac4bc3074b66066a3

bluegr noreply at scummvm.org
Sun Jan 16 19:37:09 UTC 2022


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

Summary:
3a8e79c674 SCI: Allow saving from the GMM for more SCI32 games
e40a392582 NEWS: Mention more games where saving via the GMM is possible


Commit: 3a8e79c67451a3cf742de5d06366751fe3835235
    https://github.com/scummvm/scummvm/commit/3a8e79c67451a3cf742de5d06366751fe3835235
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2022-01-16T21:36:42+02:00

Commit Message:
SCI: Allow saving from the GMM for more SCI32 games

Saving from the GMM should now work for the following games as well:
GK2, Lighthouse, LSL7, Phant2, Shivers and Torin

Many thanks to @sluicebox for his help checking the game scripts of
these games

Changed paths:
    engines/sci/engine/features.cpp
    engines/sci/engine/guest_additions.cpp
    engines/sci/engine/savegame.cpp


diff --git a/engines/sci/engine/features.cpp b/engines/sci/engine/features.cpp
index ab8e8cad5b5..b666221b359 100644
--- a/engines/sci/engine/features.cpp
+++ b/engines/sci/engine/features.cpp
@@ -851,6 +851,7 @@ bool GameFeatures::hasScriptObjectNames() const {
 
 bool GameFeatures::canSaveFromGMM() const {
 	switch (g_sci->getGameId()) {
+	// ==== Demos/mini-games with no saving functionality ====
 	case GID_ASTROCHICKEN:
 	case GID_CHEST:
 	case GID_CHRISTMAS1988:
@@ -862,27 +863,22 @@ bool GameFeatures::canSaveFromGMM() const {
 	case GID_CNICK_LSL:
 	case GID_CNICK_SQ:
 	case GID_FUNSEEKER:
-	case GID_GK2:				// different scheme for checking if user has control
-	case GID_HOYLE1:			// different saving scheme
-	case GID_HOYLE2:			// different saving scheme
-	case GID_HOYLE3:			// different saving scheme
-	case GID_HOYLE4:			// different saving scheme
-	case GID_HOYLE5:			// different saving scheme
 	case GID_INNDEMO:
-	case GID_JONES:				// different saving scheme
 	case GID_KQUESTIONS:
-	case GID_MOTHERGOOSE:		// different saving scheme
-	case GID_MOTHERGOOSE256:	// different saving scheme
-	case GID_MOTHERGOOSEHIRES:	// different saving scheme
 	case GID_MSASTROCHICKEN:
-	case GID_LIGHTHOUSE:		// stores an incorrect version ("1.0" instead of "xx.yyy.zzz")
-	case GID_LSL7:				// different scheme for checking if user has control
-	case GID_PHANTASMAGORIA:	// different saving scheme
-	case GID_PHANTASMAGORIA2:	// different scheme for checking if user has control
-	case GID_RAMA:				// different saving scheme
-	case GID_SHIVERS:			// stores an incorrect version ("Shivers" instead of "xx.yyy.zzz")
-	case GID_SLATER:			// different saving scheme
-	case GID_TORIN:				// different scheme for checking if user has control
+	// ==== Games with a different saving scheme =============
+	case GID_HOYLE1:
+	case GID_HOYLE2:
+	case GID_HOYLE3:
+	case GID_HOYLE4:
+	case GID_HOYLE5:
+	case GID_JONES:
+	case GID_MOTHERGOOSE:
+	case GID_MOTHERGOOSE256:
+	case GID_MOTHERGOOSEHIRES:
+	case GID_PHANTASMAGORIA:
+	case GID_RAMA:
+	case GID_SLATER:
 		return false;
 	default:
 		return true;
diff --git a/engines/sci/engine/guest_additions.cpp b/engines/sci/engine/guest_additions.cpp
index 4456b705ce8..3d3338e36a8 100644
--- a/engines/sci/engine/guest_additions.cpp
+++ b/engines/sci/engine/guest_additions.cpp
@@ -150,8 +150,21 @@ bool GuestAdditions::shouldSyncAudioToScummVM() const {
 	return false;
 }
 
+static Common::String getUserObject(SciGameId gameId) {
+	switch (gameId) {
+	case GID_TORIN:
+	case GID_LSL7:
+		return "oUser";
+	case GID_PHANTASMAGORIA2:
+		return "p2User";
+	default:
+		return "User";
+	}
+}
+
 bool GuestAdditions::userHasControl() {
-	const reg_t user = _segMan->findObjectByName("User");
+	const SciGameId gameId = g_sci->getGameId();
+	const reg_t user = _segMan->findObjectByName(getUserObject(gameId));
 	const Object *userObject = _segMan->getObject(user);
 
 	// Selectors input/canInput and controls should be available at all times, except
@@ -160,11 +173,25 @@ bool GuestAdditions::userHasControl() {
 	const bool hasCanInputSelector = userObject->locateVarSelector(_segMan, SELECTOR(canInput)) >= 0;
 	const bool hasControlsSelector = userObject->locateVarSelector(_segMan, SELECTOR(controls)) >= 0;
 
-	if ((hasInputSelector || hasCanInputSelector) && hasControlsSelector) {
+	if (hasInputSelector || hasCanInputSelector) {
 		const Selector inputSelector = hasInputSelector ? SELECTOR(input) : SELECTOR(canInput);
 		const int16 input = readSelectorValue(_segMan, user, inputSelector);
-		const int16 controls = readSelectorValue(_segMan, user, SELECTOR(controls));
-		return input && controls;
+
+		if (hasControlsSelector) {
+			const int16 controls = readSelectorValue(_segMan, user, SELECTOR(controls));
+			if (gameId != GID_GK2) {
+				return input && controls;
+			} else {
+				// The GK2 scripts only check the input selector in their HandsOff code in script 0
+				return input;
+			}
+		} else if (gameId == GID_PHANTASMAGORIA2) {
+			// Phantasmagoria 2's canInput function is totally different and checks bit 1 of the state
+			// variable instead
+			return readSelectorValue(_segMan, user, SELECTOR(state)) & 1;
+		} else {
+			return false;
+		}
 	} else {
 		return false;
 	}
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index acd7e999fb3..a37897a319f 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -1238,10 +1238,14 @@ bool gamestate_save(EngineState *s, Common::WriteStream *fh, const Common::Strin
 	Common::Serializer ser(nullptr, fh);
 	Common::String ver = version;
 
-	// If the game version is empty, fall back to loading it from the VERSION file
+	// If the game version is empty, we are probably saving from the GMM, so read it
+	// from global 27 and then the VERSION file
 	if (ver == "") {
-		Common::ScopedPtr<Common::SeekableReadStream> versionFile(SearchMan.createReadStreamForMember("VERSION"));
-		ver = versionFile ? versionFile->readLine() : "";
+		ver = s->_segMan->getString(s->variables[VAR_GLOBAL][kGlobalVarVersion]);
+		if (ver == "") {
+			Common::ScopedPtr<Common::SeekableReadStream> versionFile(SearchMan.createReadStreamForMember("VERSION"));
+			ver = versionFile ? versionFile->readLine() : "";
+		}
 	}
 
 	set_savegame_metadata(ser, fh, savename, ver);


Commit: e40a392582282ab9629afd2ac4bc3074b66066a3
    https://github.com/scummvm/scummvm/commit/e40a392582282ab9629afd2ac4bc3074b66066a3
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2022-01-16T21:36:43+02:00

Commit Message:
NEWS: Mention more games where saving via the GMM is possible

Changed paths:
    NEWS.md


diff --git a/NEWS.md b/NEWS.md
index bf6cf44e6a4..9fef90a0305 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -48,10 +48,10 @@ For a more comprehensive changelog of the latest experimental code, see:
  SCI:
    - Added support for Text To Speech in SCI floppy games.
    - Allow saving from the ScummVM Global Game Menu in the following games:
-     BRAIN1, BRAIN2, ECOQUEST1, ECOQUEST2, FAIRYTALES, PHARKAS, GK1, ICEMAN,
-     KQ1, KQ4, KQ5, KQ6, KQ7, LB1, LB2, LONGBOW, LSL1, LSL2, LSL3, LSL5, LSL6,
-     LSL6HIRES, PEPPER, PQ1, PQ2, PQ3, PQ4, PQSWAT, QFG1, QFG1VGA, QFG2, QFG3,
-     QFG4, SQ1, SQ3, SQ4, SQ5, SQ6.
+     BRAIN1, BRAIN2, ECOQUEST1, ECOQUEST2, FAIRYTALES, PHARKAS, GK1, GK2, ICEMAN,
+     KQ1, KQ4, KQ5, KQ6, KQ7, LB1, LB2, LIGHTHOUSE, LONGBOW, LSL1, LSL2, LSL3,
+     LSL5, LSL6, LSL6HIRES, LSL7, PEPPER, PHANT2, PQ1, PQ2, PQ3, PQ4, PQSWAT,
+     QFG1, QFG1VGA, QFG2, QFG3, QFG4, SHIVERS, SQ1, SQ3, SQ4, SQ5, SQ6, TORIN.
 
  SCUMM:
    - New Digital iMUSE engine.




More information about the Scummvm-git-logs mailing list