[Scummvm-git-logs] scummvm master -> e1d7318d56a9fb80f03d46c9585765daf1bb8b7b

bluegr noreply at scummvm.org
Tue Jan 7 13:39:57 UTC 2025


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
e1d7318d56 SCUMM: Add SE speech support for MI2SE


Commit: e1d7318d56a9fb80f03d46c9585765daf1bb8b7b
    https://github.com/scummvm/scummvm/commit/e1d7318d56a9fb80f03d46c9585765daf1bb8b7b
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2025-01-07T15:39:36+02:00

Commit Message:
SCUMM: Add SE speech support for MI2SE

Changed paths:
    engines/scumm/detection_tables.h
    engines/scumm/soundse.cpp
    engines/scumm/soundse.h


diff --git a/engines/scumm/detection_tables.h b/engines/scumm/detection_tables.h
index ac4252f0c3f..8995ccb6dcd 100644
--- a/engines/scumm/detection_tables.h
+++ b/engines/scumm/detection_tables.h
@@ -200,7 +200,7 @@ static const GameSettings gameVariantsTable[] = {
 	{"monkey", "SEGA",         0, GID_MONKEY,     5, 0, MDT_NONE,                         GF_AUDIOTRACKS, Common::kPlatformSegaCD, GUIO4(GUIO_NOSPEECH, GUIO_NOMIDI, GAMEOPTION_ENHANCEMENTS, GAMEOPTION_ORIGINALGUI)},
 	{"monkey", "SE Talkie",    0, GID_MONKEY,     5, 0, MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, GF_AUDIOTRACKS | GF_ULTIMATE_TALKIE, UNK, GUIO2(GUIO_RENDEREGA, GAMEOPTION_ORIGINALGUI)},
 	{"monkey2", "", 0, GID_MONKEY2,  5, 0, MDT_PCSPK | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, UNK, GUIO5(GUIO_NOSPEECH, GUIO_RENDEREGA, GAMEOPTION_ENHANCEMENTS, GAMEOPTION_ORIGINALGUI, GAMEOPTION_COPY_PROTECTION)},
-	{"monkey2", "SE", 0, GID_MONKEY2,  5, 0, MDT_PCSPK | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, GF_DOUBLEFINE_PAK, UNK, GUIO5(GUIO_NOSPEECH, GUIO_RENDEREGA, GAMEOPTION_ENHANCEMENTS, GAMEOPTION_ORIGINALGUI, GAMEOPTION_COPY_PROTECTION)},
+	{"monkey2", "SE", 0, GID_MONKEY2, 5, 0, MDT_PCSPK | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, GF_DOUBLEFINE_PAK, UNK, GUIO6(GUIO_NOSPEECH, GUIO_RENDEREGA, GAMEOPTION_ENHANCEMENTS, GAMEOPTION_ORIGINALGUI, GAMEOPTION_COPY_PROTECTION, GAMEOPTION_USE_REMASTERED_AUDIO)},
 	{"monkey2", "Demo", 0, GID_MONKEY2,  5, 0, MDT_PCSPK | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, GF_DEMO, UNK, GUIO2(GUIO_NOSPEECH, GAMEOPTION_ENHANCEMENTS)},
 	{"monkey2", "Amiga", 0, GID_MONKEY2,  5, 0, MDT_AMIGA, 0, Common::kPlatformAmiga, GUIO5(GUIO_NOSPEECH, GUIO_MIDIAMIGA, GAMEOPTION_ENHANCEMENTS, GAMEOPTION_ORIGINALGUI, GAMEOPTION_COPY_PROTECTION)},
 	{"monkey2", "Mac", 0, GID_MONKEY2,  5, 0, MDT_MACINTOSH, 0, UNK, GUIO5(GUIO_NOSPEECH, GAMEOPTION_ENHANCEMENTS, GAMEOPTION_ORIGINALGUI, GAMEOPTION_COPY_PROTECTION, GUIO_NOASPECT)},
diff --git a/engines/scumm/soundse.cpp b/engines/scumm/soundse.cpp
index ffa380adfe2..fdcec25f8eb 100644
--- a/engines/scumm/soundse.cpp
+++ b/engines/scumm/soundse.cpp
@@ -183,21 +183,18 @@ void SoundSE::indexXWBFile(const Common::String &filename, AudioIndex *audioInde
 		audioIndex->push_back(entry);
 	}
 
-	uint32 nameOffset = segments[kXWBSegmentEntryNames].offset;
-	uint32 nameLen = 64;
-
-#if 0
 	if (_vm->_game.id == GID_MONKEY2) {
 		f->close();
+		delete f;
 
 		// The audio file names of Monkey Island 2 SE are placed in a separate file
-		// TODO: These are read in the wrong order
-		f->open(Common::Path("speechcues.xsb"));
-		f->skip(42);
-		nameOffset = f->readUint32LE();
-		nameLen = Common::String::npos;
+		if (_speechFilename.equalsIgnoreCase("Speech.xwb"))
+			indexMI2SpeechFiles(entryCount);
+
+		return;
 	}
-#endif
+
+	const uint32 nameOffset = segments[kXWBSegmentEntryNames].offset;
 
 	if (!nameOffset)
 		WARN_AND_RETURN_XWB("XWB file does not contain audio file names")
@@ -205,7 +202,7 @@ void SoundSE::indexXWBFile(const Common::String &filename, AudioIndex *audioInde
 	f->seek(nameOffset);
 
 	for (uint32 i = 0; i < entryCount; i++) {
-		Common::String name = f->readString(0, nameLen);
+		Common::String name = f->readString(0, 64);
 		name.toLowercase();
 
 		(*audioIndex)[i].name = name;
@@ -218,6 +215,40 @@ void SoundSE::indexXWBFile(const Common::String &filename, AudioIndex *audioInde
 
 #undef WARN_AND_RETURN_XWB
 
+void SoundSE::indexMI2SpeechFiles(uint32 entryCount) {
+	Common::List<uint16> speechIndices;
+
+	Common::File *f = new Common::File();
+	f->open(Common::Path("speechcues.xsb"));
+
+	f->skip(42);
+	const uint32 nameOffset = f->readUint32LE();
+	f->skip(24);
+	const uint32 entriesOffset = f->readUint32LE();
+
+	f->seek(entriesOffset);
+
+	for (uint32 i = 0; i < entryCount; i++) {
+		f->skip(9);
+		const uint16 speechIndex = f->readUint16LE();
+		speechIndices.push_back(speechIndex);
+		f->skip(8);
+	}
+
+	f->seek(nameOffset);
+
+	for (auto &index : speechIndices) {
+		Common::String name = f->readString(0);
+		name.toLowercase();
+
+		_speechEntries[index].name = name;
+		_nameToIndex[name] = index;
+	}
+
+	f->close();
+	delete f;
+}
+
 #define WARN_AND_RETURN_FSB(message)          \
 	{                                         \
 		warning("indexFSBFile: %s", message); \
diff --git a/engines/scumm/soundse.h b/engines/scumm/soundse.h
index 9ae8a0642a4..4f798c2ed9f 100644
--- a/engines/scumm/soundse.h
+++ b/engines/scumm/soundse.h
@@ -154,6 +154,7 @@ private:
 
 	// Index XWB audio files - used in MI1SE and MI2SE
 	void indexXWBFile(const Common::String &filename, AudioIndex *audioIndex);
+	void indexMI2SpeechFiles(uint32 entryCount);
 
 	// Index FSB audio files - used in DOTT and FT
 	void indexFSBFile(const Common::String &filename, AudioIndex *audioIndex);




More information about the Scummvm-git-logs mailing list