aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/kernel.cpp1
-rw-r--r--engines/sci/engine/workarounds.cpp1
-rw-r--r--engines/sci/resource.cpp31
-rw-r--r--engines/sci/resource.h1
4 files changed, 30 insertions, 4 deletions
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index d8bbc75c18..ea6fa31d05 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 7adb0b4e04..d1dd5f606d 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 8c8bc6d512..22d153a81c 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 92749ba162..76b5a421ee 100644
--- a/engines/sci/resource.h
+++ b/engines/sci/resource.h
@@ -124,6 +124,7 @@ enum ResVersion {
kResVersionUnknown,
kResVersionSci0Sci1Early,
kResVersionSci1Middle,
+ kResVersionKQ5FMT,
kResVersionSci1Late,
kResVersionSci11,
kResVersionSci11Mac,