diff --git a/FModel/Settings/UserSettings.cs b/FModel/Settings/UserSettings.cs index 8afcac2d..1ca12fca 100644 --- a/FModel/Settings/UserSettings.cs +++ b/FModel/Settings/UserSettings.cs @@ -361,12 +361,44 @@ namespace FModel.Settings {FGame.Hotta, null}, {FGame.eFootball, null} }; + + private IDictionary>> _overridedMapStructTypes = new Dictionary>> + { + {FGame.Unknown, null}, + {FGame.FortniteGame, null}, + {FGame.ShooterGame, null}, + {FGame.DeadByDaylight, null}, + {FGame.OakGame, null}, + {FGame.Dungeons, null}, + {FGame.WorldExplorers, null}, + {FGame.g3, null}, + {FGame.StateOfDecay2, null}, + {FGame.Prospect, null}, + {FGame.Indiana, null}, + {FGame.RogueCompany, null}, + {FGame.SwGame, null}, + {FGame.Platform, null}, + {FGame.BendGame, null}, + {FGame.TslGame, null}, + {FGame.PortalWars, null}, + {FGame.Gameface, null}, + {FGame.Athena, null}, + {FGame.PandaGame, null}, + {FGame.Hotta, null}, + {FGame.eFootball, null} + }; public IDictionary> OverridedOptions { get => _overridedOptions; set => SetProperty(ref _overridedOptions, value); } + public IDictionary>> OverridedMapStructTypes + { + get => _overridedMapStructTypes; + set => SetProperty(ref _overridedMapStructTypes, value); + } + private IDictionary _customEndpoints = new Dictionary { {FGame.Unknown, new FEndpoint[]{new (), new ()}}, diff --git a/FModel/ViewModels/ApiEndpoints/Models/FModelResponse.cs b/FModel/ViewModels/ApiEndpoints/Models/FModelResponse.cs index 4ba2f926..0239c24c 100644 --- a/FModel/ViewModels/ApiEndpoints/Models/FModelResponse.cs +++ b/FModel/ViewModels/ApiEndpoints/Models/FModelResponse.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Diagnostics; using CUE4Parse.UE4.Versions; using FModel.Creator; @@ -39,6 +39,7 @@ public class Version [J] public int UeVer { get; private set; } [J] public Dictionary CustomVersions { get; private set; } [J] public Dictionary Options { get; private set; } + [J] public Dictionary> MapStructTypes { get; private set; } } [DebuggerDisplay("{" + nameof(Mode) + "}")] @@ -195,4 +196,4 @@ public class CommunityDesign }; } } -} \ No newline at end of file +} diff --git a/FModel/ViewModels/CUE4ParseViewModel.cs b/FModel/ViewModels/CUE4ParseViewModel.cs index 79a6e69c..5a732c38 100644 --- a/FModel/ViewModels/CUE4ParseViewModel.cs +++ b/FModel/ViewModels/CUE4ParseViewModel.cs @@ -146,7 +146,8 @@ public class CUE4ParseViewModel : ViewModel Game = Helper.IAmThePanda(parent) ? FGame.PandaGame : parent.ToEnum(FGame.Unknown); var versions = new VersionContainer(UserSettings.Default.OverridedGame[Game], UserSettings.Default.OverridedPlatform, customVersions: UserSettings.Default.OverridedCustomVersions[Game], - optionOverrides: UserSettings.Default.OverridedOptions[Game]); + optionOverrides: UserSettings.Default.OverridedOptions[Game], + mapStructTypesOverrides: UserSettings.Default.OverridedMapStructTypes[Game]); switch (Game) { @@ -178,7 +179,8 @@ public class CUE4ParseViewModel : ViewModel { versions = new VersionContainer(settings.OverridedGame, UserSettings.Default.OverridedPlatform, customVersions: settings.OverridedCustomVersions, - optionOverrides: settings.OverridedOptions); + optionOverrides: settings.OverridedOptions, + mapStructTypesOverrides: settings.OverridedMapStructTypes); goto default; } default: diff --git a/FModel/ViewModels/GameSelectorViewModel.cs b/FModel/ViewModels/GameSelectorViewModel.cs index 52277677..35bcb99e 100644 --- a/FModel/ViewModels/GameSelectorViewModel.cs +++ b/FModel/ViewModels/GameSelectorViewModel.cs @@ -29,6 +29,7 @@ public class GameSelectorViewModel : ViewModel public EGame OverridedGame { get; set; } public List OverridedCustomVersions { get; set; } public Dictionary OverridedOptions { get; set; } + public Dictionary> OverridedMapStructTypes { get; set; } public IList CustomDirectories { get; set; } } @@ -74,6 +75,7 @@ public class GameSelectorViewModel : ViewModel OverridedGame = EGame.GAME_UE4_LATEST, OverridedCustomVersions = null, OverridedOptions = null, + OverridedMapStructTypes = null, CustomDirectories = new List() }; diff --git a/FModel/ViewModels/SettingsViewModel.cs b/FModel/ViewModels/SettingsViewModel.cs index c1dfbc6c..e74a96fb 100644 --- a/FModel/ViewModels/SettingsViewModel.cs +++ b/FModel/ViewModels/SettingsViewModel.cs @@ -76,6 +76,13 @@ public class SettingsViewModel : ViewModel set => SetProperty(ref _selectedOptions, value); } + private Dictionary> _selectedMapStructTypes; + public Dictionary> SelectedMapStructTypes + { + get => _selectedMapStructTypes; + set => SetProperty(ref _selectedMapStructTypes, value); + } + private FEndpoint _aesEndpoint; public FEndpoint AesEndpoint { @@ -192,6 +199,7 @@ public class SettingsViewModel : ViewModel private EGame _ueGameSnapshot; private List _customVersionsSnapshot; private Dictionary _optionsSnapshot; + private Dictionary> _mapStructTypesSnapshot; private ELanguage _assetLanguageSnapshot; private ECompressedAudio _compressedAudioSnapshot; private EIconStyle _cosmeticStyleSnapshot; @@ -225,12 +233,14 @@ public class SettingsViewModel : ViewModel _ueGameSnapshot = settings.OverridedGame; _customVersionsSnapshot = settings.OverridedCustomVersions; _optionsSnapshot = settings.OverridedOptions; + _mapStructTypesSnapshot = settings.OverridedMapStructTypes; } else { _ueGameSnapshot = UserSettings.Default.OverridedGame[_game]; _customVersionsSnapshot = UserSettings.Default.OverridedCustomVersions[_game]; _optionsSnapshot = UserSettings.Default.OverridedOptions[_game]; + _mapStructTypesSnapshot = UserSettings.Default.OverridedMapStructTypes[_game]; } if (UserSettings.Default.CustomEndpoints.TryGetValue(_game, out var endpoints)) @@ -259,6 +269,7 @@ public class SettingsViewModel : ViewModel SelectedUeGame = _ueGameSnapshot; SelectedCustomVersions = _customVersionsSnapshot; SelectedOptions = _optionsSnapshot; + SelectedMapStructTypes = _mapStructTypesSnapshot; SelectedAssetLanguage = _assetLanguageSnapshot; SelectedCompressedAudio = _compressedAudioSnapshot; SelectedCosmeticStyle = _cosmeticStyleSnapshot; @@ -317,6 +328,12 @@ public class SettingsViewModel : ViewModel { SelectedOptions[k] = v; } + + SelectedMapStructTypes = new Dictionary>(); + foreach (var (k, v) in version.MapStructTypes) + { + SelectedMapStructTypes[k] = v; + } } public void ResetPreset() @@ -324,6 +341,7 @@ public class SettingsViewModel : ViewModel SelectedUeGame = _ueGameSnapshot; SelectedCustomVersions = _customVersionsSnapshot; SelectedOptions = _optionsSnapshot; + SelectedMapStructTypes = _mapStructTypesSnapshot; } public bool Save(out List whatShouldIDo) @@ -340,6 +358,7 @@ public class SettingsViewModel : ViewModel if (_ueGameSnapshot != SelectedUeGame || _customVersionsSnapshot != SelectedCustomVersions || _uePlatformSnapshot != SelectedUePlatform || _optionsSnapshot != SelectedOptions || // combobox + _mapStructTypesSnapshot != SelectedMapStructTypes || _outputSnapshot != UserSettings.Default.OutputDirectory || // textbox _rawDataSnapshot != UserSettings.Default.RawDataDirectory || // textbox _propertiesSnapshot != UserSettings.Default.PropertiesDirectory || // textbox @@ -357,12 +376,14 @@ public class SettingsViewModel : ViewModel UserSettings.Default.ManualGames[UserSettings.Default.GameDirectory].OverridedGame = SelectedUeGame; UserSettings.Default.ManualGames[UserSettings.Default.GameDirectory].OverridedCustomVersions = SelectedCustomVersions; UserSettings.Default.ManualGames[UserSettings.Default.GameDirectory].OverridedOptions = SelectedOptions; + UserSettings.Default.ManualGames[UserSettings.Default.GameDirectory].OverridedMapStructTypes = SelectedMapStructTypes; } else { UserSettings.Default.OverridedGame[_game] = SelectedUeGame; UserSettings.Default.OverridedCustomVersions[_game] = SelectedCustomVersions; UserSettings.Default.OverridedOptions[_game] = SelectedOptions; + UserSettings.Default.OverridedMapStructTypes[_game] = SelectedMapStructTypes; } UserSettings.Default.AssetLanguage = SelectedAssetLanguage; diff --git a/FModel/Views/Resources/Controls/DictionaryEditor.xaml.cs b/FModel/Views/Resources/Controls/DictionaryEditor.xaml.cs index a69c23d4..15f78d0a 100644 --- a/FModel/Views/Resources/Controls/DictionaryEditor.xaml.cs +++ b/FModel/Views/Resources/Controls/DictionaryEditor.xaml.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Windows; @@ -16,15 +16,18 @@ public partial class DictionaryEditor private readonly bool _enableElements; private readonly List _defaultCustomVersions; private readonly Dictionary _defaultOptions; + private readonly Dictionary> _defaultMapStructTypes; public List CustomVersions { get; private set; } public Dictionary Options { get; private set; } + public Dictionary> MapStructTypes { get; private set; } public DictionaryEditor(string title, bool enableElements) { _enableElements = enableElements; _defaultCustomVersions = new List { new() { Key = new FGuid(), Version = 0 } }; _defaultOptions = new Dictionary { { "key1", true }, { "key2", false } }; + _defaultMapStructTypes = new Dictionary> { { "MapName", new KeyValuePair("KeyType", "ValueType") } }; InitializeComponent(); @@ -49,6 +52,14 @@ public partial class DictionaryEditor }; } + public DictionaryEditor(Dictionary> options, string title, bool enableElements) : this(title, enableElements) + { + MyAvalonEditor.Document = new TextDocument + { + Text = JsonConvert.SerializeObject(options ?? _defaultMapStructTypes, Formatting.Indented) + }; + } + private void OnClick(object sender, RoutedEventArgs e) { if (!_enableElements) @@ -74,6 +85,12 @@ public partial class DictionaryEditor DialogResult = true; Close(); break; + case "MapStructTypes": + MapStructTypes = JsonConvert.DeserializeObject>>(MyAvalonEditor.Document.Text); + // DialogResult = !Options.SequenceEqual(_defaultOptions); + DialogResult = true; + Close(); + break; default: throw new NotImplementedException(); } @@ -100,6 +117,10 @@ public partial class DictionaryEditor { Text = JsonConvert.SerializeObject(_defaultOptions, Formatting.Indented) }, + "MapStructTypes" => new TextDocument + { + Text = JsonConvert.SerializeObject(_defaultMapStructTypes, Formatting.Indented) + }, _ => throw new NotImplementedException() }; } diff --git a/FModel/Views/SettingsView.xaml b/FModel/Views/SettingsView.xaml index a3f3ab16..5142a14a 100644 --- a/FModel/Views/SettingsView.xaml +++ b/FModel/Views/SettingsView.xaml @@ -186,10 +186,13 @@ + +