From bf5ae45490a0683692715fcc8a103f0e096e9c21 Mon Sep 17 00:00:00 2001 From: Florian Kagerer Date: Sun, 24 Oct 2010 13:00:47 +0000 Subject: KYRA/PC98: workaround for missing delay opcodes The sequence data for the forest sequence in the Kyra PC-98 intro has no delay opcodes making it play way too fast on modern systems. This workaround adds the same delay opcodes to the sequence data that the other Kyra versions have. svn-id: r53761 --- dists/engine-data/kyra.dat | Bin 355807 -> 355898 bytes engines/kyra/staticres.cpp | 2 +- tools/create_kyradat/create_kyradat.cpp | 4 +-- tools/create_kyradat/extract.cpp | 52 ++++++++++++++++++++++++++++++++ tools/create_kyradat/extract.h | 1 + 5 files changed, 56 insertions(+), 3 deletions(-) diff --git a/dists/engine-data/kyra.dat b/dists/engine-data/kyra.dat index d8cb28076a..23e866c62e 100644 Binary files a/dists/engine-data/kyra.dat and b/dists/engine-data/kyra.dat differ diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index c55ee57214..edfa61e5b4 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -42,7 +42,7 @@ namespace Kyra { -#define RESFILE_VERSION 72 +#define RESFILE_VERSION 73 namespace { bool checkKyraDat(Common::SeekableReadStream *file) { diff --git a/tools/create_kyradat/create_kyradat.cpp b/tools/create_kyradat/create_kyradat.cpp index 85038a0820..93a5804179 100644 --- a/tools/create_kyradat/create_kyradat.cpp +++ b/tools/create_kyradat/create_kyradat.cpp @@ -45,7 +45,7 @@ #include enum { - kKyraDatVersion = 72 + kKyraDatVersion = 73 }; const ExtractFilename extractFilenames[] = { @@ -53,7 +53,7 @@ const ExtractFilename extractFilenames[] = { { kIdMap, -1, true }, // INTRO / OUTRO sequences - { k1ForestSeq, kTypeRawData, false }, + { k1ForestSeq, kTypeForestSeqData, false }, { k1KallakWritingSeq, kTypeRawData, false }, { k1KyrandiaLogoSeq, kTypeRawData, false }, { k1KallakMalcolmSeq, kTypeRawData, false }, diff --git a/tools/create_kyradat/extract.cpp b/tools/create_kyradat/extract.cpp index 8286d1ca63..3503aea47f 100644 --- a/tools/create_kyradat/extract.cpp +++ b/tools/create_kyradat/extract.cpp @@ -36,6 +36,7 @@ bool extractStrings(PAKFile &out, const ExtractInformation *info, const byte *da bool extractStrings10(PAKFile &out, const ExtractInformation *info, const byte *data, const uint32 size, const char *filename, int id); bool extractRooms(PAKFile &out, const ExtractInformation *info, const byte *data, const uint32 size, const char *filename, int id); bool extractShapes(PAKFile &out, const ExtractInformation *info, const byte *data, const uint32 size, const char *filename, int id); +bool extractKyraForestSeqData(PAKFile &out, const ExtractInformation *info, const byte *data, const uint32 size, const char *filename, int id); bool extractAmigaSfx(PAKFile &out, const ExtractInformation *info, const byte *data, const uint32 size, const char *filename, int id); bool extractWdSfx(PAKFile &out, const ExtractInformation *info, const byte *data, const uint32 size, const char *filename, int id); @@ -58,6 +59,7 @@ const ExtractType extractTypeTable[] = { { kTypeRoomList, extractRooms }, { kTypeShapeList, extractShapes }, { kTypeRawData, extractRaw }, + { kTypeForestSeqData, extractKyraForestSeqData }, { kTypeAmigaSfxTable, extractAmigaSfx }, { kTypeTownsWDSfxTable, extractWdSfx }, @@ -90,6 +92,7 @@ const TypeTable typeTable[] = { { kTypeRawData, 1 }, { kTypeRoomList, 2 }, { kTypeShapeList, 3 }, + { kTypeForestSeqData, 1 }, { kTypeAmigaSfxTable, 4 }, { kTypeTownsWDSfxTable, 1 }, { k2TypeSeqData, 5 }, @@ -376,6 +379,55 @@ bool extractShapes(PAKFile &out, const ExtractInformation *info, const byte *dat return out.addFile(filename, buffer, size + 1 * 4); } +bool extractKyraForestSeqData(PAKFile &out, const ExtractInformation *info, const byte *data, const uint32 size, const char *filename, int id) { + if (info->platform != kPlatformPC98) + return extractRaw(out, info, data, size, filename, id); + + struct PatchEntry { + uint16 pos; + uint8 val; + }; + + // This data has been taken from the FM-Towns version + static const PatchEntry patchData[] = { + { 0x0019, 0x06 }, { 0x001A, 0x09 }, { 0x001B, 0x00 }, { 0x002E, 0x06 }, { 0x002F, 0x09 }, { 0x0030, 0x00 }, + { 0x003D, 0x06 }, { 0x003E, 0x09 }, { 0x003F, 0x00 }, { 0x004C, 0x06 }, { 0x004D, 0x09 }, { 0x004E, 0x00 }, + { 0x005B, 0x06 }, { 0x005C, 0x09 }, { 0x005D, 0x00 }, { 0x0064, 0x06 }, { 0x0065, 0x09 }, { 0x0066, 0x00 }, + { 0x0079, 0x06 }, { 0x007A, 0x09 }, { 0x007B, 0x00 }, { 0x0088, 0x06 }, { 0x0089, 0x09 }, { 0x008A, 0x00 }, + { 0x0097, 0x06 }, { 0x0098, 0x09 }, { 0x0099, 0x00 }, { 0x00A6, 0x06 }, { 0x00A7, 0x09 }, { 0x00A8, 0x00 }, + { 0x00AD, 0x06 }, { 0x00AE, 0x09 }, { 0x00AF, 0x00 }, { 0x00B4, 0x06 }, { 0x00B5, 0x09 }, { 0x00B6, 0x00 }, + { 0x00C3, 0x06 }, { 0x00C4, 0x09 }, { 0x00C5, 0x00 }, { 0x00CA, 0x06 }, { 0x00CB, 0x09 }, { 0x00CC, 0x00 }, + { 0x00D1, 0x06 }, { 0x00D2, 0x09 }, { 0x00D3, 0x00 }, { 0x00E0, 0x06 }, { 0x00E1, 0x09 }, { 0x00E2, 0x00 }, + { 0x00E7, 0x06 }, { 0x00E8, 0x09 }, { 0x00E9, 0x00 }, { 0x00EE, 0x06 }, { 0x00EF, 0x09 }, { 0x00F0, 0x00 }, + { 0x00FD, 0x06 }, { 0x00FE, 0x09 }, { 0x00FF, 0x00 }, { 0x010A, 0x06 }, { 0x010B, 0x09 }, { 0x010C, 0x00 }, + { 0x011D, 0x06 }, { 0x011E, 0x09 }, { 0x011F, 0x00 }, { 0x012C, 0x06 }, { 0x012D, 0x09 }, { 0x012E, 0x00 }, + { 0x013D, 0x06 }, { 0x013E, 0x09 }, { 0x013F, 0x00 }, { 0x0148, 0x06 }, { 0x0149, 0x09 }, { 0x014A, 0x00 }, + { 0x0153, 0x06 }, { 0x0154, 0x09 }, { 0x0155, 0x00 }, { 0x015E, 0x06 }, { 0x015F, 0x09 }, { 0x0160, 0x00 }, + { 0x0169, 0x06 }, { 0x016A, 0x09 }, { 0x016B, 0x00 }, { 0x016C, 0x06 }, { 0x016D, 0x12 }, { 0x016E, 0x00 }, + { 0x017B, 0x06 }, { 0x017C, 0x09 }, { 0x017D, 0x00 }, { 0x0188, 0x06 }, { 0x0189, 0x09 }, { 0x018A, 0x00 }, + { 0x0190, 0x13 }, { 0x0000, 0x00 } + }; + + uint32 outsize = size + (ARRAYSIZE(patchData) - 1); + uint8 *buffer = new uint8[outsize]; + assert(buffer); + + const uint8 *src = data; + uint8 *dst = buffer; + const PatchEntry *patchPos = patchData; + + while (dst < (buffer + outsize)) { + if ((dst - buffer) == patchPos->pos) { + *dst++ = patchPos->val; + patchPos++; + } else { + *dst++ = *src++; + } + } + + return out.addFile(filename, buffer, outsize); +} + bool extractAmigaSfx(PAKFile &out, const ExtractInformation *info, const byte *data, const uint32 size, const char *filename, int id) { const uint32 entries = size / 8; byte *buffer = new byte[entries * 6 + 1 * 4]; diff --git a/tools/create_kyradat/extract.h b/tools/create_kyradat/extract.h index 5aee089466..0903852dd2 100644 --- a/tools/create_kyradat/extract.h +++ b/tools/create_kyradat/extract.h @@ -35,6 +35,7 @@ enum kExtractType { kTypeRoomList, kTypeShapeList, kTypeRawData, + kTypeForestSeqData, kTypeAmigaSfxTable, kTypeTownsWDSfxTable, -- cgit v1.2.3