Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
4sval committed Dec 7, 2023
1 parent 1461a6e commit 3721d7c
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 48 deletions.
1 change: 1 addition & 0 deletions FModel/Creator/Bases/FN/BaseIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ protected string GetCosmeticSet(string setName)
1 => 10,
2 => 8,
3 => 4,
4 => 5,
_ => 10
};

Expand Down
7 changes: 3 additions & 4 deletions FModel/Creator/Bases/FN/BaseMtxOffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ public BaseMtxOffer(UObject uObject, EIconStyle style) : base(uObject, style)

public override void ParseForInfo()
{
if (Object.TryGetValue(out FStructFallback typeImage, "DetailsImage", "TileImage") &&
typeImage.TryGetValue(out FPackageIndex resource, "ResourceObject"))
if (Object.TryGetValue(out FSoftObjectPath image, "SoftDetailsImage", "SoftTileImage"))
{
Preview = Utils.GetBitmap(resource);
Preview = Utils.GetBitmap(image);
}

if (Object.TryGetValue(out FStructFallback gradient, "Gradient") &&
Expand Down Expand Up @@ -81,4 +80,4 @@ public override SKBitmap[] Draw()

return new[] { ret };
}
}
}
13 changes: 9 additions & 4 deletions FModel/Creator/Bases/FN/BaseOfferDisplayData.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using CUE4Parse.UE4.Assets.Exports;
using CUE4Parse.UE4.Assets.Exports.Material;
using CUE4Parse.UE4.Assets.Objects;
using CUE4Parse.UE4.Objects.UObject;
using SkiaSharp;

