[Scummvm-git-logs] scummvm master -> 9d605801f08d10695fa36b95c54a559d4fa4832c

sluicebox noreply at scummvm.org
Wed Jun 19 22:32:27 UTC 2024


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

Summary:
241910af57 SCI: Minor resource code cleanup
039069e803 SCI: Replace ECO2 workaround with script patch
e6273f2fda SCI32: Set HOYLE5 floppy edition as unsupported
9d605801f0 SCI32: Fix HOYLE5 volume sync on variants


Commit: 241910af5762e3fe69364e9f49673003a868636d
    https://github.com/scummvm/scummvm/commit/241910af5762e3fe69364e9f49673003a868636d
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-06-19T16:26:34-06:00

Commit Message:
SCI: Minor resource code cleanup

Changed paths:
    engines/sci/resource/resource.cpp
    engines/sci/resource/resource.h


diff --git a/engines/sci/resource/resource.cpp b/engines/sci/resource/resource.cpp
index 442eb5722e7..6695890ee4f 100644
--- a/engines/sci/resource/resource.cpp
+++ b/engines/sci/resource/resource.cpp
@@ -630,7 +630,7 @@ Resource *ResourceManager::testResource(const ResourceId &id) const {
 	return _resMap.getValOrDefault(id, NULL);
 }
 
