From 9318838ea7671e0d65cdd736f5f2a27dfa0342e6 Mon Sep 17 00:00:00 2001 From: Masusder <59669685+Masusder@users.noreply.github.com> Date: Mon, 28 Apr 2025 17:28:04 +0200 Subject: [PATCH] Generic search for wwise directory --- FModel/ViewModels/CUE4ParseViewModel.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/FModel/ViewModels/CUE4ParseViewModel.cs b/FModel/ViewModels/CUE4ParseViewModel.cs index 70f0ed94..cbea2176 100644 --- a/FModel/ViewModels/CUE4ParseViewModel.cs +++ b/FModel/ViewModels/CUE4ParseViewModel.cs @@ -837,14 +837,26 @@ public class CUE4ParseViewModel : ViewModel return false; } case UAkAudioEvent when isNone && pointer.Object.Value is UAkAudioEvent { EventCookedData: { } wwiseData }: - { + { + var files = Provider.Files.Values.ToList(); + + var bnkFile = files.FirstOrDefault(f => f.Path.Contains("/WwiseAudio/") && f.Path.EndsWith(".bnk", StringComparison.OrdinalIgnoreCase)); + string bnkDirectory = bnkFile != null ? Path.GetDirectoryName(bnkFile.Path.Replace('/', Path.DirectorySeparatorChar)) : null; + foreach (var kvp in wwiseData.EventLanguageMap) { if (!kvp.Value.HasValue) continue; var projectName = string.IsNullOrEmpty(Provider.ProjectName) ? "Game" : Provider.ProjectName; - var baseWwiseAudioPath = Path.Combine(projectName, "Content", "WwiseAudio", "Cooked"); + var baseWwiseAudioPath = Path.Combine(projectName, "Content", "WwiseAudio", "Cooked"); + + // If .bnk was found we will use that for base wwise directory + if (!string.IsNullOrEmpty(bnkDirectory)) + { + baseWwiseAudioPath = bnkDirectory; + } + var audioEventPath = pointer.Object.Value.GetPathName().Replace("Game", projectName); foreach (var soundBank in kvp.Value.Value.SoundBanks)