[Scummvm-cvs-logs] scummvm master -> bfcf0e85b4b1c5cdd18c710460884e6f39bd8086

clone2727 clone2727 at gmail.com
Wed Feb 16 20:27:55 CET 2011


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:
758e495872 SCI: Add support for the KQ5 FM Towns resource format
e19d6a2462 SCI: Add workaround for uninitialized read in KQ5 FM Towns
bfcf0e85b4 SCI: Fix Mixed-Up Mother Goose FM Towns


Commit: 758e4958724bf557013e587789425bed0bc1a6a5
    https://github.com/scummvm/scummvm/commit/758e4958724bf557013e587789425bed0bc1a6a5
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-02-16T11:24:38-08:00

Commit Message:
SCI: Add support for the KQ5 FM Towns resource format

Thanks to alexbevi for providing details on the format

Changed paths:
    engines/sci/engine/kernel.cpp
    engines/sci/engine/workarounds.cpp
    engines/sci/resource.cpp
    engines/sci/resource.h



diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index d8bbc75..ea6fa31 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -533,6 +533,7 @@ void Kernel::mapFunctions() {
 
 	switch (g_sci->getPlatform()) {
 	case Common::kPlatformPC:
+	case Common::kPlatformFMTowns:
 		platformMask = SIGFOR_DOS;
 		break;
 	case Common::kPlatformPC98:
diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index 7adb0b4..d1dd5f6 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -357,6 +357,7 @@ const SciWorkaroundEntry kGraphRedrawBox_workarounds[] = {
 	{ GID_KQ5,            -1,   981,  0,           "myWindow",     "dispose",    -1,    0, { WORKAROUND_STILLCALL, 0 } }, // Happens in the floppy version, when closing any dialog box, accidental additional parameter specified - bug #3036331
 	{ GID_KQ5,            -1,   995,  0,               "invW",        "doit",    -1,    0, { WORKAROUND_STILLCALL, 0 } }, // Happens in the floppy version, when closing the inventory window, accidental additional parameter specified
 	{ GID_KQ5,            -1,   995,  0,                   "",    "export 0",    -1,    0, { WORKAROUND_STILLCALL, 0 } }, // Happens in the floppy version, when opening the gem pouch, accidental additional parameter specified - bug #3039395
+	{ GID_KQ5,            -1,   403,  0,          "KQ5Window",     "dispose",    -1,    0, { WORKAROUND_STILLCALL, 0 } }, // Happens in the FM Towns version when closing any dialog box, accidental additional parameter specified
 	SCI_WORKAROUNDENTRY_TERMINATOR
 };
 
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 8c8bc6d..22d153a 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -38,6 +38,7 @@ namespace Sci {
 enum {
 	SCI0_RESMAP_ENTRIES_SIZE = 6,
 	SCI1_RESMAP_ENTRIES_SIZE = 6,
+	KQ5FMT_RESMAP_ENTRIES_SIZE = 7,
 	SCI11_RESMAP_ENTRIES_SIZE = 5
 };
 
@@ -1115,6 +1116,8 @@ const char *ResourceManager::versionDescription(ResVersion version) const {
 		return "SCI0 / Early SCI1";
 	case kResVersionSci1Middle:
 		return "Middle SCI1";
+	case kResVersionKQ5FMT:
+		return "KQ5 FM Towns";
 	case kResVersionSci1Late:
 		return "Late SCI1";
 	case kResVersionSci11:
@@ -1164,6 +1167,14 @@ ResVersion ResourceManager::detectMapVersion() {
 	fileStream->seek(-4, SEEK_END);
 	uint32 uEnd = fileStream->readUint32LE();
 	if (uEnd == 0xFFFFFFFF) {
+		// check if the last 7 bytes are all ff, indicating a KQ5 FM-Towns map
+		fileStream->seek(-7, SEEK_END);
+		fileStream->read(buff, 3);
+		if (buff[0] == 0xff && buff[1] == 0xff && buff[2] == 0xff) {
+			delete fileStream;
+			return kResVersionKQ5FMT;
+		}
+
 		// check if 0 or 01 - try to read resources in SCI0 format and see if exists
 		fileStream->seek(0, SEEK_SET);
 		while (fileStream->read(buff, 6) == 6 && !(buff[0] == 0xFF && buff[1] == 0xFF && buff[2] == 0xFF)) {
@@ -1578,10 +1589,15 @@ int ResourceManager::readResourceMapSCI0(ResourceSource *map) {
 
 	fileStream->seek(0, SEEK_SET);
 
-	byte bMask = (_mapVersion == kResVersionSci1Middle) ? 0xF0 : 0xFC;
-	byte bShift = (_mapVersion == kResVersionSci1Middle) ? 28 : 26;
+	byte bMask = (_mapVersion >= kResVersionSci1Middle) ? 0xF0 : 0xFC;
+	byte bShift = (_mapVersion >= kResVersionSci1Middle) ? 28 : 26;
 
 	do {
+		// King's Quest 5 FM-Towns uses a 7 byte version of the SCI1 Middle map,
+		// splitting the type from the id.
+		if (_mapVersion == kResVersionKQ5FMT)
+			type = convertResType(fileStream->readByte());
+
 		id = fileStream->readUint16LE();
 		offset = fileStream->readUint32LE();
 
@@ -1590,11 +1606,17 @@ int ResourceManager::readResourceMapSCI0(ResourceSource *map) {
 			warning("Error while reading %s", map->getLocationName().c_str());
 			return SCI_ERROR_RESMAP_NOT_FOUND;
 		}
+	
 		if (offset == 0xFFFFFFFF)
 			break;
 
-		type = convertResType(id >> 11);
-		number = id & 0x7FF;
+		if (_mapVersion == kResVersionKQ5FMT) {
+			number = id;
+		} else {
+			type = convertResType(id >> 11);
+			number = id & 0x7FF;
+		}
+
 		ResourceId resId = ResourceId(type, number);
 		// adding a new resource
 		if (_resMap.contains(resId) == false) {
@@ -2233,6 +2255,7 @@ void ResourceManager::detectSciVersion() {
 		s_sciVersion = SCI_VERSION_1_EARLY;
 		return;
 	case kResVersionSci1Middle:
+	case kResVersionKQ5FMT:
 		s_sciVersion = SCI_VERSION_1_MIDDLE;
 		return;
 	case kResVersionSci1Late:
diff --git a/engines/sci/resource.h b/engines/sci/resource.h
index 92749ba..76b5a42 100644
--- a/engines/sci/resource.h
+++ b/engines/sci/resource.h
@@ -124,6 +124,7 @@ enum ResVersion {
 	kResVersionUnknown,
 	kResVersionSci0Sci1Early,
 	kResVersionSci1Middle,
+	kResVersionKQ5FMT,
 	kResVersionSci1Late,
 	kResVersionSci11,
 	kResVersionSci11Mac,


Commit: e19d6a2462c559577a1009f20e1fc6bc7a7ba730
    https://github.com/scummvm/scummvm/commit/e19d6a2462c559577a1009f20e1fc6bc7a7ba730
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-02-16T11:24:39-08:00

Commit Message:
SCI: Add workaround for uninitialized read in KQ5 FM Towns

Thanks to alexbevi

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



diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index d1dd5f6..faf7662 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -136,6 +136,7 @@ const SciWorkaroundEntry uninitializedReadWorkarounds[] = {
 	// ^^ shouldn't be needed anymore, we got a script patch instead (kq5PatchCdHarpyVolume)
 	{ GID_KQ5,            25,    25,  0,              "rm025", "doit",           -1,    0, { WORKAROUND_FAKE,   0 } }, // inside witch forest, when going to the room where the walking rock is
 	{ GID_KQ5,            55,    55,  0,         "helpScript", "doit",           -1,    0, { WORKAROUND_FAKE,   0 } }, // when giving the tambourine to the monster in the labyrinth (only happens at one of the locations) - bug #3041262
+	{ GID_KQ5,            -1,   755,  0,              "gcWin", "open",           -1,   -1, { WORKAROUND_FAKE,   0 } }, // when entering control menu in the FM-Towns version
 	{ GID_KQ6,            -1,    30,  0,               "rats", "changeState",    -1,   -1, { WORKAROUND_FAKE,   0 } }, // rats in the catacombs (temps 1 - 5) - bugs #3034597, #3035495, #3035824
 	{ GID_KQ6,           210,   210,  0,              "rm210", "scriptCheck",    -1,    0, { WORKAROUND_FAKE,   1 } }, // using inventory in that room - bug #3034565
 	{ GID_KQ6,           500,   500,  0,              "rm500", "init",           -1,    0, { WORKAROUND_FAKE,   0 } }, // going to island of the beast


Commit: bfcf0e85b4b1c5cdd18c710460884e6f39bd8086
    https://github.com/scummvm/scummvm/commit/bfcf0e85b4b1c5cdd18c710460884e6f39bd8086
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-02-16T11:24:39-08:00

Commit Message:
SCI: Fix Mixed-Up Mother Goose FM Towns

Thanks to alexbevi

Changed paths:
    engines/sci/detection_tables.h



diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h
index f042664..c7ef720 100644
--- a/engines/sci/detection_tables.h
+++ b/engines/sci/detection_tables.h
@@ -2274,7 +2274,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
 		Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO, GUIO_NOSPEECH	},
 
 	// Mixed-Up Mother Goose - FM-Towns (supplied by abevi in bug report #3038720)
-	{"mothergoose", "", {
+	{"mothergoose256", "", {
 		{"resource.map", 0, "b11e971ccd2040bebba59dfb409a08ef", 5772},
 		{"resource.001", 0, "d49625d9b8005ec01c852f8322a82867", 4330713},
 		AD_LISTEND},






More information about the Scummvm-git-logs mailing list