From adf1df19c0a002123946379b3bfb1f537a66c869 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 29 Aug 2009 07:52:24 +0000 Subject: Move Amiga SFX tables to kyra.dat. svn-id: r43793 --- dists/engine-data/kyra.dat | Bin 263839 -> 264840 bytes engines/kyra/resource.h | 11 +- engines/kyra/sound_amiga.cpp | 60 ++++----- engines/kyra/sound_intern.h | 17 ++- engines/kyra/staticres.cpp | 213 +++++++------------------------- tools/create_kyradat/amiga.h | 2 + tools/create_kyradat/create_kyradat.cpp | 58 ++++++--- tools/create_kyradat/create_kyradat.h | 4 + tools/create_kyradat/misc.h | 2 + 9 files changed, 140 insertions(+), 227 deletions(-) diff --git a/dists/engine-data/kyra.dat b/dists/engine-data/kyra.dat index 2242d4e385..10cf665a4a 100644 Binary files a/dists/engine-data/kyra.dat and b/dists/engine-data/kyra.dat differ diff --git a/engines/kyra/resource.h b/engines/kyra/resource.h index 3dc6c5ff2f..508c698b9a 100644 --- a/engines/kyra/resource.h +++ b/engines/kyra/resource.h @@ -174,10 +174,14 @@ enum kKyraResources { k1AudioTracks, k1AudioTracksIntro, + k1CreditsStrings, + k1TownsSFXwdTable, k1TownsSFXbtTable, k1TownsCDATable, - k1CreditsStrings, + + k1AmigaIntroSFXTable, + k1AmigaGameSFXTable, k2SeqplayPakFiles, k2SeqplayCredits, @@ -301,6 +305,7 @@ enum kKyraResources { struct Shape; struct Room; +struct AmigaSfxTable; class StaticResource { public: @@ -317,6 +322,7 @@ public: const char * const *loadStrings(int id, int &strings); const uint8 *loadRawData(int id, int &size); const Shape *loadShapeTable(int id, int &entries); + const AmigaSfxTable *loadAmigaSfxTable(int id, int &entries); const Room *loadRoomTable(int id, int &entries); const uint8 * const *loadPaletteTable(int id, int &entries); const HofSeqData *loadHofSequenceData(int id, int &entries); @@ -357,6 +363,7 @@ private: bool loadStringTable(const char *filename, void *&ptr, int &size); bool loadRawData(const char *filename, void *&ptr, int &size); bool loadShapeTable(const char *filename, void *&ptr, int &size); + bool loadAmigaSfxTable(const char *filename, void *&ptr, int &size); bool loadRoomTable(const char *filename, void *&ptr, int &size); bool loadPaletteTable(const char *filename, void *&ptr, int &size); bool loadHofSequenceData(const char *filename, void *&ptr, int &size); @@ -375,6 +382,7 @@ private: void freeRawData(void *&ptr, int &size); void freeStringTable(void *&ptr, int &size); void freeShapeTable(void *&ptr, int &size); + void freeAmigaSfxTable(void *&ptr, int &size); void freeRoomTable(void *&ptr, int &size); void freePaletteTable(void *&ptr, int &size); void freeHofSequenceData(void *&ptr, int &size); @@ -400,6 +408,7 @@ private: kShapeList, kRawData, kPaletteTable, + kAmigaSfxTable, k2SeqData, k2ShpAnimDataV1, diff --git a/engines/kyra/sound_amiga.cpp b/engines/kyra/sound_amiga.cpp index 0b64e67525..3024dbaa16 100644 --- a/engines/kyra/sound_amiga.cpp +++ b/engines/kyra/sound_amiga.cpp @@ -32,26 +32,6 @@ #include "sound/mods/maxtrax.h" #include "sound/audiostream.h" -namespace { - -FORCEINLINE uint8 sfxTableGetNote(const byte* address) { - return (uint8)address[0]; -} -FORCEINLINE uint8 sfxTableGetPatch(const byte* address) { - return (uint8)address[1]; -} -FORCEINLINE uint16 sfxTableGetDuration(const byte* address) { - return READ_BE_UINT16(&address[4]); -} -FORCEINLINE int8 sfxTableGetVolume(const byte* address) { - return (int8)address[6]; -} -FORCEINLINE int8 sfxTableGetPan(const byte* address) { - return (int8)address[7]; -} - -} // end of namespace - namespace Kyra { SoundAmiga::SoundAmiga(KyraEngine_v1 *vm, Audio::Mixer *mixer) @@ -59,8 +39,10 @@ SoundAmiga::SoundAmiga(KyraEngine_v1 *vm, Audio::Mixer *mixer) _driver(0), _musicHandle(), _fileLoaded(kFileNone), - _tableSfxIntro(), - _tableSfxGame() { + _tableSfxIntro(0), + _tableSfxGame(0), + _tableSfxIntro_Size(0), + _tableSfxGame_Size(0) { } SoundAmiga::~SoundAmiga() { @@ -68,13 +50,11 @@ SoundAmiga::~SoundAmiga() { delete _driver; } -extern const byte LoKAmigaSfxIntro[]; -extern const byte LoKAmigaSfxGame[]; - bool SoundAmiga::init() { _driver = new Audio::MaxTrax(_mixer->getOutputRate(), true); - _tableSfxIntro = LoKAmigaSfxIntro; - _tableSfxGame = LoKAmigaSfxGame; + + _tableSfxIntro = _vm->staticres()->loadAmigaSfxTable(k1AmigaIntroSFXTable, _tableSfxIntro_Size); + _tableSfxGame = _vm->staticres()->loadAmigaSfxTable(k1AmigaGameSFXTable, _tableSfxGame_Size); return _driver != 0 && _tableSfxIntro && _tableSfxGame; } @@ -201,16 +181,16 @@ void SoundAmiga::beginFadeOut() { void SoundAmiga::playSoundEffect(uint8 track) { debugC(5, kDebugLevelSound, "SoundAmiga::playSoundEffect(%d)", track); - const byte* tableEntry = 0; + const AmigaSfxTable *sfx = 0; bool pan = false; switch (_fileLoaded) { case kFileFinal: case kFileIntro: // We only allow playing of sound effects, which are included in the table. - if (track < 40) { - tableEntry = &_tableSfxIntro[track * 8]; - pan = (sfxTableGetPan(tableEntry) != 0); + if (track < _tableSfxIntro_Size) { + sfx = &_tableSfxIntro[track]; + pan = (sfx->pan != 0); } break; @@ -218,18 +198,22 @@ void SoundAmiga::playSoundEffect(uint8 track) { if (0x61 <= track && track <= 0x63) playTrack(track - 0x4F); - assert(track < 120); - if (sfxTableGetNote(&_tableSfxGame[track * 8])) { - tableEntry = &_tableSfxGame[track * 8]; - pan = (sfxTableGetPan(tableEntry) != 0) && (sfxTableGetPan(tableEntry) != 2); + if (track >= _tableSfxGame_Size) + return; + + if (_tableSfxGame[track].note) { + sfx = &_tableSfxGame[track]; + pan = (sfx->pan != 0) && (sfx->pan != 2); } + break; + default: - ; + return; } - if (_sfxEnabled && tableEntry) { - const bool success = _driver->playNote(sfxTableGetNote(tableEntry), sfxTableGetPatch(tableEntry), sfxTableGetDuration(tableEntry), sfxTableGetVolume(tableEntry), pan); + if (_sfxEnabled && sfx) { + const bool success = _driver->playNote(sfx->note, sfx->patch, sfx->duration, sfx->volume, pan); if (success && !_mixer->isSoundHandleActive(_musicHandle)) _mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_musicHandle, _driver, -1, Audio::Mixer::kMaxChannelVolume, 0, false); } diff --git a/engines/kyra/sound_intern.h b/engines/kyra/sound_intern.h index b85b8a2e30..3ee468b87b 100644 --- a/engines/kyra/sound_intern.h +++ b/engines/kyra/sound_intern.h @@ -285,6 +285,15 @@ private: static const uint8 _noteTable2[]; }; +// for StaticResource (maybe we can find a nicer way to handle it) +struct AmigaSfxTable { + uint8 note; + uint8 patch; + uint16 duration; + uint8 volume; + uint8 pan; +}; + class SoundAmiga : public Sound { public: SoundAmiga(KyraEngine_v1 *vm, Audio::Mixer *mixer); @@ -309,8 +318,12 @@ protected: Audio::MaxTrax *_driver; Audio::SoundHandle _musicHandle; enum FileType { kFileNone = -1, kFileIntro = 0, kFileGame = 1, kFileFinal = 2 } _fileLoaded; - const byte *_tableSfxIntro; - const byte *_tableSfxGame; + + const AmigaSfxTable *_tableSfxIntro; + int _tableSfxIntro_Size; + + const AmigaSfxTable *_tableSfxGame; + int _tableSfxGame_Size; }; } // end of namespace Kyra diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index 52eb0d322f..3bbc999ac3 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -41,10 +41,11 @@ #include "kyra/gui_lol.h" #include "kyra/gui_hof.h" #include "kyra/gui_mr.h" +#include "kyra/sound_intern.h" namespace Kyra { -#define RESFILE_VERSION 51 +#define RESFILE_VERSION 52 namespace { bool checkKyraDat(Common::SeekableReadStream *file) { @@ -219,6 +220,7 @@ bool StaticResource::init() { { kStringList, proc(loadStringTable), proc(freeStringTable) }, { StaticResource::kRoomList, proc(loadRoomTable), proc(freeRoomTable) }, { kShapeList, proc(loadShapeTable), proc(freeShapeTable) }, + { kAmigaSfxTable, proc(loadAmigaSfxTable), proc(freeAmigaSfxTable) }, { kRawData, proc(loadRawData), proc(freeRawData) }, { kPaletteTable, proc(loadPaletteTable), proc(freePaletteTable) }, @@ -322,8 +324,14 @@ bool StaticResource::init() { { k1TownsSFXwdTable, kRawData, "SFXWDTABLE" }, { k1TownsSFXbtTable, kRawData, "SFXBTTABLE" }, { k1TownsCDATable, kRawData, "CDATABLE" }, + + // CREDITS (used in FM-TOWNS and AMIGA) { k1CreditsStrings, kRawData, "CREDITS" }, + // AMIGA specific + { k1AmigaIntroSFXTable, kAmigaSfxTable, "SFXINTRO" }, + { k1AmigaGameSFXTable, kAmigaSfxTable, "SFXGAME" }, + { 0, 0, 0 } }; @@ -507,6 +515,10 @@ const Shape *StaticResource::loadShapeTable(int id, int &entries) { return (const Shape *)getData(id, kShapeList, entries); } +const AmigaSfxTable *StaticResource::loadAmigaSfxTable(int id, int &entries) { + return (const AmigaSfxTable *)getData(id, kAmigaSfxTable, entries); +} + const Room *StaticResource::loadRoomTable(int id, int &entries) { return (const Room *)getData(id, StaticResource::kRoomList, entries); } @@ -774,6 +786,29 @@ bool StaticResource::loadShapeTable(const char *filename, void *&ptr, int &size) return true; } +bool StaticResource::loadAmigaSfxTable(const char *filename, void *&ptr, int &size) { + Common::SeekableReadStream *file = getFile(filename); + if (!file) + return false; + + size = file->readUint32BE(); + AmigaSfxTable *loadTo = new AmigaSfxTable[size]; + assert(loadTo); + + for (int i = 0; i < size; ++i) { + loadTo[i].note = file->readByte(); + loadTo[i].patch = file->readByte(); + loadTo[i].duration = file->readUint16BE(); + loadTo[i].volume = file->readByte(); + loadTo[i].pan = file->readByte(); + } + + delete file; + ptr = loadTo; + + return true; +} + bool StaticResource::loadRoomTable(const char *filename, void *&ptr, int &size) { Common::SeekableReadStream *file = getFile(filename); if (!file) @@ -1205,6 +1240,13 @@ void StaticResource::freeShapeTable(void *&ptr, int &size) { size = 0; } +void StaticResource::freeAmigaSfxTable(void *&ptr, int &size) { + AmigaSfxTable *data = (AmigaSfxTable *)ptr; + delete[] data; + ptr = 0; + size = 0; +} + void StaticResource::freeRoomTable(void *&ptr, int &size) { Room *data = (Room *)ptr; delete[] data; @@ -3400,172 +3442,5 @@ const int LoLEngine::_outroMonsterScaleTableY[] = { #endif // ENABLE_LOL -// TODO: fileoffset = 0x32D5C, len = 40 * 8 -extern const byte LoKAmigaSfxIntro[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3C, 0x19, 0x00, 0x00, 0x25, 0x2C, 0x6E, 0x00, - 0x3C, 0x19, 0x00, 0x00, 0x25, 0x2C, 0x6E, 0x00, - 0x3C, 0x19, 0x00, 0x00, 0x25, 0x2C, 0x6E, 0x00, - 0x3C, 0x13, 0x00, 0x00, 0x1B, 0x91, 0x6E, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3C, 0x16, 0x00, 0x00, 0x26, 0x77, 0x6E, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3C, 0x17, 0x00, 0x00, 0x11, 0x98, 0x6E, 0x00, - 0x3C, 0x19, 0x00, 0x00, 0x25, 0x2C, 0x6E, 0x00, - 0x3C, 0x18, 0x00, 0x00, 0x22, 0xD1, 0x6E, 0x00, - 0x3C, 0x19, 0x00, 0x00, 0x25, 0x2C, 0x6E, 0x00, - 0x45, 0x03, 0x00, 0x00, 0x02, 0x24, 0x6E, 0x00, - 0x3C, 0x16, 0x00, 0x00, 0x26, 0x77, 0x6E, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -// TODO: fileoffset = 0x2C55E, len = 120 * 8 -extern const byte LoKAmigaSfxGame[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3C, 0x13, 0x00, 0x00, 0x01, 0x56, 0x78, 0x02, - 0x3C, 0x14, 0x00, 0x00, 0x27, 0x2C, 0x78, 0x02, - 0x3C, 0x15, 0x00, 0x00, 0x1B, 0x91, 0x78, 0x02, - 0x3C, 0x16, 0x00, 0x00, 0x1E, 0x97, 0x78, 0x02, - 0x3C, 0x17, 0x00, 0x00, 0x12, 0x2B, 0x78, 0x02, - 0x3C, 0x16, 0x00, 0x00, 0x1E, 0x97, 0x78, 0x02, - 0x45, 0x03, 0x00, 0x00, 0x02, 0x24, 0x78, 0x02, - 0x3C, 0x16, 0x00, 0x00, 0x1E, 0x97, 0x78, 0x02, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3C, 0x19, 0x00, 0x00, 0x25, 0x2C, 0x78, 0x02, - 0x2C, 0x04, 0x00, 0x00, 0x09, 0x10, 0x78, 0x02, - 0x3C, 0x19, 0x00, 0x00, 0x25, 0x2C, 0x78, 0x02, - 0x3C, 0x1A, 0x00, 0x00, 0x3A, 0xEB, 0x78, 0x02, - 0x25, 0x1B, 0x00, 0x00, 0x13, 0x8B, 0x78, 0x02, - 0x18, 0x03, 0x00, 0x00, 0x0F, 0x52, 0x78, 0x02, - 0x3E, 0x1C, 0x00, 0x00, 0x06, 0x22, 0x78, 0x02, - 0x3B, 0x1C, 0x00, 0x00, 0x07, 0x54, 0x78, 0x02, - 0x16, 0x03, 0x00, 0x00, 0x20, 0x6F, 0x78, 0x02, - 0x3C, 0x19, 0x00, 0x00, 0x25, 0x2C, 0x78, 0x02, - 0x3C, 0x1D, 0x00, 0x00, 0x09, 0xEA, 0x78, 0x02, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3C, 0x14, 0x00, 0x00, 0x27, 0x2C, 0x78, 0x02, - 0x3C, 0x1E, 0x00, 0x00, 0x03, 0x6E, 0x78, 0x02, - 0x3C, 0x17, 0x00, 0x00, 0x12, 0x2B, 0x78, 0x02, - 0x4E, 0x0B, 0x00, 0x00, 0x09, 0x91, 0x78, 0x02, - 0x47, 0x1B, 0x00, 0x00, 0x02, 0xBC, 0x78, 0x02, - 0x4C, 0x1B, 0x00, 0x00, 0x02, 0x11, 0x78, 0x02, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3C, 0x13, 0x00, 0x00, 0x01, 0x56, 0x78, 0x02, - 0x3C, 0x13, 0x00, 0x00, 0x01, 0x56, 0x78, 0x02, - 0x3C, 0x1F, 0x00, 0x00, 0x0E, 0x9E, 0x78, 0x02, - 0x3C, 0x20, 0x00, 0x00, 0x01, 0x0C, 0x78, 0x02, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3C, 0x19, 0x00, 0x00, 0x25, 0x2C, 0x78, 0x02, - 0x3C, 0x21, 0x00, 0x00, 0x0F, 0x7C, 0x78, 0x02, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x2A, 0x0B, 0x00, 0x00, 0x4C, 0x47, 0x78, 0x02, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3C, 0x1B, 0x00, 0x00, 0x05, 0x28, 0x78, 0x02, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x2C, 0x04, 0x00, 0x00, 0x09, 0x10, 0x78, 0x02, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3C, 0x22, 0x00, 0x00, 0x0A, 0xEE, 0x78, 0x02, - 0x3C, 0x16, 0x00, 0x00, 0x1E, 0x97, 0x78, 0x02, - 0x3C, 0x15, 0x00, 0x00, 0x1B, 0x91, 0x78, 0x02, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3C, 0x14, 0x00, 0x00, 0x27, 0x2C, 0x78, 0x02, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3C, 0x22, 0x00, 0x00, 0x0A, 0xEE, 0x78, 0x02, - 0x3C, 0x14, 0x00, 0x00, 0x27, 0x2C, 0x78, 0x02, - 0x32, 0x23, 0x00, 0x00, 0x14, 0x19, 0x9C, 0x02, - 0x3C, 0x19, 0x00, 0x00, 0x17, 0x1C, 0x78, 0x02, - 0x3C, 0x14, 0x00, 0x00, 0x27, 0x2C, 0x78, 0x02, - 0x3E, 0x1C, 0x00, 0x00, 0x06, 0x22, 0x78, 0x02, - 0x43, 0x13, 0x00, 0x00, 0x02, 0x01, 0x78, 0x02, - 0x3C, 0x24, 0x00, 0x00, 0x12, 0x43, 0x5A, 0x02, - 0x3E, 0x20, 0x00, 0x00, 0x00, 0xEE, 0x78, 0x02, - 0x3C, 0x19, 0x00, 0x00, 0x25, 0x2C, 0x78, 0x02, - 0x29, 0x04, 0x00, 0x00, 0x19, 0xEA, 0x78, 0x02, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3C, 0x20, 0x00, 0x00, 0x01, 0x0C, 0x78, 0x02, - 0x3C, 0x25, 0x00, 0x00, 0x30, 0xB6, 0x78, 0x02, - 0x3C, 0x19, 0x00, 0x00, 0x25, 0x2C, 0x78, 0x02, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3C, 0x16, 0x00, 0x00, 0x1E, 0x97, 0x78, 0x02, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3C, 0x1A, 0x00, 0x00, 0x3A, 0xEB, 0x78, 0x02, - 0x1B, 0x04, 0x00, 0x00, 0x39, 0xF3, 0x78, 0x02, - 0x30, 0x23, 0x00, 0x00, 0x16, 0x99, 0x50, 0x02, - 0x3C, 0x15, 0x00, 0x00, 0x1B, 0x91, 0x78, 0x02, - 0x29, 0x06, 0x00, 0x00, 0x19, 0xEA, 0x50, 0x02, - 0x3C, 0x19, 0x00, 0x00, 0x25, 0x2C, 0x78, 0x02, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3C, 0x1A, 0x00, 0x00, 0x3A, 0xEB, 0x78, 0x02, - 0x3C, 0x19, 0x00, 0x00, 0x25, 0x2C, 0x78, 0x02, - 0x3C, 0x26, 0x00, 0x00, 0x07, 0x13, 0x78, 0x02, - 0x3C, 0x26, 0x00, 0x00, 0x07, 0x13, 0x78, 0x02, - 0x3C, 0x14, 0x00, 0x00, 0x27, 0x2C, 0x78, 0x02, - 0x30, 0x23, 0x00, 0x00, 0x16, 0x99, 0x50, 0x02, - 0x30, 0x23, 0x00, 0x00, 0x16, 0x99, 0x50, 0x02, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3C, 0x13, 0x00, 0x00, 0x01, 0x56, 0x78, 0x02 -}; - } // End of namespace Kyra + diff --git a/tools/create_kyradat/amiga.h b/tools/create_kyradat/amiga.h index 3b3aa2d5a5..19e1a15139 100644 --- a/tools/create_kyradat/amiga.h +++ b/tools/create_kyradat/amiga.h @@ -48,6 +48,8 @@ const ExtractEntry kyra1AmigaEng[] = { { kNewGameString, 0x00031164, 0x0003117A }, { kConfigStrings, 0x00015ACA, 0x00015AF8 }, { kCreditsStrings, 0x0000777C, 0x00007C48 }, + { kAmigaIntroSFXTable, 0x00032D5C, 0x00032E9C }, + { kAmigaGameSFXTable, 0x0002C55E, 0x0002C91E }, { -1, 0, 0 } }; diff --git a/tools/create_kyradat/create_kyradat.cpp b/tools/create_kyradat/create_kyradat.cpp index 43e17c80e0..15c17fa981 100644 --- a/tools/create_kyradat/create_kyradat.cpp +++ b/tools/create_kyradat/create_kyradat.cpp @@ -31,7 +31,7 @@ #include "md5.h" enum { - kKyraDatVersion = 51, + kKyraDatVersion = 52, kIndexSize = 12 }; @@ -61,21 +61,22 @@ const Game kyra1FanTranslations[] = { GAME_DUMMY_ENTRY }; -bool extractRaw(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch = 0); -bool extractStrings(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch = 0); -bool extractRooms(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch = 0); -bool extractShapes(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch = 0); -bool extractHofSeqData(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch = 0); -bool extractHofShapeAnimDataV1(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch = 0); -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); -bool extractRaw16(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch = 0); -bool extractRaw32(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch = 0); -bool extractLolButtonDefs(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch = 0); +bool extractRaw(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch); +bool extractStrings(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch); +bool extractRooms(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch); +bool extractShapes(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch); +bool extractAmigaSfx(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch); +bool extractHofSeqData(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch); +bool extractHofShapeAnimDataV1(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch); +bool extractHofShapeAnimDataV2(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch); + +bool extractStringsWoSuffix(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch); +bool extractPaddedStrings(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch); +bool extractRaw16to8(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch); +bool extractMrShapeAnimData(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch); +bool extractRaw16(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch); +bool extractRaw32(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch); +bool extractLolButtonDefs(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch); int extractHofSeqData_checkString(const void *ptr, uint8 checkSize); int extractHofSeqData_isSequence(const void *ptr, const Game *g, uint32 maxCheckSize); @@ -90,6 +91,7 @@ const ExtractType extractTypeTable[] = { { kTypeRoomList, extractRooms, createFilename }, { kTypeShapeList, extractShapes, createFilename }, { kTypeRawData, extractRaw, createFilename }, + { kTypeAmigaSfxTable, extractAmigaSfx, createFilename }, { k2TypeSeqData, extractHofSeqData, createFilename }, { k2TypeShpDataV1, extractHofShapeAnimDataV1, createFilename }, @@ -214,13 +216,16 @@ const ExtractFilename extractFilenames[] = { { kPaletteList31, kTypeRawData, "PALTABLE31.PAL" }, { kPaletteList32, kTypeRawData, "PALTABLE32.PAL" }, { kPaletteList33, kTypeRawData, "PALTABLE33.PAL" }, + { kCreditsStrings, kTypeRawData, "CREDITS" }, // FM-TOWNS specific { kKyra1TownsSFXwdTable, kTypeRawData, "SFXWDTABLE" }, { kKyra1TownsSFXbtTable, kTypeRawData, "SFXBTTABLE" }, { kKyra1TownsCDATable, kTypeRawData, "CDATABLE" }, - { kCreditsStrings, kTypeRawData, "CREDITS" }, + // AMIGA specific + { kAmigaIntroSFXTable, kTypeAmigaSfxTable, "SFXINTRO" }, + { kAmigaGameSFXTable, kTypeAmigaSfxTable, "SFXGAME" }, // HAND OF FATE @@ -692,6 +697,25 @@ bool extractShapes(PAKFile &out, const Game *g, const byte *data, const uint32 s return out.addFile(filename, buffer, size + 1 * 4); } +bool extractAmigaSfx(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch) { + const uint32 entries = size / 8; + byte *buffer = new byte[entries * 6 + 1 * 4]; + + byte *output = buffer; + WRITE_BE_UINT32(output, entries); output += 4; + + for (uint32 i = 0; i < entries; ++i) { + *output++ = *data++; // Note + *output++ = *data++; // Patch + data += 2; // Unused + WRITE_BE_UINT16(output, READ_BE_UINT16(data)); output += 2; data += 2; // Duration + *output++ = *data++; // Volume + *output++ = *data++; // Pan + } + + return out.addFile(filename, buffer, entries * 6 + 1 * 4); +} + bool extractHofSeqData(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch) { int numSequences = 0; int numNestedSequences = 0; diff --git a/tools/create_kyradat/create_kyradat.h b/tools/create_kyradat/create_kyradat.h index 2a6e0a37c3..5941467aab 100644 --- a/tools/create_kyradat/create_kyradat.h +++ b/tools/create_kyradat/create_kyradat.h @@ -141,6 +141,9 @@ enum kExtractID { kKyra1TownsCDATable, kCreditsStrings, + kAmigaIntroSFXTable, + kAmigaGameSFXTable, + k2SeqplayPakFiles, k2SeqplayStrings, k2SeqplaySfxFiles, @@ -346,6 +349,7 @@ enum kExtractType { kTypeRoomList, kTypeShapeList, kTypeRawData, + kTypeAmigaSfxTable, k2TypeSeqData, k2TypeShpDataV1, diff --git a/tools/create_kyradat/misc.h b/tools/create_kyradat/misc.h index 2a14dab611..5379b8577b 100644 --- a/tools/create_kyradat/misc.h +++ b/tools/create_kyradat/misc.h @@ -369,6 +369,8 @@ const int kyra1AmigaNeed[] = { kNewGameString, kConfigStrings, kCreditsStrings, + kAmigaIntroSFXTable, + kAmigaGameSFXTable, -1 }; -- cgit v1.2.3