diff options
author | Florian Kagerer | 2008-05-12 14:22:27 +0000 |
---|---|---|
committer | Florian Kagerer | 2008-05-12 14:22:27 +0000 |
commit | bde4fa1e9b6478e6d3820692048bbd7b85e56f73 (patch) | |
tree | 0732e75fdb85cb120cd935d1034405e9de35c2ae | |
parent | 0b9a3f22083cb7ec61953c3c6905c4780e93619a (diff) | |
download | scummvm-rg350-bde4fa1e9b6478e6d3820692048bbd7b85e56f73.tar.gz scummvm-rg350-bde4fa1e9b6478e6d3820692048bbd7b85e56f73.tar.bz2 scummvm-rg350-bde4fa1e9b6478e6d3820692048bbd7b85e56f73.zip |
fix for kyra 3 sfx (broken by last commit)
svn-id: r32061
-rw-r--r-- | dists/engine-data/kyra.dat | bin | 233702 -> 232687 bytes | |||
-rw-r--r-- | engines/kyra/sound_towns.cpp | 8 | ||||
-rw-r--r-- | engines/kyra/staticres.cpp | 10 | ||||
-rw-r--r-- | tools/create_kyradat/create_kyradat.cpp | 32 | ||||
-rw-r--r-- | tools/create_kyradat/create_kyradat.h | 1 |
5 files changed, 39 insertions, 12 deletions
diff --git a/dists/engine-data/kyra.dat b/dists/engine-data/kyra.dat Binary files differindex d551220095..7706b1a9dc 100644 --- a/dists/engine-data/kyra.dat +++ b/dists/engine-data/kyra.dat diff --git a/engines/kyra/sound_towns.cpp b/engines/kyra/sound_towns.cpp index 3d8c7becae..c591646628 100644 --- a/engines/kyra/sound_towns.cpp +++ b/engines/kyra/sound_towns.cpp @@ -1442,7 +1442,13 @@ bool SoundTowns_v2::voicePlay(const char *file, bool) { return false; } - uint8 * data = _vm->resource()->fileData(file, 0); + char filename [13]; + if (scumm_stricmp(file + strlen(file) - 4, ".PCM")) + sprintf(filename, "%s.PCM", file); + else + strcpy(filename, file); + + uint8 * data = _vm->resource()->fileData(filename, 0); uint8 * src = data; uint16 sfxRate = rates[READ_LE_UINT16(src)]; diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index 87585c27d2..49b5b4dc49 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -44,7 +44,7 @@ namespace Kyra { -#define RESFILE_VERSION 25 +#define RESFILE_VERSION 26 bool StaticResource::checkKyraDat() { Common::File kyraDat; @@ -1215,8 +1215,7 @@ void KyraEngine_HoF::initStaticResource() { _ingameTimJpStr = _staticres->loadStrings(k2IngameTimJpStrings, _ingameTimJpStrSize); _itemAnimData = _staticres->loadShapeAnimData_v2(k2IngameShapeAnimData, _itemAnimDataSize); - // replace sequence talkie files with localized versions and cut off .voc - // suffix from voc files so as to allow compression specific file extensions + // replace sequence talkie files with localized versions const char* const* seqSoundList = _staticres->loadStrings(k2SeqplaySfxFiles, _sequenceSoundListSize); const char* const* tlkfiles = _staticres->loadStrings(k2SeqplayTlkFiles, tmpSize); char ** tmpSndLst = new char*[_sequenceSoundListSize]; @@ -1227,9 +1226,6 @@ void KyraEngine_HoF::initStaticResource() { tmpSndLst[i] = new char[len + 1]; tmpSndLst[i][0] = 0; - if (_flags.platform == Common::kPlatformPC) - len -= 4; - if (tlkfiles) { for (int ii = 0; ii < tmpSize; ii++) { if (!scumm_stricmp(&seqSoundList[i][1], &tlkfiles[ii][1])) @@ -1239,8 +1235,6 @@ void KyraEngine_HoF::initStaticResource() { if (tmpSndLst[i][0] == 0) strcpy(tmpSndLst[i], seqSoundList[i]); - - tmpSndLst[i][len] = 0; } tlkfiles = seqSoundList = 0; diff --git a/tools/create_kyradat/create_kyradat.cpp b/tools/create_kyradat/create_kyradat.cpp index 0ee3da4143..e49b5672b4 100644 --- a/tools/create_kyradat/create_kyradat.cpp +++ b/tools/create_kyradat/create_kyradat.cpp @@ -31,7 +31,7 @@ #include "md5.h" enum { - kKyraDatVersion = 25, + kKyraDatVersion = 26, kIndexSize = 12 }; @@ -66,6 +66,7 @@ bool extractHofShapeAnimDataV1(PAKFile &out, const Game *g, const byte *data, co bool extractHofShapeAnimDataV2(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch = 0); bool extractStringsWoSuffix(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch = 0); +bool extractPaddedStrings(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch = 0); bool extractRaw16to8(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch = 0); bool extractMrShapeAnimData(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch = 0); @@ -88,6 +89,7 @@ const ExtractType extractTypeTable[] = { { k2TypeShpDataV2, extractHofShapeAnimDataV2, createFilename }, { k2TypeSoundList, extractStringsWoSuffix, createFilename }, + { k2TypeSfxList, extractPaddedStrings, createFilename }, { k3TypeRaw16to8, extractRaw16to8, createFilename }, { k3TypeShpData, extractMrShapeAnimData, createFilename }, @@ -216,7 +218,7 @@ const ExtractFilename extractFilenames[] = { { k2SeqplayCredits, kTypeRawData, "S_CREDITS.TXT" }, { k2SeqplayCreditsSpecial, kTypeStringList, "S_CREDITS2.TXT" }, { k2SeqplayStrings, kTypeLanguageList, "S_STRINGS" }, - { k2SeqplaySfxFiles, kTypeStringList, "S_SFXFILES.TXT" }, + { k2SeqplaySfxFiles, k2TypeSoundList, "S_SFXFILES.TXT" }, { k2SeqplayTlkFiles, kTypeLanguageList, "S_TLKFILES" }, { k2SeqplaySeqData, k2TypeSeqData, "S_DATA.SEQ" }, { k2SeqplayIntroTracks, kTypeStringList, "S_INTRO.TRA" }, @@ -241,7 +243,7 @@ const ExtractFilename extractFilenames[] = { { k3MainMenuStrings, kTypeStringList, "MAINMENU.TXT" }, { k3MusicFiles, k2TypeSoundList, "SCORE.TRA" }, { k3ScoreTable, kTypeRawData, "SCORE.MAP" }, - { k3SfxFiles, kTypeStringList, "SFXFILES.TRA" }, + { k3SfxFiles, k2TypeSfxList, "SFXFILES.TRA" }, { k3SfxMap, k3TypeRaw16to8, "SFXINDEX.MAP" }, { k3ItemAnimData, k3TypeShpData, "INVANIM.SHP" }, { k3ItemMagicTable, k3TypeRaw16to8, "ITEMMAGIC.MAP" }, @@ -966,6 +968,30 @@ bool extractStringsWoSuffix(PAKFile &out, const Game *g, const byte *data, const return out.addFile(filename, buffer, outsize); } +bool extractPaddedStrings(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch) { + int outsize = size + 4; + uint8 *buffer = new uint8[outsize]; + const uint8 *src = data; + uint8 *dst = buffer + 4; + const uint8 *fin = src + size; + int entries = 0; + + while (src < fin) { + while (!*src && src < fin) + src++; + while (*src && src < fin) + *dst++ = *src++; + + *dst++ = '\0'; + entries++; + } + + WRITE_BE_UINT32(buffer, entries); + outsize = dst - buffer; + + return out.addFile(filename, buffer, outsize); +} + bool extractRaw16to8(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch) { int outsize = size >> 1; uint8 *buffer = new uint8[outsize]; diff --git a/tools/create_kyradat/create_kyradat.h b/tools/create_kyradat/create_kyradat.h index 79d7dd3001..62cfbc3374 100644 --- a/tools/create_kyradat/create_kyradat.h +++ b/tools/create_kyradat/create_kyradat.h @@ -257,6 +257,7 @@ enum kExtractType { k2TypeShpDataV1, k2TypeShpDataV2, k2TypeSoundList, + k2TypeSfxList, k3TypeRaw16to8, k3TypeShpData |