-int ResourceManager::addAppropriateSources() {
+void ResourceManager::addAppropriateSources() {
 #ifdef ENABLE_SCI32
 	_multiDiscAudio = false;
 #endif
@@ -676,7 +676,7 @@ int ResourceManager::addAppropriateSources() {
 		SearchMan.listMatchingMembers(files, "ressci.0##");
 
 		if (mapFiles.empty() || files.empty())
-			return 0;
+			return;
 
 		if (Common::File::exists("ressci.001") && !Common::File::exists("resource.aud")) {
 			_multiDiscAudio = true;
@@ -718,7 +718,7 @@ int ResourceManager::addAppropriateSources() {
 	}
 #else
 	} else
-		return 0;
+		return;
 #endif
 
 	addPatchDir(".");
@@ -740,17 +740,15 @@ int ResourceManager::addAppropriateSources() {
 		}
 	}
 #endif
-
-	return 1;
 }
 
-int ResourceManager::addAppropriateSourcesForDetection(const Common::FSList &fslist) {
+void ResourceManager::addAppropriateSourcesForDetection(const Common::FSList &fslist) {
 	ResourceSource *map = nullptr;
 	Common::Array<ResourceSource *> sci21Maps;
 
 #ifdef ENABLE_SCI32
-	ResourceSource *sci21PatchMap = 0;
-	const Common::FSNode *sci21PatchRes = 0;
+	ResourceSource *sci21PatchMap = nullptr;
+	const Common::FSNode *sci21PatchRes = nullptr;
 	_multiDiscAudio = false;
 #endif
 
@@ -787,7 +785,7 @@ int ResourceManager::addAppropriateSourcesForDetection(const Common::FSList &fsl
 	}
 
 	if (!map && sci21Maps.empty())
-		return 0;
+		return;
 
 #ifdef ENABLE_SCI32
 	if (sci21PatchMap && sci21PatchRes)
@@ -818,8 +816,6 @@ int ResourceManager::addAppropriateSourcesForDetection(const Common::FSList &fsl
 
 	// This function is only called by the advanced detector, and we don't really need
 	// to add a patch directory or message.map here
-
-	return 1;
 }
 
 void ResourceManager::addScriptChunkSources() {
diff --git a/engines/sci/resource/resource.h b/engines/sci/resource/resource.h
index d0d6a991723..04aa9e2000d 100644
--- a/engines/sci/resource/resource.h
+++ b/engines/sci/resource/resource.h
@@ -218,7 +218,7 @@ public:
 		output += intToBase36(getNumber(), 3);                     // Map
 		output += intToBase36(getTuple() >> 24, 2);                // Noun
 		output += intToBase36((getTuple() >> 16) & 0xff, 2);       // Verb
-		output += '.';                                                   // Separator
+		output += '.';                                             // Separator
 		output += intToBase36((getTuple() >> 8) & 0xff, 2);        // Cond
 		output += intToBase36(getTuple() & 0xff, 1);               // Seq
 
@@ -357,12 +357,12 @@ public:
 	/**
 	 * Adds all of the resource files for a game
 	 */
-	int addAppropriateSources();
+	void addAppropriateSources();
 
 	/**
 	 * Similar to the function above, only called from the fallback detector
 	 */
-	int addAppropriateSourcesForDetection(const Common::FSList &fslist);	// TODO: Switch from FSList to Common::Archive?
+	void addAppropriateSourcesForDetection(const Common::FSList &fslist);	// TODO: Switch from FSList to Common::Archive?
 
 	/**
 	 * Looks up a resource's data.


Commit: 039069e803bb546d4fe043026a6a807164a67e80
    https://github.com/scummvm/scummvm/commit/039069e803bb546d4fe043026a6a807164a67e80
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-06-19T16:31:36-06:00

Commit Message:
SCI: Replace ECO2 workaround with script patch

The workaround fixed the crash in the first scene, but the underlying
script bug still corrupted global variables

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


diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 08cc6e0f020..173e09b85b0 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -1619,6 +1619,45 @@ static const uint16 ecoquest2PatchIconBarTutorial[] = {
 	PATCH_END
 };
 
+// When awarding points, the game often corrupts a random global variable.
+//  Rain:points takes an optional second parameter as the points flag to test.
+//  Instead of testing the parameter count before setting the flag, the script
+//  tests the parameter even if it doesn't exist. If the undefined value on the
+//  stack happens to be non-zero then the game treats it as a flag and attempts
+//  to set it. If the value is an object then this causes an arithmetic error,
+//  such as when clicking the passport on the customs officer, otherwise the
+//  "flag" is set and a global is altered.
+//
+// We fix this by testing the parameter count as the other points methods do.
+//
+// Applies to: All versions
+// Responsible method: Rain:points
+// Fixes bugs: #4939, #5750
+static const uint16 ecoquest2SignaturePointsFlag[] = {
+	SIG_MAGICDWORD,
+	0x87, 0x02,                         // lap 02 [ flag ]
+	0x31, 0x06,                         // bnt 06
+	0x78,                               // push1
+	0x36,                               // push
+	0x40, SIG_ADDTOOFFSET(+2), 0x02,    // call set-flag 02
+	0x8f, 0x01,                         // lsp 01 [ points (never negative) ]
+	0x35, 0x00,                         // ldi 00
+	0x1e,                               // gt?    [ points > 0 ]
+	SIG_END
+};
+
+static const uint16 ecoquest2PatchPointsFlag[] = {
+	0x78,                               // push1
+	0x87, 0x00,                         // lap 00 [ argc ]
+	0x22,                               // lt?    [ 1 < argc ]
+	0x31, 0x07,                         // bnt 07
+	0x78,                               // push1
+	0x8f, 0x02,                         // lsp 02 [ flag ]
+	0x40, PATCH_GETORIGINALUINT16ADJUST(7, -3), 0x02, // call set-flag 02
+	0x87, 0x01,                         // lap 01 [ points (never negative) ]
+	PATCH_END
+};
+
 // The electronic organizer and password paper reappear in room 500 after they
 //  fall into the water when entering the canoe. rm500:init only tests if these
 //  items are in inventory. It should have also tested the canoe flag like room
@@ -1786,6 +1825,7 @@ static const uint16 ecoquest2PatchCampMessages2[] = {
 //          script, description,                                        signature                          patch
 static const SciScriptPatcherEntry ecoquest2Signatures[] = {
 	{  true,     0, "icon bar tutorial",                            10, ecoquest2SignatureIconBarTutorial, ecoquest2PatchIconBarTutorial },
+	{  true,     0, "points flag",                                   1, ecoquest2SignaturePointsFlag,      ecoquest2PatchPointsFlag },
 	{  true,    10, "disable speed test",                            1, sci11SpeedTestSignature,           sci11SpeedTestPatch},
 	{  true,    50, "initial text not removed on ecorder",           3, ecoquest2SignatureEcorder,         ecoquest2PatchEcorder },
 	{  true,   333, "initial text not removed on ecorder tutorial",  3, ecoquest2SignatureEcorderTutorial, ecoquest2PatchEcorderTutorial },
diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index e2703528912..66fc876c58c 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -54,29 +54,9 @@ static const uint16 sig_arithmetic_camelot_1[] = {
 	SIG_END
 };
 
-//                Game: Eco Quest 2
-//      Calling method: Rain::points
-//   Subroutine offset: English 0x0cc6, French/Spanish 0x0ce0 (script 0)
-// Applies to at least: English/French/Spanish PC floppy
-static const uint16 sig_arithmetic_ecoq2_1[] = {
-	0x8f, 0x01,                      // lsp param[1]
-	0x35, 0x10,                      // ldi 10h
-	0x08,                            // div
-	0x99, 0x6e,                      // lsgi global[6Eh]
-	0x38, SIG_UINT16(0x8000),        // pushi 8000h
-	0x8f, 0x01,                      // lsp param[1]
-	0x35, 0x10,                      // ldi 10h
-	0x0a,                            // mod
-	0x0c,                            // shr
-	0x14,                            // or
-	0x36,                            // push
-	SIG_END
-};
-
 //    gameID,           room,script,lvl,          object-name, method-name,       local-call-signature, index-range,   workaround
 const SciWorkaroundEntry arithmeticWorkarounds[] = {
 	{ GID_CAMELOT,         92,   92,  0,     "endingCartoon2", "changeState", sig_arithmetic_camelot_1,     0,     0, { WORKAROUND_FAKE,   0 } }, // op_lai: during the ending, sub gets called with no parameters, uses parameter 1 which is theGrail in this case - bug #5237
-	{ GID_ECOQUEST2,      100,    0,  0,               "Rain", "points",        sig_arithmetic_ecoq2_1,     0,     0, { WORKAROUND_FAKE,   0 } }, // op_or: when giving the papers to the customs officer, gets called against a pointer instead of a number - bug #4939, Spanish version - bug #5750
 	{ GID_FANMADE,        516,  983,  0,             "Wander", "setTarget",                    nullptr,     0,     0, { WORKAROUND_FAKE,   0 } }, // op_mul: The Legend of the Lost Jewel Demo (fan made): called with object as second parameter when attacked by insects - bug #5124
 	{ GID_FANMADE,         -1,  935,  0,             "Scaler", "init",                         nullptr,     0,     0, { WORKAROUND_FAKE,   0 } }, // op_mul: Zork: The Great Underground Empire (fan made): called with object as second parameter when changing rooms
 	{ GID_GK1,            800,64992,  0,                "Fwd", "doit",                         nullptr,     0,     0, { WORKAROUND_FAKE,   1 } }, // op_gt: when Mosely finds Gabriel and Grace near the end of the game, compares the Grooper object with 7


Commit: e6273f2fdae3e36de0b107243e0deeb0dbe6cb64
    https://github.com/scummvm/scummvm/commit/e6273f2fdae3e36de0b107243e0deeb0dbe6cb64
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-06-19T16:31:36-06:00

Commit Message:
SCI32: Set HOYLE5 floppy edition as unsupported

Changed paths:
    engines/sci/detection_tables.h


diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h
index 2c44a80f1e8..ba1385917bb 100644
--- a/engines/sci/detection_tables.h
+++ b/engines/sci/detection_tables.h
@@ -1410,15 +1410,28 @@ static const struct ADGameDescription SciGameDescriptions[] = {
 		{"resmap.000", 0, "daf64a91344a7934fe4374765267c2af", 5767},
 		AD_LISTEND},
 		Common::EN_ANY, Common::kPlatformWindows, ADGF_DROPPLATFORM, GUIO_HOYLE5_SAVELOAD },
+		
+	// Hoyle 5 (Hoyle Classic Games for Laptops) - Windows
+	// File date: 1995.11.04
+	// This version is unsupported because it is missing the main menu resources and will crash.
+	// Each card game was launched by a Windows shortcut that passed a config file to the interpreter
+	// via the command line. Each config file provided a card game room and skipped the main menu.
+	{"hoyle5", _s("Game does not contain menu resources"), {
+		{"resmap.000", 0, "000fd106aa6c5eb1d15a76fd2416677a", 4213},
+		{"ressci.000", 0, "ca50cf09f80a5f982a965afea852cc42", 3279020},
+		AD_LISTEND},
+		Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSUPPORTED | ADGF_DROPPLATFORM, GUIO_HOYLE5_SAVELOAD },
 
 	// Hoyle 5 (Hoyle Classic Games for Laptops) - Windows
-	// SCI 2.100.002
-	// Reported by misterhands in bug Trac #10676
-	{"hoyle5", "", {
-		{"ressci.000", 0, "ca50cf09f80a5f982a965afea852cc42", 3278849},
+	// File date: 1995.11.21
+	// This versi on is unsupported because it is missing the main menu resources and will crash.
+	// Each card game was launched by a Windows shortcut that passed a config file to the interpreter
+	// via the command line. Each config file provided a card game room and skipped the main menu.
+	{"hoyle5", _s("Game does not contain menu resources"), {
 		{"resmap.000", 0, "d5eef6f2529313e950c4d78251a95b1e", 4213},
+		{"ressci.000", 0, "ca50cf09f80a5f982a965afea852cc42", 3278849},
 		AD_LISTEND},
-		Common::EN_ANY, Common::kPlatformWindows, ADGF_DROPPLATFORM, GUIO_HOYLE5_SAVELOAD },
+		Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSUPPORTED | ADGF_DROPPLATFORM, GUIO_HOYLE5_SAVELOAD },
 
 	// Hoyle Bridge - Windows
 	{"hoyle5bridge", "", {


Commit: 9d605801f08d10695fa36b95c54a559d4fa4832c
    https://github.com/scummvm/scummvm/commit/9d605801f08d10695fa36b95c54a559d4fa4832c
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-06-19T16:31:36-06:00

Commit Message:
SCI32: Fix HOYLE5 volume sync on variants

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


diff --git a/engines/sci/engine/features.cpp b/engines/sci/engine/features.cpp
index 8eeae5cde1f..2ecf52b7e37 100644
--- a/engines/sci/engine/features.cpp
+++ b/engines/sci/engine/features.cpp
@@ -586,7 +586,6 @@ bool GameFeatures::audioVolumeSyncUsesGlobals() const {
 	switch (g_sci->getGameId()) {
 	case GID_GK1:
 	case GID_GK2:
-	case GID_HOYLE5:
 	case GID_LSL6:
 	case GID_LSL6HIRES:
 	case GID_LSL7:
@@ -595,6 +594,9 @@ bool GameFeatures::audioVolumeSyncUsesGlobals() const {
 	case GID_RAMA:
 	case GID_TORIN:
 		return true;
+	case GID_HOYLE5:
+		// Hoyle school house math does not use a volume global
+		return !g_sci->getResMan()->testResource(ResourceId(kResourceTypeView, 21));
 	default:
 		return false;
 	}
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 173e09b85b0..afc213d4607 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -2811,6 +2811,7 @@ static const uint16 hoyle5PatchHeartsStrategy[] = {
 
 //          script, description,                                      signature                         patch
 static const SciScriptPatcherEntry hoyle5Signatures[] = {
+	{  true,     0, "disable volume reset on startup",             1, sci2VolumeResetSignature,         sci2VolumeResetPatch },
 	{  true,     3, "remove kGetTime spin",                        1, hoyle5SignatureSpinLoop,          hoyle5PatchSpinLoop },
 	{  true,    23, "remove kGetTime spin",                        1, hoyle5SignatureSpinLoop,          hoyle5PatchSpinLoop },
 	{  true,   200, "fix setScale calls",                         11, hoyle5SetScaleSignature,          hoyle5PatchSetScale },




More information about the Scummvm-git-logs mailing list