Skip to content

Commit

Permalink
Merge pull request #401 from 4sval/feature/settingsv2
Browse files Browse the repository at this point in the history
feature/settingsv2
  • Loading branch information
4sval authored Jun 22, 2023
2 parents 3435897 + 1829660 commit b337ab7
Show file tree
Hide file tree
Showing 36 changed files with 567 additions and 1,058 deletions.
2 changes: 1 addition & 1 deletion CUE4Parse
Submodule CUE4Parse updated 30 files
+1 −1 CUE4Parse-Conversion/CUE4Parse-Conversion.csproj
+1 −1 CUE4Parse.Example/Program.cs
+1 −1 CUE4Parse/CUE4Parse.csproj
+11 −11 CUE4Parse/FileProvider/AbstractFileProvider.cs
+1 −1 CUE4Parse/FileProvider/IFileProvider.cs
+1 −1 CUE4Parse/FileProvider/Vfs/AbstractVfsFileProvider.cs
+5 −0 CUE4Parse/GameTypes/FN/Assets/Exports/ULevelSaveRecord.cs
+11 −12 CUE4Parse/UE4/Assets/Exports/SkeletalMesh/FClothLODDataCommon.cs
+10 −8 CUE4Parse/UE4/Assets/Exports/SkeletalMesh/FClothTetherData.cs
+7 −8 CUE4Parse/UE4/Assets/Exports/SkeletalMesh/FClothingSectionData.cs
+16 −17 CUE4Parse/UE4/Assets/Exports/SkeletalMesh/FGPUVertFloat.cs
+16 −17 CUE4Parse/UE4/Assets/Exports/SkeletalMesh/FGPUVertHalf.cs
+14 −15 CUE4Parse/UE4/Assets/Exports/SkeletalMesh/FSkeletalMeshVertexClothBuffer.cs
+0 −2 CUE4Parse/UE4/Assets/Exports/SkeletalMesh/FStaticLODModel.cs
+12 −8 CUE4Parse/UE4/Assets/Exports/SkeletalMesh/USkeletalMesh.cs
+0 −1 CUE4Parse/UE4/Assets/Exports/StaticMesh/FStaticMeshRenderData.cs
+2 −2 CUE4Parse/UE4/Assets/Exports/StaticMesh/FStaticMeshSection.cs
+4 −5 CUE4Parse/UE4/Assets/Exports/StaticMesh/UStaticMesh.cs
+1 −1 CUE4Parse/UE4/Assets/IoPackage.cs
+18 −3 CUE4Parse/UE4/Assets/Objects/FByteBulkDataHeader.cs
+13 −2 CUE4Parse/UE4/Assets/Package.cs
+1 −1 CUE4Parse/UE4/IO/Objects/FZenPackageSummary.cs
+2 −2 CUE4Parse/UE4/Objects/Core/Math/FPlane.cs
+3 −3 CUE4Parse/UE4/Objects/NavigationSystem/UNavCollision.cs
+1 −1 CUE4Parse/UE4/Objects/UObject/FName.cs
+1 −1 CUE4Parse/UE4/Objects/UObject/FNameEntrySerialized.cs
+45 −0 CUE4Parse/UE4/Objects/UObject/FObjectDataResource.cs
+2 −1 CUE4Parse/UE4/Versions/EGame.cs
+247 −240 CUE4Parse/UE4/Versions/FUE5MainStreamObjectVersion.cs
+16 −15 CUE4Parse/UE4/Versions/VersionContainer.cs
13 changes: 13 additions & 0 deletions FModel/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ protected override void OnStartup(StartupEventArgs e)
{
UserSettings.Default = JsonConvert.DeserializeObject<UserSettings>(
File.ReadAllText(UserSettings.FilePath), JsonNetSerializer.SerializerSettings);

/*if (UserSettings.Default.ShowChangelog) */MigrateV1Games();
}
catch
{
Expand Down Expand Up @@ -141,6 +143,17 @@ private void OnUnhandledException(object sender, DispatcherUnhandledExceptionEve
e.Handled = true;
}

private void MigrateV1Games()
{
foreach ((var gameDir, var setting) in UserSettings.Default.ManualGames)
{
if (!Directory.Exists(gameDir)) continue;
UserSettings.Default.PerDirectory[gameDir] =
DirectorySettings.Default(setting.GameName, setting.GameDirectory, true, setting.OverridedGame, setting.AesKeys?.MainKey);
}
UserSettings.Default.ManualGames.Clear();
}

private string GetOperatingSystemProductName()
{
var productName = string.Empty;
Expand Down
63 changes: 0 additions & 63 deletions FModel/Creator/CreatorPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,69 +203,6 @@ public bool TryConstructCreator(out UCreator creator)
case "QuestData":
creator = new Bases.MV.BaseQuest(_object, _style);
return true;
// Battle Breakers
case "WExpGenericAccountItemDefinition":
case "WExpGearAccountItemDefinition":
case "WExpHQWorkerLodgesDefinition":
case "WExpPersonalEventDefinition":
case "WExpUpgradePotionDefinition":
case "WExpAccountRewardDefinition":
case "WExpHQBlacksmithDefinition":
case "WExpHQSecretShopDefinition":
case "WExpHQMonsterPitDefinition":
case "WExpHQHeroTowerDefinition":
case "WExpVoucherItemDefinition":
case "WExpTreasureMapDefinition":
case "WExpHammerChestDefinition":
case "WExpHQWorkshopDefinition":
case "WExpUnlockableDefinition":
case "WExpHQSmelterDefinition":
case "WExpContainerDefinition":
case "WExpCharacterDefinition":
case "WExpHQMarketDefinition":
case "WExpGiftboxDefinition":
case "WExpStandInDefinition":
case "WExpRegionDefinition":
case "WExpHQMineDefinition":
case "WExpXpBookDefinition":
case "WExpTokenDefinition":
case "WExpItemDefinition":
case "WExpZoneDefinition":
creator = new BaseBreakersIcon(_object, EIconStyle.Default);
return true;
// Spellbreak
case "GTargetedTeleportActiveSkill":
case "GChronomasterV2ActiveSkill":
case "GShadowstepActiveSkill":
case "GGatewayActiveSkill":
case "GStealthActiveSkill":
case "GFeatherActiveSkill":
case "GCosmeticDropTrail":
case "GFlightActiveSkill":
case "GCosmeticRunTrail":
case "GCosmeticArtifact":
case "GCosmeticTriumph":
case "GWolfsbloodSkill":
case "GDashActiveSkill":
case "GCharacterPerk":
case "GCosmeticTitle":
case "GCosmeticBadge":
case "GRMTStoreOffer":
case "GCosmeticEmote":
case "GCosmeticCard":
case "GCosmeticSkin":
case "GStoreOffer":
case "GAccolade":
case "GRuneItem":
case "GQuest":
creator = new BaseSpellIcon(_object, EIconStyle.Default);
return true;
case "GLeagueTier":
creator = new BaseLeague(_object, EIconStyle.Default);
return true;
case "GLeagueDivision":
creator = new BaseDivision(_object, EIconStyle.Default);
return true;
default:
creator = null;
return false;
Expand Down
52 changes: 3 additions & 49 deletions FModel/Creator/Typefaces.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,6 @@ public class Typefaces
private const string _XIANGHEHEI_SC_PRO_BLACK = "XiangHeHei_SC/MXiangHeHeiSCPro-Black";
private const string _XIANGHEHEI_SC_PRO_HEAVY = "XiangHeHei_SC/MXiangHeHeiSCPro-Heavy";

// Spellbreak
private const string _SPELLBREAK_BASE_PATH = "/Game/UI/Fonts/";
private const string _MONTSERRAT_SEMIBOLD = "Montserrat-Semibold";
private const string _MONTSERRAT_SEMIBOLD_ITALIC = "Montserrat-SemiBoldItalic";
private const string _NANUM_GOTHIC = "NanumGothic";
private const string _QUADRAT_BOLD = "Quadrat_Bold";
private const string _SEGOE_BOLD_ITALIC = "Segoe_Bold_Italic";

// WorldExplorers
private const string _BATTLE_BREAKERS_BASE_PATH = "/Game/UMG/Fonts/Faces/";
private const string _HEMIHEAD426 = "HemiHead426";
private const string _NOTO_SANS_JP_REGULAR = "NotoSansJP-Regular";
private const string _LATO_BLACK = "Lato-Black";
private const string _LATO_BLACK_ITALIC = "Lato-BlackItalic";
private const string _LATO_LIGHT = "Lato-Light";
private const string _LATO_MEDIUM = "Lato-Medium";

private readonly CUE4ParseViewModel _viewModel;

public readonly SKTypeface Default; // used as a fallback font for all untranslated strings (item source, ...)
Expand All @@ -85,9 +68,9 @@ public Typefaces(CUE4ParseViewModel viewModel)

Default = SKTypeface.FromStream(Application.GetResourceStream(_BURBANK_BIG_CONDENSED_BOLD)?.Stream);

switch (viewModel.Game)
switch (viewModel.Provider.InternalGameName.ToUpperInvariant())
{
case FGame.FortniteGame:
case "FORTNITEGAME":
{
DisplayName = OnTheFly(_FORTNITE_BASE_PATH +
language switch
Expand Down Expand Up @@ -172,36 +155,7 @@ public Typefaces(CUE4ParseViewModel viewModel)
} + _EXT);
break;
}
case FGame.WorldExplorers:
{
DisplayName = OnTheFly(_BATTLE_BREAKERS_BASE_PATH +
language switch
{
ELanguage.Korean => _NOTO_SANS_KR_REGULAR,
ELanguage.Russian => _LATO_BLACK,
ELanguage.Japanese => _NOTO_SANS_JP_REGULAR,
ELanguage.Chinese => _NOTO_SANS_SC_REGULAR,
_ => _HEMIHEAD426
} + _EXT);

Description = OnTheFly(_BATTLE_BREAKERS_BASE_PATH +
language switch
{
ELanguage.Korean => _NOTO_SANS_KR_REGULAR,
ELanguage.Russian => _LATO_BLACK,
ELanguage.Japanese => _NOTO_SANS_JP_REGULAR,
ELanguage.Chinese => _NOTO_SANS_SC_REGULAR,
_ => _HEMIHEAD426
} + _EXT);
break;
}
case FGame.g3:
{
DisplayName = OnTheFly(_SPELLBREAK_BASE_PATH + _QUADRAT_BOLD + _EXT);
Description = OnTheFly(_SPELLBREAK_BASE_PATH + _MONTSERRAT_SEMIBOLD + _EXT);
break;
}
case FGame.MultiVersus:
case "MULTIVERSUS":
{
DisplayName = OnTheFly(_PANDAGAME_BASE_PATH + language switch
{
Expand Down
2 changes: 1 addition & 1 deletion FModel/Creator/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public static SKBitmap GetBitmap(UMaterialInstanceConstant material)
public static SKBitmap GetB64Bitmap(string b64) => SKBitmap.Decode(new MemoryStream(Convert.FromBase64String(b64)) { Position = 0 });
public static SKBitmap GetBitmap(FSoftObjectPath softObjectPath) => GetBitmap(softObjectPath.AssetPathName.Text);
public static SKBitmap GetBitmap(string fullPath) => TryLoadObject(fullPath, out UTexture2D texture) ? GetBitmap(texture) : null;
public static SKBitmap GetBitmap(UTexture2D texture) => texture.IsVirtual ? null : texture.Decode(UserSettings.Default.OverridedPlatform);
public static SKBitmap GetBitmap(UTexture2D texture) => texture.IsVirtual ? null : texture.Decode(UserSettings.Default.CurrentDir.TexturePlatform);
public static SKBitmap GetBitmap(byte[] data) => SKBitmap.Decode(data);

public static SKBitmap ResizeWithRatio(this SKBitmap me, double width, double height)
Expand Down
50 changes: 0 additions & 50 deletions FModel/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,56 +52,6 @@ public enum EDiscordRpc
Never
}

public enum FGame
{
[Description("Unknown")]
Unknown,
[Description("Fortnite")]
FortniteGame,
[Description("Valorant")]
ShooterGame,
[Description("Dead By Daylight")]
DeadByDaylight,
[Description("Borderlands 3")]
OakGame,
[Description("Minecraft Dungeons")]
Dungeons,
[Description("Battle Breakers")]
WorldExplorers,
[Description("Spellbreak")]
g3,
[Description("State Of Decay 2")]
StateOfDecay2,
[Description("The Cycle")]
Prospect,
[Description("The Outer Worlds")]
Indiana,
[Description("Rogue Company")]
RogueCompany,
[Description("Star Wars: Jedi Fallen Order")]
SwGame,
[Description("Core")]
Platform,
[Description("Days Gone")]
BendGame,
[Description("PLAYERUNKNOWN'S BATTLEGROUNDS")]
TslGame,
[Description("Splitgate")]
PortalWars,
[Description("GTA: The Trilogy - Definitive Edition")]
Gameface,
[Description("Sea of Thieves")]
Athena,
[Description("DEPRECATED")]
PandaGame,
[Description("MultiVersus")]
MultiVersus,
[Description("Tower of Fantasy")]
Hotta,
[Description("eFootball 2023")]
eFootball
}

public enum ELoadingMode
{
[Description("Single")]
Expand Down
6 changes: 3 additions & 3 deletions FModel/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
</Viewbox>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Directories" ItemsSource="{Binding CustomDirectories.Directories}" IsEnabled="{Binding Status.IsReady}">
<MenuItem Header="Favorite Directories" ItemsSource="{Binding CustomDirectories.Directories}" IsEnabled="{Binding Status.IsReady}">
<MenuItem.Icon>
<Viewbox Width="16" Height="16">
<Canvas Width="24" Height="24">
Expand Down Expand Up @@ -138,7 +138,7 @@
<Style TargetType="MenuItem" BasedOn="{StaticResource {x:Type MenuItem}}">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding CUE4Parse.Game}" Value="{x:Static local:FGame.FortniteGame}">
<DataTrigger Binding="{Binding CUE4Parse.InternalGameName, Converter={x:Static converters:CaseInsensitiveStringEqualsConverter.Instance}, ConverterParameter='FortniteGame'}" Value="True">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
</Style.Triggers>
Expand Down Expand Up @@ -396,7 +396,7 @@
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Header="Save Directory" Click="OnSaveDirectoryClick">
<MenuItem Header="Favorite Directory" Click="OnFavoriteDirectoryClick">
<MenuItem.Icon>
<Viewbox Width="16" Height="16">
<Canvas Width="24" Height="24">
Expand Down
9 changes: 4 additions & 5 deletions FModel/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public MainWindow()

private void OnClosing(object sender, CancelEventArgs e)
{
_applicationView.CustomDirectories.Save();
_discordHandler.Dispose();
}

Expand All @@ -56,8 +55,8 @@ private async void OnLoaded(object sender, RoutedEventArgs e)
case EAesReload.Always:
await _applicationView.CUE4Parse.RefreshAes();
break;
case EAesReload.OncePerDay when UserSettings.Default.LastAesReload != DateTime.Today:
UserSettings.Default.LastAesReload = DateTime.Today;
case EAesReload.OncePerDay when UserSettings.Default.CurrentDir.LastAesReload != DateTime.Today:
UserSettings.Default.CurrentDir.LastAesReload = DateTime.Today;
await _applicationView.CUE4Parse.RefreshAes();
break;
}
Expand Down Expand Up @@ -228,13 +227,13 @@ private async void OnFolderAnimationClick(object sender, RoutedEventArgs e)
}
}

private void OnSaveDirectoryClick(object sender, RoutedEventArgs e)
private void OnFavoriteDirectoryClick(object sender, RoutedEventArgs e)
{
if (AssetsFolderName.SelectedItem is not TreeItem folder) return;

_applicationView.CustomDirectories.Add(new CustomDirectory(folder.Header, folder.PathAtThisPoint));
FLogger.Append(ELog.Information, () =>
FLogger.Text($"Successfully saved '{folder.PathAtThisPoint}' as a new custom directory", Constants.WHITE, true));
FLogger.Text($"Successfully saved '{folder.PathAtThisPoint}' as a new favorite directory", Constants.WHITE, true));
}

