[Scummvm-git-logs] scummvm master -> 05778930559f32d7714cab111c40aee2052983ff
criezy
noreply at scummvm.org
Sun Dec 3 16:17:38 UTC 2023
This automated email contains information about 7 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
6fc56a6333 AUDIO: Add lookup of fluidsynth soundfont using SearchMan or a soundfontpath config
f47d915ec0 AUDIO: Support specifying a soundfont in the ConfMan default domain
95a060e4fe AUDIO: Add a basic soundfont for fluidsynth
ab13d18e58 BACKENDS: Add function in FS Factory to map scummvm path to system path
cac0664757 AUDIO: Improve code to map the soundfont path to system path on iOS
c748d1fd6d COMMON: Add ConfMan function to know if a default is set for a key
0577893055 GUI: Indicate when a default soundfont is used in options
Commit: 6fc56a63332bd2c5ee7d319bd1db3b6472f42f34
https://github.com/scummvm/scummvm/commit/6fc56a63332bd2c5ee7d319bd1db3b6472f42f34
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-12-03T16:17:32Z
Commit Message:
AUDIO: Add lookup of fluidsynth soundfont using SearchMan or a soundfontpath config
Changed paths:
audio/softsynth/fluidsynth.cpp
diff --git a/audio/softsynth/fluidsynth.cpp b/audio/softsynth/fluidsynth.cpp
index cb4f57b55f0..5317ba0f796 100644
--- a/audio/softsynth/fluidsynth.cpp
+++ b/audio/softsynth/fluidsynth.cpp
@@ -42,6 +42,7 @@
#include "common/error.h"
#include "common/stream.h"
#include "common/system.h"
+#include "common/archive.h"
#include "common/textconsole.h"
#include "common/translation.h"
#include "audio/musicplugin.h"
@@ -111,6 +112,8 @@ protected:
void generateSamples(int16 *buf, int len) override;
+ Common::String getSoundFontPath() const;
+
public:
MidiDriver_FluidSynth(Audio::Mixer *mixer);
@@ -279,6 +282,49 @@ static long SoundFontMemLoader_tell(void *handle) {
#endif // USE_FLUIDLITE
+Common::String MidiDriver_FluidSynth::getSoundFontPath() const {
+ Common::String path = ConfMan.get("soundfont");
+ if (path.empty())
+ return path;
+
+ // First check if this is a full path
+#if defined(IPHONE_IOS7)
+ // HACK: Due to the sandbox on non-jailbroken iOS devices, we need to deal
+ // with the chroot filesystem. All the path selected by the user are
+ // relative to the Document directory. So, we need to adjust the path to
+ // reflect that.
+ Common::FSNode fileNode(iOS7_getDocumentsDir() + path);
+#else
+ Common::FSNode fileNode(path);
+#endif
+ if (fileNode.exists())
+ return fileNode.getPath();
+
+ // Then check with soundfontpath
+ if (ConfMan.hasKey("soundfontpath")) {
+ Common::FSNode dirNode(ConfMan.get("soundfontpath"));
+ if (dirNode.exists() && dirNode.isDirectory()) {
+ fileNode = dirNode.getChild(path);
+ if (fileNode.exists())
+ return fileNode.getPath();
+ }
+ }
+
+ // Finally look for it with SearchMan
+ Common::ArchiveMemberDetailsList files;
+ SearchMan.listMatchingMembers(files, path);
+ for (Common::ArchiveMemberDetails file : files) {
+ Common::FSDirectory* dir = dynamic_cast<Common::FSDirectory*>(SearchMan.getArchive(file.arcName));
+ if (!dir)
+ continue;
+ fileNode = dir->getFSNode().getChild(file.arcMember->getPathInArchive().toString());
+ if (fileNode.exists())
+ return fileNode.getPath();
+ }
+
+ return path;
+}
+
int MidiDriver_FluidSynth::open() {
if (_isOpen)
return MERR_ALREADY_OPEN;
@@ -308,7 +354,7 @@ int MidiDriver_FluidSynth::open() {
// We can only do this with FluidSynth 2.0
if (!isUsingInMemorySoundFontData &&
AndroidFilesystemFactory::instance().hasSAF()) {
- Common::FSNode fsnode(ConfMan.get("soundfont"));
+ Common::FSNode fsnode(getSoundFontPath());
_engineSoundFontData = fsnode.createReadStream();
isUsingInMemorySoundFontData = _engineSoundFontData != nullptr;
}
@@ -438,15 +484,8 @@ int MidiDriver_FluidSynth::open() {
} else
#endif // FS_HAS_STREAM_SUPPORT
{
-#if defined(IPHONE_IOS7)
- // HACK: Due to the sandbox on non-jailbroken iOS devices, we need to deal
- // with the chroot filesystem. All the path selected by the user are
- // relative to the Document directory. So, we need to adjust the path to
- // reflect that.
- soundfont = iOS7_getDocumentsDir() + ConfMan.get("soundfont");
-#else
- soundfont = ConfMan.get("soundfont");
-#endif
+// soundfont = ConfMan.get("soundfont");
+ soundfont = getSoundFontPath();
}
_soundFont = fluid_synth_sfload(_synth, soundfont.c_str(), 1);
Commit: f47d915ec096d6bf749b694c85260c8eff67a41a
https://github.com/scummvm/scummvm/commit/f47d915ec096d6bf749b694c85260c8eff67a41a
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-12-03T16:17:32Z
Commit Message:
AUDIO: Support specifying a soundfont in the ConfMan default domain
Changed paths:
audio/softsynth/fluidsynth.cpp
diff --git a/audio/softsynth/fluidsynth.cpp b/audio/softsynth/fluidsynth.cpp
index 5317ba0f796..a049d2024c1 100644
--- a/audio/softsynth/fluidsynth.cpp
+++ b/audio/softsynth/fluidsynth.cpp
@@ -343,7 +343,7 @@ int MidiDriver_FluidSynth::open() {
const bool isUsingInMemorySoundFontData = false;
#endif
- if (!isUsingInMemorySoundFontData && !ConfMan.hasKey("soundfont")) {
+ if (!isUsingInMemorySoundFontData && ConfMan.get("soundfont").empty()) {
GUI::MessageDialog dialog(_("FluidSynth requires a 'soundfont' setting. Please specify it in ScummVM GUI on MIDI tab. Music is off."));
dialog.runModal();
return MERR_DEVICE_NOT_AVAILABLE;
Commit: 95a060e4fe210a642ba6e616d9d674e1314a0f00
https://github.com/scummvm/scummvm/commit/95a060e4fe210a642ba6e616d9d674e1314a0f00
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-12-03T16:17:32Z
Commit Message:
AUDIO: Add a basic soundfont for fluidsynth
The soundfont was already included in the Libretro port. It is
now included in all platforms.
Changed paths:
A dists/soundfonts/COPYRIGHT.Roland_SC-55
A dists/soundfonts/Roland_SC-55.sf2
R backends/platform/libretro/dist/README.md
R backends/platform/libretro/dist/Roland_SC-55.sf2
Makefile
Makefile.common
backends/platform/android/android.mk
backends/platform/libretro/scripts/bundle_datafiles.sh
backends/platform/sdl/switch/switch.mk
base/commandLine.cpp
devtools/create_project/xcode.cpp
dists/scummvm.rc
ports.mk
diff --git a/Makefile b/Makefile
index 507b408f0aa..6427f854f56 100644
--- a/Makefile
+++ b/Makefile
@@ -134,7 +134,7 @@ endif
.PHONY: print-dists print-executables print-version print-distversion
print-dists:
- @echo $(DIST_FILES_DOCS) $(DIST_FILES_THEMES) $(DIST_FILES_NETWORKING) $(DIST_FILES_VKEYBD) $(DIST_FILES_ENGINEDATA) $(DIST_FILES_ENGINEDATA_BIG) $(DIST_FILES_PLATFORM) $(srcdir)/doc
+ @echo $(DIST_FILES_DOCS) $(DIST_FILES_THEMES) $(DIST_FILES_NETWORKING) $(DIST_FILES_VKEYBD) $(DIST_FILES_ENGINEDATA) $(DIST_FILES_ENGINEDATA_BIG) $(DIST_FILES_SOUNDFONTS) $(DIST_FILES_PLATFORM) $(srcdir)/doc
print-executables:
@echo $(if $(DIST_EXECUTABLES),$(DIST_EXECUTABLES),$(EXECUTABLE) $(PLUGINS))
diff --git a/Makefile.common b/Makefile.common
index a9d8568362d..0ba3541a262 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -535,4 +535,11 @@ DIST_FILES_SHADERS+=$(wildcard $(srcdir)/engines/freescape/shaders/*)
endif
endif
+# Soundfonts
+DIST_FILES_SOUNDFONTS=
+ifdef USE_FLUIDSYNTH
+DIST_FILES_SOUNDFONTS:=$(addprefix $(srcdir)/dists/soundfonts/,Roland_SC-55.sf2)
+DIST_FILES_DOCS+=$(addprefix $(srcdir)/dists/soundfonts/,COPYRIGHT.Roland_SC-55)
+endif
+
.PHONY: all clean distclean plugins dist-src clean-toplevel manual
diff --git a/backends/platform/android/android.mk b/backends/platform/android/android.mk
index c8a348b3510..838294e0cbf 100644
--- a/backends/platform/android/android.mk
+++ b/backends/platform/android/android.mk
@@ -27,9 +27,9 @@ $(PATH_BUILD_GRADLE): $(GRADLE_FILES) | $(PATH_BUILD)
$(ECHO) "android.enableJetifier=true\n" >> $(PATH_BUILD)/gradle.properties
$(ECHO) "sdk.dir=$(realpath $(ANDROID_SDK_ROOT))\n" > $(PATH_BUILD)/local.properties
-$(PATH_BUILD_ASSETS): $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA) $(DIST_FILES_ENGINEDATA_BIG) $(DIST_FILES_NETWORKING) $(DIST_FILES_VKEYBD) $(DIST_FILES_DOCS) $(DIST_FILES_HELP) | $(PATH_BUILD)
+$(PATH_BUILD_ASSETS): $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA) $(DIST_FILES_ENGINEDATA_BIG) $(DIST_FILES_SOUNDFONTS) $(DIST_FILES_NETWORKING) $(DIST_FILES_VKEYBD) $(DIST_FILES_DOCS) $(DIST_FILES_HELP) | $(PATH_BUILD)
$(INSTALL) -d $(PATH_BUILD_ASSETS)
- $(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA) $(DIST_FILES_ENGINEDATA_BIG) $(DIST_FILES_NETWORKING) $(DIST_FILES_VKEYBD) $(DIST_FILES_DOCS) $(DIST_FILES_HELP) $(PATH_BUILD_ASSETS)/
+ $(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA) $(DIST_FILES_ENGINEDATA_BIG) $(DIST_FILES_SOUNDFONTS) $(DIST_FILES_NETWORKING) $(DIST_FILES_VKEYBD) $(DIST_FILES_DOCS) $(DIST_FILES_HELP) $(PATH_BUILD_ASSETS)/
ifneq ($(DIST_FILES_SHADERS),)
$(INSTALL) -d $(PATH_BUILD_ASSETS)/shaders
$(INSTALL) -c -m 644 $(DIST_FILES_SHADERS) $(PATH_BUILD_ASSETS)/shaders
diff --git a/backends/platform/libretro/scripts/bundle_datafiles.sh b/backends/platform/libretro/scripts/bundle_datafiles.sh
index 1cbaed359da..6a83093f3bd 100755
--- a/backends/platform/libretro/scripts/bundle_datafiles.sh
+++ b/backends/platform/libretro/scripts/bundle_datafiles.sh
@@ -73,11 +73,13 @@ BUNDLE_LOCAL_DATAFILES_DIR="${BUILD_PATH}/dist"
# Retrieve data file info from ScummVM source
THEMES_LIST=$(cat "${SCUMMVM_PATH}/dists/scummvm.rc" 2>/dev/null | grep FILE.*gui/themes.*\* | sed "s|.*\"\(.*\)\"|${SCUMMVM_PATH}/\1|g")
DATAFILES_LIST=$(cat "${SCUMMVM_PATH}/dists/scummvm.rc" 2>/dev/null| grep FILE.*dists/engine-data | sed "s|.*\"\(.*\)\"|${SCUMMVM_PATH}/\1|g")
+SOUNDFONTS_LIST=$(cat "${SCUMMVM_PATH}/dists/scummvm.rc" 2>/dev/null| grep FILE.*dists/soundfonts | sed "s|.*\"\(.*\)\"|${SCUMMVM_PATH}/\1|g")
# Put retrieved data into arrays
set +e
read -a THEME_ARRAY -d '' -r <<< "${THEMES_LIST}"
read -a DATAFILES_ARRAY -d '' -r <<< "$DATAFILES_LIST"
+read -a SOUNDFONTS_ARRAY -d '' -r <<< "$SOUNDFONTS_LIST"
set -e
# Add specific data files
@@ -93,6 +95,7 @@ count=0
# Process datafiles
process_group "$BUNDLE_DATAFILES_DIR" $3 ${DATAFILES_ARRAY[@]}
+ process_group "$BUNDLE_DATAFILES_DIR" $3 ${SOUNDFONTS_ARRAY[@]}
# Process additional local bundle files
if [ -d "$BUNDLE_LOCAL_DATAFILES_DIR" -a ! -z "$(ls -A ${BUNDLE_LOCAL_DATAFILES_DIR} 2>/dev/null)" ] ; then
diff --git a/backends/platform/sdl/switch/switch.mk b/backends/platform/sdl/switch/switch.mk
index 2dbd47b88d7..e4a3fb50d37 100644
--- a/backends/platform/sdl/switch/switch.mk
+++ b/backends/platform/sdl/switch/switch.mk
@@ -13,6 +13,9 @@ endif
ifdef DIST_FILES_ENGINEDATA_BIG
cp $(DIST_FILES_ENGINEDATA_BIG) ./switch_release/scummvm/data
endif
+ifdef DIST_FILES_SOUNDFONTS
+ cp $(DIST_FILES_SOUNDFONTS) ./switch_release/scummvm/data
+endif
ifdef DIST_FILES_NETWORKING
cp $(DIST_FILES_NETWORKING) ./switch_release/scummvm/data
endif
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 8cdffb04108..1e82b438539 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -328,6 +328,10 @@ void registerDefaults() {
ConfMan.registerDefault("enable_unsupported_game_warning", true);
+#ifdef USE_FLUIDSYNTH
+ ConfMan.registerDefault("soundfont", "Roland_SC-55.sf2");
+#endif
+
// Game specific
ConfMan.registerDefault("path", "");
ConfMan.registerDefault("platform", Common::kPlatformDOS);
@@ -2132,6 +2136,7 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
ADD_DEFAULT_PATH("themepath", "gui/themes/")
ADD_DEFAULT_PATH("extrapath", "dists/engine-data/")
+ ADD_DEFAULT_PATH("soundfontpath", "dists/soundfonts/")
#endif
return false;
diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp
index c3bcd2db849..be81f53c396 100644
--- a/devtools/create_project/xcode.cpp
+++ b/devtools/create_project/xcode.cpp
@@ -1150,6 +1150,10 @@ XcodeProvider::ValueList& XcodeProvider::getResourceFiles(const BuildSetup &setu
files.push_back("engines/freescape/shaders/freescape_triangle.fragment");
files.push_back("engines/freescape/shaders/freescape_triangle.vertex");
}
+ if (CONTAINS_DEFINE(setup.defines, "USE_FLUIDSYNTH")) {
+ files.push_back("dists/soundfonts/Roland_SC-55.sf2");
+ files.push_back("dists/soundfonts/COPYRIGHT.Roland_SC-55");
+ }
files.push_back("icons/scummvm.icns");
files.push_back("AUTHORS");
files.push_back("COPYING");
diff --git a/dists/scummvm.rc b/dists/scummvm.rc
index 41bfcfaca11..504ae321843 100644
--- a/dists/scummvm.rc
+++ b/dists/scummvm.rc
@@ -31,6 +31,10 @@ encoding.dat FILE "dists/engine-data/encoding.dat"
macgui.dat FILE "dists/engine-data/macgui.dat"
classicmacfonts.dat FILE "dists/engine-data/classicmacfonts.dat"
+#ifdef USE_FLUIDSYNTH
+Roland_SC-55.sf2 FILE "dists/soundfonts/Roland_SC-55.sf2"
+#endif
+
// Engine or feature specific resources
#ifdef BUILTIN_RESOURCES
#if PLUGIN_ENABLED_STATIC(FREESCAPE)
diff --git a/backends/platform/libretro/dist/README.md b/dists/soundfonts/COPYRIGHT.Roland_SC-55
similarity index 100%
rename from backends/platform/libretro/dist/README.md
rename to dists/soundfonts/COPYRIGHT.Roland_SC-55
diff --git a/backends/platform/libretro/dist/Roland_SC-55.sf2 b/dists/soundfonts/Roland_SC-55.sf2
similarity index 100%
rename from backends/platform/libretro/dist/Roland_SC-55.sf2
rename to dists/soundfonts/Roland_SC-55.sf2
diff --git a/ports.mk b/ports.mk
index 4fd3aa6bf52..faef1752519 100644
--- a/ports.mk
+++ b/ports.mk
@@ -15,7 +15,7 @@ install-data:
$(INSTALL) -d "$(DESTDIR)$(docdir)"
$(INSTALL) -c -m 644 $(DIST_FILES_DOCS) "$(DESTDIR)$(docdir)"
$(INSTALL) -d "$(DESTDIR)$(datadir)"
- $(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(DIST_FILES_NETWORKING) $(DIST_FILES_VKEYBD) $(DIST_FILES_ENGINEDATA) $(DIST_FILES_ENGINEDATA_BIG) "$(DESTDIR)$(datadir)/"
+ $(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(DIST_FILES_NETWORKING) $(DIST_FILES_VKEYBD) $(DIST_FILES_ENGINEDATA) $(DIST_FILES_ENGINEDATA_BIG) $(DIST_FILES_SOUNDFONTS) "$(DESTDIR)$(datadir)/"
$(INSTALL) -d "$(DESTDIR)$(datarootdir)/applications"
$(INSTALL) -c -m 644 "$(srcdir)/dists/org.scummvm.scummvm.desktop" "$(DESTDIR)$(datarootdir)/applications/org.scummvm.scummvm.desktop"
$(INSTALL) -d "$(DESTDIR)$(datarootdir)/metainfo"
@@ -75,6 +75,9 @@ endif
ifdef DIST_FILES_VKEYBD
cp $(DIST_FILES_VKEYBD) ./dist-generic/scummvm/data
endif
+ifdef DIST_FILES_SOUNDFONTS
+ cp $(DIST_FILES_SOUNDFONTS) ./dist-generic/scummvm/data
+endif
ifdef DIST_FILES_SHADERS
mkdir -p ./dist-generic/scummvm/data/shaders
cp $(DIST_FILES_SHADERS) ./dist-generic/scummvm/data/shaders
@@ -163,6 +166,9 @@ endif
ifdef DIST_FILES_VKEYBD
cp $(DIST_FILES_VKEYBD) $(bundle_name)/Contents/Resources/
endif
+ifdef DIST_FILES_SOUNDFONTS
+ cp $(DIST_FILES_SOUNDFONTS) $(bundle_name)/Contents/Resources/
+endif
ifneq ($(DIST_FILES_SHADERS),)
mkdir -p $(bundle_name)/Contents/Resources/shaders
cp $(DIST_FILES_SHADERS) $(bundle_name)/Contents/Resources/shaders/
@@ -297,6 +303,9 @@ endif
ifdef DIST_FILES_VKEYBD
cp $(DIST_FILES_VKEYBD) $(bundle_name)/
endif
+ifdef DIST_FILES_SOUNDFONTS
+ cp $(DIST_FILES_SOUNDFONTS) $(bundle_name)/
+endif
ifneq ($(DIST_FILES_SHADERS),)
cp $(DIST_FILES_SHADERS) $(bundle_name)/
endif
@@ -391,6 +400,9 @@ endif
ifdef DIST_FILES_VKEYBD
cp $(DIST_FILES_VKEYBD) $(bundle_name)/
endif
+ifdef DIST_FILES_SOUNDFONTS
+ cp $(DIST_FILES_SOUNDFONTS) $(bundle_name)/
+endif
ifneq ($(DIST_FILES_SHADERS),)
cp $(DIST_FILES_SHADERS) $(bundle_name)/
endif
Commit: ab13d18e5883d8fedf0db320ab66fa0259e7ec86
https://github.com/scummvm/scummvm/commit/ab13d18e5883d8fedf0db320ab66fa0259e7ec86
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-12-03T16:17:32Z
Commit Message:
BACKENDS: Add function in FS Factory to map scummvm path to system path
In most cases they are the same, but in the case of a sandboxed filesystem,
they may be different. Mapping to the full system path allows using the
path with system functions, such as fopen() or third party libraries (for
example to pass a soundfont path to the fluidsynth library).
Changed paths:
backends/fs/chroot/chroot-fs-factory.cpp
backends/fs/chroot/chroot-fs-factory.h
backends/fs/fs-factory.h
diff --git a/backends/fs/chroot/chroot-fs-factory.cpp b/backends/fs/chroot/chroot-fs-factory.cpp
index 7042a579941..0321b0e31a3 100644
--- a/backends/fs/chroot/chroot-fs-factory.cpp
+++ b/backends/fs/chroot/chroot-fs-factory.cpp
@@ -74,4 +74,14 @@ void ChRootFilesystemFactory::addVirtualDrive(const Common::String &name, const
_virtualDrives[name] = path;
}
+Common::String ChRootFilesystemFactory::getSystemFullPath(const Common::String& path) const {
+ size_t driveEnd = path.findFirstOf('/');
+ if (driveEnd != Common::String::npos && driveEnd > 0) {
+ auto it = _virtualDrives.find(path.substr(0, driveEnd));
+ if (it != _virtualDrives.end())
+ return it->_value + path.substr(driveEnd);
+ }
+ return _root + path;
+}
+
#endif
diff --git a/backends/fs/chroot/chroot-fs-factory.h b/backends/fs/chroot/chroot-fs-factory.h
index a9ad3e1dbae..47d54bce071 100644
--- a/backends/fs/chroot/chroot-fs-factory.h
+++ b/backends/fs/chroot/chroot-fs-factory.h
@@ -40,6 +40,8 @@ public:
void addVirtualDrive(const Common::String &name, const Common::String &path);
+ Common::String getSystemFullPath(const Common::String& path) const override;
+
private:
const Common::String _root;
Common::StringMap _virtualDrives;
diff --git a/backends/fs/fs-factory.h b/backends/fs/fs-factory.h
index 8a7feee69b3..99434401be9 100644
--- a/backends/fs/fs-factory.h
+++ b/backends/fs/fs-factory.h
@@ -63,6 +63,15 @@ public:
* On Windows, it will be a special node which "contains" all drives (C:, D:, E:).
*/
virtual AbstractFSNode *makeRootFileNode() const = 0;
+
+ /**
+ * Returns a path suitable for systen functions such as fopen() for the given ScummVM path,
+ *
+ * In most cases the returned path is the same as the given path, but it may be different, for
+ * example when the application is sandboxed and ScummVM path are relative to the saandbox
+ * root.
+ */
+ virtual Common::String getSystemFullPath(const Common::String& path) const { return path; }
};
#endif /*FILESYSTEM_FACTORY_H*/
Commit: cac06647571a3352cb108faad48af9271a69ce36
https://github.com/scummvm/scummvm/commit/cac06647571a3352cb108faad48af9271a69ce36
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-12-03T16:17:32Z
Commit Message:
AUDIO: Improve code to map the soundfont path to system path on iOS
The code looks a bit less hack-ish and also now supports using path
in the application bundle and not only in the documents folder. It
could also help for other backends using a sandoxed filesystem.
Changed paths:
audio/softsynth/fluidsynth.cpp
diff --git a/audio/softsynth/fluidsynth.cpp b/audio/softsynth/fluidsynth.cpp
index a049d2024c1..38036b0a54e 100644
--- a/audio/softsynth/fluidsynth.cpp
+++ b/audio/softsynth/fluidsynth.cpp
@@ -49,9 +49,7 @@
#include "audio/mpu401.h"
#include "audio/softsynth/emumidi.h"
#include "gui/message.h"
-#if defined(IPHONE_IOS7)
-#include "backends/platform/ios7/ios7_common.h"
-#endif
+#include "backends/fs/fs-factory.h"
#ifdef __ANDROID__
#include "backends/fs/android/android-fs-factory.h"
#endif
@@ -288,17 +286,10 @@ Common::String MidiDriver_FluidSynth::getSoundFontPath() const {
return path;
// First check if this is a full path
-#if defined(IPHONE_IOS7)
- // HACK: Due to the sandbox on non-jailbroken iOS devices, we need to deal
- // with the chroot filesystem. All the path selected by the user are
- // relative to the Document directory. So, we need to adjust the path to
- // reflect that.
- Common::FSNode fileNode(iOS7_getDocumentsDir() + path);
-#else
- Common::FSNode fileNode(path);
-#endif
+ Common::String fullPath = g_system->getFilesystemFactory()->getSystemFullPath(path);
+ Common::FSNode fileNode(fullPath);
if (fileNode.exists())
- return fileNode.getPath();
+ return fullPath;
// Then check with soundfontpath
if (ConfMan.hasKey("soundfontpath")) {
Commit: c748d1fd6d70b97b3ae29b08673e4d7ceb9aa057
https://github.com/scummvm/scummvm/commit/c748d1fd6d70b97b3ae29b08673e4d7ceb9aa057
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-12-03T16:17:32Z
Commit Message:
COMMON: Add ConfMan function to know if a default is set for a key
Changed paths:
common/config-manager.cpp
common/config-manager.h
diff --git a/common/config-manager.cpp b/common/config-manager.cpp
index a0f6a0a9b86..55d4d159003 100644
--- a/common/config-manager.cpp
+++ b/common/config-manager.cpp
@@ -482,6 +482,10 @@ bool ConfigManager::hasKey(const String &key, const String &domName) const {
return domain->contains(key);
}
+bool ConfigManager::hasDefault(const String &key) const {
+ return _defaultsDomain.contains(key);
+}
+
void ConfigManager::removeKey(const String &key, const String &domName) {
Domain *domain = getDomain(domName);
diff --git a/common/config-manager.h b/common/config-manager.h
index 04e7cad678e..25e73703bae 100644
--- a/common/config-manager.h
+++ b/common/config-manager.h
@@ -149,6 +149,11 @@ public:
void set(const String &key, const String &value); /*!< Assign a @p value to a @p key. */
/** @} */
+ /**
+ * Indicate if a default value has been set for the given key.
+ */
+ bool hasDefault(const String &key) const;
+
/**
* Update a configuration entry for the active domain and flush
* the configuration file to disk if the value changed.
Commit: 05778930559f32d7714cab111c40aee2052983ff
https://github.com/scummvm/scummvm/commit/05778930559f32d7714cab111c40aee2052983ff
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-12-03T16:17:32Z
Commit Message:
GUI: Indicate when a default soundfont is used in options
Changed paths:
gui/options.cpp
diff --git a/gui/options.cpp b/gui/options.cpp
index 9d11f4e9054..0e7cd22818c 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -478,9 +478,12 @@ void OptionsDialog::build() {
if (ConfMan.isKeyTemporary("soundfont")) {
_soundFont->setFontColor(ThemeEngine::FontColor::kFontColorOverride);
}
- if (soundFont.empty() || !ConfMan.hasKey("soundfont", _domain)) {
+ if (soundFont.empty()) {
_soundFont->setLabel(_c("None", "soundfont"));
_soundFontClearButton->setEnabled(false);
+ } else if (!ConfMan.hasKey("soundfont", _domain)) {
+ _soundFont->setLabel(_("Default"));
+ _soundFontClearButton->setEnabled(false);
} else {
_soundFont->setLabel(soundFont);
_soundFontClearButton->setEnabled(true);
@@ -987,7 +990,7 @@ void OptionsDialog::apply() {
Common::U32String soundFont(_soundFont->getLabel());
if (soundFont != ConfMan.get("soundfont", _domain)) {
_soundFont->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
- if (soundFont.empty() || (soundFont == _c("None", "soundfont")))
+ if (soundFont.empty() || (soundFont == _c("None", "soundfont")) || (soundFont == _("Default")))
ConfMan.removeKey("soundfont", _domain);
else
ConfMan.set("soundfont", soundFont.encode(), _domain);
@@ -1151,7 +1154,10 @@ void OptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data
_subSpeedLabel->markAsDirty();
break;
case kClearSoundFontCmd:
- _soundFont->setLabel(_c("None", "soundfont"));
+ if (ConfMan.hasDefault("soundfont"))
+ _soundFont->setLabel(_("Default"));
+ else
+ _soundFont->setLabel(_c("None", "soundfont"));
_soundFontClearButton->setEnabled(false);
break;
case kKbdMouseSpeedChanged:
@@ -1307,7 +1313,7 @@ void OptionsDialog::setMIDISettingsState(bool enabled) {
_soundFontButton->setEnabled(enabled);
_soundFont->setEnabled(enabled);
- if (enabled && !_soundFont->getLabel().empty() && (_soundFont->getLabel() != _c("None", "soundfont")))
+ if (enabled && !_soundFont->getLabel().empty() && (_soundFont->getLabel() != _c("None", "soundfont")) && (_soundFont->getLabel() != _("Default")))
_soundFontClearButton->setEnabled(enabled);
else
_soundFontClearButton->setEnabled(false);
More information about the Scummvm-git-logs
mailing list