@@ -78,6 +78,13 @@ public bool ModelIsOverwritingMaterial
7878 set => SetProperty ( ref _modelIsOverwritingMaterial , value ) ;
7979 }
8080
81+ private bool _modelIsWaitingAnimation ;
82+ public bool ModelIsWaitingAnimation
83+ {
84+ get => _modelIsWaitingAnimation ;
85+ set => SetProperty ( ref _modelIsWaitingAnimation , value ) ;
86+ }
87+
8188 public bool IsSnooperOpen => _snooper is { Exists : true , IsVisible : true } ;
8289 private Snooper _snooper ;
8390 public Snooper SnooperViewer
@@ -117,6 +124,8 @@ public Snooper SnooperViewer
117124 public SearchViewModel SearchVm { get ; }
118125 public TabControlViewModel TabControl { get ; }
119126 public ConfigIni IoStoreOnDemand { get ; }
127+ private Lazy < WwiseProvider > _wwiseProviderLazy ;
128+ public WwiseProvider WwiseProvider => _wwiseProviderLazy . Value ;
120129
121130 public CUE4ParseViewModel ( )
122131 {
@@ -266,6 +275,7 @@ await _threadWorkerView.Begin(cancellationToken =>
266275 }
267276
268277 Provider . Initialize ( ) ;
278+ _wwiseProviderLazy = new Lazy < WwiseProvider > ( ( ) => new WwiseProvider ( Provider , UserSettings . Default . WwiseMaxBnkPrefetch ) ) ;
269279 Log . Information ( $ "{ Provider . Versions . Game } ({ Provider . Versions . Platform } ) | Archives: x{ Provider . UnloadedVfs . Count } | AES: x{ Provider . RequiredKeys . Count } | Loose Files: x{ Provider . Files . Count } ") ;
270280 } ) ;
271281 }
@@ -670,9 +680,11 @@ public void Extract(CancellationToken cancellationToken, GameFile entry, bool ad
670680 var archive = entry . CreateReader ( ) ;
671681 var wwise = new WwiseReader ( archive ) ;
672682 TabControl . SelectedTab . SetDocumentText ( JsonConvert . SerializeObject ( wwise , Formatting . Indented ) , saveProperties , updateUi ) ;
673- foreach ( var ( name , data ) in wwise . WwiseEncodedMedias )
683+
684+ var medias = WwiseProvider . ExtractBankSounds ( wwise ) ;
685+ foreach ( var media in medias )
674686 {
675- SaveAndPlaySound ( entry . Path . SubstringBeforeWithLast ( '/' ) + name , "WEM" , data ) ;
687+ SaveAndPlaySound ( media . OutputPath , media . Extension , media . Data ) ;
676688 }
677689
678690 break ;
@@ -852,22 +864,12 @@ public void ExtractAndScroll(CancellationToken cancellationToken, string fullPat
852864 TabControl . SelectedTab . AddImage ( sourceFile . SubstringAfterLast ( '/' ) , false , bitmap , false , updateUi ) ;
853865 return false ;
854866 }
855- case UAkAudioEvent when isNone && pointer . Object . Value is UAkAudioEvent { EventCookedData : { } wwiseData } :
867+ case UAkAudioEvent when isNone && pointer . Object . Value is UAkAudioEvent audioEvent :
856868 {
857- foreach ( var kvp in wwiseData . EventLanguageMap )
869+ var extractedSounds = WwiseProvider . ExtractAudioEventSounds ( audioEvent ) ;
870+ foreach ( var sound in extractedSounds )
858871 {
859- if ( ! kvp . Value . HasValue ) continue ;
860-
861- foreach ( var media in kvp . Value . Value . Media )
862- {
863- if ( ! Provider . TrySaveAsset ( Path . Combine ( "Game/WwiseAudio/" , media . MediaPathName . Text ) , out var data ) ) continue ;
864-
865- var namedPath = string . Concat (
866- Provider . ProjectName , "/Content/WwiseAudio/" ,
867- media . DebugName . Text . SubstringBeforeLast ( '.' ) . Replace ( '\\ ' , '/' ) ,
868- " (" , kvp . Key . LanguageName . Text , ")" ) ;
869- SaveAndPlaySound ( namedPath , media . MediaPathName . Text . SubstringAfterLast ( '.' ) , data ) ;
870- }
872+ SaveAndPlaySound ( sound . OutputPath , sound . Extension , sound . Data ) ;
871873 }
872874 return false ;
873875 }
@@ -914,7 +916,7 @@ public void ExtractAndScroll(CancellationToken cancellationToken, string fullPat
914916 SnooperViewer . Run ( ) ;
915917 return true ;
916918 }
917- case UAnimSequenceBase when isNone && UserSettings . Default . PreviewAnimations || SnooperViewer . Renderer . Options . ModelIsWaitingAnimation :
919+ case UAnimSequenceBase when isNone && UserSettings . Default . PreviewAnimations || ModelIsWaitingAnimation :
918920 {
919921 // animate all animations using their specified skeleton or when we explicitly asked for a loaded model to be animated (ignoring whether we wanted to preview animations)
920922 SnooperViewer . Renderer . Animate ( pointer . Object . Value ) ;
@@ -961,7 +963,7 @@ public void ShowMetadata(GameFile entry)
961963
962964 private void SaveAndPlaySound ( string fullPath , string ext , byte [ ] data )
963965 {
964- if ( fullPath . StartsWith ( "/" ) ) fullPath = fullPath [ 1 ..] ;
966+ if ( fullPath . StartsWith ( '/' ) ) fullPath = fullPath [ 1 ..] ;
965967 var savedAudioPath = Path . Combine ( UserSettings . Default . AudioDirectory ,
966968 UserSettings . Default . KeepDirectoryStructure ? fullPath : fullPath . SubstringAfterLast ( '/' ) ) . Replace ( '\\ ' , '/' ) + $ ".{ ext . ToLowerInvariant ( ) } ";
967969
0 commit comments