namespace FModel.Creator.Bases.FN;
Expand All @@ -14,13 +16,16 @@ public BaseOfferDisplayData(UObject uObject, EIconStyle style) : base(uObject, s

public override void ParseForInfo()
{
if (!Object.TryGetValue(out UMaterialInterface[] presentations, "Presentations"))
if (!Object.TryGetValue(out FStructFallback[] contextualPresentations, "ContextualPresentations"))
return;

_offerImages = new BaseMaterialInstance[presentations.Length];
_offerImages = new BaseMaterialInstance[contextualPresentations.Length];
for (var i = 0; i < _offerImages.Length; i++)
{
var offerImage = new BaseMaterialInstance(presentations[i], Style);
if (!contextualPresentations[i].TryGetValue(out FSoftObjectPath material, "Material") ||
!material.TryLoad(out UMaterialInterface presentation)) continue;

var offerImage = new BaseMaterialInstance(presentation, Style);
offerImage.ParseForInfo();
_offerImages[i] = offerImage;
}
Expand All @@ -36,4 +41,4 @@ public override SKBitmap[] Draw()

return ret;
}
}
}
24 changes: 21 additions & 3 deletions FModel/Creator/CreatorPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,18 @@ public bool TryConstructCreator(out UCreator creator)
case "FortAmmoItemDefinition":
case "FortEmoteItemDefinition":
case "FortBadgeItemDefinition":
case "SparksMicItemDefinition":
case "FortAwardItemDefinition":
case "SparksAuraItemDefinition":
case "SparksDrumItemDefinition":
case "SparksBassItemDefinition":
case "FortGadgetItemDefinition":
case "AthenaCharmItemDefinition":
case "FortPlaysetItemDefinition":
case "FortGiftBoxItemDefinition":
case "FortOutpostItemDefinition":
case "FortVehicleItemDefinition":
case "SparksGuitarItemDefinition":
case "FortCardPackItemDefinition":
case "FortDefenderItemDefinition":
case "FortCurrencyItemDefinition":
Expand All @@ -80,38 +85,51 @@ public bool TryConstructCreator(out UCreator creator)
case "FortWeaponModItemDefinition":
case "FortCodeTokenItemDefinition":
case "FortSchematicItemDefinition":
case "SparksKeyboardItemDefinition":
case "FortWorldMultiItemDefinition":
case "FortAlterationItemDefinition":
case "FortExpeditionItemDefinition":
case "FortIngredientItemDefinition":
case "StWFortAccoladeItemDefinition":
case "FortAccountBuffItemDefinition":
case "FortWeaponMeleeItemDefinition":
case "FortPlayerPerksItemDefinition":
case "FortPlaysetPropItemDefinition":
case "JunoRecipeBundleItemDefinition":
case "FortHomebaseNodeItemDefinition":
case "FortNeverPersistItemDefinition":
case "FortPlayerAugmentItemDefinition":
case "FortSmartBuildingItemDefinition":
case "FortWeaponModItemDefinitionOptic":
case "RadioContentSourceItemDefinition":
case "FortPlaysetGrenadeItemDefinition":
case "JunoWeaponCreatureItemDefinition":
case "FortPersonalVehicleItemDefinition":
case "FortGameplayModifierItemDefinition":
case "FortHardcoreModifierItemDefinition":
case "FortWeaponModItemDefinitionMagazine":
case "FortConsumableAccountItemDefinition":
case "FortConversionControlItemDefinition":
case "FortAccountBuffCreditItemDefinition":
case "JunoBuildInstructionsItemDefinition":
case "FortEventCurrencyItemDefinitionRedir":
case "FortPersistentResourceItemDefinition":
case "FortWeaponMeleeOffhandItemDefinition":
case "FortHomebaseBannerIconItemDefinition":
case "FortCampaignHeroLoadoutItemDefinition":
case "FortConditionalResourceItemDefinition":
case "FortChallengeBundleScheduleDefinition":
case "FortWeaponMeleeDualWieldItemDefinition":
case "FortDailyRewardScheduleTokenDefinition":
case "FortCreativeWeaponRangedItemDefinition":
case "FortVehicleCosmeticsItemDefinition_Body":
case "FortVehicleCosmeticsItemDefinition_Skin":
case "FortVehicleCosmeticsItemDefinition_Wheel":
case "FortCreativeRealEstatePlotItemDefinition":
case "FortVehicleCosmeticsItemDefinition_Booster":
case "AthenaDanceItemDefinition_AdHocSquadsJoin_C":
case "StWFortAccoladeItemDefinition":
case "FortSmartBuildingItemDefinition":
case "FortVehicleCosmeticsItemDefinition_DriftSmoke":
case "FortVehicleCosmeticsItemDefinition_EngineAudio":
creator = _style switch
{
EIconStyle.Cataba => new BaseCommunity(_object, _style, "Cataba"),
Expand All @@ -134,7 +152,7 @@ public bool TryConstructCreator(out UCreator creator)
return true;
case "MaterialInstanceConstant"
when _object.Owner != null &&
(_object.Owner.Name.EndsWith($"/MI_OfferImages/{_object.Name}", StringComparison.OrdinalIgnoreCase) ||
(_object.Owner.Name.Contains("/MI_OfferImages/", StringComparison.OrdinalIgnoreCase) ||
_object.Owner.Name.EndsWith($"/RenderSwitch_Materials/{_object.Name}", StringComparison.OrdinalIgnoreCase) ||
_object.Owner.Name.EndsWith($"/MI_BPTile/{_object.Name}", StringComparison.OrdinalIgnoreCase)):
creator = new BaseMaterialInstance(_object, _style);
Expand Down
1 change: 0 additions & 1 deletion FModel/FModel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@
<PackageReference Include="K4os.Compression.LZ4.Streams" Version="1.3.6" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NVorbis" Version="0.10.5" />
<PackageReference Include="Oodle.NET" Version="1.0.1" />
<PackageReference Include="Ookii.Dialogs.Wpf" Version="5.0.1" />
<PackageReference Include="OpenTK" Version="4.8.1" />
<PackageReference Include="RestSharp" Version="110.2.0" />
Expand Down
3 changes: 1 addition & 2 deletions FModel/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,8 @@ await Task.WhenAll(
_applicationView.CUE4Parse.VerifyConsoleVariables(),
_applicationView.CUE4Parse.VerifyOnDemandArchives(),
_applicationView.CUE4Parse.InitMappings(),
_applicationView.InitImGuiSettings(newOrUpdated),
_applicationView.InitVgmStream(),
_applicationView.InitOodle(),
_applicationView.InitImGuiSettings(newOrUpdated),
Task.Run(() =>
{
if (UserSettings.Default.DiscordRpc == EDiscordRpc.Always)
Expand Down
31 changes: 0 additions & 31 deletions FModel/ViewModels/ApplicationViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using FModel.Views;
using FModel.Views.Resources.Controls;
using Ionic.Zip;
using Oodle.NET;
using System;
using System.Diagnostics;
using System.IO;
Expand All @@ -15,7 +14,6 @@
using MessageBox = AdonisUI.Controls.MessageBox;
using MessageBoxButton = AdonisUI.Controls.MessageBoxButton;
using MessageBoxImage = AdonisUI.Controls.MessageBoxImage;
using OodleCUE4 = CUE4Parse.Compression.Oodle;

namespace FModel.ViewModels;

Expand Down Expand Up @@ -56,7 +54,6 @@ public FStatus Status
public SettingsViewModel SettingsView { get; }
public AesManagerViewModel AesManager { get; }
public AudioPlayerViewModel AudioPlayer { get; }
private OodleCompressor _oodle;

public ApplicationViewModel()
{
Expand Down Expand Up @@ -181,34 +178,6 @@ public async Task InitVgmStream()
}
}

public async Task InitOodle()
{
var dataDir = Directory.CreateDirectory(Path.Combine(UserSettings.Default.OutputDirectory, ".data"));
var oodlePath = Path.Combine(dataDir.FullName, OodleCUE4.OODLE_DLL_NAME);

if (File.Exists(OodleCUE4.OODLE_DLL_NAME))
{
File.Move(OodleCUE4.OODLE_DLL_NAME, oodlePath, true);
}
else if (!File.Exists(oodlePath))
{
var result = await OodleCUE4.DownloadOodleDll(oodlePath);
if (!result) return;
}

if (File.Exists("oo2core_8_win64.dll"))
File.Delete("oo2core_8_win64.dll");

_oodle = new OodleCompressor(oodlePath);

unsafe
{
OodleCUE4.DecompressFunc = (bufferPtr, bufferSize, outputPtr, outputSize, a, b, c, d, e, f, g, h, i, threadModule) =>
_oodle.Decompress(new IntPtr(bufferPtr), bufferSize, new IntPtr(outputPtr), outputSize,
(OodleLZ_FuzzSafe) a, (OodleLZ_CheckCRC) b, (OodleLZ_Verbosity) c, d, e, f, g, h, i, (OodleLZ_Decode_ThreadPhase) threadModule);
}
}

public async Task InitImGuiSettings(bool forceDownload)
{
var imgui = Path.Combine(/*UserSettings.Default.OutputDirectory, ".data", */"imgui.ini");
Expand Down
5 changes: 3 additions & 2 deletions FModel/ViewModels/CUE4ParseViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,8 @@ public Task VerifyOnDemandArchives()
{
ChunkBaseUri = new Uri("https://download.epicgames.com/ias/fortnite/", UriKind.Absolute),
ChunkCacheDirectory = Directory.CreateDirectory(Path.Combine(UserSettings.Default.OutputDirectory, ".data")),
Authorization = new AuthenticationHeaderValue("Bearer", UserSettings.Default.LastAuthResponse.AccessToken)
Authorization = new AuthenticationHeaderValue("Bearer", UserSettings.Default.LastAuthResponse.AccessToken),
Timeout = TimeSpan.FromSeconds(15)
});
var onDemandCount = await Provider.MountAsync();
FLogger.Append(ELog.Information, () =>
Expand Down Expand Up @@ -849,7 +850,7 @@ public void ExtractAndScroll(CancellationToken cancellationToken, string fullPat
case USkeleton when isNone && UserSettings.Default.SaveSkeletonAsMesh:
case UMaterialInstance when isNone && UserSettings.Default.PreviewMaterials && !ModelIsOverwritingMaterial &&
!(Provider.InternalGameName.Equals("FortniteGame", StringComparison.OrdinalIgnoreCase) && export.Owner != null &&
(export.Owner.Name.EndsWith($"/MI_OfferImages/{export.Name}", StringComparison.OrdinalIgnoreCase) ||
(export.Owner.Name.Contains("/MI_OfferImages/", StringComparison.OrdinalIgnoreCase) ||
export.Owner.Name.EndsWith($"/RenderSwitch_Materials/{export.Name}", StringComparison.OrdinalIgnoreCase) ||
export.Owner.Name.EndsWith($"/MI_BPTile/{export.Name}", StringComparison.OrdinalIgnoreCase))):
{
Expand Down
1 change: 0 additions & 1 deletion FModel/Views/Snooper/Models/Section.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public Section(int index, int facesCount, int firstFaceIndex)
FirstFaceIndex = firstFaceIndex;
FirstFaceIndexPtr = new IntPtr(FirstFaceIndex * sizeof(uint));
Color = Constants.COLOR_PALETTE[MaterialIndex % Constants.PALETTE_LENGTH];
Show = true;
}

public void SetupMaterial(Material material)
Expand Down

0 comments on commit 3721d7c

Please sign in to comment.