fixed some audios + fixed cid 776 + fixed pickaxes without images

This commit is contained in:
iAmAsval
2020-06-17 22:29:53 +02:00
parent 2016eb7e99
commit 3ff24995c0
9 changed files with 53 additions and 26 deletions

View File

@@ -22,18 +22,32 @@ namespace FModel.Creator.Icons
PakPackage p = Utils.GetPropertyPakPackage(path);
if (p.HasExport() && !p.Equals(default))
{
var obj = p.GetExport<UObject>();
if (obj != null)
{
if (hightRes && obj.TryGetValue("LargePreviewImage", out var sLarge) && sLarge is SoftObjectProperty largePreviewImage)
GetPreviewImage(icon, largePreviewImage);
else if (obj.TryGetValue("SmallPreviewImage", out var sSmall) && sSmall is SoftObjectProperty smallPreviewImage)
GetPreviewImage(icon, smallPreviewImage);
}
if (GetPreviewImage(icon, p.GetIndexedExport<UObject>(0), hightRes))
return;
else if (GetPreviewImage(icon, p.GetIndexedExport<UObject>(1), hightRes)) // FortniteGame/Content/Athena/Items/Cosmetics/Pickaxes/Pickaxe_ID_402_BlackKnightFemale1H.uasset
return;
}
}
public static void GetPreviewImage(BaseIcon icon, SoftObjectProperty s) => icon.IconImage = Utils.GetSoftObjectTexture(s);
private static bool GetPreviewImage(BaseIcon icon, UObject obj, bool hightRes)
{
if (obj != null)
{
if (hightRes && obj.TryGetValue("LargePreviewImage", out var sLarge) && sLarge is SoftObjectProperty largePreviewImage)
{
GetPreviewImage(icon, largePreviewImage);
return true;
}
else if (obj.TryGetValue("SmallPreviewImage", out var sSmall) && sSmall is SoftObjectProperty smallPreviewImage)
{
GetPreviewImage(icon, smallPreviewImage);
return true;
}
}
return false;
}
public static void DrawPreviewImage(SKCanvas c, BaseIcon icon) =>
c.DrawBitmap(icon.IconImage ?? icon.FallbackImage, new SKRect(icon.Margin, icon.Margin, icon.Size - icon.Margin, icon.Size - icon.Margin),
new SKPaint { FilterQuality = SKFilterQuality.High, IsAntialias = true });

View File

@@ -8,8 +8,8 @@
<StartupObject>FModel.App</StartupObject>
<Authors>Asval</Authors>
<Company></Company>
<AssemblyVersion>3.1.0.4</AssemblyVersion>
<FileVersion>3.1.0.4</FileVersion>
<AssemblyVersion>3.1.0.5</AssemblyVersion>
<FileVersion>3.1.0.5</FileVersion>
<PackageIcon>FModel.ico</PackageIcon>
<PackageIconUrl />
<PackageProjectUrl>https://github.com/iAmAsval/FModel</PackageProjectUrl>

View File

@@ -14,8 +14,7 @@ namespace FModel.Grabber.Aes
{
if (NetworkInterface.GetIsNetworkAvailable())
{
(_, string fortniteVersion, string _) = Utils.Paks.GetUEGameFilesPath("Fortnite");
BenResponse data = await Endpoints.GetJsonEndpoint<BenResponse>(Endpoints.BENBOT_AES, fortniteVersion).ConfigureAwait(false);
BenResponse data = await Endpoints.GetJsonEndpoint<BenResponse>(Endpoints.BENBOT_AES, string.Empty).ConfigureAwait(false);
return data;
}
else

View File

@@ -55,7 +55,7 @@ namespace FModel
}
private async void OnLoaded(object sender, RoutedEventArgs e)
{
FModelVersion_TxtBlck.Text += Assembly.GetExecutingAssembly().GetName().Version.ToString().Substring(0, 5);
FModelVersion_TxtBlck.Text += Assembly.GetExecutingAssembly().GetName().Version.ToString();
FModel_StsBar.DataContext = StatusBarVm.statusBarViewModel;
FModel_AvalonEdit.DataContext = AvalonEditVm.avalonEditViewModel;
FModel_ImgBox.DataContext = ImageBoxVm.imageBoxViewModel;

View File

@@ -78,6 +78,16 @@ namespace PakReader.Pak
}
return default;
}
public T GetIndexedExport<T>(int index) where T : IUExport
{
var exports = Exports;
for (int i = 0; i < exports.Length; i++)
{
if (i == index && exports[i] is T)
return (T)exports[i];
}
return default;
}
public bool HasExport() => exports != null;

View File

@@ -10,7 +10,7 @@ namespace PakReader.Parsers.Class
{
public bool bCooked;
/** Whether this sound can be streamed to avoid increased memory usage. If using Stream Caching, use Loading Behavior instead to control memory usage. */
public bool bStreaming = false;
public bool bStreaming = true;
/** Uncompressed wav data 16 bit in mono or stereo - stereo not allowed for multichannel data */
public FByteBulkData RawData;
/** GUID used to uniquely identify this node so it can be found in the DDC */
@@ -21,10 +21,6 @@ namespace PakReader.Parsers.Class
public FName AudioFormat;
/** audio data. */
public FStreamedAudioChunk[] Chunks;
/** Cached sample rate for displaying in the tools */
//public int SampleRate;
/** Number of channels of multichannel data; 1 or 2 for regular mono and stereo files */
//public int NumChannels;
byte[] sound;
public byte[] Sound

View File

@@ -14,12 +14,20 @@ namespace PakReader.Parsers.Objects
{
[JsonIgnore]
public readonly int Index;
public FObjectResource Resource =>
!IsNull ?
IsImport ?
Reader.ImportMap[AsImport] :
(FObjectResource)Reader.ExportMap[AsExport]
: null;
public FObjectResource Resource
{
get
{
if (!IsNull)
{
if (IsImport && AsImport < Reader.ImportMap.Length)
return Reader.ImportMap[AsImport];
else if (IsImport && AsExport < Reader.ExportMap.Length)
return Reader.ExportMap[AsExport];
}
return null;
}
}
readonly PackageReader Reader;

View File

@@ -39,7 +39,7 @@ namespace FModel.ViewModels.SoundPlayer
private string _content;
private string _bytes;
private string _duration;
private float _volume = float.Parse(Properties.Settings.Default.AudioPlayerVolume);
private float _volume = float.TryParse(Properties.Settings.Default.AudioPlayerVolume, out var v) ? v : 0.5f;
public ObservableCollection<Device> Devices
{

View File

@@ -53,7 +53,7 @@ namespace FModel.Windows.SoundPlayer.Visualization
}
}
private float volume = float.Parse(Properties.Settings.Default.AudioPlayerVolume);
private float volume = float.TryParse(Properties.Settings.Default.AudioPlayerVolume, out var v) ? v : 0.5f;
public float Volume
{
get { return _soundOut == null ? 0.0f : _soundOut.Volume; }