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

mduggan noreply at scummvm.org
Sun Mar 2 05:11:19 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:
d4948067e6 DGDS: Use Willy Beamish FDD MT32 patches in CD version


Commit: d4948067e6f12385d50cda412a25167d7f28aeda
    https://github.com/scummvm/scummvm/commit/d4948067e6f12385d50cda412a25167d7f28aeda
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-03-02T16:08:34+11:00

Commit Message:
DGDS: Use Willy Beamish FDD MT32 patches in CD version

Unfortunately, the CD version never offically supported MT-32 for SFX and music
because the voice acting needed a Sound Blaster.  This means it was shipped
with corrupted MT-32 patches for the SFX.

The GOG version of the game comes with both CD and FDD data together, so add
the ability to load MT-32 patch information out of the FDD version if it's also
present.

Changed paths:
    engines/dgds/resource.cpp
    engines/dgds/resource.h
    engines/dgds/sound/drivers/midipatch.cpp


diff --git a/engines/dgds/resource.cpp b/engines/dgds/resource.cpp
index 5176e31d74a..b92b9405e9d 100644
--- a/engines/dgds/resource.cpp
+++ b/engines/dgds/resource.cpp
@@ -34,8 +34,8 @@ namespace Dgds {
 
 static const int FILENAME_LENGTH = 12;
 
-ResourceManager::ResourceManager() {
-	const char *indexFiles[] = {
+ResourceManager::ResourceManager(const char *dir /* = ""*/) {
+	static const char *indexFiles[] = {
 		"volume.vga", // Dragon VGA versions
 		"volume.ega", // Dragon EGA versions
 		"volume.rmf", // Beamish / HoC
@@ -44,14 +44,16 @@ ResourceManager::ResourceManager() {
 
 	Common::File indexFile;
 	for (int i = 0; i < ARRAYSIZE(indexFiles); i++) {
-		if (Common::File::exists(indexFiles[i])) {
-			indexFile.open(indexFiles[i]);
+		Common::Path path(dir);
+		path.joinInPlace(indexFiles[i]);
+		if (Common::File::exists(path)) {
+			indexFile.open(path);
 			break;
 		}
 	}
 
 	if (!indexFile.isOpen()) {
-		warning("No DGDS volume index file found to open.");
+		debug("No DGDS volume index file found to open in directory '%s'.", dir);
 		return;
 	}
 
@@ -63,8 +65,9 @@ ResourceManager::ResourceManager() {
 
 	for (int i = 0; i < nvolumes; i++) {
 		indexFile.read(fnbuf, FILENAME_LENGTH);
-		Common::Path volumeName(fnbuf);
-		assert(!volumeName.empty());
+		assert(strlen(fnbuf) > 0);
+		Common::Path volumeName(dir);
+		volumeName.joinInPlace(fnbuf);
 
 		_volumes[i].open(volumeName);
 		if (!_volumes[i].isOpen())
diff --git a/engines/dgds/resource.h b/engines/dgds/resource.h
index fbf197486d5..b0f35778b7a 100644
--- a/engines/dgds/resource.h
+++ b/engines/dgds/resource.h
@@ -48,7 +48,7 @@ typedef Common::HashMap<Common::String, Resource> ResourceList;
 
 class ResourceManager {
 public:
-	ResourceManager();
+	ResourceManager(const char *dir = "");
 	virtual ~ResourceManager();
 
 	Common::SeekableReadStream *getResource(Common::String name, bool ignorePatches = false);
diff --git a/engines/dgds/sound/drivers/midipatch.cpp b/engines/dgds/sound/drivers/midipatch.cpp
index 1c090def8f8..db50e9db0c0 100644
--- a/engines/dgds/sound/drivers/midipatch.cpp
+++ b/engines/dgds/sound/drivers/midipatch.cpp
@@ -49,7 +49,7 @@ SciResource *getMidiPatchData(int num) {
 	DgdsEngine *engine = DgdsEngine::getInstance();
 	ResourceManager *resource = engine->getResourceManager();
 	Decompressor *decomp = engine->getDecompressor();
-
+	ResourceManager *fddMgr = nullptr;
 	Common::SeekableReadStream *ovlStream;
 
 	int resNum = 0;
@@ -59,8 +59,23 @@ SciResource *getMidiPatchData(int num) {
 			break;
 	}
 
+	//
+	// WORKAROUND: The MT-32 patch data in Willy Beamish CD version is corrupted.
+	// If the FDD version is avaialble in the "FDD" directory, use that instead.
+	// This is how the data comes arranged in the GOG version.
+	//
+	if (num == 1 && engine->getGameId() == GID_WILLY) {
+		fddMgr = new ResourceManager("FDD");
+		if (fddMgr->hasResource("SX.OVL")) {
+			debug("Overriding MT32 patch data with patches from FDD version.");
+			delete ovlStream;
+			resNum = 2;
+			ovlStream = fddMgr->getResource("SX.OVL");
+		}
+	}
+
 	if (!ovlStream) {
-		warning("Couldn't load DGDS midi patch data from any known OVL file.");
+		warning("Couldn't load DGDS midi patch data from any known OVL file");
 		return nullptr;
 	}
 
@@ -94,6 +109,10 @@ SciResource *getMidiPatchData(int num) {
 		}
 	}
 
+	delete ovlStream;
+	if (fddMgr)
+		delete fddMgr;
+
 	warning("Didn't find section %s in midi patch resource %s", targetSection.c_str(), PATCH_RESOURCES[resNum]);
 
 	return nullptr;




More information about the Scummvm-git-logs mailing list