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

csnover csnover at users.noreply.github.com
Thu Sep 28 21:58:51 CEST 2017


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

Summary:
cd6130cdd6 SCI32: Add audio volume sync support for RAMA
81d6706cf4 SCI: Remove resolved TODO
c81348e3fe SCI32: Block RAMA from creating PREF.DAT file
7de9c1682b SCI32: Allow save games to be deleted from original save/restore in RAMA
f570e4b351 SCI32: Disable change directory button in original save/load in RAMA


Commit: cd6130cdd62aa54e9b4ec4e8b367509224bd3248
    https://github.com/scummvm/scummvm/commit/cd6130cdd62aa54e9b4ec4e8b367509224bd3248
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-28T14:58:17-05:00

Commit Message:
SCI32: Add audio volume sync support for RAMA

Changed paths:
    engines/sci/detection_tables.h
    engines/sci/engine/features.cpp
    engines/sci/engine/guest_additions.cpp
    engines/sci/engine/guest_additions.h
    engines/sci/engine/selector.cpp
    engines/sci/engine/selector.h
    engines/sci/engine/vm.h


diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h
index efe2884..58af0fd 100644
--- a/engines/sci/detection_tables.h
+++ b/engines/sci/detection_tables.h
@@ -4022,17 +4022,18 @@ static const struct ADGameDescription SciGameDescriptions[] = {
 #undef GUIO_QFG4_FLOPPY
 #undef GUIO_QFG4_CD
 
-#define GUIO_RAMA_DEMO GUIO7(GUIO_NOMIDI, \
+#define GUIO_RAMA_DEMO GUIO8(GUIO_NOSUBTITLES, \
+                             GUIO_NOMIDI, \
                              GUIO_NOLAUNCHLOAD, \
                              GUIO_NOASPECT, \
                              GUIO_LINKSPEECHTOSFX, \
                              GUIO_LINKMUSICTOSFX, \
                              GAMEOPTION_ENABLE_BLACK_LINED_VIDEO, \
                              GAMEOPTION_HQ_VIDEO)
-#define GUIO_RAMA      GUIO7(GUIO_NOMIDI, \
+#define GUIO_RAMA      GUIO7(GUIO_NOSUBTITLES, \
+                             GUIO_NOMIDI, \
                              GUIO_NOASPECT, \
                              GUIO_LINKSPEECHTOSFX, \
-                             GUIO_LINKMUSICTOSFX, \
                              GAMEOPTION_ORIGINAL_SAVELOAD, \
                              GAMEOPTION_ENABLE_BLACK_LINED_VIDEO, \
                              GAMEOPTION_HQ_VIDEO)
