[Scummvm-git-logs] scummvm master -> 8f6979234e694af368b520c5b72725cbbb31e382

sluicebox 22204938+sluicebox at users.noreply.github.com
Fri Feb 7 21:16:29 UTC 2020


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

Summary:
ed9318494d SCI32: Fix Mac sound initialization error
d5d7d05d80 SCI32: Use correct kDoSound subops in Mac games
ab8cf3d77c SCI32: Update kCheckDisc kernel signature for Mac
4b504a5786 SCI32: Fix kArrayFill kernel signature
07827aeb20 SCI32: Add PHANT1 Mac kArrayFill workarounds
01360d26fe SCI32: Set PHANT1 Mac video quality to high
8f6979234e SCI: Remove unreachable error() from Mac cursor code


Commit: ed9318494dc2c840d9450b56cd10937124176dc2
    https://github.com/scummvm/scummvm/commit/ed9318494dc2c840d9450b56cd10937124176dc2
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2020-02-07T13:15:43-08:00

Commit Message:
SCI32: Fix Mac sound initialization error

Changed paths:
    engines/sci/sound/music.cpp


diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp
index 581f1a8..833a0c0 100644
--- a/engines/sci/sound/music.cpp
+++ b/engines/sci/sound/music.cpp
@@ -74,6 +74,8 @@ void SciMusic::init() {
 #ifdef ENABLE_SCI32
 	if (g_sci->_features->generalMidiOnly()) {
 		deviceFlags = MDT_MIDI;
+	} else if (platform == Common::kPlatformMacintosh && getSciVersion() >= SCI_VERSION_2_1_MIDDLE) {
+		deviceFlags = MDT_MIDI;
 	} else {
 #endif
 		deviceFlags = MDT_PCSPK | MDT_PCJR | MDT_ADLIB | MDT_MIDI;


Commit: d5d7d05d80faeb8df77c9ab1403446827e560dff
    https://github.com/scummvm/scummvm/commit/d5d7d05d80faeb8df77c9ab1403446827e560dff
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2020-02-07T13:15:43-08:00

Commit Message:
SCI32: Use correct kDoSound subops in Mac games

Changed paths:
    engines/sci/engine/features.h
    engines/sci/engine/kernel.cpp
    engines/sci/engine/kernel.h
    engines/sci/engine/ksound.cpp


diff --git a/engines/sci/engine/features.h b/engines/sci/engine/features.h
index 01535ce..ea478a3 100644
--- a/engines/sci/engine/features.h
+++ b/engines/sci/engine/features.h
@@ -161,6 +161,17 @@ public:
 			g_sci->getGameId() != GID_GK2;
 	}
 
+	inline bool useDoSoundMac32() const {
+		// Several SCI 2.1 Middle Mac games use a modified kDoSound with
+		//  different subop numbers.
+		return g_sci->getPlatform() == Common::kPlatformMacintosh &&
+			(g_sci->getGameId() == GID_HOYLE5 ||
+			 g_sci->getGameId() == GID_PHANTASMAGORIA ||
+			 g_sci->getGameId() == GID_PQSWAT ||
+			 g_sci->getGameId() == GID_SHIVERS ||
+			 g_sci->getGameId() == GID_SQ6);
+	}
+
 	inline bool usesAlternateSelectors() const {
 		return g_sci->getGameId() == GID_PHANTASMAGORIA2;
 	}
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index 8477b93..9c7cc8d 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -555,7 +555,7 @@ bool Kernel::signatureMatch(const uint16 *sig, int argc, const reg_t *argv) {
 	return false;
 }
 
-void Kernel::mapFunctions() {
+void Kernel::mapFunctions(GameFeatures *features) {
 	int mapped = 0;
 	int ignored = 0;
 	uint functionCount = _kernelNames.size();
@@ -612,12 +612,12 @@ void Kernel::mapFunctions() {
 		}
 
 #ifdef ENABLE_SCI32
-		// HACK: Phantasmagoria Mac uses a modified kDoSound (which *nothing*
-		// else seems to use)!
-		if (g_sci->getPlatform() == Common::kPlatformMacintosh && g_sci->getGameId() == GID_PHANTASMAGORIA && kernelName == "DoSound") {
-			_kernelFuncs[id].function = kDoSoundPhantasmagoriaMac;
-			_kernelFuncs[id].signature = parseKernelSignature("DoSoundPhantasmagoriaMac", "i.*");
-			_kernelFuncs[id].name = "DoSoundPhantasmagoriaMac";
+		// Several SCI 2.1 Middle Mac games use a modified kDoSound
+		//  with different subop numbers.
+		if (features->useDoSoundMac32() && kernelName == "DoSound") {
+			_kernelFuncs[id].function = kDoSoundMac32;
+			_kernelFuncs[id].signature = parseKernelSignature("DoSoundMac32", "i(.*)");
+			_kernelFuncs[id].name = "DoSoundMac32";
 			continue;
 		}
 #endif
@@ -874,7 +874,7 @@ void Kernel::loadKernelNames(GameFeatures *features) {
 	}
 #endif
 
-	mapFunctions();
+	mapFunctions(features);
 }
 
 Common::String Kernel::lookupText(reg_t address, int index) {
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index d762ee8..6605364 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -250,7 +250,7 @@ private:
 	/**
 	 * Maps kernel functions.
 	 */
-	void mapFunctions();
+	void mapFunctions(GameFeatures *features);
 
 	ResourceManager *_resMan;
 	SegManager *_segMan;
@@ -649,8 +649,8 @@ reg_t kDeleteLine(EngineState *s, int argc, reg_t *argv);
 
 reg_t kWinDLL(EngineState *s, int argc, reg_t *argv);
 
-// Phantasmagoria Mac Special Kernel Function
-reg_t kDoSoundPhantasmagoriaMac(EngineState *s, int argc, reg_t *argv);
+// SCI 2.1 Middle Mac modified kDoSound
+reg_t kDoSoundMac32(EngineState *s, int argc, reg_t *argv);
 
 // SCI3 Kernel functions
 reg_t kPlayDuck(EngineState *s, int argc, reg_t *argv);
diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp
index 321e83d..62fbf13 100644
--- a/engines/sci/engine/ksound.cpp
+++ b/engines/sci/engine/ksound.cpp
@@ -71,13 +71,18 @@ CREATE_DOSOUND_FORWARD(DoSoundSetPriority)
 CREATE_DOSOUND_FORWARD(DoSoundSetLoop)
 
 #ifdef ENABLE_SCI32
-reg_t kDoSoundPhantasmagoriaMac(EngineState *s, int argc, reg_t *argv) {
-	// Phantasmagoria Mac (and seemingly no other game (!)) uses this
-	// cutdown version of kDoSound.
-
+reg_t kDoSoundMac32(EngineState *s, int argc, reg_t *argv) {
+	// Several SCI 2.1 Middle Mac games, but not all, contain a modified kDoSound
+	//  in which all but eleven subops were removed, changing their subop values to
+	//  zero through ten. PQSWAT then restored all of the subops, but kept the new
+	//  subop values that removing caused in the first place, and assigned new
+	//  values to the restored subops. It is the only game that does this and it
+	//  only uses two of them.
 	switch (argv[0].toUint16()) {
 	case 0:
 		return g_sci->_soundCmd->kDoSoundMasterVolume(s, argc - 1, argv + 1);
+	case 1:
+		return g_sci->_soundCmd->kDoSoundGetAudioCapability(s, argc - 1, argv + 1);
 	case 2:
 		return g_sci->_soundCmd->kDoSoundInit(s, argc - 1, argv + 1);
 	case 3:
@@ -86,17 +91,26 @@ reg_t kDoSoundPhantasmagoriaMac(EngineState *s, int argc, reg_t *argv) {
 		return g_sci->_soundCmd->kDoSoundPlay(s, argc - 1, argv + 1);
 	case 5:
 		return g_sci->_soundCmd->kDoSoundStop(s, argc - 1, argv + 1);
+	case 6:
+		return g_sci->_soundCmd->kDoSoundPause(s, argc - 1, argv + 1);
+	case 7:
+		return g_sci->_soundCmd->kDoSoundFade(s, argc - 1, argv + 1);
 	case 8:
 		return g_sci->_soundCmd->kDoSoundSetVolume(s, argc - 1, argv + 1);
 	case 9:
 		return g_sci->_soundCmd->kDoSoundSetLoop(s, argc - 1, argv + 1);
 	case 10:
 		return g_sci->_soundCmd->kDoSoundUpdateCues(s, argc - 1, argv + 1);
+	// PQSWAT only
+	case 12: // kDoSoundRestore
+		return kEmpty(s, argc - 1, argv + 1);
+	case 13:
+		return g_sci->_soundCmd->kDoSoundGetPolyphony(s, argc - 1, argv + 1);
 	default:
 		break;
 	}
 
-	error("Unknown kDoSound Phantasmagoria Mac subop %d", argv[0].toUint16());
+	error("Unknown kDoSoundMac32 subop %d", argv[0].toUint16());
 	return s->r_acc;
 }
 #endif


Commit: ab8cf3d77c212f86cf961fd472c691cc2078eb6a
    https://github.com/scummvm/scummvm/commit/ab8cf3d77c212f86cf961fd472c691cc2078eb6a
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2020-02-07T13:15:43-08:00

Commit Message:
SCI32: Update kCheckDisc kernel signature for Mac

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


diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index 21263d0..bfb84a6 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -404,7 +404,7 @@ static const SciKernelMapSubEntry kBitmap_subops[] = {
 
 //    version,         subId, function-mapping,                    signature,              workarounds
 static const SciKernelMapSubEntry kCD_subops[] = {
-	{ SIG_SINCE_SCI21MID,  0, MAP_CALL(CheckCD),                   "(i)",                  NULL },
+	{ SIG_SINCE_SCI21MID,  0, MAP_CALL(CheckCD),                   "(i)(i)",               NULL },
 	{ SIG_SINCE_SCI21MID,  1, MAP_CALL(GetSavedCD),                "",                     NULL },
 	SCI_SUBOPENTRY_TERMINATOR
 };
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index 53c3988..e60c896 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -206,6 +206,9 @@ reg_t kCD(EngineState *s, int argc, reg_t *argv) {
 }
 
 reg_t kCheckCD(EngineState *s, int argc, reg_t *argv) {
+	// Mac interpreters would display a dialog prompting for the disc.
+	//  kCheckCD took an optional second boolean parameter, which we
+	//  ignore, that affected the dialog's text.
 	const int16 cdNo = argc > 0 ? argv[0].toSint16() : 0;
 
 	if (cdNo) {


Commit: 4b504a578697cd8fdbd879f8294113794cad1938
    https://github.com/scummvm/scummvm/commit/4b504a578697cd8fdbd879f8294113794cad1938
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2020-02-07T13:15:43-08:00

Commit Message:
SCI32: Fix kArrayFill kernel signature

kArray fill always expects 4 parameters. Fixes PHANT1 Mac initialization

Changed paths:
    engines/sci/engine/kernel_tables.h


diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index bfb84a6..7b635bc 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -543,7 +543,7 @@ static const SciKernelMapSubEntry kString_subops[] = {
 	{ SIG_THRU_SCI21MID,   2, MAP_CALL(StringGetChar),             "[r0]i",                NULL },
 	{ SIG_THRU_SCI21MID,   3, MAP_CALL(ArraySetElements),          "ri(i*)",               kArraySetElements_workarounds },
 	{ SIG_THRU_SCI21MID,   4, MAP_CALL(StringFree),                "[r0]",                 NULL },
-	{ SIG_THRU_SCI21MID,   5, MAP_CALL(ArrayFill),                 "rii",                  kArrayFill_workarounds },
+	{ SIG_THRU_SCI21MID,   5, MAP_CALL(ArrayFill),                 "riii",                 kArrayFill_workarounds },
 	{ SIG_THRU_SCI21MID,   6, MAP_CALL(ArrayCopy),                 "ririi",                NULL },
 	{ SIG_SCI32,           7, MAP_CALL(StringCompare),             "[r0][r0](i)",          NULL },
 


Commit: 07827aeb20876c00cf92e25d48881f565a58e711
    https://github.com/scummvm/scummvm/commit/07827aeb20876c00cf92e25d48881f565a58e711
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2020-02-07T13:15:43-08:00

Commit Message:
SCI32: Add PHANT1 Mac kArrayFill workarounds

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


diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index a0dc305..be4b918 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -586,6 +586,16 @@ const SciWorkaroundEntry kArraySetElements_workarounds[] = {
 
 //    gameID,           room,script,lvl,          object-name, method-name, local-call-signature, index-range,   workaround
 const SciWorkaroundEntry kArrayFill_workarounds[] = {
+	// Phantasmagoria Mac calls kArrayFill to zero-initialize new string buffers, but almost
+	//  half of these calls are missing the start-index parameter and so they had no effect.
+	//  Our SCI strings are already zero-initialized and so these calls can be ignored.
+	{ GID_PHANTASMAGORIA, -1,    38,  0,        "SaveManager", "init",                      NULL,     0,     0, { WORKAROUND_IGNORE, 0 } },
+	{ GID_PHANTASMAGORIA, -1,    38,  0,        "SaveManager", "save",                      NULL,     0,     0, { WORKAROUND_IGNORE, 0 } },
+	{ GID_PHANTASMAGORIA, -1,    38,  0,        "SaveManager", "getSaveType",               NULL,     0,     0, { WORKAROUND_IGNORE, 0 } },
+	{ GID_PHANTASMAGORIA, -1,    38,  0,        "SaveManager", "testFlag",                  NULL,     0,     0, { WORKAROUND_IGNORE, 0 } },
+	{ GID_PHANTASMAGORIA, -1,    38,  0,        "SaveManager", "delete",                    NULL,     0,     0, { WORKAROUND_IGNORE, 0 } },
+	{ GID_PHANTASMAGORIA, -1,    90,  0,           "logoRoom", "init",                      NULL,     0,     0, { WORKAROUND_IGNORE, 0 } },
+	{ GID_PHANTASMAGORIA, -1, 45950,  0,            "rm45950", "init",                      NULL,     0,     0, { WORKAROUND_IGNORE, 0 } },
 	{ GID_PQ4,           540, 64918,  0,                "Str", "callKernel",                NULL,     0,     0, { WORKAROUND_STILLCALL, 0 } }, // when clicking on Hate Crimes in the computer on day 2
 	SCI_WORKAROUNDENTRY_TERMINATOR
 };


Commit: 01360d26fe0bdb03b18c1650333fee1baacffe73
    https://github.com/scummvm/scummvm/commit/01360d26fe0bdb03b18c1650333fee1baacffe73
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2020-02-07T13:15:43-08:00

Commit Message:
SCI32: Set PHANT1 Mac video quality to high

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 e1510e3..b6f8045 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -8424,8 +8424,33 @@ static const uint16 phant1Video2020CensorPatch[] = {
 	PATCH_END
 };
 
+// The Mac version is hard-coded to use a low video speed value. This defaults
+//  the video size to half-screen and causes low frame-rate versions of several
+//  videos to play, even though better versions are included. PC versions read
+//  config values written by a benchmark in the game's installer. We address
+//  that by returning a high video speed value of 500 in kGetSierraProfileInt
+//  and kGetConfig, and so we patch the Mac value to 500 as well.
+//
+// Applies to: Mac version only
+// Responsible method: Scary:init
+static const uint16 phant1MacVideoQualitySignature[] = {
+	0x34, SIG_UINT16(0x0190),       // ldi 0190
+	SIG_MAGICDWORD,
+	0xa1, 0xb2,                     // sag b2 [ video speed = 400 ]
+	0x36,                           // push
+	0x34, SIG_UINT16(0x01a9),       // ldi 01a9
+	0x1e,                           // gt?
+	SIG_END
+};
+
+static const uint16 phant1MacVideoQualityPatch[] = {
+	0x34, PATCH_UINT16(0x01f4),     // ldi 01f4 [ 500 ]
+	PATCH_END
+};
+
 //          script, description,                                      signature                        patch
 static const SciScriptPatcherEntry phantasmagoriaSignatures[] = {
+	{  true,     0, "mac: set high video quality",                 1, phant1MacVideoQualitySignature,  phant1MacVideoQualityPatch },
 	{  true,    23, "make cursor red after clicking quit",         1, phant1RedQuitCursorSignature,    phant1RedQuitCursorPatch },
 	{  true,    26, "fix video 1920 censorship",                   1, phant1Video1920CensorSignature,  phant1Video1920CensorPatch },
 	{  true,    26, "fix video 2020 censorship",                   1, phant1Video2020CensorSignature,  phant1Video2020CensorPatch },


Commit: 8f6979234e694af368b520c5b72725cbbb31e382
    https://github.com/scummvm/scummvm/commit/8f6979234e694af368b520c5b72725cbbb31e382
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2020-02-07T13:15:44-08:00

Commit Message:
SCI: Remove unreachable error() from Mac cursor code

Removes a call to error() that can't be reached.
The condition it's attempting to detect is normal and not an error.

Changed paths:
    engines/sci/graphics/cursor32.cpp


diff --git a/engines/sci/graphics/cursor32.cpp b/engines/sci/graphics/cursor32.cpp
index 46fce8e..8ba35e1 100644
--- a/engines/sci/graphics/cursor32.cpp
+++ b/engines/sci/graphics/cursor32.cpp
@@ -206,9 +206,6 @@ void GfxCursor32::setView(const GuiResourceId viewId, const int16 loopNo, const
 				viewNum = (i + 1) * 0x100 + loopNo * 0x10 + celNo;
 				break;
 			}
-
-			if (i == _macCursorRemap.size())
-				error("Unmatched Mac cursor %d", viewNum);
 		}
 
 		_cursorInfo.resourceId = viewNum;




More information about the Scummvm-git-logs mailing list