From 08be529a33ba85be4697b1f9461096224c1b7966 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Thu, 4 Sep 2025 14:54:05 -0400 Subject: [PATCH] Few fixes for custom music addons. --- Toby Doom Launcher.py | 70 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 58 insertions(+), 12 deletions(-) diff --git a/Toby Doom Launcher.py b/Toby Doom Launcher.py index 83d876b..65ad1ce 100755 --- a/Toby Doom Launcher.py +++ b/Toby Doom Launcher.py @@ -1526,12 +1526,35 @@ class DoomLauncher(QMainWindow): if fullPath.exists(): gameFiles.append(str(fullPath)) - # Add optional files last (only first one found, for priority) - for optFile in config.get('optional_files', []): - optPath = self.gamePath / optFile - if optPath.exists(): - gameFiles.append(str(optPath)) - break # Only add the first optional file found + # Add music files with custom music mod priority + optional_files = config.get('optional_files', []) + music_added = False + + # Check if any optional files are music-related (contain metal/music keywords) + has_music_optionals = any('metal' in opt.lower() or 'music' in opt.lower() for opt in optional_files) + + if has_music_optionals: + # First try to find custom music mod (highest priority) + customMusicMod = self.find_custom_music_mod() + if customMusicMod: + gameFiles.append(str(customMusicMod)) + music_added = True + else: + # Fall back to standard optional files priority + for optFile in optional_files: + optPath = self.gamePath / optFile + if optPath.exists(): + gameFiles.append(str(optPath)) + music_added = True + break + + # Add any remaining non-music optional files + if not music_added: + for optFile in optional_files: + optPath = self.gamePath / optFile + if optPath.exists(): + gameFiles.append(str(optPath)) + break # Only add the first optional file found # Get any custom flags gameFlags = config.get('flags', []) @@ -2610,12 +2633,35 @@ class DoomLauncher(QMainWindow): if fullPath.exists(): gameFiles.append(str(fullPath)) - # Add optional files last (only first one found, for priority) - for optFile in config.get('optional_files', []): - optPath = self.gamePath / optFile - if optPath.exists(): - gameFiles.append(str(optPath)) - break # Only add the first optional file found + # Add music files with custom music mod priority + optional_files = config.get('optional_files', []) + music_added = False + + # Check if any optional files are music-related (contain metal/music keywords) + has_music_optionals = any('metal' in opt.lower() or 'music' in opt.lower() for opt in optional_files) + + if has_music_optionals: + # First try to find custom music mod (highest priority) + customMusicMod = self.find_custom_music_mod() + if customMusicMod: + gameFiles.append(str(customMusicMod)) + music_added = True + else: + # Fall back to standard optional files priority + for optFile in optional_files: + optPath = self.gamePath / optFile + if optPath.exists(): + gameFiles.append(str(optPath)) + music_added = True + break + + # Add any remaining non-music optional files + if not music_added: + for optFile in optional_files: + optPath = self.gamePath / optFile + if optPath.exists(): + gameFiles.append(str(optPath)) + break # Only add the first optional file found # Get any custom flags gameFlags = config.get('flags', [])