[Scummvm-git-logs] scummvm master -> 0c06708053784f0cbefb0ad7e15803c0de348154

sluicebox noreply at scummvm.org
Fri Jan 26 21:54:42 UTC 2024


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

Summary:
d4a3c8c1c2 AGI: Fix Manhunter 2 Amiga emulated version
15819e0686 AGI: Use correct Amiga platform value
0c06708053 AGI: Fix opcode table version detection


Commit: d4a3c8c1c21fe3b6dae9b11de3ad4ace583fabb4
    https://github.com/scummvm/scummvm/commit/d4a3c8c1c21fe3b6dae9b11de3ad4ace583fabb4
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-01-26T13:34:53-08:00

Commit Message:
AGI: Fix Manhunter 2 Amiga emulated version

Fixes the hold.key opcode being parsed incorrectly

Changed paths:
    engines/agi/detection_tables.h


diff --git a/engines/agi/detection_tables.h b/engines/agi/detection_tables.h
index 207c39e98a3..b0c3bcd7188 100644
--- a/engines/agi/detection_tables.h
+++ b/engines/agi/detection_tables.h
@@ -651,7 +651,7 @@ static const AGIGameDescription gameDescriptions[] = {
 	GAME3_P("mh2", "1.0 1989-07-29", "mh2dir", "5e3581495708b952fea24438a6c7e040", 0x3149, 0, GID_MH1, Common::kPlatformAtariST),
 
 	// Manhunter SF (Amiga) 3.06 8/17/89        # 2.333
-	GAME3_PSO("mh2", "3.06 1989-08-17", "dirs", "b412e8a126368b76696696f7632d4c16", 2573, 0x3086, GF_OLDAMIGAV20, GID_MH2, Common::kPlatformAmiga, GAMEOPTIONS_AMIGA),
+	GAME3_PSO("mh2", "3.06 1989-08-17", "dirs", "b412e8a126368b76696696f7632d4c16", 2573, 0x3149, GF_OLDAMIGAV20, GID_MH2, Common::kPlatformAmiga, GAMEOPTIONS_AMIGA),
 
 	// Manhunter SF (PC 5.25") 3.02 5.25\"" [AGI 3.002.149]
 	GAME3("mh2", "3.02 1989-07-26 5.25\"", "mh2dir", "bbb2c2f88d5740f7437fb7aa6f080b7b", 0x3149, GID_MH2),


Commit: 15819e0686e09347b33eb42f75c90445e0f166da
    https://github.com/scummvm/scummvm/commit/15819e0686e09347b33eb42f75c90445e0f166da
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-01-26T13:34:53-08:00

Commit Message:
AGI: Use correct Amiga platform value

The correct value for variable 20 on Amiga interpreters is always 5.

Confirmed in the Amiga scripts for SQ1, MH1, and MH2. These games all
expect variable 20 to have a value of 5, just like all Amiga games.

Fixes Amiga menus and help text not appearing, and other details.

Note that this fix exposes another bug which now prevents the Amiga
Manhunter games from starting: the opcode table is wrong for these
versions. This also prevents the Atari ST version of MH1 from starting.
Fixed in next commit.

Changed paths:
    engines/agi/agi.h
    engines/agi/cycle.cpp
    engines/agi/detection_tables.h


diff --git a/engines/agi/agi.h b/engines/agi/agi.h
index 3f3aa6426a3..bf04298909f 100644
--- a/engines/agi/agi.h
+++ b/engines/agi/agi.h
@@ -115,18 +115,13 @@ enum AgiGameType {
 	GType_V3 = 3
 };
 
-//
-// GF_OLDAMIGAV20 means that the interpreter is an old Amiga AGI interpreter that
-// uses value 20 for the computer type (v20 i.e. vComputer) rather than the usual value 5.
-//
 enum AgiGameFeatures {
 	GF_AGIMOUSE    = (1 << 0), // this disables "Click-to-walk mouse interface"
 	GF_AGDS        = (1 << 1),
 	GF_AGI256      = (1 << 2), // marks fanmade AGI-256 games
 	GF_FANMADE     = (1 << 3), // marks fanmade games
-	GF_OLDAMIGAV20 = (1 << 4),
 	GF_2GSOLDSOUND = (1 << 5),
-	GF_EXTCHAR = (1 << 6) // use WORDS.TOK.EXTENDED
+	GF_EXTCHAR     = (1 << 6)  // use WORDS.TOK.EXTENDED
 };
 
 enum BooterDisks {
@@ -284,31 +279,12 @@ enum AgiMonitorType {
 /**
  * Different computer types.
  * Used with AGI variable 20 i.e. vComputer.
- *
- * At least these Amiga AGI versions use value 5:
- * 2.082 (King's Quest I v1.0U 1986)
- * 2.090 (King's Quest III v1.01 1986-11-08)
- * x.yyy (Black Cauldron v2.00 1987-06-14)
- * x.yyy (Larry I v1.05 1987-06-26)
- * 2.107 (King's Quest II v2.0J. Date is probably 1987-01-29)
- * 2.202 (Space Quest II v2.0F)
- * 2.310 (Police Quest I v2.0B 1989-02-22)
- * 2.316 (Gold Rush! v2.05 1989-03-09)
- * 2.328 (Mixed-Up Mother Mother Goose v1.1)
- * 2.333 (King's Quest III v2.15 1989-11-15)
- *
- * At least these Amiga AGI versions use value 20:
- * 2.082 (Space Quest I v1.2 1986)
- * x.yyy (Manhunter NY 1.06 3/18/89)
- * 2.333 (Manhunter SF 3.06 8/17/89)
- *
  */
 enum AgiComputerType {
 	kAgiComputerPC = 0,
 	kAgiComputerAtariST = 4,
-	kAgiComputerAmiga = 5, // Newer Amiga AGI interpreters' value (Commonly used)
-	kAgiComputerApple2GS = 7,
-	kAgiComputerAmigaOld = 20 // Older Amiga AGI interpreters' value (Seldom used)
+	kAgiComputerAmiga = 5,
+	kAgiComputerApple2GS = 7
 };
 
 enum AgiSoundType {
diff --git a/engines/agi/cycle.cpp b/engines/agi/cycle.cpp
index f8927c404b4..78a72beca8e 100644
--- a/engines/agi/cycle.cpp
+++ b/engines/agi/cycle.cpp
@@ -488,10 +488,7 @@ int AgiEngine::runGame() {
 			setVar(VM_VAR_SOUNDGENERATOR, kAgiSoundPC);
 			break;
 		case Common::kPlatformAmiga:
-			if (getFeatures() & GF_OLDAMIGAV20)
-				setVar(VM_VAR_COMPUTER, kAgiComputerAmigaOld);
-			else
-				setVar(VM_VAR_COMPUTER, kAgiComputerAmiga);
+			setVar(VM_VAR_COMPUTER, kAgiComputerAmiga);
 			setVar(VM_VAR_SOUNDGENERATOR, kAgiSoundTandy);
 			break;
 		case Common::kPlatformApple2GS:
diff --git a/engines/agi/detection_tables.h b/engines/agi/detection_tables.h
index b0c3bcd7188..ab31c82eeb6 100644
--- a/engines/agi/detection_tables.h
+++ b/engines/agi/detection_tables.h
@@ -614,7 +614,7 @@ static const AGIGameDescription gameDescriptions[] = {
 	GAME3_P("mh1", "2.0E 1988-10-05 (CE)", "mhdir", "2f1509f76f24e6e7d213f2dadebbf156", 0x3149, 0, GID_MH1, Common::kPlatformApple2GS),
 
 	// Manhunter NY (Amiga) 1.06 3/18/89 # 2.328
-	GAME3_PO("mh1", "1.06 1989-03-18", "dirs", "92c6183042d1c2bb76236236a7d7a847", 0x3149, GF_OLDAMIGAV20, GID_MH1, Common::kPlatformAmiga, GAMEOPTIONS_AMIGA),
+	GAME3_PO("mh1", "1.06 1989-03-18", "dirs", "92c6183042d1c2bb76236236a7d7a847", 0x3149, 0, GID_MH1, Common::kPlatformAmiga, GAMEOPTIONS_AMIGA),
 
 	// reported by Filippos (thebluegr) in bugreport #3048
 	// Manhunter NY (PC 5.25") 1.22 8/31/88 [AGI 3.002.107]
@@ -651,7 +651,7 @@ static const AGIGameDescription gameDescriptions[] = {
 	GAME3_P("mh2", "1.0 1989-07-29", "mh2dir", "5e3581495708b952fea24438a6c7e040", 0x3149, 0, GID_MH1, Common::kPlatformAtariST),
 
 	// Manhunter SF (Amiga) 3.06 8/17/89        # 2.333
-	GAME3_PSO("mh2", "3.06 1989-08-17", "dirs", "b412e8a126368b76696696f7632d4c16", 2573, 0x3149, GF_OLDAMIGAV20, GID_MH2, Common::kPlatformAmiga, GAMEOPTIONS_AMIGA),
+	GAME3_PSO("mh2", "3.06 1989-08-17", "dirs", "b412e8a126368b76696696f7632d4c16", 2573, 0x3149, 0, GID_MH2, Common::kPlatformAmiga, GAMEOPTIONS_AMIGA),
 
 	// Manhunter SF (PC 5.25") 3.02 5.25\"" [AGI 3.002.149]
 	GAME3("mh2", "3.02 1989-07-26 5.25\"", "mh2dir", "bbb2c2f88d5740f7437fb7aa6f080b7b", 0x3149, GID_MH2),
@@ -758,7 +758,7 @@ static const AGIGameDescription gameDescriptions[] = {
 
 	// Space Quest 1 (Amiga) 1.2            # 2.082
 	// The original game did not have menus, they are enabled under ScummVM
-	GAME_FPO("sq1", "1.2 1986", "0b216d931e95750f1f4837d6a4b821e5", 0x2440, GF_OLDAMIGAV20, GID_SQ1, Common::kPlatformAmiga, GAMEOPTIONS_AMIGA),
+	GAME_FPO("sq1", "1.2 1986", "0b216d931e95750f1f4837d6a4b821e5", 0x2440, 0, GID_SQ1, Common::kPlatformAmiga, GAMEOPTIONS_AMIGA),
 
 	// Space Quest 1 (Mac) 1.5D
 	GAME_P("sq1", "1.5D 1987-04-02", "ce88419aadd073d1c6682d859b3d8aa2", 0x2440, GID_SQ1, Common::kPlatformMacintosh),


Commit: 0c06708053784f0cbefb0ad7e15803c0de348154
    https://github.com/scummvm/scummvm/commit/0c06708053784f0cbefb0ad7e15803c0de348154
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-01-26T13:34:53-08:00

Commit Message:
AGI: Fix opcode table version detection

- Fixes Manhunter 1 Amiga / Atari ST not starting
- Fixes Manhunter 2 Amiga not starting
- Fixes Gold Rush Atari ST
- Fixes King's Quest IV Apple IIGS
- Fixes Black Cauldron Apple IIGS
- Uses original opcode name: get.mse.posn (from GR Amiga)

Changed paths:
    engines/agi/op_cmd.cpp
    engines/agi/opcodes.cpp
    engines/agi/opcodes.h


diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp
index 10afc08d3c0..1e023b73c46 100644
--- a/engines/agi/op_cmd.cpp
+++ b/engines/agi/op_cmd.cpp
@@ -1115,9 +1115,10 @@ void cmdAdjEgoMoveToXY(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
 	int8 x, y;
 
 	switch (opCodeTable[182].parameterSize) {
-	// The 2 arguments version is used at least in Amiga Gold Rush!
-	// (v2.05 1989-03-09, Amiga AGI 2.316) in logics 130 and 150
-	// (Using arguments (0, 0), (0, 7), (0, 8), (9, 9) and (-9, 9)).
+	// The 2 parameter version is used in:
+	// Amiga/Atari ST Gold Rush!   - Logic 130, 150
+	// Amiga/Atari ST Manhunter 1  - Logic 0
+	// Amiga Manhunter 2           - Logic 0
 	case 2:
 		// Both arguments are signed 8-bit (i.e. in range -128 to +127).
 		x = (int8) parameter[0];
@@ -2272,7 +2273,7 @@ void cmdSetPriBase(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
 	state->_vm->_gfx->setPriorityTable(priorityBase);
 }
 
-void cmdMousePosn(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
+void cmdGetMousePosn(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
 	uint16 destVarNr1 = parameter[0];
 	uint16 destVarNr2 = parameter[1];
 	int16 mouseX = vm->_mouse.pos.x;
diff --git a/engines/agi/opcodes.cpp b/engines/agi/opcodes.cpp
index 43c8a17b295..7814b87836b 100644
--- a/engines/agi/opcodes.cpp
+++ b/engines/agi/opcodes.cpp
@@ -24,6 +24,13 @@
 
 namespace Agi {
 
+// FIXME: The parameter strings in the opcode table have mistakes.
+// Nothing depends on the values of the individual characters.
+// Some are out of sync with how the opcode function interprets
+// the parameter. Only the string lengths are used to indicate
+// the parameter count for parsing.
+// Consult the opcode functions for the real parameter types.
+
 const AgiOpCodeDefinitionEntry opCodesV1Cond[] = {
 	{ "",                   "",         &condUnknown },     // 00
 	{ "equaln",             "vn",       &condEqual },       // 01
@@ -345,13 +352,13 @@ AgiOpCodeDefinitionEntry opCodesV2[] = {
 	{ "hold.key",           "",         &cmdHoldKey },          // AD
 	{ "set.pri.base",       "n",        &cmdSetPriBase },       // AE AGI2.936+ *AND* also inside AGI2.425
 	{ "discard.sound",      "n",        &cmdDiscardSound },     // AF was skip for PC
-	{ "hide.mouse",         "",         &cmdHideMouse },        // B0 1 arg for AGI version 3.002.086 AGI3+ only starts here
+	{ "hide.mouse",         "",         &cmdHideMouse },        // B0 1 arg for AGI3 Apple IIGS and AGI 3.002.086. AGI3+ only starts here
 	{ "allow.menu",         "n",        &cmdAllowMenu },        // B1
-	{ "show.mouse",         "",         &cmdShowMouse },        // B2
+	{ "show.mouse",         "",         &cmdShowMouse },        // B2 1 arg for AGI3 Apple IIGS
 	{ "fence.mouse",        "nnnn",     &cmdFenceMouse },       // B3
-	{ "mouse.posn",         "vv",       &cmdMousePosn },        // B4
-	{ "release.key",        "",         &cmdReleaseKey },       // B5 2 args for at least the Amiga GR (v2.05 1989-03-09) using AGI 2.316
-	{ "adj.ego.move.to.xy", "",         &cmdAdjEgoMoveToXY }    // B6
+	{ "get.mse.posn",       "vv",       &cmdGetMousePosn },     // B4
+	{ "release.key",        "",         &cmdReleaseKey },       // B5
+	{ "adj.ego.move.to.x.y","",         &cmdAdjEgoMoveToXY }    // B6 2 args for Amiga/Atari ST GR, MH1, MH2
 };
 
 //
@@ -402,9 +409,10 @@ void AgiEngine::setupOpCodes(uint16 version) {
 		if (version == 0x2089)
 			_opCodes[0x86].parameters = "";
 
-		// 'print.at' and 'print.at.v' take 3 args before 2.089.
-		// This is documented in the specs as only < 2.440, but
-		// SQ1 1.0X (2.089) and KQ3 (2.272) take 4 args. Bug #10872
+		// 'print.at' and 'print.at.v' take three parameters before 2.089.
+		// This is documented in the specs as only < 2.440, but SQ1 1.0X (2.089)
+		// and KQ3 (2.272) take four. Bug #10872. No game scripts have been
+		// discovered that call either opcode with only three parameters.
 		if (version < 0x2089) {
 			_opCodes[0x97].parameters = "vvv";
 			_opCodes[0x98].parameters = "vvv";
@@ -413,32 +421,36 @@ void AgiEngine::setupOpCodes(uint16 version) {
 
 	if (version >= 0x3000) {
 		// AGI3 adjustments
-		// 'unknown176' takes 1 arg for 3.002.086, not 0 args.
-		// 'unknown173' also takes 1 arg for 3.002.068, not 0 args.
-		// Is this actually used anywhere? -- dsymonds
+
+		// hide.mouse and hide.key take 1 parameter for 3.002.086.
+		// KQ4 is the only known game with this interpreter and
+		// its scripts do not call either opcode. no game scripts
+		// have been discovered that call hold.key with 1 parameter.
 		if (version == 0x3086) {
-			_opCodes[0xb0].parameters = "n";
-			_opCodes[0xad].parameters = "n";
+			_opCodes[0xb0].parameters = "n"; // hide.mouse
+			_opCodes[0xad].parameters = "n"; // hold.key
 		}
-	}
 
-	// TODO: This could be either turned into a game feature, or a version
-	// specific check, instead of a game version check
-	// The Apple IIGS versions of MH1 and Goldrush both have a parameter for
-	// show.mouse and hide.mouse. Fixes bugs #6161 and #5885.
-	if ((getGameID() == GID_MH1 || getGameID() == GID_GOLDRUSH) &&
-	        getPlatform() == Common::kPlatformApple2GS) {
-		_opCodes[176].parameters = "n";  // hide.mouse
-		_opCodes[178].parameters = "n";  // show.mouse
-	}
+		// hide.mouse and show.mouse take 1 parameter on Apple IIGS.
+		// Used by Black Cauldron, Gold Rush, King's Quest IV, and Manhunter 1.
+		// Fixes bugs #6161 and #5885.
+		if (getPlatform() == Common::kPlatformApple2GS) {
+			_opCodes[0xb0].parameters = "n";  // hide.mouse
+			_opCodes[0xb2].parameters = "n";  // show.mouse
+		}
 
-	// FIXME: Apply this fix to other games also that use 2 arguments for command 182.
-	// 'adj.ego.move.to.x.y' (i.e. command 182) takes 2 arguments for at least the
-	// Amiga Gold Rush! (v2.05 1989-03-09) using Amiga AGI 2.316. Amiga's Gold Rush
-	// has been set to use AGI 3.149 in ScummVM so that's why this initialization is
-	// here and not in setupV2Game.
-	if (getGameID() == GID_GOLDRUSH && getPlatform() == Common::kPlatformAmiga)
-		_opCodes[182].parameters = "vv";
+		// adj.ego.move.to.x.y takes two parameters for Amiga/Atari ST
+		// versions of Gold Rush, Manhunter 1, and Manhunter 2.
+		// No scripts have been discovered that call adj.ego.move.to.x.y
+		// with zero parameters.
+		if ((getGameID() == GID_GOLDRUSH ||
+			 getGameID() == GID_MH1 ||
+			 getGameID() == GID_MH2) &&
+			(getPlatform() == Common::kPlatformAmiga ||
+			 getPlatform() == Common::kPlatformAtariST)) {
+			_opCodes[0xb6].parameters = "vv";
+		}
+	}
 
 	// add invalid entries for every opcode, that is not defined at all
 	for (int opCodeNr = opCodesTableSize; opCodeNr < ARRAYSIZE(_opCodes); opCodeNr++) {
diff --git a/engines/agi/opcodes.h b/engines/agi/opcodes.h
index 9ea5e5d3291..af1d616e1a8 100644
--- a/engines/agi/opcodes.h
+++ b/engines/agi/opcodes.h
@@ -216,7 +216,7 @@ void cmdHideMouse(AgiGame *state, AgiEngine *vm, uint8 *p); // 0xb0
 void cmdAllowMenu(AgiGame *state, AgiEngine *vm, uint8 *p);
 void cmdShowMouse(AgiGame *state, AgiEngine *vm, uint8 *p);
 void cmdFenceMouse(AgiGame *state, AgiEngine *vm, uint8 *p);
-void cmdMousePosn(AgiGame *state, AgiEngine *vm, uint8 *p);
+void cmdGetMousePosn(AgiGame *state, AgiEngine *vm, uint8 *p);
 void cmdReleaseKey(AgiGame *state, AgiEngine *vm, uint8 *p);
 void cmdAdjEgoMoveToXY(AgiGame *state, AgiEngine *vm, uint8 *p);
 




More information about the Scummvm-git-logs mailing list