diff --git a/FModel/ViewModels/CUE4ParseViewModel.cs b/FModel/ViewModels/CUE4ParseViewModel.cs index 589bee60..528e01fd 100644 --- a/FModel/ViewModels/CUE4ParseViewModel.cs +++ b/FModel/ViewModels/CUE4ParseViewModel.cs @@ -48,6 +48,7 @@ using CUE4Parse.UE4.Assets.Exports.StaticMesh; using CUE4Parse.UE4.Assets.Exports.Texture; using CUE4Parse.UE4.Assets.Exports.Verse; using CUE4Parse.UE4.Assets.Exports.Wwise; +using CUE4Parse.UE4.Assets.Objects; using CUE4Parse.UE4.BinaryConfig; using CUE4Parse.UE4.CriWare; using CUE4Parse.UE4.CriWare.Readers; @@ -86,6 +87,7 @@ using Serilog; using SkiaSharp; using Svg.Skia; using UE4Config.Parsing; +using static CUE4Parse.UE4.Versions.EGame; using Application = System.Windows.Application; using FGuid = CUE4Parse.UE4.Objects.Core.Misc.FGuid; @@ -192,24 +194,24 @@ public class CUE4ParseViewModel : ViewModel { Provider = versionContainer.Game switch { - EGame.GAME_StateOfDecay2 => new DefaultFileProvider(new DirectoryInfo(gameDirectory), + GAME_StateOfDecay2 => new DefaultFileProvider(new DirectoryInfo(gameDirectory), [ new(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\StateOfDecay2\\Saved\\Paks"), new(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\StateOfDecay2\\Saved\\DisabledPaks") ], SearchOption.AllDirectories, versionContainer, pathComparer), - EGame.GAME_eFootball => new DefaultFileProvider(new DirectoryInfo(gameDirectory), + GAME_eFootball => new DefaultFileProvider(new DirectoryInfo(gameDirectory), [ new(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\KONAMI\\eFootball\\ST\\Download") ], SearchOption.AllDirectories, versionContainer, pathComparer), - EGame.GAME_DeadByDaylight => new DefaultFileProvider(new DirectoryInfo(gameDirectory), + GAME_DeadByDaylight => new DefaultFileProvider(new DirectoryInfo(gameDirectory), [ new(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\DeadByDaylight\\Saved\\PersistentDownloadDir\\DynamicContent") ], SearchOption.AllDirectories, versionContainer, pathComparer), - EGame.GAME_AshEchoes => new AEDefaultFileProvider(gameDirectory, SearchOption.AllDirectories, versionContainer, pathComparer), - EGame.GAME_BlackStigma => new DefaultFileProvider(gameDirectory, SearchOption.AllDirectories, versionContainer, StringComparer.Ordinal), - EGame.GAME_HonorofKingsWorld => new HoKWDefaultFileProvider(gameDirectory, SearchOption.AllDirectories, versionContainer, pathComparer), - EGame.GAME_LordOfMysteries => new LoMDefaultFileProvider(gameDirectory, SearchOption.AllDirectories, versionContainer, pathComparer), - EGame.GAME_ArcRaiders or EGame.GAME_MARVELTokonFightingSouls or EGame.GAME_Highguard => new TheiaFileProvider(gameDirectory, SearchOption.AllDirectories, versionContainer, pathComparer), + GAME_AshEchoes => new AEDefaultFileProvider(gameDirectory, SearchOption.AllDirectories, versionContainer, pathComparer), + GAME_BlackStigma => new DefaultFileProvider(gameDirectory, SearchOption.AllDirectories, versionContainer, StringComparer.Ordinal), + GAME_HonorofKingsWorld => new HoKWDefaultFileProvider(gameDirectory, SearchOption.AllDirectories, versionContainer, pathComparer), + GAME_LordOfMysteries => new LoMDefaultFileProvider(gameDirectory, SearchOption.AllDirectories, versionContainer, pathComparer), + GAME_ArcRaiders or GAME_Highguard or GAME_MARVELTokonFightingSouls => new TheiaFileProvider(gameDirectory, SearchOption.AllDirectories, versionContainer, pathComparer), _ => new DefaultFileProvider(gameDirectory, SearchOption.AllDirectories, versionContainer, pathComparer) }; @@ -514,7 +516,7 @@ public class CUE4ParseViewModel : ViewModel FLogger.Text("Additive animations have their reference pose stripped, which will lead to inaccurate preview and export", Constants.WHITE, true)); } - if (Provider.Versions.Game is EGame.GAME_UE4_LATEST or EGame.GAME_UE5_LATEST && !Provider.ProjectName.Equals("FortniteGame", StringComparison.OrdinalIgnoreCase)) // ignore fortnite globally + if (Provider.Versions.Game is GAME_UE4_LATEST or GAME_UE5_LATEST && !Provider.ProjectName.Equals("FortniteGame", StringComparison.OrdinalIgnoreCase)) // ignore fortnite globally { FLogger.Append(ELog.Warning, () => FLogger.Text($"Experimental UE version selected, likely unsuitable for '{Provider.GameDisplayName ?? Provider.ProjectName}'", Constants.WHITE, true)); @@ -734,17 +736,17 @@ public class CUE4ParseViewModel : ViewModel break; } - case "dat" when Provider.Versions.Game is EGame.GAME_Aion2: + case "dat" when Provider.Versions.Game is GAME_Aion2: { ProcessAion2DatFile(entry, updateUi, saveProperties); break; } - case "bytes" when Provider.Versions.Game is EGame.GAME_RocoKingdomWorld: + case "bytes" when Provider.Versions.Game is GAME_RocoKingdomWorld: { ProcessRocoBinFile(entry, updateUi, saveProperties); break; } - case "dbc" when Provider.Versions.Game is EGame.GAME_AshesOfCreation: + case "dbc" when Provider.Versions.Game is GAME_AshesOfCreation: { ProcessCacheDBFile(entry, updateUi, saveProperties); break; @@ -820,8 +822,8 @@ public class CUE4ParseViewModel : ViewModel case "py": case "md": case "h": - case "non" when Provider.Versions.Game is EGame.GAME_RocoKingdomWorld: - case "cam" when Provider.Versions.Game is EGame.GAME_RocoKingdomWorld: + case "non" when Provider.Versions.Game is GAME_RocoKingdomWorld: + case "cam" when Provider.Versions.Game is GAME_RocoKingdomWorld: // Uncharted Waters Origin case "crn": case "uwt": @@ -841,7 +843,7 @@ public class CUE4ParseViewModel : ViewModel break; } - case "ebd" when Provider.Versions.Game is EGame.GAME_ArcRaiders: + case "ebd" when Provider.Versions.Game is GAME_ArcRaiders: case "json": case "Json": { @@ -982,7 +984,7 @@ public class CUE4ParseViewModel : ViewModel break; } - case "ustbin" when Provider.Versions.Game is EGame.GAME_DeltaForce: + case "ustbin" when Provider.Versions.Game is GAME_DeltaForce: { var archive = entry.CreateReader(); var ustbin = new FDeltaStringTable(archive); @@ -1453,6 +1455,11 @@ public class CUE4ParseViewModel : ViewModel SaveAndPlaySound(cancellationToken, outputPath, audioFormat, data, saveAudio, updateUi); } + if (Provider.Versions.Game is GAME_GearsofWarEDay && akMediaAsset.CustomGameData is FByteBulkData bulkData) + { + var shouldDecompress = UserSettings.Default.CompressedAudioMode is ECompressedAudio.PlayDecompressed; + SaveAndPlaySound(cancellationToken, outputPath, "WEM", bulkData.Data, saveAudio, updateUi); + } return false; } case UAkAudioEventData when (isNone || saveAudio) && pointer.Object.Value is UAkAudioEventData akAudioEventData: @@ -1470,6 +1477,12 @@ public class CUE4ParseViewModel : ViewModel SaveAndPlaySound(cancellationToken, outputPath, audioFormat, data, saveAudio, updateUi); } + if (Provider.Versions.Game is GAME_GearsofWarEDay && akMediaAsset.CustomGameData is FByteBulkData bulkData) + { + var audioName = akMediaAsset.MediaName ?? $"{akAudioEventData.Outer.Name} ({akMediaAsset.ID})"; + var outputPath = Path.Combine(TabControl.SelectedTab.Entry.PathWithoutExtension.Replace('\\', '/').SubstringBeforeLast('/'), audioName); + SaveAndPlaySound(cancellationToken, outputPath, "WEM", bulkData.Data, saveAudio, updateUi); + } } } return false; @@ -1487,7 +1500,7 @@ public class CUE4ParseViewModel : ViewModel // Borderlands 4 case UFaceFXAnimSet when (isNone || saveAudio) && pointer.Object.Value is UFaceFXAnimSet faceFXAnimSet: { - if (Provider.Versions.Game is not EGame.GAME_Borderlands4) + if (Provider.Versions.Game is not GAME_Borderlands4) return false; var ownerDirectory = WwiseProvider.GetOwnerDirectory(faceFXAnimSet);