curve table fix

This commit is contained in:
iAmAsval 2020-12-18 19:22:38 +01:00
parent 1a3b2935f0
commit 1e01f39917
4 changed files with 18 additions and 9 deletions

View File

@ -24,7 +24,10 @@ namespace FModel.Grabber.Paks
public static async Task PopulateMenu()
{
PopulateBase();
await Application.Current.Dispatcher.InvokeAsync(delegate
{
PopulateBase();
});
await Task.Run(async () =>
{

View File

@ -77,14 +77,13 @@ namespace FModel
if (!Properties.Settings.Default.SkipVersion) Updater.CheckForUpdate();
DebugHelper.WriteUserSettings();
Folders.CheckWatermarks();
LoadMappings();
await Task.WhenAll(Init()).ContinueWith(t =>
{
Keys.NoKeyGoodBye();
MenuItems.FeedCustomGoTos();
AeConfiguration();
LoadMappings();
if (t.Exception != null) Tasks.TaskCompleted(t.Exception);
else StatusBarVm.statusBarViewModel.Set($"{Properties.Resources.Hello} {Environment.UserName}!", Properties.Resources.State);
@ -97,11 +96,11 @@ namespace FModel
private async Task Init()
{
await PaksGrabber.PopulateMenu().ConfigureAwait(false);
if (Properties.Settings.Default.UseDiscordRpc) DiscordIntegration.StartClient();
await AesGrabber.Load(Properties.Settings.Default.ReloadAesKeys).ConfigureAwait(false);
await CdnDataGrabber.DoCDNStuff().ConfigureAwait(false);
await PaksGrabber.PopulateMenu().ConfigureAwait(false);
await AesGrabber.Load(Properties.Settings.Default.ReloadAesKeys).ConfigureAwait(false);
await Folders.DownloadAndExtractVgm().ConfigureAwait(false);
if (Properties.Settings.Default.UseDiscordRpc) DiscordIntegration.StartClient();
}
private async void LoadMappings()

View File

@ -1,5 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Runtime.CompilerServices;
using FModel.PakReader.IO;
using FModel.PakReader.Parsers.Objects;
@ -10,7 +11,7 @@ namespace FModel.PakReader.Parsers.Class
{
public ECurveTableMode CurveTableMode { get; }
readonly Dictionary<string, object> RowMap;
internal UCurveTable(PackageReader reader)
{
new UObject(reader); //will break
@ -33,13 +34,19 @@ namespace FModel.PakReader.Parsers.Class
}
}
internal UCurveTable(IoPackageReader reader, IReadOnlyDictionary<int, PropertyInfo> properties)
internal UCurveTable(IoPackageReader reader)
{
reader.ReadUInt16(); // don't ask me
reader.ReadUInt32(); // what this is
int NumRows = reader.ReadInt32();
CurveTableMode = (ECurveTableMode)reader.ReadByte();
Dictionary<int, PropertyInfo> properties = CurveTableMode switch
{
ECurveTableMode.RichCurves => Globals.TypeMappings["RichCurve"],
ECurveTableMode.SimpleCurves => Globals.TypeMappings["SimpleCurve"],
_ => throw new FileLoadException($"This table has an unknown mode ({CurveTableMode})")
};
RowMap = new Dictionary<string, object>();
for (int i = 0; i < NumRows; i++)

View File

@ -166,7 +166,7 @@ namespace FModel.PakReader.Parsers
"Texture2D" => new UTexture2D(this, properties, _ubulk, ExportMap.Sum(e => (long)e.CookedSerialSize) + beginExportOffset),
"TextureCube" => new UTexture2D(this, properties, _ubulk, ExportMap.Sum(e => (long)e.CookedSerialSize) + beginExportOffset),
"VirtualTexture2D" => new UTexture2D(this, properties, _ubulk, ExportMap.Sum(e => (long)e.CookedSerialSize) + beginExportOffset),
"CurveTable" => new UCurveTable(this, properties),
"CurveTable" => new UCurveTable(this),
"DataTable" => new UDataTable(this, properties, exportType.String),
"SoundWave" => new USoundWave(this, properties, _ubulk, ExportMap.Sum(e => (long)e.CookedSerialSize) + beginExportOffset),
_ => new UObject(this, properties, type: exportType.String),