mirror of
https://github.com/4sval/FModel.git
synced 2026-06-22 07:50:10 -05:00
sounds are auto-played as a playlist now (auto skip to the next one)
This commit is contained in:
parent
3c50c37373
commit
1ebc396a2f
|
|
@ -1,4 +1,4 @@
|
|||
namespace PakReader.Parsers.Objects
|
||||
namespace PakReader.Parsers.Objects
|
||||
{
|
||||
// NOTE: THIS IS NOT AN ACTUAL ENUM IN UE4.
|
||||
// LINK: https://github.com/EpicGames/UnrealEngine/blob/8b6414ae4bca5f93b878afadcc41ab518b09984f/Engine/Source/Runtime/PakFile/Public/IPlatformFilePak.h#L85
|
||||
|
|
|
|||
|
|
@ -21,16 +21,20 @@ namespace PakReader.Parsers.Objects
|
|||
var BulkDataOffsetInFile = reader.ReadInt64();
|
||||
|
||||
Data = null;
|
||||
if ((BulkDataFlags & (uint)EBulkDataFlags.BULKDATA_ForceInlinePayload) != 0)
|
||||
if ((BulkDataFlags & (uint)EBulkDataFlags.BULKDATA_ForceInlinePayload) != 0 && ElementCount > 0)
|
||||
{
|
||||
Data = reader.ReadBytes((int)ElementCount);
|
||||
}
|
||||
|
||||
if ((BulkDataFlags & (uint)EBulkDataFlags.BULKDATA_PayloadInSeperateFile) != 0)
|
||||
{
|
||||
ubulk.Position = BulkDataOffsetInFile + ubulkOffset;
|
||||
Data = new byte[ElementCount];
|
||||
ubulk.Read(Data, 0, (int)ElementCount);
|
||||
if (ubulk != null)
|
||||
{
|
||||
ubulk.Position = BulkDataOffsetInFile + ubulkOffset;
|
||||
Data = new byte[ElementCount];
|
||||
ubulk.Read(Data, 0, (int)ElementCount);
|
||||
}
|
||||
//else throw new FileLoadException("No ubulk specified for texture");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace PakReader.Parsers.Objects
|
||||
|
|
@ -25,7 +25,7 @@ namespace PakReader.Parsers.Objects
|
|||
|
||||
if (FModel.Globals.Game.ActualGame == FModel.EGame.Valorant || FModel.Globals.Game.Version > EPakVersion.FNAME_BASED_COMPRESSION_METHOD)
|
||||
{
|
||||
if (reader.ReadInt32() != 0) throw new FileLoadException("Too lazy to add virtual textures right now");
|
||||
if (reader.ReadInt32() != 0) throw new FileLoadException("VirtualTextures are not supported");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,15 +132,6 @@ namespace FModel.Utils
|
|||
}
|
||||
break;
|
||||
}
|
||||
case ".png":
|
||||
{
|
||||
using var asset = GetMemoryStream(selected.PakEntry.PakFileName, mount + selected.PakEntry.GetPathWithoutExtension());
|
||||
asset.Position = 0;
|
||||
ImageBoxVm.imageBoxViewModel.Set(SKBitmap.Decode(asset), mount + selected.PakEntry.Name);
|
||||
break;
|
||||
}
|
||||
case ".ushaderbytecode":
|
||||
break;
|
||||
case ".bnk":
|
||||
case ".pck":
|
||||
{
|
||||
|
|
@ -157,6 +148,15 @@ namespace FModel.Utils
|
|||
});
|
||||
break;
|
||||
}
|
||||
case ".png":
|
||||
{
|
||||
using var asset = GetMemoryStream(selected.PakEntry.PakFileName, mount + selected.PakEntry.GetPathWithoutExtension());
|
||||
asset.Position = 0;
|
||||
ImageBoxVm.imageBoxViewModel.Set(SKBitmap.Decode(asset), mount + selected.PakEntry.Name);
|
||||
break;
|
||||
}
|
||||
case ".ushaderbytecode":
|
||||
break;
|
||||
default:
|
||||
AvalonEditVm.avalonEditViewModel.Set(GetJsonProperties(selected.PakEntry, mount, true), mount + selected.PakEntry.Name);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
using CSCore.SoundOut;
|
||||
using FModel.Discord;
|
||||
using FModel.ViewModels.ListBox;
|
||||
using FModel.ViewModels.SoundPlayer;
|
||||
|
|
@ -190,12 +191,45 @@ namespace FModel.Windows.SoundPlayer
|
|||
Properties.Settings.Default.Save();
|
||||
|
||||
if (output == null)
|
||||
{
|
||||
output = new OutputSource(d);
|
||||
output.SourcePropertyChangedEvent += Output_SourcePropertyChangedEvent;
|
||||
}
|
||||
else
|
||||
output.SwapDevice(d);
|
||||
}
|
||||
}
|
||||
|
||||
private void Output_SourcePropertyChangedEvent(object sender, SourcePropertyChangedEventArgs e)
|
||||
{
|
||||
switch (e.Property)
|
||||
{
|
||||
case ESourceProperty.PlaybackState:
|
||||
if (output != null && output.Position == output.Length && (PlaybackState)e.Value == PlaybackState.Stopped)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(delegate
|
||||
{
|
||||
PlayPauseImg.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/play.png"));
|
||||
});
|
||||
|
||||
var selected = ListBoxVm.soundFiles.Where(x => x.FullPath.Equals(output.FileName)).FirstOrDefault();
|
||||
if (selected is ListBoxViewModel2 s)
|
||||
{
|
||||
int index = ListBoxVm.soundFiles.IndexOf(s);
|
||||
if (index < ListBoxVm.soundFiles.Count - 1)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(delegate
|
||||
{
|
||||
Sound_LstBox.SelectedIndex = index + 1;
|
||||
OnPlayPauseClick(sender, null);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSelectedItemChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (sender is ListBox listBox && listBox.SelectedItem is ListBoxViewModel2 selectedItem)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
using CSCore.DSP;
|
||||
using CSCore.SoundOut;
|
||||
using CSCore.Streams;
|
||||
using FModel.ViewModels.SoundPlayer;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user