diff --git a/engines/sci/engine/features.cpp b/engines/sci/engine/features.cpp
index c4e23b5..f94ab8a 100644
--- a/engines/sci/engine/features.cpp
+++ b/engines/sci/engine/features.cpp
@@ -577,8 +577,8 @@ bool GameFeatures::audioVolumeSyncUsesGlobals() const {
 	case GID_LSL7:
 	case GID_PHANTASMAGORIA:
 	case GID_PHANTASMAGORIA2:
+	case GID_RAMA:
 	case GID_TORIN:
-		// TODO: SCI3
 		return true;
 	default:
 		return false;
diff --git a/engines/sci/engine/guest_additions.cpp b/engines/sci/engine/guest_additions.cpp
index 06cf0c9..d4e4102 100644
--- a/engines/sci/engine/guest_additions.cpp
+++ b/engines/sci/engine/guest_additions.cpp
@@ -100,7 +100,7 @@ bool GuestAdditions::shouldSyncAudioToScummVM() const {
 			// SCI16 with menu bar
 			return true;
 		} else if (objName == "volumeSlider") {
-			// SCI16 with icon bar, QFG4, Hoyle5
+			// SCI16 with icon bar, QFG4, Hoyle5, RAMA
 			return true;
 		} else if (gameId == GID_MOTHERGOOSE256 && objName == "soundBut") {
 			return true;
@@ -163,6 +163,8 @@ void GuestAdditions::writeVarHook(const int type, const int index, const reg_t v
 				syncAudioVolumeGlobalsToScummVM(index, value);
 			} else if (g_sci->getGameId() == GID_GK1) {
 				syncGK1StartupVolumeFromScummVM(index, value);
+			} else if (g_sci->getGameId() == GID_RAMA && index == kGlobalVarRamaMusicVolume) {
+				syncRamaVolumeFromScummVM((ConfMan.getInt("music_volume") + 1) * kRamaVolumeMax / Audio::Mixer::kMaxMixerVolume);
 			}
 
 			if (_features->supportsTextSpeed()) {
@@ -1034,6 +1036,13 @@ void GuestAdditions::syncAudioVolumeGlobalsFromScummVM() const {
 		break;
 	}
 
+	case GID_RAMA: {
+		const int16 musicVolume = (ConfMan.getInt("music_volume") + 1) * kRamaVolumeMax / Audio::Mixer::kMaxMixerVolume;
+		syncRamaVolumeFromScummVM(musicVolume);
+		syncRamaUI(musicVolume);
+		break;
+	}
+
 	case GID_LSL7:
 	case GID_TORIN: {
 		const int16 musicVolume  = (ConfMan.getInt("music_volume") + 1)  * 100 / Audio::Mixer::kMaxMixerVolume;
@@ -1143,6 +1152,15 @@ void GuestAdditions::syncPhant2VolumeFromScummVM(const int16 masterVolume) const
 	}
 }
 
+void GuestAdditions::syncRamaVolumeFromScummVM(const int16 musicVolume) const {
+	_state->variables[VAR_GLOBAL][kGlobalVarRamaMusicVolume] = make_reg(0, musicVolume);
+	const reg_t gameId = _state->variables[VAR_GLOBAL][kGlobalVarGame];
+	if (!gameId.isNull()) {
+		reg_t args[] = { make_reg(0, musicVolume) };
+		invokeSelector(gameId, SELECTOR(masterVolume), 1, args);
+	}
+}
+
 void GuestAdditions::syncTorinVolumeFromScummVM(const int16 musicVolume, const int16 sfxVolume, const int16 speechVolume) const {
 	_state->variables[VAR_GLOBAL][kGlobalVarTorinMusicVolume]  = make_reg(0, musicVolume);
 	_state->variables[VAR_GLOBAL][kGlobalVarTorinSFXVolume]    = make_reg(0, sfxVolume);
@@ -1204,6 +1222,13 @@ void GuestAdditions::syncAudioVolumeGlobalsToScummVM(const int index, const reg_
 		}
 		break;
 
+	case GID_RAMA:
+		if (index == kGlobalVarRamaMusicVolume) {
+			const int16 musicVolume = value.toSint16() * Audio::Mixer::kMaxMixerVolume / kRamaVolumeMax;
+			ConfMan.setInt("music_volume", musicVolume);
+		}
+		break;
+
 	case GID_LSL7:
 	case GID_TORIN:
 		if (index == kGlobalVarTorinMusicVolume ||
@@ -1434,6 +1459,14 @@ void GuestAdditions::syncQFG4UI(const int16 musicVolume) const {
 	}
 }
 
+void GuestAdditions::syncRamaUI(const int16 musicVolume) const {
+	const reg_t sliderId = _segMan->findObjectByName("volumeSlider");
+	if (!sliderId.isNull() && !readSelector(_segMan, sliderId, SELECTOR(plane)).isNull()) {
+		reg_t args[] = { make_reg(0, musicVolume) };
+		invokeSelector(sliderId, SELECTOR(setCel), 1, args);
+	}
+}
+
 void GuestAdditions::syncShivers1UI(const int16 dacVolume) const {
 	const reg_t sliderId = _segMan->findObjectByName("spVolume");
 	if (!sliderId.isNull()) {
diff --git a/engines/sci/engine/guest_additions.h b/engines/sci/engine/guest_additions.h
index a1043a8..ba6adf3 100644
--- a/engines/sci/engine/guest_additions.h
+++ b/engines/sci/engine/guest_additions.h
@@ -43,6 +43,7 @@ enum {
 	// will just use 85 as the maximum volume.
 	kPhant2VolumeMax       = 85,
 
+	kRamaVolumeMax         = 16,
 	kLSL6HiresUIVolumeMax  = 13,
 	kLSL6HiresSubtitleFlag = 105
 };
@@ -388,6 +389,7 @@ private:
 	void syncGK2VolumeFromScummVM(const int16 musicVolume) const;
 	void syncLSL6HiresVolumeFromScummVM(const int16 musicVolume) const;
 	void syncPhant2VolumeFromScummVM(const int16 masterVolume) const;
+	void syncRamaVolumeFromScummVM(const int16 musicVolume) const;
 	void syncTorinVolumeFromScummVM(const int16 musicVolume, const int16 sfxVolume, const int16 speechVolume) const;
 
 	/**
@@ -421,6 +423,7 @@ private:
 	void syncPQ4UI(const int16 musicVolume) const;
 	void syncPQSWATUI() const;
 	void syncQFG4UI(const int16 musicVolume) const;
+	void syncRamaUI(const int16 musicVolume) const;
 	void syncShivers1UI(const int16 dacVolume) const;
 	void syncSQ6UI() const;
 	void syncTorinUI(const int16 musicVolume, const int16 sfxVolume, const int16 speechVolume) const;
diff --git a/engines/sci/engine/selector.cpp b/engines/sci/engine/selector.cpp
index 1feb808..42c71c4 100644
--- a/engines/sci/engine/selector.cpp
+++ b/engines/sci/engine/selector.cpp
@@ -230,6 +230,8 @@ void Kernel::mapSelectors() {
 	FIND_SELECTOR(fileNumber);
 	FIND_SELECTOR(description);
 	FIND_SELECTOR(dispose);
+	FIND_SELECTOR(masterVolume);
+	FIND_SELECTOR(setCel);
 #endif
 }
 
diff --git a/engines/sci/engine/selector.h b/engines/sci/engine/selector.h
index 1603ca9..2debd32 100644
--- a/engines/sci/engine/selector.h
+++ b/engines/sci/engine/selector.h
@@ -187,6 +187,8 @@ struct SelectorCache {
 	Selector fileNumber; // for RAMA save/load
 	Selector description; // for RAMA save/load
 	Selector dispose; // for RAMA save/load save from launcher
+	Selector masterVolume; // for RAMA volume sync
+	Selector setCel; // for RAMA volume sync
 #endif
 };
 
diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h
index 83550f8..0da48a4 100644
--- a/engines/sci/engine/vm.h
+++ b/engines/sci/engine/vm.h
@@ -139,6 +139,7 @@ enum {
 
 enum GlobalVar {
 	kGlobalVarEgo            = 0,
+	kGlobalVarGame           = 1,
 	kGlobalVarCurrentRoom    = 2,
 	kGlobalVarSpeed          = 3,  // SCI16
 	kGlobalVarQuit           = 4,
@@ -158,6 +159,7 @@ enum GlobalVar {
 	kGlobalVarRamaCatalogFile      = 130,
 	kGlobalVarLSL6HiresGameFlags   = 137,
 	kGlobalVarGK1NarratorMode      = 166, // 0 for text, 1 for speech
+	kGlobalVarRamaMusicVolume      = 176, // 0 to 16
 	kGlobalVarPhant1MusicVolume    = 187, // 0 to 15
 	kGlobalVarPhant1DACVolume      = 188, // 0 to 127
 	kGlobalVarLSL6HiresMusicVolume = 194, // 0 to 13


Commit: 81d6706cf4bce3cd479dda685fc4c9fd164d8920
    https://github.com/scummvm/scummvm/commit/81d6706cf4bce3cd479dda685fc4c9fd164d8920
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-28T14:58:17-05:00

Commit Message:
SCI: Remove resolved TODO

Changed paths:
    engines/sci/engine/vm.cpp


diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 785f92b..0324feb 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -291,7 +291,6 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt
 		if (selectorType == kSelectorMethod) {
 			stackType = EXEC_STACK_TYPE_CALL;
 			curSP = sp;
-			// TODO: Will this offset suffice for large SCI3 scripts?
 			curFP = make_reg32(funcp.getSegment(), funcp.getOffset());
 			sp = CALL_SP_CARRY; // Destroy sp, as it will be carried over
 		}


Commit: c81348e3fe6b49cf8671e476d74469846542f950
    https://github.com/scummvm/scummvm/commit/c81348e3fe6b49cf8671e476d74469846542f950
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-28T14:58:18-05:00

Commit Message:
SCI32: Block RAMA from creating PREF.DAT file

This file normally stores brightness, music volume, and most
recently used save game directory. Since we store the music volume
ourselves and don't use the save game directory, the only
potentially useful information is the brightness level, and that
is fine to just restore from the save games.

Changed paths:
    engines/sci/engine/kfile.cpp


diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index d87013f..f32888b 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -443,6 +443,10 @@ reg_t kFileIOOpen(EngineState *s, int argc, reg_t *argv) {
 		// Ignore the censorship password file in lieu of our game option
 		return SIGNAL_REG;
 	} else if (g_sci->getGameId() == GID_RAMA) {
+		if (name == "PREF.DAT") {
+			return SIGNAL_REG;
+		}
+
 		int saveNo = -1;
 		if (name == "911.sg") {
 			saveNo = kAutoSaveId;


Commit: 7de9c1682b9d9967bcea6294733c5e7f2fd000ee
    https://github.com/scummvm/scummvm/commit/7de9c1682b9d9967bcea6294733c5e7f2fd000ee
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-28T14:58:18-05:00

Commit Message:
SCI32: Allow save games to be deleted from original save/restore in RAMA

Changed paths:
    engines/sci/engine/kfile.cpp


diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index f32888b..baa088d 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -666,11 +666,15 @@ reg_t kFileIOUnlink(EngineState *s, int argc, reg_t *argv) {
 		result = saveFileMan->removeSavefile(name);
 #ifdef ENABLE_SCI32
 	} else if (getSciVersion() >= SCI_VERSION_2) {
-		// Special case for KQ7, basically identical to the SQ4 case above,
-		// where the game hardcodes its save game names
-		if (name.hasPrefix("kq7cdsg.")) {
-			int saveNo = atoi(name.c_str() + name.size() - 3);
+		// Special cases for KQ7 & RAMA, basically identical to the SQ4 case
+		// above, where the game hardcodes its save game names
+		int saveNo;
+		if (sscanf(name.c_str(), "kq7cdsg.%i", &saveNo) == 1 ||
+			sscanf(name.c_str(), "ramasg.%i", &saveNo) == 1) {
+
 			name = g_sci->getSavegameName(saveNo + kSaveIdShift);
+		} else if (g_sci->getGameId() == GID_RAMA && name == "911.sg") {
+			name = g_sci->getSavegameName(kAutoSaveId);
 		}
 
 		// The file name may be already wrapped, so check both cases


Commit: f570e4b35190085ed692201ae7325e332f3aacbe
    https://github.com/scummvm/scummvm/commit/f570e4b35190085ed692201ae7325e332f3aacbe
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-28T14:58:18-05:00

Commit Message:
SCI32: Disable change directory button in original save/load in RAMA

Changed paths:
    engines/sci/engine/script_patches.cpp


diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 60e314d..8330f0a 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -144,6 +144,7 @@ static const char *const selectorNameTable[] = {
 	"saveFilePtr",  // RAMA
 	"priority",     // RAMA
 	"plane",        // RAMA
+	"state",        // RAMA
 #endif
 	NULL
 };
@@ -211,7 +212,8 @@ enum ScriptPatcherSelectors {
 	SELECTOR_handle,
 	SELECTOR_saveFilePtr,
 	SELECTOR_priority,
-	SELECTOR_plane
+	SELECTOR_plane,
+	SELECTOR_state
 #endif
 };
 
@@ -6394,11 +6396,31 @@ static const uint16 ramaDocReaderInitPatch[] = {
 	PATCH_END
 };
 
+// It is not possible to change the directory for ScummVM save games, so disable
+// the "change directory" button in the RAMA save dialogue
+static const uint16 ramaChangeDirSignature[] = {
+	SIG_MAGICDWORD,
+	0x7e, SIG_UINT16(0x64),     // line 100
+	0x39, SIG_SELECTOR8(state), // pushi $1d (state)
+	0x78,                       // push1
+	0x39, 0x03,                 // pushi 3
+	0x72, SIG_ADDTOOFFSET(+2),  // lofsa changeDirI
+	0x4a, SIG_UINT16(0x0e),     // send 14
+	SIG_END
+};
+
+static const uint16 ramaChangeDirPatch[] = {
+	PATCH_ADDTOOFFSET(+6),    // line 100, pushi state, push1
+	0x39, 0x00,               // pushi 0
+	PATCH_END
+};
+
 static const SciScriptPatcherEntry ramaSignatures[] = {
 	{  true,     0, "fix bad text resolution",                      1, ramaTextResolutionSignature,     ramaTextResolutionPatch },
 	{  true,    55, "fix bad DocReader::init priority calculation", 1, ramaDocReaderInitSignature,      ramaDocReaderInitPatch },
 	{  true,    85, "fix SaveManager to use normal readWord calls", 1, ramaSerializeRegTSignature1,     ramaSerializeRegTPatch1 },
 	{  true, 64908, "disable video benchmarking",                   1, ramaBenchmarkSignature,          ramaBenchmarkPatch },
+	{  true, 64990, "disable change directory button",              1, ramaChangeDirSignature,          ramaChangeDirPatch },
 	SCI_SIGNATUREENTRY_TERMINATOR
 };
 





More information about the Scummvm-git-logs mailing list