mirror of
https://github.com/4sval/FModel.git
synced 2026-03-21 17:24:26 -05:00
Borderlands 3 audio (#649)
Some checks failed
FModel QA Builder / build (push) Has been cancelled
Some checks failed
FModel QA Builder / build (push) Has been cancelled
This commit is contained in:
parent
7fab3e2ead
commit
fd4eb0a418
|
|
@ -1 +1 @@
|
|||
Subproject commit 872f9013bc05d8ba764c52f060dcfdc286ad0a43
|
||||
Subproject commit db808145a2910f3e9b5db3a7c87abae396109b9a
|
||||
|
|
@ -157,5 +157,5 @@ public enum EAssetCategory : uint
|
|||
AudioEvent = Media + 5,
|
||||
Particle = AssetCategoryExtensions.CategoryBase + (9 << 16),
|
||||
GameSpecific = AssetCategoryExtensions.CategoryBase + (10 << 16),
|
||||
Borderlands4 = GameSpecific + 1,
|
||||
Borderlands = GameSpecific + 1,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ using CUE4Parse.GameTypes.SMG.UE4.Assets.Exports.Wwise;
|
|||
using CUE4Parse.GameTypes.KRD.Assets.Exports;
|
||||
using CUE4Parse.GameTypes.Borderlands4.Assets.Exports;
|
||||
using CUE4Parse.GameTypes.Borderlands4.Wwise;
|
||||
using CUE4Parse.GameTypes.Borderlands3.Assets.Exports;
|
||||
using CUE4Parse.MappingsProvider;
|
||||
using CUE4Parse.UE4.AssetRegistry;
|
||||
using CUE4Parse.UE4.Assets;
|
||||
|
|
@ -792,7 +793,7 @@ public class CUE4ParseViewModel : ViewModel
|
|||
var directory = Path.GetDirectoryName(entry.Path) ?? "/FMOD/Desktop/";
|
||||
foreach (var sound in extractedSounds)
|
||||
{
|
||||
SaveAndPlaySound(Path.Combine(directory, sound.Name), sound.Extension, sound.Data, saveAudio, updateUi);
|
||||
SaveAndPlaySound(cancellationToken, Path.Combine(directory, sound.Name), sound.Extension, sound.Data, saveAudio, updateUi);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
@ -807,7 +808,7 @@ public class CUE4ParseViewModel : ViewModel
|
|||
var medias = WwiseProvider.ExtractBankSounds(wwise);
|
||||
foreach (var media in medias)
|
||||
{
|
||||
SaveAndPlaySound(media.OutputPath, media.Extension, media.Data, saveAudio, updateUi);
|
||||
SaveAndPlaySound(cancellationToken, media.OutputPath, media.Extension, media.Data, saveAudio, updateUi);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
@ -823,7 +824,7 @@ public class CUE4ParseViewModel : ViewModel
|
|||
var extractedSounds = CriWareProvider.ExtractCriWareSounds(awbReader, archive.Name);
|
||||
foreach (var sound in extractedSounds)
|
||||
{
|
||||
SaveAndPlaySound(Path.Combine(directory, sound.Name), sound.Extension, sound.Data, saveAudio, updateUi);
|
||||
SaveAndPlaySound(cancellationToken, Path.Combine(directory, sound.Name), sound.Extension, sound.Data, saveAudio, updateUi);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
@ -839,7 +840,7 @@ public class CUE4ParseViewModel : ViewModel
|
|||
var extractedSounds = CriWareProvider.ExtractCriWareSounds(acbReader, archive.Name);
|
||||
foreach (var sound in extractedSounds)
|
||||
{
|
||||
SaveAndPlaySound(Path.Combine(directory, sound.Name), sound.Extension, sound.Data, saveAudio, updateUi);
|
||||
SaveAndPlaySound(cancellationToken, Path.Combine(directory, sound.Name), sound.Extension, sound.Data, saveAudio, updateUi);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
@ -854,7 +855,7 @@ public class CUE4ParseViewModel : ViewModel
|
|||
// todo: CSCore.MediaFoundation.MediaFoundationException The byte stream type of the given URL is unsupported. case "aif":
|
||||
{
|
||||
var data = Provider.SaveAsset(entry);
|
||||
SaveAndPlaySound(entry.PathWithoutExtension, entry.Extension, data, saveAudio, updateUi);
|
||||
SaveAndPlaySound(cancellationToken, entry.PathWithoutExtension, entry.Extension, data, saveAudio, updateUi);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -1114,7 +1115,16 @@ public class CUE4ParseViewModel : ViewModel
|
|||
case UExternalSource when (isNone || saveAudio) && pointer.Object.Value is UExternalSource externalSource:
|
||||
{
|
||||
var audioName = Path.GetFileNameWithoutExtension(externalSource.ExternalSourcePath);
|
||||
SaveAndPlaySound(audioName, "wem", externalSource.Data?.WemFile ?? [], saveAudio, updateUi);
|
||||
SaveAndPlaySound(cancellationToken, audioName, "wem", externalSource.Data?.WemFile ?? [], saveAudio, updateUi);
|
||||
return false;
|
||||
}
|
||||
case UAkAudioBank when (isNone || saveAudio) && pointer.Object.Value is UAkAudioBank soundBank:
|
||||
{
|
||||
var extractedSounds = WwiseProvider.ExtractBankSounds(soundBank);
|
||||
foreach (var sound in extractedSounds)
|
||||
{
|
||||
SaveAndPlaySound(cancellationToken, sound.OutputPath, sound.Extension, sound.Data, saveAudio, updateUi);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
case UAkAudioEvent when (isNone || saveAudio) && pointer.Object.Value is UAkAudioEvent audioEvent:
|
||||
|
|
@ -1122,7 +1132,7 @@ public class CUE4ParseViewModel : ViewModel
|
|||
var extractedSounds = WwiseProvider.ExtractAudioEventSounds(audioEvent);
|
||||
foreach (var sound in extractedSounds)
|
||||
{
|
||||
SaveAndPlaySound(sound.OutputPath, sound.Extension, sound.Data, saveAudio, updateUi);
|
||||
SaveAndPlaySound(cancellationToken, sound.OutputPath, sound.Extension, sound.Data, saveAudio, updateUi);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1132,7 +1142,7 @@ public class CUE4ParseViewModel : ViewModel
|
|||
var directory = Path.GetDirectoryName(fmodEvent.Owner?.Name) ?? "/FMOD/Desktop/";
|
||||
foreach (var sound in extractedSounds)
|
||||
{
|
||||
SaveAndPlaySound(Path.Combine(directory, sound.Name), sound.Extension, sound.Data, saveAudio, updateUi);
|
||||
SaveAndPlaySound(cancellationToken, Path.Combine(directory, sound.Name), sound.Extension, sound.Data, saveAudio, updateUi);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1142,7 +1152,7 @@ public class CUE4ParseViewModel : ViewModel
|
|||
var directory = Path.GetDirectoryName(fmodBank.Owner?.Name) ?? "/FMOD/Desktop/";
|
||||
foreach (var sound in extractedSounds)
|
||||
{
|
||||
SaveAndPlaySound(Path.Combine(directory, sound.Name), sound.Extension, sound.Data, saveAudio, updateUi);
|
||||
SaveAndPlaySound(cancellationToken, Path.Combine(directory, sound.Name), sound.Extension, sound.Data, saveAudio, updateUi);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1161,7 +1171,7 @@ public class CUE4ParseViewModel : ViewModel
|
|||
directory = Path.GetDirectoryName(atomObject.Owner.Provider.FixPath(directory));
|
||||
foreach (var sound in extractedSounds)
|
||||
{
|
||||
SaveAndPlaySound(Path.Combine(directory, sound.Name).Replace("\\", "/"), sound.Extension, sound.Data, saveAudio, updateUi);
|
||||
SaveAndPlaySound(cancellationToken, Path.Combine(directory, sound.Name).Replace("\\", "/"), sound.Extension, sound.Data, saveAudio, updateUi);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1181,7 +1191,7 @@ public class CUE4ParseViewModel : ViewModel
|
|||
return false;
|
||||
}
|
||||
|
||||
SaveAndPlaySound(TabControl.SelectedTab.Entry.PathWithoutExtension.Replace('\\', '/'), audioFormat, data, saveAudio, updateUi);
|
||||
SaveAndPlaySound(cancellationToken, TabControl.SelectedTab.Entry.PathWithoutExtension.Replace('\\', '/'), audioFormat, data, saveAudio, updateUi);
|
||||
return false;
|
||||
}
|
||||
case UAkMediaAsset when (isNone || saveAudio) && pointer.Object.Value is UAkMediaAsset akMediaAsset:
|
||||
|
|
@ -1192,7 +1202,7 @@ public class CUE4ParseViewModel : ViewModel
|
|||
var shouldDecompress = UserSettings.Default.CompressedAudioMode is ECompressedAudio.PlayDecompressed;
|
||||
akMediaAssetData.Decode(shouldDecompress, out var audioFormat, out var data);
|
||||
|
||||
SaveAndPlaySound(audioName, audioFormat, data, saveAudio, updateUi);
|
||||
SaveAndPlaySound(cancellationToken, audioName, audioFormat, data, saveAudio, updateUi);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1208,12 +1218,22 @@ public class CUE4ParseViewModel : ViewModel
|
|||
var audioName = akMediaAsset.MediaName ?? $"{akAudioEventData.Outer.Name} ({akMediaAsset.ID})";
|
||||
akMediaAssetData.Decode(shouldDecompress, out var audioFormat, out var data);
|
||||
|
||||
SaveAndPlaySound(audioName, audioFormat, data, saveAudio, updateUi);
|
||||
SaveAndPlaySound(cancellationToken, audioName, audioFormat, data, saveAudio, updateUi);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Borderlands 3
|
||||
case UDialogPerformanceData when (isNone || saveAudio) && pointer.Object.Value is UDialogPerformanceData dialogPerformanceData:
|
||||
{
|
||||
var extractedSounds = WwiseProvider.ExtractDialogBorderlands3(dialogPerformanceData);
|
||||
foreach (var sound in extractedSounds)
|
||||
{
|
||||
SaveAndPlaySound(cancellationToken, sound.OutputPath, sound.Extension, sound.Data, saveAudio, updateUi);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Borderlands 4
|
||||
case UFaceFXAnimSet when (isNone || saveAudio) && pointer.Object.Value is UFaceFXAnimSet faceFXAnimSet:
|
||||
{
|
||||
|
|
@ -1225,7 +1245,7 @@ public class CUE4ParseViewModel : ViewModel
|
|||
var extractedSounds = WwiseProvider.ExtractAudioEventBorderlands4(faceFXAnimData.ID.Name, false);
|
||||
foreach (var sound in extractedSounds)
|
||||
{
|
||||
SaveAndPlaySound(sound.OutputPath, sound.Extension, sound.Data, saveAudio, updateUi);
|
||||
SaveAndPlaySound(cancellationToken, sound.OutputPath, sound.Extension, sound.Data, saveAudio, updateUi);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1239,7 +1259,7 @@ public class CUE4ParseViewModel : ViewModel
|
|||
var extractedSounds = WwiseProvider.ExtractAudioEventBorderlands4(eventName, useSoundTag);
|
||||
foreach (var sound in extractedSounds)
|
||||
{
|
||||
SaveAndPlaySound(sound.OutputPath, sound.Extension, sound.Data, saveAudio, updateUi);
|
||||
SaveAndPlaySound(cancellationToken, sound.OutputPath, sound.Extension, sound.Data, saveAudio, updateUi);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1379,7 +1399,7 @@ public class CUE4ParseViewModel : ViewModel
|
|||
TabControl.SelectedTab.SetDocumentText(cpp, false, false);
|
||||
}
|
||||
|
||||
private void SaveAndPlaySound(string fullPath, string ext, byte[] data, bool isBulk, bool updateUi)
|
||||
private void SaveAndPlaySound(CancellationToken cancellationToken, string fullPath, string ext, byte[] data, bool isBulk, bool updateUi)
|
||||
{
|
||||
if (fullPath.StartsWith('/')) fullPath = fullPath[1..];
|
||||
var savedAudioPath = Path.Combine(UserSettings.Default.AudioDirectory,
|
||||
|
|
@ -1387,6 +1407,7 @@ public class CUE4ParseViewModel : ViewModel
|
|||
|
||||
if (isBulk)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
Directory.CreateDirectory(savedAudioPath.SubstringBeforeLast('/'));
|
||||
using var stream = new FileStream(savedAudioPath, FileMode.Create, FileAccess.Write);
|
||||
using (var writer = new BinaryWriter(stream))
|
||||
|
|
@ -1398,7 +1419,18 @@ public class CUE4ParseViewModel : ViewModel
|
|||
if (UserSettings.Default.ConvertAudioOnBulkExport)
|
||||
{
|
||||
AudioPlayerViewModel.TryConvert(savedAudioPath, data, out string wavFilePath);
|
||||
savedAudioPath = wavFilePath;
|
||||
if (!string.IsNullOrEmpty(wavFilePath))
|
||||
{
|
||||
savedAudioPath = wavFilePath;
|
||||
}
|
||||
else if (updateUi)
|
||||
{
|
||||
FLogger.Append(ELog.Error, () =>
|
||||
{
|
||||
FLogger.Text("Failed to convert audio to WAV format, aborting extraction.", Constants.WHITE, true);
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Log.Information("Successfully saved {FilePath}", savedAudioPath);
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using System.Windows.Media;
|
|||
using System.Windows.Media.Imaging;
|
||||
|
||||
using CUE4Parse.FileProvider.Objects;
|
||||
using CUE4Parse.GameTypes.Borderlands3.Assets.Exports;
|
||||
using CUE4Parse.GameTypes.Borderlands4.Assets.Exports;
|
||||
using CUE4Parse.GameTypes.FN.Assets.Exports.DataAssets;
|
||||
using CUE4Parse.GameTypes.SMG.UE4.Assets.Exports.Wwise;
|
||||
|
|
@ -257,8 +258,9 @@ public class GameFileViewModel(GameFile asset) : ViewModel
|
|||
UNiagaraSystem or UNiagaraScriptBase or UParticleSystem => (EAssetCategory.Particle, EBulkType.None),
|
||||
|
||||
// Game specific assets below
|
||||
UGbxGraphAsset => (EAssetCategory.Borderlands4, EBulkType.Audio), // Borderlands 4
|
||||
UFaceFXAnimSet when _applicationView.CUE4Parse?.Provider.Versions.Game is EGame.GAME_Borderlands4 => (EAssetCategory.Borderlands4, EBulkType.Audio), // Borderlands 4
|
||||
UBorderlandsDialogObject => (EAssetCategory.Borderlands, EBulkType.None), // Borderlands 3;
|
||||
UGbxGraphAsset or UDialogScriptData or UDialogPerformanceData => (EAssetCategory.Borderlands, EBulkType.Audio), // Borderlands 4; Borderlands 3;
|
||||
UFaceFXAnimSet when _applicationView.CUE4Parse?.Provider.Versions.Game is EGame.GAME_Borderlands4 => (EAssetCategory.Borderlands, EBulkType.Audio), // Borderlands 4;
|
||||
|
||||
_ => (EAssetCategory.All, EBulkType.None),
|
||||
};
|
||||
|
|
@ -427,6 +429,11 @@ public class GameFileViewModel(GameFile asset) : ViewModel
|
|||
bitmap.Dispose();
|
||||
});
|
||||
}
|
||||
// Game specific extensions below
|
||||
case "ace": // Borderlands 3
|
||||
case "ncs": // Borderlands 4
|
||||
AssetCategory = EAssetCategory.Borderlands;
|
||||
break;
|
||||
default:
|
||||
AssetCategory = EAssetCategory.All; // just so it sets resolved
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
<SolidColorBrush x:Key="AudioBrush" Color="MediumSeaGreen" />
|
||||
<SolidColorBrush x:Key="SoundBankBrush" Color="DarkSeaGreen" />
|
||||
<SolidColorBrush x:Key="AudioEventBrush" Color="DarkTurquoise" />
|
||||
<SolidColorBrush x:Key="AudioEventBrush" Color="LightSeaGreen" />
|
||||
|
||||
<SolidColorBrush x:Key="VideoBrush" Color="IndianRed" />
|
||||
<SolidColorBrush x:Key="DataTableBrush" Color="SteelBlue" />
|
||||
|
|
@ -47,6 +47,7 @@
|
|||
<SolidColorBrush x:Key="CssBrush" Color="MediumPurple" />
|
||||
<SolidColorBrush x:Key="GitBrush" Color="Coral" />
|
||||
<SolidColorBrush x:Key="CsvBrush" Color="ForestGreen" />
|
||||
<SolidColorBrush x:Key="AIBrush" Color="LightGray" />
|
||||
|
||||
<!-- For specific games -->
|
||||
<SolidColorBrush x:Key="BorderlandsBrush" Color="Yellow"></SolidColorBrush>
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class FileToGeometryConverter : IMultiValueConverter
|
|||
|
||||
EAssetCategory.ByteCode => ("CodeIcon", "CodeBrush"),
|
||||
|
||||
EAssetCategory.Borderlands4 => ("BorderlandsIcon", "BorderlandsBrush"),
|
||||
EAssetCategory.Borderlands => ("BorderlandsIcon", "BorderlandsBrush"),
|
||||
|
||||
_ => ("AssetIcon", "NeutralBrush")
|
||||
};
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ public class FolderToGeometryConverter : IValueConverter
|
|||
|
||||
var (geometry, brush) = folderName switch
|
||||
{
|
||||
"ai" => ("AIIcon", "AIBrush"),
|
||||
"textures" or "texture" or "ui" or "icons" or "umgassets" or "hud" or "hdri" or "tex" => ("TextureIconAlt", "TextureBrush"),
|
||||
"config" or "tags" => ("ConfigIcon", "ConfigBrush"),
|
||||
"audio" or "wwiseaudio" or "wwise" or "fmod" or "sound" or "sounds" or "cue" => ("AudioIconAlt", "AudioBrush"),
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@
|
|||
<Geometry x:Key="JavaScriptIcon">M3,3H21V21H3V3M7.73,18.04C8.13,18.89 8.92,19.59 10.27,19.59C11.77,19.59 12.8,18.79 12.8,17.04V11.26H11.1V17C11.1,17.86 10.75,18.08 10.2,18.08C9.62,18.08 9.38,17.68 9.11,17.21L7.73,18.04M13.71,17.86C14.21,18.84 15.22,19.59 16.8,19.59C18.4,19.59 19.6,18.76 19.6,17.23C19.6,15.82 18.79,15.19 17.35,14.57L16.93,14.39C16.2,14.08 15.89,13.87 15.89,13.37C15.89,12.96 16.2,12.64 16.7,12.64C17.18,12.64 17.5,12.85 17.79,13.37L19.1,12.5C18.55,11.54 17.77,11.17 16.7,11.17C15.19,11.17 14.22,12.13 14.22,13.4C14.22,14.78 15.03,15.43 16.25,15.95L16.67,16.13C17.45,16.47 17.91,16.68 17.91,17.26C17.91,17.74 17.46,18.09 16.76,18.09C15.93,18.09 15.45,17.66 15.09,17.06L13.71,17.86Z</Geometry>
|
||||
<Geometry x:Key="CssIcon">M5,3L4.35,6.34H17.94L17.5,8.5H3.92L3.26,11.83H16.85L16.09,15.64L10.61,17.45L5.86,15.64L6.19,14H2.85L2.06,18L9.91,21L18.96,18L20.16,11.97L20.4,10.76L21.94,3H5Z</Geometry>
|
||||
<Geometry x:Key="CsvIcon">M14 2H6C4.9 2 4 2.9 4 4V20C4 21.1 4.9 22 6 22H18C19.1 22 20 21.1 20 20V8L14 2M15 16L13 20H10L12 16H9V11H15V16M13 9V3.5L18.5 9H13Z</Geometry>
|
||||
<Geometry x:Key="AIIcon">M12,2A2,2 0 0,1 14,4C14,4.74 13.6,5.39 13,5.73V7H14A7,7 0 0,1 21,14H22A1,1 0 0,1 23,15V18A1,1 0 0,1 22,19H21V20A2,2 0 0,1 19,22H5A2,2 0 0,1 3,20V19H2A1,1 0 0,1 1,18V15A1,1 0 0,1 2,14H3A7,7 0 0,1 10,7H11V5.73C10.4,5.39 10,4.74 10,4A2,2 0 0,1 12,2M7.5,13A2.5,2.5 0 0,0 5,15.5A2.5,2.5 0 0,0 7.5,18A2.5,2.5 0 0,0 10,15.5A2.5,2.5 0 0,0 7.5,13M16.5,13A2.5,2.5 0 0,0 14,15.5A2.5,2.5 0 0,0 16.5,18A2.5,2.5 0 0,0 19,15.5A2.5,2.5 0 0,0 16.5,13Z</Geometry>
|
||||
|
||||
<!-- For specific games-->
|
||||
<Geometry x:Key="BorderlandsIcon">M13,9V3.5L18.5,9M6,2C4.89,2 4,2.89 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2H6 ZM12,11A3,3 0 1,0 12,17A3,3 0 0,0 12,11 ZM12,12.5L14,16H13L12,14.5L11,16H10L12,12.5Z</Geometry>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user