[Scummvm-git-logs] scummvm master -> 365dde1e5dd72e65189634d0748dbfcd54067dbb

csnover csnover at users.noreply.github.com
Thu Jul 27 05:43:43 CEST 2017


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:
14907039fe SCI32: Fix lofsa/lofss of strings in SCI3 disassembly
4357809ce8 SCI32: Fix truncated save game names in Phant2
85194cdf75 SCI32: Patch bad version retrieval in Phant2
8adb91038f SCI32: Dummy SCI3 bitmap calls to discover possible usage
dc597dc7a8 SCI32: Patch spin loop in Phant2 puzzle
655c5973fd SCI32: Add kMinimize to stop unmapped function warning
365dde1e5d SCI32: Reduce priority of PATCHES directory for Phant2


Commit: 14907039fe092e0ee5ac8176480ca08803cd82c2
    https://github.com/scummvm/scummvm/commit/14907039fe092e0ee5ac8176480ca08803cd82c2
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-07-26T22:02:37-05:00

Commit Message:
SCI32: Fix lofsa/lofss of strings in SCI3 disassembly

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


diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index 545aae6..1b3f186 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -271,7 +271,11 @@ reg_t disassemble(EngineState *s, reg32_t pos, const Object *obj, bool printBWTa
 			reg_t addr;
 			addr.setSegment(retval.getSegment());
 			addr.setOffset(offset);
-			debugN("\t%s", s->_segMan->getObjectName(addr));
+			if (getSciVersion() == SCI_VERSION_3 && !s->_segMan->isObject(addr)) {
+				debugN("\t\"%s\"", s->_segMan->derefString(addr));
+			} else {
+				debugN("\t%s", s->_segMan->getObjectName(addr));
+			}
 			debugN(opsize ? "[%02x]" : "[%04x]", offset);
 			break;
 		}


Commit: 4357809ce8238cfd0bc5d8c92b6da28068607d55
    https://github.com/scummvm/scummvm/commit/4357809ce8238cfd0bc5d8c92b6da28068607d55
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-07-26T22:02:37-05:00

Commit Message:
SCI32: Fix truncated save game names in Phant2

Phant2 creates save game names that append "<PROTECTED>" at the
end of the game name, with an assumption that the game name is
always exactly 36 characters long. This seems to be OK with other
games too (tested GK1, SQ6, and Torin).

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


diff --git a/engines/sci/engine/file.cpp b/engines/sci/engine/file.cpp
index 2128433..7e218bc 100644
--- a/engines/sci/engine/file.cpp
+++ b/engines/sci/engine/file.cpp
@@ -371,7 +371,9 @@ bool fillSavegameDesc(const Common::String &filename, SavegameDesc *desc) {
 	if (meta.name.lastChar() == '\n')
 		meta.name.deleteLastChar();
 
-	Common::strlcpy(desc->name, meta.name.c_str(), SCI_MAX_SAVENAME_LENGTH);
+	// At least Phant2 requires use of strncpy, since it creates save game
+	// names of exactly SCI_MAX_SAVENAME_LENGTH
+	strncpy(desc->name, meta.name.c_str(), SCI_MAX_SAVENAME_LENGTH);
 
 	return desc;
 }