private void OnCopyDirectoryPathClick(object sender, RoutedEventArgs e)
Expand Down
2 changes: 1 addition & 1 deletion FModel/Services/DiscordService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void Initialize(string gameName)

public void UpdatePresence(CUE4ParseViewModel viewModel) =>
UpdatePresence(
$"{viewModel.Provider.GameDisplayName ?? viewModel.Provider.GameName} - {viewModel.Provider.MountedVfs.Count}/{viewModel.Provider.MountedVfs.Count + viewModel.Provider.UnloadedVfs.Count} Packages",
$"{viewModel.Provider.GameDisplayName ?? viewModel.Provider.InternalGameName} - {viewModel.Provider.MountedVfs.Count}/{viewModel.Provider.MountedVfs.Count + viewModel.Provider.UnloadedVfs.Count} Packages",
$"Mode: {UserSettings.Default.LoadingMode.GetDescription()} - {viewModel.SearchVm.ResultsCount:### ### ###} Loaded Assets".Trim());

public void UpdatePresence(string details, string state)
Expand Down
65 changes: 65 additions & 0 deletions FModel/Settings/CustomDirectory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
using System.Collections.Generic;
using FModel.Framework;

namespace FModel.Settings;

public class CustomDirectory : ViewModel
{
public static IList<CustomDirectory> Default(string gameName)
{
switch (gameName)
{
case "Fortnite":
case "Fortnite [LIVE]":
return new List<CustomDirectory>
{
new("Cosmetics", "FortniteGame/Content/Athena/Items/Cosmetics/"),
new("Emotes [AUDIO]", "FortniteGame/Content/Athena/Sounds/Emotes/"),
new("Music Packs [AUDIO]", "FortniteGame/Content/Athena/Sounds/MusicPacks/"),
new("Weapons", "FortniteGame/Content/Athena/Items/Weapons/"),
new("Strings", "FortniteGame/Content/Localization/")
};
case "VALORANT":
case "VALORANT [LIVE]":
return new List<CustomDirectory>
{
new("Audio", "ShooterGame/Content/WwiseAudio/Media/"),
new("Characters", "ShooterGame/Content/Characters/"),
new("Gun Buddies", "ShooterGame/Content/Equippables/Buddies/"),
new("Cards and Sprays", "ShooterGame/Content/Personalization/"),
new("Shop Backgrounds", "ShooterGame/Content/UI/OutOfGame/MainMenu/Store/Shared/Textures/"),
new("Weapon Renders", "ShooterGame/Content/UI/Screens/OutOfGame/MainMenu/Collection/Assets/Large/")
};
default:
return new List<CustomDirectory>();
}
}

private string _header;
public string Header
{
get => _header;
set => SetProperty(ref _header, value);
}

private string _directoryPath;
public string DirectoryPath
{
get => _directoryPath;
set => SetProperty(ref _directoryPath, value);
}

public CustomDirectory()
{
Header = string.Empty;
DirectoryPath = string.Empty;
}

public CustomDirectory(string header, string path)
{
Header = header;
DirectoryPath = path;
}

public override string ToString() => Header;
}
Loading

0 comments on commit b337ab7

Please sign in to comment.