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

bluegr noreply at scummvm.org
Fri Dec 27 08:16:51 UTC 2024


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:
ae660505a4 AUDIO: Fix Fluidsynth soundfont path check on iOS


Commit: ae660505a4ab3a60e69347bdd960090de61ede71
    https://github.com/scummvm/scummvm/commit/ae660505a4ab3a60e69347bdd960090de61ede71
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2024-12-27T10:16:48+02:00

Commit Message:
AUDIO: Fix Fluidsynth soundfont path check on iOS

On iOS a sandboxed filesystem is used where the root is in the
Application folder instead of being the filesystem root. As a
result path used in ScummVM (for example for FSNode) are different
from filesystem paths. For fluidsynth the internal soundfont path
is transformed to a filesystem path to pass to the fluidsynth
library. On iOS trying to create a FSNode with that full path does
not work and that caused the soundfont existence check to fail.

Changed paths:
    audio/softsynth/fluidsynth.cpp


diff --git a/audio/softsynth/fluidsynth.cpp b/audio/softsynth/fluidsynth.cpp
index 10496983d11..e64d2fc8500 100644
--- a/audio/softsynth/fluidsynth.cpp
+++ b/audio/softsynth/fluidsynth.cpp
@@ -113,7 +113,7 @@ protected:
 public:
 	MidiDriver_FluidSynth(Audio::Mixer *mixer);
 
-	static Common::Path getSoundFontPath();
+	static Common::Path getSoundFontPath(bool *exists = nullptr);
 
 	int open() override;
 	void close() override;
@@ -280,13 +280,18 @@ static long SoundFontMemLoader_tell(void *handle) {
 
 #endif // USE_FLUIDLITE
 
-Common::Path MidiDriver_FluidSynth::getSoundFontPath() {
+Common::Path MidiDriver_FluidSynth::getSoundFontPath(bool *exists) {
 	Common::Path path = ConfMan.getPath("soundfont");
-	if (path.empty())
+	if (path.empty()) {
+		if (exists)
+			*exists = false;
 		return path;
+	}
 
 	Common::FSNode fileNode(path);
 	if (fileNode.exists()) {
+		if (exists)
+			*exists = true;
 		// Return the full system path to the soundfont
 		return Common::Path(g_system->getFilesystemFactory()->getSystemFullPath(path.toString(Common::Path::kNativeSeparator)), Common::Path::kNativeSeparator);
 	}
@@ -296,8 +301,11 @@ Common::Path MidiDriver_FluidSynth::getSoundFontPath() {
 		Common::FSNode dirNode(ConfMan.getPath("soundfontpath"));
 		if (dirNode.exists() && dirNode.isDirectory()) {
 			fileNode = dirNode.getChild(path.baseName());
-			if (fileNode.exists())
+			if (fileNode.exists()) {
+				if (exists)
+					*exists = true;
 				return fileNode.getPath();
+			}
 		}
 	}
 
@@ -309,10 +317,15 @@ Common::Path MidiDriver_FluidSynth::getSoundFontPath() {
 		if (!dir)
 			continue;
 		fileNode = dir->getFSNode().getChild(file.arcMember->getPathInArchive().toString(Common::Path::kNativeSeparator));
-		if (fileNode.exists())
+		if (fileNode.exists()) {
+			if (exists)
+				*exists = true;
 			return fileNode.getPath();
+		}
 	}
 
+	if (exists)
+		*exists = false;
 	return path;
 }
 
@@ -608,11 +621,9 @@ bool FluidSynthMusicPlugin::checkDevice(MidiDriver::DeviceHandle, int flags, boo
 		return true;
 #endif
 
-	Common::Path sfPath = MidiDriver_FluidSynth::getSoundFontPath();
-	if (sfPath.empty())
-		return false;
-
-	return Common::FSNode(sfPath).exists();
+	bool exists = false;
+	Common::Path sfPath = MidiDriver_FluidSynth::getSoundFontPath(&exists);
+	return !sfPath.empty() && exists;
 }
 
 Common::Error FluidSynthMusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle) const {




More information about the Scummvm-git-logs mailing list