diff --git a/engines/sci/engine/file.h b/engines/sci/engine/file.h
index fee628a..1657dd3 100644
--- a/engines/sci/engine/file.h
+++ b/engines/sci/engine/file.h
@@ -35,7 +35,7 @@ enum kFileOpenMode {
 };
 
 enum {
-	SCI_MAX_SAVENAME_LENGTH = 36, ///< Maximum length of a savegame name (including terminator character).
+	SCI_MAX_SAVENAME_LENGTH = 36, ///< Maximum length of a savegame name (including optional terminator character).
 	MAX_SAVEGAME_NR = 20 ///< Maximum number of savegames
 };
 
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index 1a6695f..eb6cacb 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -426,7 +426,7 @@ reg_t kFileIOOpen(EngineState *s, int argc, reg_t *argv) {
 				byte *out = buffer;
 				for (uint i = 0; i < numSaves; ++i) {
 					WRITE_UINT16(out, saves[i].id - kSaveIdShift);
-					Common::strlcpy((char *)out + sizeof(int16), saves[i].name, SCI_MAX_SAVENAME_LENGTH);
+					strncpy((char *)out + sizeof(int16), saves[i].name, SCI_MAX_SAVENAME_LENGTH);
 					out += recordSize;
 				}
 				WRITE_UINT16(out, 0xFFFF);
@@ -1372,7 +1372,9 @@ reg_t kGetSaveFiles32(EngineState *s, int argc, reg_t *argv) {
 	for (uint i = 0; i < saves.size(); ++i) {
 		const SavegameDesc &save = saves[i];
 		char *target = &descriptions.charAt(SCI_MAX_SAVENAME_LENGTH * i);
-		Common::strlcpy(target, save.name, SCI_MAX_SAVENAME_LENGTH);
+		// At least Phant2 requires use of strncpy, since it creates save game
+		// names of exactly SCI_MAX_SAVENAME_LENGTH
+		strncpy(target, save.name, SCI_MAX_SAVENAME_LENGTH);
 		saveIds.setFromInt16(i, save.id - kSaveIdShift);
 	}
 


Commit: 85194cdf750d67dda1ef1e12141f69c1004f8373
    https://github.com/scummvm/scummvm/commit/85194cdf750d67dda1ef1e12141f69c1004f8373
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-07-26T22:02:37-05:00

Commit Message:
SCI32: Patch bad version retrieval in Phant2

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 48ddf97..8730024 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -117,6 +117,7 @@ static const char *const selectorNameTable[] = {
 	"set",          // Torin
 	"clear",        // Torin
 	"masterVolume", // SCI2 master volume reset
+	"data",         // Phant2
 #endif
 	NULL
 };
@@ -160,7 +161,8 @@ enum ScriptPatcherSelectors {
 	SELECTOR_get,
 	SELECTOR_set,
 	SELECTOR_clear,
-	SELECTOR_masterVolume
+	SELECTOR_masterVolume,
+	SELECTOR_data
 #endif
 };
 
@@ -3733,9 +3735,56 @@ static const uint16 phant2CompSlideDoorsPatch[] = {
 	PATCH_END
 };
 
+// When reading the VERSION file, Phant2 sends a Str object instead of a
+// reference to a string (kernel signature violation), and flips the file handle
+// and size arguments, so the version file data never actually makes it into the
+// game.
+// Applies to at least: Phant2 US English CD
+static const uint16 phant2GetVersionSignature[] = {
+	0x36,                         // push
+	0x35, 0xff,                   // ldi $ff
+	0x1c,                         // ne?
+	0x31, 0x0e,                   // bnt $e
+	0x39, 0x04,                   // pushi 4
+	0x39, 0x05,                   // pushi 5
+	SIG_MAGICDWORD,
+	0x89, 0x1b,                   // lsg $1b
+	0x8d, 0x05,                   // lst 5
+	0x39, 0x09,                   // pushi 9
+	0x43, 0x5d, SIG_UINT16(0x08), // callk FileIO, 8
+	0x7a,                         // push2
+	0x78,                         // push1
+	0x8d, 0x05,                   // lst 5
+	0x43, 0x5d, SIG_UINT16(0x04), // callk FileIO, 4
+	0x35, 0x01,                   // ldi 1
+	0xa1, 0xd8,                   // sag $d8
+	SIG_END
+};
+
+static const uint16 phant2GetVersionPatch[] = {
+	0x39, 0x04,                     // pushi 4
+	0x39, 0x05,                     // pushi 5
+	0x81, 0x1b,                     // lag $1b
+	0x39, PATCH_SELECTOR8(data),    // pushi data
+	0x76,                           // push0
+	0x4a, PATCH_UINT16(4),          // send 4
+	0x36,                           // push
+	0x39, 0x09,                     // pushi 9
+	0x8d, 0x05,                     // lst 5
+	0x43, 0x5d, PATCH_UINT16(0x08), // callk FileIO, 8
+	0x7a,                           // push2
+	0x78,                           // push1
+	0x8d, 0x05,                     // lst 5
+	0x43, 0x5d, PATCH_UINT16(0x04), // callk FileIO, 4
+	0x78,                           // push1
+	0xa9, 0xd8,                     // ssg $d8
+	PATCH_END
+};
+
 //          script, description,                                      signature                        patch
 static const SciScriptPatcherEntry phantasmagoria2Signatures[] = {
 	{  true,     0, "slow interface fades",                        3, phant2SlowIFadeSignature,      phant2SlowIFadePatch },
+	{  true,     0, "bad arguments to get game version",           1, phant2GetVersionSignature,     phant2GetVersionPatch },
 	{  true, 63016, "non-responsive mouse during music fades",     1, phant2Wait4FadeSignature,      phant2Wait4FadePatch },
 	{  true, 63019, "non-responsive mouse during computer load",   1, phant2CompSlideDoorsSignature, phant2CompSlideDoorsPatch },
 	SCI_SIGNATUREENTRY_TERMINATOR


Commit: 8adb91038ff3e086608c759576b3a40dba09677c
    https://github.com/scummvm/scummvm/commit/8adb91038ff3e086608c759576b3a40dba09677c
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-07-26T22:02:37-05:00

Commit Message:
SCI32: Dummy SCI3 bitmap calls to discover possible usage

Non-use of these kernel calls was assumed by reviewing script
disassembly by SV, but it turns out that SV was not picking up
script patches correctly in SCI3 games, so this data is no longer
considered reliable.

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 cb1f2ed..4a7b004 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -393,8 +393,8 @@ static const SciKernelMapSubEntry kBitmap_subops[] = {
 	{ SIG_SINCE_SCI21MID, 12, MAP_CALL(BitmapGetInfo),             "r(i)(i)",              NULL },
 	{ SIG_SINCE_SCI21LATE,13, MAP_CALL(BitmapScale),               "r...ii",               NULL },
 	{ SIG_SCI3,           14, MAP_CALL(BitmapCreateFromUnknown),   "......",               NULL },
-	{ SIG_SCI3,           15, MAP_EMPTY(Bitmap),                   "(.*)",                 NULL },
-	{ SIG_SCI3,           16, MAP_EMPTY(Bitmap),                   "(.*)",                 NULL },
+	{ SIG_SCI3,           15, MAP_DUMMY(Bitmap),                   "(.*)",                 NULL },
+	{ SIG_SCI3,           16, MAP_DUMMY(Bitmap),                   "(.*)",                 NULL },
 	SCI_SUBOPENTRY_TERMINATOR
 };
 


Commit: dc597dc7a87d3d053b67cfbaf93a4855d472ddda
    https://github.com/scummvm/scummvm/commit/dc597dc7a87d3d053b67cfbaf93a4855d472ddda
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-07-26T22:02:37-05:00

Commit Message:
SCI32: Patch spin loop in Phant2 puzzle

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 8730024..2f382f4 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -3781,10 +3781,35 @@ static const uint16 phant2GetVersionPatch[] = {
 	PATCH_END
 };
 
+// The game uses a spin loop when displaying the success animation of the ratboy
+// puzzle, which causes the mouse to appear unresponsive. Replace the spin loop
+// with a call to ScummVM kWait.
+// Applies to at least: US English
+static const uint16 phant2RatboySignature[] = {
+	0x8d, 0x01,                   // lst 1
+	0x35, 0x1e,                   // ldi $1e
+	0x22,                         // lt?
+	SIG_MAGICDWORD,
+	0x31, 0x17,                   // bnt $17 [0c3d]
+	0x76,                         // push0
+	0x43, 0x79, SIG_UINT16(0x00), // callk GetTime, 0
+	SIG_END
+};
+
+static const uint16 phant2RatboyPatch[] = {
+	0x78,                                     // push1
+	0x35, 0x1e,                               // ldi $1e
+	0x36,                                     // push
+	0x43, kScummVMWaitId, PATCH_UINT16(0x02), // callk Wait, $2
+	0x33, 0x14,                               // jmp [to next outer loop]
+	PATCH_END
+};
+
 //          script, description,                                      signature                        patch
 static const SciScriptPatcherEntry phantasmagoria2Signatures[] = {
 	{  true,     0, "slow interface fades",                        3, phant2SlowIFadeSignature,      phant2SlowIFadePatch },
 	{  true,     0, "bad arguments to get game version",           1, phant2GetVersionSignature,     phant2GetVersionPatch },
+	{  true,  4081, "non-responsive mouse after ratboy puzzle",    1, phant2RatboySignature,         phant2RatboyPatch },
 	{  true, 63016, "non-responsive mouse during music fades",     1, phant2Wait4FadeSignature,      phant2Wait4FadePatch },
 	{  true, 63019, "non-responsive mouse during computer load",   1, phant2CompSlideDoorsSignature, phant2CompSlideDoorsPatch },
 	SCI_SIGNATUREENTRY_TERMINATOR


Commit: 655c5973fd3d41dcabc1dee253953a51687e7fed
    https://github.com/scummvm/scummvm/commit/655c5973fd3d41dcabc1dee253953a51687e7fed
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-07-26T22:43:19-05:00

Commit Message:
SCI32: Add kMinimize to stop unmapped function warning

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 4a7b004..bd3184a 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -1014,6 +1014,7 @@ static SciKernelMapEntry s_kernelMap[] = {
 	{ MAP_CALL(MorphOn),            SIG_EVERYWHERE,           "",                     NULL,            NULL },
 
 	// SCI3 Kernel Functions
+	{ MAP_EMPTY(Minimize),          SIG_SCI3, SIGFOR_ALL,     "(.*)",                 NULL,            NULL },
 	{ MAP_CALL(PlayDuck),           SIG_SCI3, SIGFOR_ALL,     "(.*)",                 kPlayDuck_subops,NULL },
 	{ MAP_CALL(WebConnect),         SIG_SCI3, SIGFOR_ALL,     "(r)",                  NULL,            NULL },
 	{ MAP_CALL(WinExec),            SIG_SCI3, SIGFOR_ALL,     "r",                    NULL,            NULL },


Commit: 365dde1e5dd72e65189634d0748dbfcd54067dbb
    https://github.com/scummvm/scummvm/commit/365dde1e5dd72e65189634d0748dbfcd54067dbb
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-07-26T22:43:20-05:00

Commit Message:
SCI32: Reduce priority of PATCHES directory for Phant2

For whatever reason, Sierra decided that the final patches would
go in the root directory for Phant2. The game disc includes
(different, older) patches for many of the same resources in the
PATCHES directory, and loading those instead makes the game not
always work quite right.

Changed paths:
    engines/sci/sci.cpp


diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index f6bc48f..f5e327c 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -164,8 +164,14 @@ SciEngine::SciEngine(OSystem *syst, const ADGameDescription *desc, SciGameId gam
 
 	// Add the patches directory, except for KQ6CD; The patches folder in some versions of KQ6CD
 	// (e.g. KQ Collection 1997) is for the demo of Phantasmagoria, included in the disk
-	if (_gameId != GID_KQ6)
-		SearchMan.addSubDirectoryMatching(gameDataDir, "patches");	// resource patches
+	if (_gameId != GID_KQ6) {
+		// Patch files in the root directory of Phantasmagoria 2 are higher
+		// priority than patch files in the patches directory (the SSCI
+		// installer copies these patches to HDD and gives the HDD directory
+		// top priority)
+		const int priority = _gameId == GID_PHANTASMAGORIA2 ? -1 : 0;
+		SearchMan.addSubDirectoryMatching(gameDataDir, "patches", priority);	// resource patches
+	}
 
 	// Some releases (e.g. Pointsoft Torin) use a different patch directory name
 	SearchMan.addSubDirectoryMatching(gameDataDir, "patch");	// resource patches





More information about the Scummvm-git-logs mailing list