aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/saga/detection_tables.h20
-rw-r--r--engines/saga/saga.h3
-rw-r--r--engines/saga/sndres.cpp47
3 files changed, 58 insertions, 12 deletions
diff --git a/engines/saga/detection_tables.h b/engines/saga/detection_tables.h
index 3ab9a052ae..0017f34957 100644
--- a/engines/saga/detection_tables.h
+++ b/engines/saga/detection_tables.h
@@ -104,12 +104,12 @@ static const GameFontDescription IHNMCD_GameFonts[] = { {2}, {3}, {4}, {5},
// frequency, sampleBits, stereo, isBigEndian, isSigned
static const GameSoundInfo ITEPC_GameSound = { kSoundPCM, 22050, 16, false, false, true };
-static const GameSoundInfo ITEMAC_GameSound = { kSoundPCM, 22050, 16, false, true, true };
static const GameSoundInfo ITEWINDEMO1_GameSound = { kSoundPCM, 22050, 8, false, false, false };
static const GameSoundInfo ITEMACCD_G_GameSound = { kSoundMacPCM, 22050, 8, false, false, false };
static const GameSoundInfo ITEDISK_GameSound = { kSoundVOC, -1, -1, false, false, true };
static const GameSoundInfo ITEDEMO_GameVoice = { kSoundVOX, 22050, 16, false, false, true };
static const GameSoundInfo IHNM_GameSound = { kSoundWAV, -1, -1, false, false, true };
+static const GameSoundInfo MAC_GameSound = { kSoundPCM, 22050, 16, false, true, true };
// Patch files. Files not found will be ignored
static const GamePatchDescription ITEPatch_Files[] = {
@@ -161,7 +161,7 @@ static const GamePatchDescription ITEMacPatch_Files[] = {
{ "wyrm4.dlt", GAME_RESOURCEFILE, 1533, NULL},
{ "credit3m.dlt", GAME_RESOURCEFILE, 1796, NULL},
{ "credit4m.dlt", GAME_RESOURCEFILE, 1797, NULL},
- { "p2_a.iaf", GAME_VOICEFILE, 4, &ITEMAC_GameSound}
+ { "p2_a.iaf", GAME_VOICEFILE, 4, &MAC_GameSound}
};
static const SAGAGameDescription gameDescriptions[] = {
@@ -226,7 +226,7 @@ static const SAGAGameDescription gameDescriptions[] = {
ARRAYSIZE(ITEWINDEMO_GameFonts),
ITEWINDEMO_GameFonts,
&ITEDEMO_GameVoice,
- &ITEMAC_GameSound,
+ &MAC_GameSound,
ARRAYSIZE(ITEMacPatch_Files),
ITEMacPatch_Files,
},
@@ -255,7 +255,7 @@ static const SAGAGameDescription gameDescriptions[] = {
ARRAYSIZE(ITEWINDEMO_GameFonts),
ITEWINDEMO_GameFonts,
&ITEDEMO_GameVoice,
- &ITEMAC_GameSound,
+ &MAC_GameSound,
ARRAYSIZE(ITEMacPatch_Files),
ITEMacPatch_Files,
},
@@ -375,8 +375,8 @@ static const SAGAGameDescription gameDescriptions[] = {
&ITE_Resources,
ARRAYSIZE(ITEWINDEMO_GameFonts),
ITEWINDEMO_GameFonts,
- &ITEMAC_GameSound,
- &ITEMAC_GameSound,
+ &MAC_GameSound,
+ &MAC_GameSound,
ARRAYSIZE(ITEMacPatch_Files),
ITEMacPatch_Files,
},
@@ -410,7 +410,7 @@ static const SAGAGameDescription gameDescriptions[] = {
&ITE_Resources,
ARRAYSIZE(ITE_GameFonts),
ITE_GameFonts,
- &ITEMAC_GameSound,
+ &MAC_GameSound,
&ITEPC_GameSound,
0,
NULL,
@@ -442,7 +442,7 @@ static const SAGAGameDescription gameDescriptions[] = {
&ITE_Resources,
ARRAYSIZE(ITE_GameFonts),
ITE_GameFonts,
- &ITEMAC_GameSound,
+ &MAC_GameSound,
&ITEPC_GameSound,
0,
NULL,
@@ -892,8 +892,8 @@ static const SAGAGameDescription gameDescriptions[] = {
&IHNM_Resources,
ARRAYSIZE(IHNMCD_GameFonts),
IHNMCD_GameFonts,
- &IHNM_GameSound,
- &IHNM_GameSound,
+ &MAC_GameSound,
+ &MAC_GameSound,
0,
NULL,
},
diff --git a/engines/saga/saga.h b/engines/saga/saga.h
index 0a2d345651..35c3736b31 100644
--- a/engines/saga/saga.h
+++ b/engines/saga/saga.h
@@ -234,7 +234,8 @@ enum GameSoundTypes {
kSoundMacPCM = 4,
kSoundMP3 = 5,
kSoundOGG = 6,
- kSoundFLAC = 7
+ kSoundFLAC = 7,
+ kSoundAIFF = 8
};
enum TextStringIds {
diff --git a/engines/saga/sndres.cpp b/engines/saga/sndres.cpp
index 18f410bd90..83e13d94aa 100644
--- a/engines/saga/sndres.cpp
+++ b/engines/saga/sndres.cpp
@@ -38,6 +38,7 @@
#include "sound/voc.h"
#include "sound/wave.h"
#include "sound/adpcm.h"
+#include "sound/aiff.h"
#include "sound/audiostream.h"
namespace Saga {
@@ -170,7 +171,32 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff
return false;
}
- _vm->_resource->loadResource(context, resourceId, soundResource, soundResourceLength);
+ if (_vm->getGameType() == GType_IHNM && _vm->isMacResources()) {
+ Common::File soundFile;
+ char soundFileName[40];
+ int dirIndex = 0;
+
+ if ((context->fileType & GAME_VOICEFILE) != 0) {
+ // TODO
+ return false;
+ } else {
+ dirIndex = floor((float)(resourceId / 63));
+
+ if (resourceId <= 16) // F in hex (1 char in hex)
+ sprintf(soundFileName, "SFX/SFX%d/SFX00%x", dirIndex, resourceId);
+ else if (resourceId <= 255) // FF in hex (2 chars in hex)
+ sprintf(soundFileName, "SFX/SFX%d/SFX0%x", dirIndex, resourceId);
+ else
+ sprintf(soundFileName, "SFX/SFX%d/SFX%x", dirIndex, resourceId);
+ }
+ soundFile.open(soundFileName);
+ soundResourceLength = soundFile.size();
+ soundResource = new byte[soundResourceLength];
+ soundFile.read(soundResource, soundResourceLength);
+ soundFile.close();
+ } else {
+ _vm->_resource->loadResource(context, resourceId, soundResource, soundResourceLength);
+ }
if ((context->fileType & GAME_VOICEFILE) != 0) {
soundInfo = _vm->getVoiceInfo();
@@ -189,6 +215,8 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff
resourceType = kSoundVOC;
} else if (!memcmp(soundResource, "RIFF", 4) != 0) {
resourceType = kSoundWAV;
+ } else if (!memcmp(soundResource, "FORM", 4) != 0) {
+ resourceType = kSoundAIFF;
}
bool uncompressedSound = false;
@@ -302,6 +330,23 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff
}
free(soundResource);
break;
+ case kSoundAIFF:
+ if (Audio::loadAIFFFromStream(readS, size, rate, flags)) {
+ buffer.frequency = rate;
+ buffer.sampleBits = 16;
+ buffer.stereo = ((flags & Audio::Mixer::FLAG_STEREO) != 0);
+ buffer.isSigned = true;
+ buffer.size = size;
+ if (onlyHeader) {
+ buffer.buffer = NULL;
+ } else {
+ buffer.buffer = (byte *)malloc(size);
+ readS.read(buffer.buffer, size);
+ }
+ result = true;
+ }
+ free(soundResource);
+ break;
case kSoundMP3:
case kSoundOGG:
case kSoundFLAC: