Open tesfabpel opened 2 years ago
Hey,
Two thing are going wrong here:
Looking at the code for zmusic, this is all I find:
#ifdef __unix__
// This is the standard location on Ubuntu.
Fluid_SetupConfig("/usr/share/sounds/sf2/FluidR3_GS.sf2:/usr/share/sounds/sf2/FluidR3_GM.sf2", patch_paths, false);
#endif
This is problematic since the application isn't even installed in that directory, as it should be /app/share/sounds/
. So even if I were to bundle the soundFont, there also need to be code changes to make this work.
Not sure what to do now, but some thing have to change before this could work.
Hi,
You can't install something in the root operating system and have it appear inside Flatpak. This sandboxing is blocking you here.
Yes, I was trying to make it available via FlatSeal (or via the command line) but I don't think it can map it with another path. Anyway, as you said, it's not the correct way for a flatpak package.
BTW, looking at Archlinux's AUR, the package for zmusic has a patch ( https://aur.archlinux.org/cgit/aur.git/tree/0001-Use-correct-soundfont-path.patch?h=zmusic ) that changes the path for the .sf2 files to match Archlinux's.
From 174eb60580c9ffedad91951eefe65a517e040d4e Mon Sep 17 00:00:00 2001
From: Jan Cholasta <jan@cholasta.net>
Date: Tue, 11 Feb 2020 14:26:04 +0100
Subject: [PATCH] Use correct soundfont path
---
source/mididevices/music_fluidsynth_mididevice.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source/mididevices/music_fluidsynth_mididevice.cpp b/source/mididevices/music_fluidsynth_mididevice.cpp
index 675b4f9..8a11198 100644
--- a/source/mididevices/music_fluidsynth_mididevice.cpp
+++ b/source/mididevices/music_fluidsynth_mididevice.cpp
@@ -644,7 +644,7 @@ void Fluid_SetupConfig(const char* patches, std::vector<std::string> &patch_path
// The following will only be used if no soundfont at all is provided, i.e. even the standard one coming with GZDoom is missing.
#ifdef __unix__
// This is the standard location on Ubuntu.
- Fluid_SetupConfig("/usr/share/sounds/sf2/FluidR3_GS.sf2:/usr/share/sounds/sf2/FluidR3_GM.sf2", patch_paths, false);
+ Fluid_SetupConfig("/usr/share/soundfonts/FluidR3_GS.sf2:/usr/share/soundfonts/FluidR3_GM.sf2", patch_paths, false);
#endif
#ifdef _WIN32
// On Windows, look for the 4 megabyte patch set installed by Creative's drivers as a default.
--
2.25.0
I found out that zmusic is defined in shared-modules/gzdoom/gzdoom.json
but since my knowledge of creating a flatpak package is zero, I don't know if it's possible to patch it for gzdoom app only.
Or, if it is a org.freedesktop.Platform
runtime issue, maybe they have to bundle the .sf2 and release an updated version of the runtime... I don't know really...
Or, if it is a org.freedesktop.Platform runtime issue, maybe they have to bundle the .sf2 and release an updated version of the runtime... I don't know really...
No, the runtime doesn't contain the soundfonts not because they forgot about it, but because those soundfonts are 100Mb in size. Only if a project really needs them, should they be bundled with the application. Case in point, I also package SLADE 3 and there I do include the soundfonts. Since SLADE 3 is a developer tool, it's worthwhile trade.
That's also why I'll be reluctant to package these soundfonts... it's a lot of space for something that GZDoom doesn't technically require.
Another thing that comes to my mind, if doomShinobi.v1.pk3 asks for the soundfont, then we should also patch the mod so that it can run with a soundfont from /app/usr/
which is really specific.
So, I traced the syscalls gzdoom does and this is what I found:
openat(AT_FDCWD, ".//soundfonts/gzdoom.sf2", O_RDONLY) = -1 ENOENT (File o directory non esistente)
openat(AT_FDCWD, "/usr/share/sounds/sf2/FluidR3_GS.sf2", O_RDONLY) = -1 ENOENT (File o directory non esistente)
openat(AT_FDCWD, "/usr/share/sounds/sf2/FluidR3_GM.sf2", O_RDONLY) = -1 ENOENT (File o directory non esistente)
Digging deeper, I found this:
Thread 1 "gzdoom" hit Catchpoint 1 (call to syscall openat), 0x00007ffff74c9362 in open64 () from /usr/lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
#0 0x00007ffff74c9362 in open64 () from /usr/lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff74574df in _IO_file_open () from /usr/lib/x86_64-linux-gnu/libc.so.6
#2 0x00007ffff74576bb in _IO_file_fopen () from /usr/lib/x86_64-linux-gnu/libc.so.6
#3 0x00007ffff744aa16 in __fopen_internal () from /usr/lib/x86_64-linux-gnu/libc.so.6
#4 0x0000555555c0d13f in myfopen (flags=0x555555f0beec "rb", filename=0x55555725e41c "/app/bin//soundfonts/gzdoom.sf2") at /run/build/gzdoom/src/common/utility/files.cpp:44
#5 StdFileReader::Open (len=-1, startpos=0, filename=0x55555725e41c "/app/bin//soundfonts/gzdoom.sf2", this=0x55555725d380) at /run/build/gzdoom/src/common/utility/files.cpp:82
#6 FileReader::OpenFile (this=this@entry=0x7fffffffc5b8, filename=0x55555725e41c "/app/bin//soundfonts/gzdoom.sf2", start=start@entry=0, length=length@entry=-1)
at /run/build/gzdoom/src/common/utility/files.cpp:363
#7 0x0000555555b8b03b in FSoundFontManager::ProcessOneFile (this=0x5555569369f0 <sfmanager>, fn=...) at /run/build/gzdoom/src/common/utility/zstring.h:171
#8 0x0000555555b8b6f8 in FSoundFontManager::CollectSoundfonts (this=0x5555569369f0 <sfmanager>) at /run/build/gzdoom/src/common/audio/music/i_soundfont.cpp:429
#9 0x0000555555b8a003 in I_InitMusic () at /run/build/gzdoom/src/common/audio/music/i_music.cpp:222
#10 0x0000555555a5d18b in S_Init () at /run/build/gzdoom/src/sound/s_doomsound.cpp:235
#11 0x00005555559965ae in D_DoomMain_Internal () at /run/build/gzdoom/src/d_main.cpp:3282
#12 GameMain () at /run/build/gzdoom/src/d_main.cpp:3616
#13 0x00005555557b95e3 in main (argc=-13744, argv=0x7fffffffdb78) at /run/build/gzdoom/src/common/platform/posix/sdl/i_main.cpp:194
The line at frame #8
is ProcessOneFile(NicePath("$PROGDIR/soundfonts/" GAMENAMELOWERCASE ".sf2"));
so maybe $PROGDIR
is wrong and results in: /app/bin//soundfonts/gzdoom.sf2
...
Looking at src/gameconfigfile.cpp
it appears that "$HOME/" GAME_DIR "/soundfonts"
could also work. This is such a clusterfuck of Debian, Arch, Mac and Windows configurations all mixed up...
Could you try the following, could you copy the soundfonts to ~/.var/app/org.zdoom.GZDoom/.config/gzdoom/soundfonts
since this is included in the soundfonts folder config.
[SoundfontSearch.Directories]
Path=$HOME/.config/gzdoom/soundfonts
Path=$HOME/.config/gzdoom/fm_banks
Path=/usr/local/share/doom/soundfonts
Path=/usr/local/share/doom/fm_banks
Path=/usr/local/share/games/doom/soundfonts
Path=/usr/local/share/games/doom/fm_banks
Path=/usr/share/doom/soundfonts
Path=/usr/share/doom/fm_banks
Path=/usr/share/games/doom/soundfonts
Path=/usr/share/games/doom/fm_banks
My full config: gzdoom.zip
Also, I have not been able to reproduce this issue yet. it runs on my machine, even without adding the ~/.var/app/org.zdoom.GZDoom/.config/gzdoom/soundfonts
folder.
Thank you!
Adding those files into ~/.var/app/org.zdoom.GZDoom/.config/gzdoom/soundfonts
worked...
What a mess though... I'm leaving the issue open but feel free to close it if you deem it impossible to solve. 😉
I'm... not sure. Let's leave it open for now.
Might have to revisit the upstream project and align some patches. I've already given it some thought but it's a lot of work.
I'm getting the same error when trying to launch HEXEN.WAD
$ org.zdoom.GZDoom
GZDoom g4.8.2-m - 2022-07-04 10:31:18 +0200 - SDL version
Compiled on Sep 22 2022
OS: Freedesktop.org SDK 22.08 (Flatpak runtime), Linux 6.0.5-arch1-1 on x86_64
W_Init: Init WADfiles.
adding /app/share/games/doom/gzdoom.pk3, 668 lumps
adding /app/share/games/doom/game_support.pk3, 2514 lumps
adding /home/matheus/.config/gzdoom/HEXEN.WAD, 4270 lumps
adding /app/share/games/doom/game_widescreen_gfx.pk3, 214 lumps
adding /app/share/games/doom/lights.pk3, 7 lumps
adding /app/share/games/doom/brightmaps.pk3, 499 lumps
S_Init: Setting up sound.
I_InitSound: Initializing OpenAL
Opened device Starship/Matisse HD Audio Controller Estéreo analógico
EFX enabled
Could not find patch set /usr/share/sounds/sf2/FluidR3_GS.sf2.
Could not find patch set /usr/share/sounds/sf2/FluidR3_GM.sf2.
*** Fatal Error ***
!!! Failed to exec debug process
/app/bin/gzdoom.sh, linha 2: 3 Falha de segmentação (imagem do núcleo gravada)gzdoom +fluid_patchset /app/share/sounds/sf2/gzdoom.sf2 -file lights.pk3 brightmaps.pk3 "$@"
@KawaiiDinosaur Can you post me your config from ~/.var/app/org.zdoom.GZDoom/.config/gzdoom/gzdoom.ini
?
As explained, the sound fonts are not included but other sound systems should work
@Eonfge
# These are the directories to search for soundfonts that let listed in the menu.
# Layout is the same as for IWADSearch.Directories
[SoundfontSearch.Directories]
Path=$HOME/.config/gzdoom/soundfonts
Path=$HOME/.config/gzdoom/fm_banks
Path=$HOME/.local/share/games/doom/soundfonts
Path=$HOME/.local/share/games/doom/fm_banks
Path=/usr/local/share/doom/soundfonts
Path=/usr/local/share/doom/fm_banks
Path=/usr/local/share/games/doom/soundfonts
Path=/usr/local/share/games/doom/fm_banks
Path=/usr/share/doom/soundfonts
Path=/usr/share/doom/fm_banks
Path=/usr/share/games/doom/soundfonts
Path=/usr/share/games/doom/fm_banks
Is it possible to continue even without those files?
@XargonWan If I believe correctly, it's only a problem when you try to play certain mods or Hexen.
What are you trying to play?
I'm trying to run the Doom Shinobi mod (https://www.moddb.com/mods/doom-shinobi) but it can't find the sf2 files... Since I use Arch, I installed the
soundfont-fluid
package from the package manager (https://archlinux.org/packages/community/any/soundfont-fluid/) but the files are in a different position (/usr/share/soundfonts/FluidR3_GS.sf2
vs/usr/share/sounds/sf2/FluidR3_GS.sf2
) so gzdoom crashes...I ran gzdoom by entering the flatpak and this is the output (I granted access to the folder with the .pk3 via Flatseal):
Is it possible to bundle those two files in the flatpak itself? Thanks.