and this is where problems begin

This commit is contained in:
4sval 2023-06-14 21:39:27 +02:00
parent a184a258ab
commit 011046aa22
20 changed files with 333 additions and 557 deletions

@ -1 +1 @@
Subproject commit eb9ad66c5b1be089ea2b92f33dd299b291e13de1
Subproject commit fb4e3d5f2fcae1b761dee4eed311a1b132ac5735

View File

@ -112,7 +112,7 @@ public static class Utils
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)

View File

@ -0,0 +1,90 @@
using System;
using System.Collections.Generic;
using CUE4Parse.UE4.Assets.Exports.Texture;
using CUE4Parse.UE4.Versions;
using FModel.Framework;
using FModel.ViewModels;
using FModel.ViewModels.ApiEndpoints.Models;
namespace FModel.Settings;
public class DirectorySettings : ViewModel
{
private string _gameName;
public string GameName
{
get => _gameName;
set => SetProperty(ref _gameName, value);
}
private string _gameDirectory;
public string GameDirectory
{
get => _gameDirectory;
set => SetProperty(ref _gameDirectory, value);
}
private bool _isManual;
public bool IsManual
{
get => _isManual;
set => SetProperty(ref _isManual, value);
}
private EGame _ueVersion = EGame.GAME_UE4_LATEST;
public EGame UeVersion
{
get => _ueVersion;
set => SetProperty(ref _ueVersion, value);
}
private ETexturePlatform _texturePlatform = ETexturePlatform.DesktopMobile;
public ETexturePlatform TexturePlatform
{
get => _texturePlatform;
set => SetProperty(ref _texturePlatform, value);
}
private AesResponse _aesKeys;
public AesResponse AesKeys
{
get => _aesKeys;
set => SetProperty(ref _aesKeys, value);
}
private VersioningSettings _versioning = new ();
public VersioningSettings Versioning
{
get => _versioning;
set => SetProperty(ref _versioning, value);
}
private FEndpoint[] _endpoints = { new (), new () };
public FEndpoint[] Endpoints
{
get => _endpoints;
set => SetProperty(ref _endpoints, value);
}
private IList<CustomDirectory> _directories = new List<CustomDirectory>();
public IList<CustomDirectory> Directories
{
get => _directories;
set => SetProperty(ref _directories, value);
}
private bool Equals(DirectorySettings other)
{
return GameDirectory == other.GameDirectory && UeVersion == other.UeVersion;
}
public override bool Equals(object obj)
{
return obj is DirectorySettings other && Equals(other);
}
public override int GetHashCode()
{
return HashCode.Combine(GameDirectory, (int) UeVersion);
}
}

View File

@ -33,6 +33,7 @@ namespace FModel.Settings
public static void Save()
{
Default.PerDirectory[Default.CurrentDir.GameDirectory] = Default.CurrentDir;
File.WriteAllText(FilePath, JsonConvert.SerializeObject(Default, Formatting.Indented));
}
@ -41,13 +42,9 @@ namespace FModel.Settings
if (File.Exists(FilePath)) File.Delete(FilePath);
}
public static bool IsEndpointValid(FGame game, EEndpointType type, out FEndpoint endpoint)
public static bool IsEndpointValid(EEndpointType type, out FEndpoint endpoint)
{
endpoint = null;
if (!Default.CustomEndpoints.TryGetValue(game, out var endpoints))
return false;
endpoint = endpoints[(int) type];
endpoint = Default.CurrentDir.Endpoints[(int) type];
return endpoint.Overwrite || endpoint.IsValid;
}
@ -100,7 +97,7 @@ namespace FModel.Settings
set => SetProperty(ref _modelDirectory, value);
}
private string _gameDirectory;
private string _gameDirectory = string.Empty;
public string GameDirectory
{
get => _gameDirectory;
@ -135,13 +132,6 @@ namespace FModel.Settings
set => SetProperty(ref _avalonImageSize, value);
}
private IDictionary<FGame, AesResponse> _aesKeys = new Dictionary<FGame, AesResponse>();
public IDictionary<FGame, AesResponse> AesKeys
{
get => _aesKeys;
set => SetProperty(ref _aesKeys, value);
}
private string _audioDeviceId;
public string AudioDeviceId
{
@ -233,6 +223,26 @@ namespace FModel.Settings
set => SetProperty(ref _readScriptData, value);
}
private IDictionary<string, DirectorySettings> _perDirectory = new Dictionary<string, DirectorySettings>();
public IDictionary<string, DirectorySettings> PerDirectory
{
get => _perDirectory;
set => SetProperty(ref _perDirectory, value);
}
public DirectorySettings CurrentDir { get; set; }
/// <summary>
/// TO DELETEEEEEEEEEEEEE
/// </summary>
private IDictionary<FGame, AesResponse> _aesKeys = new Dictionary<FGame, AesResponse>();
public IDictionary<FGame, AesResponse> AesKeys
{
get => _aesKeys;
set => SetProperty(ref _aesKeys, value);
}
// <gameDirectory as string, settings>
// can't refactor to use this data layout for everything
// because it will wipe old user settings that relies on FGame
@ -243,169 +253,6 @@ namespace FModel.Settings
set => SetProperty(ref _manualGames, value);
}
private ETexturePlatform _overridedPlatform = ETexturePlatform.DesktopMobile;
public ETexturePlatform OverridedPlatform
{
get => _overridedPlatform;
set => SetProperty(ref _overridedPlatform, value);
}
private IDictionary<FGame, string> _presets = new Dictionary<FGame, string>
{
{FGame.Unknown, Constants._NO_PRESET_TRIGGER},
{FGame.FortniteGame, Constants._NO_PRESET_TRIGGER},
{FGame.ShooterGame, Constants._NO_PRESET_TRIGGER},
{FGame.DeadByDaylight, Constants._NO_PRESET_TRIGGER},
{FGame.OakGame, Constants._NO_PRESET_TRIGGER},
{FGame.Dungeons, Constants._NO_PRESET_TRIGGER},
{FGame.WorldExplorers, Constants._NO_PRESET_TRIGGER},
{FGame.g3, Constants._NO_PRESET_TRIGGER},
{FGame.StateOfDecay2, Constants._NO_PRESET_TRIGGER},
{FGame.Prospect, Constants._NO_PRESET_TRIGGER},
{FGame.Indiana, Constants._NO_PRESET_TRIGGER},
{FGame.RogueCompany, Constants._NO_PRESET_TRIGGER},
{FGame.SwGame, Constants._NO_PRESET_TRIGGER},
{FGame.Platform, Constants._NO_PRESET_TRIGGER},
{FGame.BendGame, Constants._NO_PRESET_TRIGGER},
{FGame.TslGame, Constants._NO_PRESET_TRIGGER},
{FGame.PortalWars, Constants._NO_PRESET_TRIGGER},
{FGame.Gameface, Constants._NO_PRESET_TRIGGER},
{FGame.Athena, Constants._NO_PRESET_TRIGGER},
{FGame.MultiVersus, Constants._NO_PRESET_TRIGGER},
{FGame.Hotta, Constants._NO_PRESET_TRIGGER},
{FGame.eFootball, Constants._NO_PRESET_TRIGGER}
};
public IDictionary<FGame, string> Presets
{
get => _presets;
set => SetProperty(ref _presets, value);
}
private IDictionary<FGame, EGame> _overridedGame = new Dictionary<FGame, EGame>
{
{FGame.Unknown, EGame.GAME_UE4_LATEST},
{FGame.FortniteGame, EGame.GAME_UE5_2},
{FGame.ShooterGame, EGame.GAME_Valorant},
{FGame.DeadByDaylight, EGame.GAME_UE4_27},
{FGame.OakGame, EGame.GAME_Borderlands3},
{FGame.Dungeons, EGame.GAME_UE4_22},
{FGame.WorldExplorers, EGame.GAME_UE4_24},
{FGame.g3, EGame.GAME_UE4_22},
{FGame.StateOfDecay2, EGame.GAME_StateOfDecay2},
{FGame.Prospect, EGame.GAME_Splitgate},
{FGame.Indiana, EGame.GAME_UE4_21},
{FGame.RogueCompany, EGame.GAME_RogueCompany},
{FGame.SwGame, EGame.GAME_UE4_LATEST},
{FGame.Platform, EGame.GAME_UE4_26},
{FGame.BendGame, EGame.GAME_UE4_11},
{FGame.TslGame, EGame.GAME_PlayerUnknownsBattlegrounds},
{FGame.PortalWars, EGame.GAME_UE4_27},
{FGame.Gameface, EGame.GAME_GTATheTrilogyDefinitiveEdition},
{FGame.Athena, EGame.GAME_SeaOfThieves},
{FGame.MultiVersus, EGame.GAME_UE4_26},
{FGame.Hotta, EGame.GAME_TowerOfFantasy},
{FGame.eFootball, EGame.GAME_UE4_26}
};
public IDictionary<FGame, EGame> OverridedGame
{
get => _overridedGame;
set => SetProperty(ref _overridedGame, value);
}
private IDictionary<FGame, List<FCustomVersion>> _overridedCustomVersions = new Dictionary<FGame, List<FCustomVersion>>
{
{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.MultiVersus, null},
{FGame.Hotta, null},
{FGame.eFootball, null}
};
public IDictionary<FGame, List<FCustomVersion>> OverridedCustomVersions
{
get => _overridedCustomVersions;
set => SetProperty(ref _overridedCustomVersions, value);
}
private IDictionary<FGame, Dictionary<string, bool>> _overridedOptions = new Dictionary<FGame, Dictionary<string, bool>>
{
{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.MultiVersus, null},
{FGame.Hotta, null},
{FGame.eFootball, null}
};
private IDictionary<FGame, Dictionary<string, KeyValuePair<string, string>>> _overridedMapStructTypes = new Dictionary<FGame, Dictionary<string, KeyValuePair<string, string>>>
{
{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.MultiVersus, null},
{FGame.Hotta, null},
{FGame.eFootball, null}
};
public IDictionary<FGame, Dictionary<string, bool>> OverridedOptions
{
get => _overridedOptions;
set => SetProperty(ref _overridedOptions, value);
}
public IDictionary<FGame, Dictionary<string, KeyValuePair<string, string>>> OverridedMapStructTypes
{
get => _overridedMapStructTypes;
set => SetProperty(ref _overridedMapStructTypes, value);
}
private IDictionary<FGame, FEndpoint[]> _customEndpoints = new Dictionary<FGame, FEndpoint[]>
{
{FGame.Unknown, new FEndpoint[]{new (), new ()}},
@ -437,11 +284,6 @@ namespace FModel.Settings
{FGame.Hotta, new FEndpoint[]{new (), new ()}},
{FGame.eFootball, new FEndpoint[]{new (), new ()}}
};
public IDictionary<FGame, FEndpoint[]> CustomEndpoints
{
get => _customEndpoints;
set => SetProperty(ref _customEndpoints, value);
}
private IDictionary<FGame, IList<CustomDirectory>> _customDirectories = new Dictionary<FGame, IList<CustomDirectory>>
{
@ -515,11 +357,6 @@ namespace FModel.Settings
{FGame.Hotta, new List<CustomDirectory>()},
{FGame.eFootball, new List<CustomDirectory>()}
};
public IDictionary<FGame, IList<CustomDirectory>> CustomDirectories
{
get => _customDirectories;
set => SetProperty(ref _customDirectories, value);
}
private DateTime _lastAesReload = DateTime.Today.AddDays(-1);
public DateTime LastAesReload

View File

@ -0,0 +1,29 @@
using System.Collections.Generic;
using CUE4Parse.UE4.Objects.Core.Serialization;
using FModel.Framework;
namespace FModel.Settings;
public class VersioningSettings : ViewModel
{
private IList<FCustomVersion> _customVersions;
public IList<FCustomVersion> CustomVersions
{
get => _customVersions;
set => SetProperty(ref _customVersions, value);
}
private IDictionary<string, bool> _options;
public IDictionary<string, bool> Options
{
get => _options;
set => SetProperty(ref _options, value);
}
private IDictionary<string, KeyValuePair<string, string>> _mapStructTypes;
public IDictionary<string, KeyValuePair<string, string>> MapStructTypes
{
get => _mapStructTypes;
set => SetProperty(ref _mapStructTypes, value);
}
}

View File

@ -48,9 +48,7 @@ public class ApplicationViewModel : ViewModel
public string InitialWindowTitle => $"FModel {UserSettings.Default.UpdateMode}";
public string GameDisplayName => CUE4Parse.Provider.GameDisplayName ?? "Unknown";
public string TitleExtra =>
$"({(CUE4Parse.Game == FGame.Unknown && UserSettings.Default.ManualGames.TryGetValue(UserSettings.Default.GameDirectory, out var settings) ? settings.OverridedGame : UserSettings.Default.OverridedGame[CUE4Parse.Game])})" +
$"{(Build != EBuildKind.Release ? $" ({Build})" : "")}";
public string TitleExtra => $"({UserSettings.Default.CurrentDir.UeVersion}){(Build != EBuildKind.Release ? $" ({Build})" : "")}";
public LoadingModesViewModel LoadingModes { get; }
public CustomDirectoriesViewModel CustomDirectories { get; }
@ -73,51 +71,41 @@ public class ApplicationViewModel : ViewModel
#endif
LoadingModes = new LoadingModesViewModel();
AvoidEmptyGameDirectoryAndSetEGame(false);
if (UserSettings.Default.GameDirectory is null)
UserSettings.Default.CurrentDir = AvoidEmptyGameDirectory(false);
if (UserSettings.Default.CurrentDir is null)
{
//If no game is selected, many things will break before a shutdown request is processed in the normal way.
//A hard exit is preferable to an unhandled expection in this case
Environment.Exit(0);
}
CUE4Parse = new CUE4ParseViewModel(UserSettings.Default.GameDirectory);
CustomDirectories = new CustomDirectoriesViewModel(CUE4Parse.Game, UserSettings.Default.GameDirectory);
CUE4Parse = new CUE4ParseViewModel();
CustomDirectories = new CustomDirectoriesViewModel();
SettingsView = new SettingsViewModel(CUE4Parse.Game);
AesManager = new AesManagerViewModel(CUE4Parse);
MapViewer = new MapViewerViewModel(CUE4Parse);
AudioPlayer = new AudioPlayerViewModel();
Status.SetStatus(EStatusKind.Ready);
}
public void AvoidEmptyGameDirectoryAndSetEGame(bool bAlreadyLaunched)
public DirectorySettings AvoidEmptyGameDirectory(bool bAlreadyLaunched)
{
var gameDirectory = UserSettings.Default.GameDirectory;
if (!string.IsNullOrEmpty(gameDirectory) && !bAlreadyLaunched) return;
if (!bAlreadyLaunched && UserSettings.Default.PerDirectory.TryGetValue(gameDirectory, out var currentDir))
return currentDir;
var gameLauncherViewModel = new GameSelectorViewModel(gameDirectory);
var result = new DirectorySelector(gameLauncherViewModel).ShowDialog();
if (!result.HasValue || !result.Value) return;
if (!result.HasValue || !result.Value) return null;
UserSettings.Default.GameDirectory = gameLauncherViewModel.SelectedDetectedGame.GameDirectory;
// UserSettings.Default.GameDirectory = gameLauncherViewModel.SelectedDetectedGame.OverridedGame;
if (!bAlreadyLaunched || gameDirectory == gameLauncherViewModel.SelectedDetectedGame.GameDirectory) return;
UserSettings.Default.GameDirectory = gameLauncherViewModel.SelectedDirectory.GameDirectory;
UserSettings.Default.PerDirectory[gameDirectory] = gameLauncherViewModel.SelectedDirectory;
if (!bAlreadyLaunched || UserSettings.Default.CurrentDir.Equals(gameLauncherViewModel.SelectedDirectory))
return gameLauncherViewModel.SelectedDirectory;
RestartWithWarning();
}
public async Task UpdateProvider(bool isLaunch)
{
if (!isLaunch && !AesManager.HasChange) return;
CUE4Parse.ClearProvider();
await ApplicationService.ThreadWorkerView.Begin(cancellationToken =>
{
CUE4Parse.LoadVfs(cancellationToken, AesManager.AesKeys);
CUE4Parse.Provider.LoadIniConfigs();
AesManager.SetAesKeys();
});
RaisePropertyChanged(nameof(GameDisplayName));
return null;
}
public void RestartWithWarning()
@ -162,6 +150,20 @@ public class ApplicationViewModel : ViewModel
Application.Current.Shutdown();
}
public async Task UpdateProvider(bool isLaunch)
{
if (!isLaunch && !AesManager.HasChange) return;
CUE4Parse.ClearProvider();
await ApplicationService.ThreadWorkerView.Begin(cancellationToken =>
{
CUE4Parse.LoadVfs(cancellationToken, AesManager.AesKeys);
CUE4Parse.Provider.LoadIniConfigs();
AesManager.SetAesKeys();
});
RaisePropertyChanged(nameof(GameDisplayName));
}
public async Task InitVgmStream()
{
var vgmZipFilePath = Path.Combine(UserSettings.Default.OutputDirectory, ".data", "vgmstream-win.zip");

View File

@ -123,84 +123,58 @@ public class CUE4ParseViewModel : ViewModel
public TabControlViewModel TabControl { get; }
public ConfigIni BuildInfo { get; }
public CUE4ParseViewModel(string gameDirectory)
public CUE4ParseViewModel()
{
var currentDir = UserSettings.Default.CurrentDir;
var gameDirectory = currentDir.GameDirectory;
var versionContainer = new VersionContainer(
game: currentDir.UeVersion, platform: currentDir.TexturePlatform,
customVersions: new FCustomVersionContainer(currentDir.Versioning.CustomVersions),
optionOverrides: currentDir.Versioning.Options,
mapStructTypesOverrides: currentDir.Versioning.MapStructTypes);
switch (gameDirectory)
{
case Constants._FN_LIVE_TRIGGER:
{
Game = FGame.FortniteGame;
Provider = new StreamedFileProvider("FortniteLive", true,
new VersionContainer(
UserSettings.Default.OverridedGame[Game], UserSettings.Default.OverridedPlatform,
customVersions: new FCustomVersionContainer(UserSettings.Default.OverridedCustomVersions[Game]),
optionOverrides: UserSettings.Default.OverridedOptions[Game]));
Provider = new StreamedFileProvider("FortniteLive", true, versionContainer);
break;
}
case Constants._VAL_LIVE_TRIGGER:
{
Game = FGame.ShooterGame;
Provider = new StreamedFileProvider("ValorantLive", true,
new VersionContainer(
UserSettings.Default.OverridedGame[Game], UserSettings.Default.OverridedPlatform,
customVersions: new FCustomVersionContainer(UserSettings.Default.OverridedCustomVersions[Game]),
optionOverrides: UserSettings.Default.OverridedOptions[Game]));
Provider = new StreamedFileProvider("ValorantLive", true, versionContainer);
break;
}
default:
{
var parent = gameDirectory.SubstringBeforeLast("\\Content").SubstringAfterLast("\\");
if (gameDirectory.Contains("eFootball")) parent = gameDirectory.SubstringBeforeLast("\\pak").SubstringAfterLast("\\");
var parent = gameDirectory.SubstringBeforeLast(gameDirectory.Contains("eFootball") ? "\\pak" : "\\Content").SubstringAfterLast("\\");
Game = parent.ToEnum(FGame.Unknown);
var versions = new VersionContainer(UserSettings.Default.OverridedGame[Game], UserSettings.Default.OverridedPlatform,
customVersions: new FCustomVersionContainer(UserSettings.Default.OverridedCustomVersions[Game]),
optionOverrides: UserSettings.Default.OverridedOptions[Game],
mapStructTypesOverrides: UserSettings.Default.OverridedMapStructTypes[Game]);
switch (Game)
Provider = Game switch
{
case FGame.StateOfDecay2:
{
Provider = new DefaultFileProvider(new DirectoryInfo(gameDirectory), new List<DirectoryInfo>
{
new(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\StateOfDecay2\\Saved\\Paks"),
new(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\StateOfDecay2\\Saved\\DisabledPaks")
},
SearchOption.AllDirectories, true, versions);
break;
}
case FGame.FortniteGame:
Provider = new DefaultFileProvider(new DirectoryInfo(gameDirectory), new List<DirectoryInfo>
{
new(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\FortniteGame\\Saved\\PersistentDownloadDir\\InstalledBundles"),
},
SearchOption.AllDirectories, true, versions);
break;
case FGame.eFootball:
Provider = new DefaultFileProvider(new DirectoryInfo(gameDirectory), new List<DirectoryInfo>
{
new(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\KONAMI\\eFootball\\ST\\Download")
},
SearchOption.AllDirectories, true, versions);
break;
case FGame.Unknown when UserSettings.Default.ManualGames.TryGetValue(gameDirectory, out var settings):
{
versions = new VersionContainer(settings.OverridedGame, UserSettings.Default.OverridedPlatform,
customVersions: new FCustomVersionContainer(settings.OverridedCustomVersions),
optionOverrides: settings.OverridedOptions,
mapStructTypesOverrides: settings.OverridedMapStructTypes);
goto default;
}
default:
{
Provider = new DefaultFileProvider(gameDirectory, SearchOption.AllDirectories, true, versions);
break;
}
}
FGame.StateOfDecay2 => new DefaultFileProvider(new DirectoryInfo(gameDirectory),
new List<DirectoryInfo>
{
new(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\StateOfDecay2\\Saved\\Paks"),
new(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\StateOfDecay2\\Saved\\DisabledPaks")
}, SearchOption.AllDirectories, true, versionContainer),
FGame.eFootball => new DefaultFileProvider(new DirectoryInfo(gameDirectory),
new List<DirectoryInfo>
{
new(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\KONAMI\\eFootball\\ST\\Download")
}, SearchOption.AllDirectories, true, versionContainer),
_ => new DefaultFileProvider(gameDirectory, SearchOption.AllDirectories, true, versionContainer)
};
break;
}
}
if (Game == FGame.FortniteGame) currentDir.Endpoints = new[]
{
new FEndpoint("https://fortnitecentral.genxgames.gg/api/v1/aes", "$.['mainKey','dynamicKeys']"),
new FEndpoint("https://fortnitecentral.genxgames.gg/api/v1/mappings", "$.[?(@.meta.compressionMethod=='Oodle')].['url','fileName']")
};
Provider.ReadScriptData = UserSettings.Default.ReadScriptData;
GameDirectory = new GameDirectoryViewModel();
@ -354,7 +328,7 @@ public class CUE4ParseViewModel : ViewModel
{
// game directory dependent, we don't have the provider game name yet since we don't have aes keys
// except when this comes from the AES Manager
if (!UserSettings.IsEndpointValid(Game, EEndpointType.Aes, out var endpoint))
if (!UserSettings.IsEndpointValid(EEndpointType.Aes, out var endpoint))
return;
await _threadWorkerView.Begin(cancellationToken =>
@ -385,7 +359,7 @@ public class CUE4ParseViewModel : ViewModel
public Task InitMappings()
{
if (!UserSettings.IsEndpointValid(Game, EEndpointType.Mapping, out var endpoint))
if (!UserSettings.IsEndpointValid(EEndpointType.Mapping, out var endpoint))
{
Provider.MappingsContainer = null;
return Task.CompletedTask;
@ -604,7 +578,7 @@ public class CUE4ParseViewModel : ViewModel
if (_virtualPathCount > 0) return Task.CompletedTask;
return Task.Run(() =>
{
_virtualPathCount = Provider.LoadVirtualPaths(UserSettings.Default.OverridedGame[Game].GetVersion());
_virtualPathCount = Provider.LoadVirtualPaths(UserSettings.Default.CurrentDir.UeVersion.GetVersion());
if (_virtualPathCount > 0)
{
FLogger.Append(ELog.Information, () =>
@ -1010,7 +984,7 @@ public class CUE4ParseViewModel : ViewModel
MaterialFormat = UserSettings.Default.MaterialExportFormat,
TextureFormat = UserSettings.Default.TextureExportFormat,
SocketFormat = UserSettings.Default.SocketExportFormat,
Platform = UserSettings.Default.OverridedPlatform,
Platform = UserSettings.Default.CurrentDir.TexturePlatform,
ExportMorphTargets = UserSettings.Default.SaveMorphTargets
};
var toSave = new Exporter(export, exportOptions);

View File

@ -23,7 +23,7 @@ public class MenuCommand : ViewModelCommand<ApplicationViewModel>
switch (parameter)
{
case "Directory_Selector":
contextViewModel.AvoidEmptyGameDirectoryAndSetEGame(true);
contextViewModel.AvoidEmptyGameDirectory(true);
break;
case "Directory_AES":
Helper.OpenWindow<AdonisWindow>("AES Manager", () => new AesManager().Show());

View File

@ -54,13 +54,8 @@ public class CustomDirectoriesViewModel : ViewModel
private readonly ObservableCollection<Control> _directories;
public ReadOnlyObservableCollection<Control> Directories { get; }
private readonly FGame _game;
private readonly string _gameDirectoryAtLaunch;
public CustomDirectoriesViewModel(FGame game, string directory)
public CustomDirectoriesViewModel()
{
_game = game;
_gameDirectoryAtLaunch = directory;
_directories = new ObservableCollection<Control>(EnumerateDirectories());
Directories = new ReadOnlyObservableCollection<Control>(_directories);
}
@ -91,16 +86,14 @@ public class CustomDirectoriesViewModel : ViewModel
public void Save()
{
var cd = new List<CustomDirectory>();
var directories = new List<CustomDirectory>();
for (var i = 2; i < _directories.Count; i++)
{
if (_directories[i] is not MenuItem m) continue;
cd.Add(new CustomDirectory(m.Header.ToString(), m.Tag.ToString()));
directories.Add(new CustomDirectory(m.Header.ToString(), m.Tag.ToString()));
}
if (_game == FGame.Unknown && UserSettings.Default.ManualGames.ContainsKey(_gameDirectoryAtLaunch))
UserSettings.Default.ManualGames[_gameDirectoryAtLaunch].CustomDirectories = cd;
else UserSettings.Default.CustomDirectories[_game] = cd;
UserSettings.Default.CurrentDir.Directories = directories;
}
private IEnumerable<Control> EnumerateDirectories()
@ -115,12 +108,7 @@ public class CustomDirectoriesViewModel : ViewModel
};
yield return new Separator();
IList<CustomDirectory> cd;
if (_game == FGame.Unknown && UserSettings.Default.ManualGames.TryGetValue(_gameDirectoryAtLaunch, out var settings))
cd = settings.CustomDirectories;
else cd = UserSettings.Default.CustomDirectories[_game];
foreach (var setting in cd)
foreach (var setting in UserSettings.Default.CurrentDir.Directories)
{
if (setting.DirectoryPath.EndsWith('/'))
setting.DirectoryPath = setting.DirectoryPath[..^1];
@ -167,4 +155,4 @@ public class CustomDirectoriesViewModel : ViewModel
CommandParameter = dir
};
}
}
}

View File

@ -33,79 +33,58 @@ public class GameSelectorViewModel : ViewModel
public IList<CustomDirectory> CustomDirectories { get; set; }
}
private DetectedGame _selectedDetectedGame;
public DetectedGame SelectedDetectedGame
private DirectorySettings _selectedDirectory;
public DirectorySettings SelectedDirectory
{
get => _selectedDetectedGame;
set => SetProperty(ref _selectedDetectedGame, value);
get => _selectedDirectory;
set => SetProperty(ref _selectedDirectory, value);
}
private readonly ObservableCollection<DetectedGame> _autoDetectedGames;
public ReadOnlyObservableCollection<DetectedGame> AutoDetectedGames { get; }
public ReadOnlyObservableCollection<EGame> UeGames { get; private set; }
private readonly ObservableCollection<DirectorySettings> _detectedDirectories;
public ReadOnlyObservableCollection<DirectorySettings> DetectedDirectories { get; }
public ReadOnlyObservableCollection<EGame> UeVersions { get; }
public GameSelectorViewModel(string gameDirectory)
{
_autoDetectedGames = new ObservableCollection<DetectedGame>(EnumerateDetectedGames().Where(x => x != null));
foreach (var game in UserSettings.Default.ManualGames.Values)
_detectedDirectories = new ObservableCollection<DirectorySettings>(EnumerateDetectedGames().Where(x => x != null));
foreach (var dir in UserSettings.Default.PerDirectory.Values.Where(x => x.IsManual))
{
_autoDetectedGames.Add(game);
_detectedDirectories.Add(dir);
}
AutoDetectedGames = new ReadOnlyObservableCollection<DetectedGame>(_autoDetectedGames);
DetectedDirectories = new ReadOnlyObservableCollection<DirectorySettings>(_detectedDirectories);
if (AutoDetectedGames.FirstOrDefault(x => x.GameDirectory == gameDirectory) is { } detectedGame)
SelectedDetectedGame = detectedGame;
if (DetectedDirectories.FirstOrDefault(x => x.GameDirectory == gameDirectory) is { } detectedGame)
SelectedDirectory = detectedGame;
else if (!string.IsNullOrEmpty(gameDirectory))
AddUnknownGame(gameDirectory);
AddUndetectedDir(gameDirectory);
else
SelectedDetectedGame = AutoDetectedGames.FirstOrDefault();
SelectedDirectory = DetectedDirectories.FirstOrDefault();
UeGames = new ReadOnlyObservableCollection<EGame>(new ObservableCollection<EGame>(EnumerateUeGames()));
UeVersions = new ReadOnlyObservableCollection<EGame>(new ObservableCollection<EGame>(EnumerateUeGames()));
}
/// <summary>
/// dedicated to manual games
/// </summary>
public void AddUnknownGame(string gameName, string gameDirectory)
public void AddUndetectedDir(string gameDirectory) => AddUndetectedDir(gameDirectory.SubstringAfterLast('\\'), gameDirectory);
public void AddUndetectedDir(string gameName, string gameDirectory)
{
var game = new DetectedGame
{
GameName = gameName,
GameDirectory = gameDirectory,
IsManual = true,
AesKeys = null,
OverridedGame = EGame.GAME_UE4_LATEST,
OverridedCustomVersions = null,
OverridedOptions = null,
OverridedMapStructTypes = null,
CustomDirectories = new List<CustomDirectory>()
};
UserSettings.Default.ManualGames[gameDirectory] = game;
_autoDetectedGames.Add(game);
SelectedDetectedGame = AutoDetectedGames.Last();
}
public void AddUnknownGame(string gameDirectory)
{
_autoDetectedGames.Add(new DetectedGame { GameName = gameDirectory.SubstringAfterLast('\\'), GameDirectory = gameDirectory });
SelectedDetectedGame = AutoDetectedGames.Last();
var setting = new DirectorySettings { GameName = gameName, GameDirectory = gameDirectory, IsManual = true };
UserSettings.Default.PerDirectory[gameDirectory] = setting;
_detectedDirectories.Add(setting);
SelectedDirectory = DetectedDirectories.Last();
}
public void DeleteSelectedGame()
{
UserSettings.Default.ManualGames.Remove(SelectedDetectedGame.GameDirectory); // should not be a problem
_autoDetectedGames.Remove(SelectedDetectedGame);
SelectedDetectedGame = AutoDetectedGames.Last();
UserSettings.Default.PerDirectory.Remove(SelectedDirectory.GameDirectory); // should not be a problem
_detectedDirectories.Remove(SelectedDirectory);
SelectedDirectory = DetectedDirectories.Last();
}
private IEnumerable<EGame> EnumerateUeGames() => Enum.GetValues<EGame>();
private IEnumerable<DetectedGame> EnumerateDetectedGames()
private IEnumerable<DirectorySettings> EnumerateDetectedGames()
{
yield return GetUnrealEngineGame("Fortnite", "\\FortniteGame\\Content\\Paks", EGame.GAME_UE5_2);
yield return new DetectedGame { GameName = "Fortnite [LIVE]", GameDirectory = Constants._FN_LIVE_TRIGGER, OverridedGame = EGame.GAME_UE5_2 };
yield return new DirectorySettings { GameName = "Fortnite [LIVE]", GameDirectory = Constants._FN_LIVE_TRIGGER, UeVersion = EGame.GAME_UE5_2 };
yield return GetUnrealEngineGame("Pewee", "\\RogueCompany\\Content\\Paks", EGame.GAME_RogueCompany);
yield return GetUnrealEngineGame("Rosemallow", "\\Indiana\\Content\\Paks", EGame.GAME_UE4_21);
yield return GetUnrealEngineGame("Catnip", "\\OakGame\\Content\\Paks", EGame.GAME_Borderlands3);
@ -115,7 +94,7 @@ public class GameSelectorViewModel : ViewModel
yield return GetUnrealEngineGame("711c5e95dc094ca58e5f16bd48e751d6", "\\MultiVersus\\Content\\Paks", EGame.GAME_UE4_26);
yield return GetUnrealEngineGame("9361c8c6d2f34b42b5f2f61093eedf48", "\\TslGame\\Content\\Paks", EGame.GAME_PlayerUnknownsBattlegrounds);
yield return GetRiotGame("VALORANT", "ShooterGame\\Content\\Paks", EGame.GAME_Valorant);
yield return new DetectedGame { GameName = "Valorant [LIVE]", GameDirectory = Constants._VAL_LIVE_TRIGGER, OverridedGame = EGame.GAME_Valorant };
yield return new DirectorySettings { GameName = "Valorant [LIVE]", GameDirectory = Constants._VAL_LIVE_TRIGGER, UeVersion = EGame.GAME_Valorant };
yield return GetSteamGame(381210, "\\DeadByDaylight\\Content\\Paks", EGame.GAME_UE4_27); // Dead By Daylight
yield return GetSteamGame(578080, "\\TslGame\\Content\\Paks", EGame.GAME_PlayerUnknownsBattlegrounds); // PUBG
yield return GetSteamGame(1172380, "\\SwGame\\Content\\Paks", EGame.GAME_StarWarsJediFallenOrder); // STAR WARS Jedi: Fallen Order™
@ -129,7 +108,7 @@ public class GameSelectorViewModel : ViewModel
}
private LauncherInstalled _launcherInstalled;
private DetectedGame GetUnrealEngineGame(string gameName, string pakDirectory, EGame version)
private DirectorySettings GetUnrealEngineGame(string gameName, string pakDirectory, EGame ueVersion)
{
_launcherInstalled ??= GetDriveLauncherInstalls<LauncherInstalled>("ProgramData\\Epic\\UnrealEngineLauncher\\LauncherInstalled.dat");
if (_launcherInstalled?.InstallationList != null)
@ -140,7 +119,7 @@ public class GameSelectorViewModel : ViewModel
if (installationList.AppName.Equals(gameName, StringComparison.OrdinalIgnoreCase) && Directory.Exists(gameDir))
{
Log.Debug("Found {GameName} in LauncherInstalled.dat", gameName);
return new DetectedGame { GameName = installationList.AppName, GameDirectory = gameDir, OverridedGame = version };
return new DirectorySettings { GameName = installationList.AppName, GameDirectory = gameDir, UeVersion = ueVersion };
}
}
}
@ -149,7 +128,7 @@ public class GameSelectorViewModel : ViewModel
}
private RiotClientInstalls _riotClientInstalls;
private DetectedGame GetRiotGame(string gameName, string pakDirectory, EGame version)
private DirectorySettings GetRiotGame(string gameName, string pakDirectory, EGame ueVersion)
{
_riotClientInstalls ??= GetDriveLauncherInstalls<RiotClientInstalls>("ProgramData\\Riot Games\\RiotClientInstalls.json");
if (_riotClientInstalls is { AssociatedClient: { } })
@ -160,7 +139,7 @@ public class GameSelectorViewModel : ViewModel
if (key.Contains(gameName, StringComparison.OrdinalIgnoreCase) && Directory.Exists(gameDir))
{
Log.Debug("Found {GameName} in RiotClientInstalls.json", gameName);
return new DetectedGame { GameName = gameName, GameDirectory = gameDir, OverridedGame = version };
return new DirectorySettings { GameName = gameName, GameDirectory = gameDir, UeVersion = ueVersion };
}
}
}
@ -169,7 +148,7 @@ public class GameSelectorViewModel : ViewModel
}
private LauncherSettings _launcherSettings;
private DetectedGame GetMojangGame(string gameName, string pakDirectory, EGame version)
private DirectorySettings GetMojangGame(string gameName, string pakDirectory, EGame ueVersion)
{
_launcherSettings ??= GetDataLauncherInstalls<LauncherSettings>("\\.minecraft\\launcher_settings.json");
if (_launcherSettings is { ProductLibraryDir: { } })
@ -178,26 +157,26 @@ public class GameSelectorViewModel : ViewModel
if (Directory.Exists(gameDir))
{
Log.Debug("Found {GameName} in launcher_settings.json", gameName);
return new DetectedGame { GameName = gameName, GameDirectory = gameDir, OverridedGame = version };
return new DirectorySettings { GameName = gameName, GameDirectory = gameDir, UeVersion = ueVersion };
}
}
return null;
}
private DetectedGame GetSteamGame(int id, string pakDirectory, EGame version)
private DirectorySettings GetSteamGame(int id, string pakDirectory, EGame ueVersion)
{
var steamInfo = SteamDetection.GetSteamGameById(id);
if (steamInfo is not null)
{
Log.Debug("Found {GameName} in steam manifests", steamInfo.Name);
return new DetectedGame { GameName = steamInfo.Name, GameDirectory = $"{steamInfo.GameRoot}{pakDirectory}", OverridedGame = version };
return new DirectorySettings { GameName = steamInfo.Name, GameDirectory = $"{steamInfo.GameRoot}{pakDirectory}", UeVersion = ueVersion };
}
return null;
}
private DetectedGame GetRockstarGamesGame(string key, string pakDirectory, EGame version)
private DirectorySettings GetRockstarGamesGame(string key, string pakDirectory, EGame ueVersion)
{
var installLocation = string.Empty;
try
@ -213,13 +192,13 @@ public class GameSelectorViewModel : ViewModel
if (Directory.Exists(gameDir))
{
Log.Debug("Found {GameName} in the registry", key);
return new DetectedGame { GameName = key, GameDirectory = gameDir, OverridedGame = version };
return new DirectorySettings { GameName = key, GameDirectory = gameDir, UeVersion = ueVersion };
}
return null;
}
private DetectedGame GetLevelInfiniteGame(string key, string pakDirectory, EGame version)
private DirectorySettings GetLevelInfiniteGame(string key, string pakDirectory, EGame ueVersion)
{
var installLocation = string.Empty;
var displayName = string.Empty;
@ -238,7 +217,7 @@ public class GameSelectorViewModel : ViewModel
if (Directory.Exists(gameDir))
{
Log.Debug("Found {GameName} in the registry", key);
return new DetectedGame { GameName = displayName, GameDirectory = gameDir, OverridedGame = version };
return new DirectorySettings { GameName = displayName, GameDirectory = gameDir, UeVersion = ueVersion };
}
return null;

View File

@ -37,17 +37,6 @@ public class SettingsViewModel : ViewModel
set => SetProperty(ref _selectedUpdateMode, value);
}
private string _selectedPreset;
public string SelectedPreset
{
get => _selectedPreset;
set
{
SetProperty(ref _selectedPreset, value);
RaisePropertyChanged("EnableElements");
}
}
private ETexturePlatform _selectedUePlatform;
public ETexturePlatform SelectedUePlatform
{
@ -62,22 +51,22 @@ public class SettingsViewModel : ViewModel
set => SetProperty(ref _selectedUeGame, value);
}
private List<FCustomVersion> _selectedCustomVersions;
public List<FCustomVersion> SelectedCustomVersions
private IList<FCustomVersion> _selectedCustomVersions;
public IList<FCustomVersion> SelectedCustomVersions
{
get => _selectedCustomVersions;
set => SetProperty(ref _selectedCustomVersions, value);
}
private Dictionary<string, bool> _selectedOptions;
public Dictionary<string, bool> SelectedOptions
private IDictionary<string, bool> _selectedOptions;
public IDictionary<string, bool> SelectedOptions
{
get => _selectedOptions;
set => SetProperty(ref _selectedOptions, value);
}
private Dictionary<string, KeyValuePair<string, string>> _selectedMapStructTypes;
public Dictionary<string, KeyValuePair<string, string>> SelectedMapStructTypes
private IDictionary<string, KeyValuePair<string, string>> _selectedMapStructTypes;
public IDictionary<string, KeyValuePair<string, string>> SelectedMapStructTypes
{
get => _selectedMapStructTypes;
set => SetProperty(ref _selectedMapStructTypes, value);
@ -168,7 +157,6 @@ public class SettingsViewModel : ViewModel
}
public ReadOnlyObservableCollection<EUpdateMode> UpdateModes { get; private set; }
public ObservableCollection<string> Presets { get; private set; }
public ReadOnlyObservableCollection<EGame> UeGames { get; private set; }
public ReadOnlyObservableCollection<ELanguage> AssetLanguages { get; private set; }
public ReadOnlyObservableCollection<EAesReload> AesReloads { get; private set; }
@ -182,10 +170,7 @@ public class SettingsViewModel : ViewModel
public ReadOnlyObservableCollection<ETextureFormat> TextureExportFormats { get; private set; }
public ReadOnlyObservableCollection<ETexturePlatform> Platforms { get; private set; }
public bool EnableElements => SelectedPreset == Constants._NO_PRESET_TRIGGER;
private readonly FGame _game;
private Game _gamePreset;
private string _outputSnapshot;
private string _rawDataSnapshot;
private string _propertiesSnapshot;
@ -194,12 +179,11 @@ public class SettingsViewModel : ViewModel
private string _modelSnapshot;
private string _gameSnapshot;
private EUpdateMode _updateModeSnapshot;
private string _presetSnapshot;
private ETexturePlatform _uePlatformSnapshot;
private EGame _ueGameSnapshot;
private List<FCustomVersion> _customVersionsSnapshot;
private Dictionary<string, bool> _optionsSnapshot;
private Dictionary<string, KeyValuePair<string, string>> _mapStructTypesSnapshot;
private IList<FCustomVersion> _customVersionsSnapshot;
private IDictionary<string, bool> _optionsSnapshot;
private IDictionary<string, KeyValuePair<string, string>> _mapStructTypesSnapshot;
private ELanguage _assetLanguageSnapshot;
private ECompressedAudio _compressedAudioSnapshot;
private EIconStyle _cosmeticStyleSnapshot;
@ -226,8 +210,7 @@ public class SettingsViewModel : ViewModel
_modelSnapshot = UserSettings.Default.ModelDirectory;
_gameSnapshot = UserSettings.Default.GameDirectory;
_updateModeSnapshot = UserSettings.Default.UpdateMode;
_presetSnapshot = UserSettings.Default.Presets[_game];
_uePlatformSnapshot = UserSettings.Default.OverridedPlatform;
_uePlatformSnapshot = UserSettings.Default.CurrentDir.TexturePlatform;
if (_game == FGame.Unknown && UserSettings.Default.ManualGames.TryGetValue(_gameSnapshot, out var settings))
{
_ueGameSnapshot = settings.OverridedGame;
@ -237,22 +220,19 @@ public class SettingsViewModel : ViewModel
}
else
{
_ueGameSnapshot = UserSettings.Default.OverridedGame[_game];
_customVersionsSnapshot = UserSettings.Default.OverridedCustomVersions[_game];
_optionsSnapshot = UserSettings.Default.OverridedOptions[_game];
_mapStructTypesSnapshot = UserSettings.Default.OverridedMapStructTypes[_game];
_ueGameSnapshot = UserSettings.Default.CurrentDir.UeVersion;
_customVersionsSnapshot = UserSettings.Default.CurrentDir.Versioning.CustomVersions;
_optionsSnapshot = UserSettings.Default.CurrentDir.Versioning.Options;
_mapStructTypesSnapshot = UserSettings.Default.CurrentDir.Versioning.MapStructTypes;
}
if (UserSettings.Default.CustomEndpoints.TryGetValue(_game, out var endpoints))
AesEndpoint = UserSettings.Default.CurrentDir.Endpoints[0];
MappingEndpoint = UserSettings.Default.CurrentDir.Endpoints[1];
MappingEndpoint.PropertyChanged += (_, args) =>
{
AesEndpoint = endpoints[0];
MappingEndpoint = endpoints[1];
MappingEndpoint.PropertyChanged += (_, args) =>
{
if (!_mappingsUpdate)
_mappingsUpdate = args.PropertyName is "Overwrite" or "FilePath";
};
}
if (!_mappingsUpdate)
_mappingsUpdate = args.PropertyName is "Overwrite" or "FilePath";
};
_assetLanguageSnapshot = UserSettings.Default.AssetLanguage;
_compressedAudioSnapshot = UserSettings.Default.CompressedAudioMode;
@ -264,7 +244,6 @@ public class SettingsViewModel : ViewModel
_textureExportFormatSnapshot = UserSettings.Default.TextureExportFormat;
SelectedUpdateMode = _updateModeSnapshot;
SelectedPreset = _presetSnapshot;
SelectedUePlatform = _uePlatformSnapshot;
SelectedUeGame = _ueGameSnapshot;
SelectedCustomVersions = _customVersionsSnapshot;
@ -282,7 +261,6 @@ public class SettingsViewModel : ViewModel
SelectedDiscordRpc = UserSettings.Default.DiscordRpc;
UpdateModes = new ReadOnlyObservableCollection<EUpdateMode>(new ObservableCollection<EUpdateMode>(EnumerateUpdateModes()));
Presets = new ObservableCollection<string>(EnumeratePresets());
UeGames = new ReadOnlyObservableCollection<EGame>(new ObservableCollection<EGame>(EnumerateUeGames()));
AssetLanguages = new ReadOnlyObservableCollection<ELanguage>(new ObservableCollection<ELanguage>(EnumerateAssetLanguages()));
AesReloads = new ReadOnlyObservableCollection<EAesReload>(new ObservableCollection<EAesReload>(EnumerateAesReloads()));
@ -297,53 +275,6 @@ public class SettingsViewModel : ViewModel
Platforms = new ReadOnlyObservableCollection<ETexturePlatform>(new ObservableCollection<ETexturePlatform>(EnumerateUePlatforms()));
}
public async Task InitPresets(string gameName)
{
await _threadWorkerView.Begin(cancellationToken =>
{
if (string.IsNullOrEmpty(gameName)) return;
_gamePreset = _apiEndpointView.FModelApi.GetGames(cancellationToken, gameName);
});
if (_gamePreset?.Versions == null) return;
foreach (var version in _gamePreset.Versions.Keys)
{
Presets.Add(version);
}
}
public void SwitchPreset(string key)
{
if (_gamePreset?.Versions == null || !_gamePreset.Versions.TryGetValue(key, out var version)) return;
SelectedUeGame = version.GameEnum.ToEnum(EGame.GAME_UE4_LATEST);
SelectedCustomVersions = new List<FCustomVersion>();
foreach (var (guid, v) in version.CustomVersions)
{
SelectedCustomVersions.Add(new FCustomVersion { Key = new FGuid(guid), Version = v });
}
SelectedOptions = new Dictionary<string, bool>();
foreach (var (k, v) in version.Options)
{
SelectedOptions[k] = v;
}
SelectedMapStructTypes = new Dictionary<string, KeyValuePair<string, string>>();
foreach (var (k, v) in version.MapStructTypes)
{
SelectedMapStructTypes[k] = v;
}
}
public void ResetPreset()
{
SelectedUeGame = _ueGameSnapshot;
SelectedCustomVersions = _customVersionsSnapshot;
SelectedOptions = _optionsSnapshot;
SelectedMapStructTypes = _mapStructTypesSnapshot;
}
public bool Save(out List<SettingsOut> whatShouldIDo)
{
var restart = false;
@ -369,21 +300,20 @@ public class SettingsViewModel : ViewModel
restart = true;
UserSettings.Default.UpdateMode = SelectedUpdateMode;
UserSettings.Default.Presets[_game] = SelectedPreset;
UserSettings.Default.OverridedPlatform = SelectedUePlatform;
UserSettings.Default.CurrentDir.TexturePlatform = SelectedUePlatform;
if (_game == FGame.Unknown && UserSettings.Default.ManualGames.ContainsKey(UserSettings.Default.GameDirectory))
{
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;
UserSettings.Default.ManualGames[UserSettings.Default.GameDirectory].OverridedCustomVersions = (List<FCustomVersion>) SelectedCustomVersions;
UserSettings.Default.ManualGames[UserSettings.Default.GameDirectory].OverridedOptions = (Dictionary<string, bool>) SelectedOptions;
UserSettings.Default.ManualGames[UserSettings.Default.GameDirectory].OverridedMapStructTypes = (Dictionary<string, KeyValuePair<string, string>>) SelectedMapStructTypes;
}
else
{
UserSettings.Default.OverridedGame[_game] = SelectedUeGame;
UserSettings.Default.OverridedCustomVersions[_game] = SelectedCustomVersions;
UserSettings.Default.OverridedOptions[_game] = SelectedOptions;
UserSettings.Default.OverridedMapStructTypes[_game] = SelectedMapStructTypes;
UserSettings.Default.CurrentDir.UeVersion = SelectedUeGame;
UserSettings.Default.CurrentDir.Versioning.CustomVersions = SelectedCustomVersions;
UserSettings.Default.CurrentDir.Versioning.Options = SelectedOptions;
UserSettings.Default.CurrentDir.Versioning.MapStructTypes = SelectedMapStructTypes;
}
UserSettings.Default.AssetLanguage = SelectedAssetLanguage;
@ -404,10 +334,6 @@ public class SettingsViewModel : ViewModel
}
private IEnumerable<EUpdateMode> EnumerateUpdateModes() => Enum.GetValues<EUpdateMode>();
private IEnumerable<string> EnumeratePresets()
{
yield return Constants._NO_PRESET_TRIGGER;
}
private IEnumerable<EGame> EnumerateUeGames() => Enum.GetValues<EGame>();
private IEnumerable<ELanguage> EnumerateAssetLanguages() => Enum.GetValues<ELanguage>();
private IEnumerable<EAesReload> EnumerateAesReloads() => Enum.GetValues<EAesReload>();

View File

@ -229,7 +229,7 @@ public class TabItem : ViewModel
}
public void AddImage(UTexture texture, bool save, bool updateUi)
=> AddImage(texture.Name, texture.RenderNearestNeighbor, texture.Decode(UserSettings.Default.OverridedPlatform), save, updateUi);
=> AddImage(texture.Name, texture.RenderNearestNeighbor, texture.Decode(UserSettings.Default.CurrentDir.TexturePlatform), save, updateUi);
public void AddImage(string name, bool rnn, SKBitmap[] img, bool save, bool updateUi)
{

View File

@ -80,14 +80,8 @@
<Button Grid.Column="1" MinWidth="78" Margin="0 0 12 0" IsDefault="True" IsCancel="False"
HorizontalAlignment="Right" VerticalAlignment="Bottom" Content="OK" Click="OnClick" />
<Button Grid.Column="2" MinWidth="78" Margin="0 0 12 0" IsDefault="False" IsCancel="False"
HorizontalAlignment="Right" VerticalAlignment="Bottom" Content="Refresh" Click="OnRefreshAes">
<Button.Visibility>
<!-- if aes custom endpoint is enabled, make this visible -->
<MultiBinding Converter="{x:Static converters:EndpointToTypeConverter.Instance}">
<Binding RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type local:Views.AesManager}}" Path="DataContext" />
<Binding Source="{x:Static local:EEndpointType.Aes}" />
</MultiBinding>
</Button.Visibility>
HorizontalAlignment="Right" VerticalAlignment="Bottom" Content="Refresh" Click="OnRefreshAes"
Visibility="{Binding Converter={x:Static converters:EndpointToTypeConverter.Instance}, ConverterParameter={x:Static local:EEndpointType.Aes}}">
</Button>
</Grid>
</Border>

View File

@ -51,8 +51,8 @@
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="Detected Game" VerticalAlignment="Center" Margin="0 0 0 5" />
<ComboBox Grid.Row="0" Grid.Column="2" Grid.ColumnSpan="3" ItemsSource="{Binding AutoDetectedGames}" Margin="0 0 0 5"
VerticalAlignment="Center" SelectedItem="{Binding SelectedDetectedGame, Mode=TwoWay}">
<ComboBox Grid.Row="0" Grid.Column="2" Grid.ColumnSpan="3" ItemsSource="{Binding DetectedDirectories}" Margin="0 0 0 5"
VerticalAlignment="Center" SelectedItem="{Binding SelectedDirectory, Mode=TwoWay}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding GameName, Converter={x:Static converters:StringToGameConverter.Instance}}" />
@ -61,8 +61,8 @@
</ComboBox>
<TextBlock Grid.Row="1" Grid.Column="0" Text="UE Versions" VerticalAlignment="Center" Margin="0 0 0 5" />
<ComboBox Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="3" ItemsSource="{Binding UeGames}" Margin="0 0 0 5"
VerticalAlignment="Center" SelectedItem="{Binding SelectedDetectedGame.OverridedGame, Mode=TwoWay}">
<ComboBox Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="3" ItemsSource="{Binding UeVersions}" Margin="0 0 0 5"
VerticalAlignment="Center" SelectedItem="{Binding SelectedDirectory.UeVersion, Mode=TwoWay}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Converter={x:Static converters:EnumToStringConverter.Instance}}" />
@ -71,11 +71,11 @@
</ComboBox>
<TextBlock Grid.Row="2" Grid.Column="0" Text="Directory" VerticalAlignment="Center" />
<TextBox Grid.Row="2" Grid.Column="2" Text="{Binding SelectedDetectedGame.GameDirectory, Mode=TwoWay}" />
<TextBox Grid.Row="2" Grid.Column="2" Text="{Binding SelectedDirectory.GameDirectory, Mode=TwoWay}" />
<Button Grid.Row="2" Grid.Column="4" Content="..." HorizontalAlignment="Right" Click="OnBrowseDirectories" />
<Button Grid.Row="2" Grid.Column="4" Style="{DynamicResource {x:Static adonisUi:Styles.AccentButton}}" Padding="0"
Click="OnDeleteDirectory" Width="{Binding ActualWidth, ElementName=OkGuysButWhoFuckingAsked}" ToolTip="Delete Game"
Visibility="{Binding SelectedDetectedGame.IsManual, Converter={StaticResource BoolToVisibilityConverter}}">
Visibility="{Binding SelectedDirectory.IsManual, Converter={StaticResource BoolToVisibilityConverter}}">
<Viewbox Width="16" Height="16" HorizontalAlignment="Center">
<Canvas Width="24" Height="24">
<Path Fill="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}" Data="{StaticResource RemoveIcon}" />

View File

@ -29,7 +29,7 @@ public partial class DirectorySelector
var folderBrowser = new VistaFolderBrowserDialog {ShowNewFolderButton = false};
if (folderBrowser.ShowDialog() == true)
{
gameLauncherViewModel.AddUnknownGame(folderBrowser.SelectedPath);
gameLauncherViewModel.AddUndetectedDir(folderBrowser.SelectedPath);
}
}
@ -49,7 +49,7 @@ public partial class DirectorySelector
string.IsNullOrEmpty(HelloGameMyNameIsDirectory.Text))
return;
gameLauncherViewModel.AddUnknownGame(HelloMyNameIsGame.Text, HelloGameMyNameIsDirectory.Text);
gameLauncherViewModel.AddUndetectedDir(HelloMyNameIsGame.Text, HelloGameMyNameIsDirectory.Text);
HelloMyNameIsGame.Clear();
HelloGameMyNameIsDirectory.Clear();
}

View File

@ -13,7 +13,6 @@ namespace FModel.Views.Resources.Controls;
public partial class DictionaryEditor
{
private readonly bool _enableElements;
private readonly List<FCustomVersion> _defaultCustomVersions;
private readonly Dictionary<string, bool> _defaultOptions;
private readonly Dictionary<string, KeyValuePair<string, string>> _defaultMapStructTypes;
@ -22,9 +21,8 @@ public partial class DictionaryEditor
public Dictionary<string, bool> Options { get; private set; }
public Dictionary<string, KeyValuePair<string, string>> MapStructTypes { get; private set; }
public DictionaryEditor(string title, bool enableElements)
public DictionaryEditor(string title)
{
_enableElements = enableElements;
_defaultCustomVersions = new List<FCustomVersion> { new() { Key = new FGuid(), Version = 0 } };
_defaultOptions = new Dictionary<string, bool> { { "key1", true }, { "key2", false } };
_defaultMapStructTypes = new Dictionary<string, KeyValuePair<string, string>> { { "MapName", new KeyValuePair<string, string>("KeyType", "ValueType") } };
@ -32,11 +30,10 @@ public partial class DictionaryEditor
InitializeComponent();
Title = title;
MyAvalonEditor.IsReadOnly = !_enableElements;
MyAvalonEditor.SyntaxHighlighting = AvalonExtensions.HighlighterSelector("");
}
public DictionaryEditor(List<FCustomVersion> customVersions, string title, bool enableElements) : this(title, enableElements)
public DictionaryEditor(IList<FCustomVersion> customVersions, string title) : this(title)
{
MyAvalonEditor.Document = new TextDocument
{
@ -44,7 +41,7 @@ public partial class DictionaryEditor
};
}
public DictionaryEditor(Dictionary<string, bool> options, string title, bool enableElements) : this(title, enableElements)
public DictionaryEditor(IDictionary<string, bool> options, string title) : this(title)
{
MyAvalonEditor.Document = new TextDocument
{
@ -52,7 +49,7 @@ public partial class DictionaryEditor
};
}
public DictionaryEditor(Dictionary<string, KeyValuePair<string, string>> options, string title, bool enableElements) : this(title, enableElements)
public DictionaryEditor(IDictionary<string, KeyValuePair<string, string>> options, string title) : this(title)
{
MyAvalonEditor.Document = new TextDocument
{
@ -62,13 +59,6 @@ public partial class DictionaryEditor
private void OnClick(object sender, RoutedEventArgs e)
{
if (!_enableElements)
{
DialogResult = false;
Close();
return;
}
try
{
switch (Title)
@ -104,9 +94,6 @@ public partial class DictionaryEditor
private void OnReset(object sender, RoutedEventArgs e)
{
if (!_enableElements)
return;
MyAvalonEditor.Document = Title switch
{
"Versioning Configuration (Custom Versions)" => new TextDocument

View File

@ -3,21 +3,18 @@ using System.Globalization;
using System.Windows;
using System.Windows.Data;
using FModel.Settings;
using FModel.ViewModels;
namespace FModel.Views.Resources.Converters;
public class EndpointToTypeConverter : IMultiValueConverter
public class EndpointToTypeConverter : IValueConverter
{
public static readonly EndpointToTypeConverter Instance = new();
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (values[0] is not ApplicationViewModel viewModel ||
values[1] is not EEndpointType type)
return false;
if (parameter is not EEndpointType type) throw new NotImplementedException();
var isValid = UserSettings.IsEndpointValid(viewModel.CUE4Parse.Game, type, out _);
var isValid = UserSettings.IsEndpointValid(type, out _);
return targetType switch
{
not null when targetType == typeof(Visibility) => isValid ? Visibility.Visible : Visibility.Collapsed,
@ -25,7 +22,7 @@ public class EndpointToTypeConverter : IMultiValueConverter
};
}
public object[] ConvertBack(object value, Type[] targetType, object parameter, CultureInfo culture)
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}

View File

@ -7,7 +7,7 @@
xmlns:adonisUi="clr-namespace:AdonisUI;assembly=AdonisUI"
xmlns:adonisControls="clr-namespace:AdonisUI.Controls;assembly=AdonisUI"
xmlns:adonisExtensions="clr-namespace:AdonisUI.Extensions;assembly=AdonisUI"
WindowStartupLocation="CenterScreen" ResizeMode="NoResize" IconVisibility="Collapsed" SizeToContent="Height" Loaded="OnLoaded"
WindowStartupLocation="CenterScreen" ResizeMode="NoResize" IconVisibility="Collapsed" SizeToContent="Height"
MinHeight="{Binding Source={x:Static SystemParameters.MaximizedPrimaryScreenHeight}, Converter={converters:RatioConverter}, ConverterParameter='0.10'}"
Width="{Binding Source={x:Static SystemParameters.MaximizedPrimaryScreenWidth}, Converter={converters:RatioConverter}, ConverterParameter='0.35'}">
<adonisControls:AdonisWindow.Style>
@ -42,7 +42,6 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
@ -131,14 +130,9 @@
<Separator Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="7" Style="{StaticResource CustomSeparator}" Tag="ADVANCED"></Separator>
<TextBlock Grid.Row="7" Grid.Column="0" Text="Presets" VerticalAlignment="Center" Margin="0 0 0 5" ToolTip="Use a fine tuned preset for the game you're trying to load and its version" />
<ComboBox Grid.Row="7" Grid.Column="2" Grid.ColumnSpan="5" ItemsSource="{Binding SettingsView.Presets}" SelectedItem="{Binding SettingsView.SelectedPreset, Mode=TwoWay}"
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.SettingsView}}}" SelectionChanged="OnSelectionChanged" Margin="0 0 0 5">
</ComboBox>
<TextBlock Grid.Row="8" Grid.Column="0" Text="UE Versions *" VerticalAlignment="Center" Margin="0 0 0 5" ToolTip="Override the UE version to use when parsing packages" />
<ComboBox Grid.Row="8" Grid.Column="2" Grid.ColumnSpan="5" ItemsSource="{Binding SettingsView.UeGames}" SelectedItem="{Binding SettingsView.SelectedUeGame, Mode=TwoWay}"
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.SettingsView}}}" IsEnabled="{Binding SettingsView.EnableElements}"
<TextBlock Grid.Row="7" Grid.Column="0" Text="UE Versions *" VerticalAlignment="Center" Margin="0 0 0 5" ToolTip="Override the UE version to use when parsing packages" />
<ComboBox Grid.Row="7" Grid.Column="2" Grid.ColumnSpan="5" ItemsSource="{Binding SettingsView.UeGames}" SelectedItem="{Binding SettingsView.SelectedUeGame, Mode=TwoWay}"
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.SettingsView}}}"
Margin="0 0 0 5">
<ComboBox.ItemTemplate>
<DataTemplate>
@ -147,8 +141,8 @@
</ComboBox.ItemTemplate>
</ComboBox>
<TextBlock Grid.Row="9" Grid.Column="0" Text="Versioning Configuration *" VerticalAlignment="Center" Margin="0 0 0 5" />
<Grid Grid.Row="9" Grid.Column="2" Grid.ColumnSpan="5" Margin="0 0 0 5">
<TextBlock Grid.Row="8" Grid.Column="0" Text="Versioning Configuration *" VerticalAlignment="Center" Margin="0 0 0 5" />
<Grid Grid.Row="8" Grid.Column="2" Grid.ColumnSpan="5" Margin="0 0 0 5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="5" />
@ -162,9 +156,9 @@
<Button Grid.Column="4" Content="MapStructTypes" Click="OpenMapStructTypes" />
</Grid>
<TextBlock Grid.Row="10" Grid.Column="0" Text="Texture Platform *" VerticalAlignment="Center" Margin="0 0 0 5" ToolTip="Override the game's platform to ensure texture compatibility" />
<ComboBox Grid.Row="10" Grid.Column="2" Grid.ColumnSpan="5" ItemsSource="{Binding SettingsView.Platforms}" SelectedItem="{Binding SettingsView.SelectedUePlatform, Mode=TwoWay}"
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.SettingsView}}}" IsEnabled="{Binding SettingsView.EnableElements}"
<TextBlock Grid.Row="9" Grid.Column="0" Text="Texture Platform *" VerticalAlignment="Center" Margin="0 0 0 5" ToolTip="Override the game's platform to ensure texture compatibility" />
<ComboBox Grid.Row="9" Grid.Column="2" Grid.ColumnSpan="5" ItemsSource="{Binding SettingsView.Platforms}" SelectedItem="{Binding SettingsView.SelectedUePlatform, Mode=TwoWay}"
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.SettingsView}}}"
Margin="0 0 0 5">
<ComboBox.ItemTemplate>
<DataTemplate>
@ -173,8 +167,8 @@
</ComboBox.ItemTemplate>
</ComboBox>
<TextBlock Grid.Row="11" Grid.Column="0" Text="Compressed Audio" VerticalAlignment="Center" Margin="0 0 0 5" ToolTip="What to do when encountering a compressed audio file" />
<ComboBox Grid.Row="11" Grid.Column="2" Grid.ColumnSpan="5" ItemsSource="{Binding SettingsView.CompressedAudios}" SelectedItem="{Binding SettingsView.SelectedCompressedAudio, Mode=TwoWay}"
<TextBlock Grid.Row="10" Grid.Column="0" Text="Compressed Audio" VerticalAlignment="Center" Margin="0 0 0 5" ToolTip="What to do when encountering a compressed audio file" />
<ComboBox Grid.Row="10" Grid.Column="2" Grid.ColumnSpan="5" ItemsSource="{Binding SettingsView.CompressedAudios}" SelectedItem="{Binding SettingsView.SelectedCompressedAudio, Mode=TwoWay}"
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.SettingsView}}}" Margin="0 0 0 5">
<ComboBox.ItemTemplate>
<DataTemplate>
@ -183,8 +177,8 @@
</ComboBox.ItemTemplate>
</ComboBox>
<TextBlock Grid.Row="12" Grid.Column="0" Text="Endpoint Configuration" VerticalAlignment="Center" Margin="0 0 0 5" />
<Grid Grid.Row="12" Grid.Column="2" Grid.ColumnSpan="5" Margin="0 0 0 5"
<TextBlock Grid.Row="11" Grid.Column="0" Text="Endpoint Configuration" VerticalAlignment="Center" Margin="0 0 0 5" />
<Grid Grid.Row="11" Grid.Column="2" Grid.ColumnSpan="5" Margin="0 0 0 5"
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.SettingsView}}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
@ -196,10 +190,10 @@
<Button Grid.Column="2" Content="Mapping" Click="OpenMappingEndpoint" />
</Grid>
<TextBlock Grid.Row="13" Grid.Column="0" Text="AES Reload at Launch" VerticalAlignment="Center" Margin="0 0 0 5"
<TextBlock Grid.Row="12" Grid.Column="0" Text="AES Reload at Launch" VerticalAlignment="Center" Margin="0 0 0 5"
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.SettingsView}}}"
Visibility="{Binding SettingsView.AesEndpoint.IsValid, Converter={StaticResource BoolToVisibilityConverter}}" />
<ComboBox Grid.Row="13" Grid.Column="2" Grid.ColumnSpan="5" Margin="0 0 0 5"
<ComboBox Grid.Row="12" Grid.Column="2" Grid.ColumnSpan="5" Margin="0 0 0 5"
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.SettingsView}}}"
ItemsSource="{Binding SettingsView.AesReloads}" SelectedItem="{Binding SettingsView.SelectedAesReload, Mode=TwoWay}"
Visibility="{Binding SettingsView.AesEndpoint.IsValid, Converter={StaticResource BoolToVisibilityConverter}}">
@ -210,27 +204,27 @@
</ComboBox.ItemTemplate>
</ComboBox>
<TextBlock Grid.Row="14" Grid.Column="0" Text="Serialize Script Bytecode" VerticalAlignment="Center" Margin="0 0 0 5" />
<CheckBox Grid.Row="14" Grid.Column="2" Content="{Binding IsChecked, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BoolToToggleConverter.Instance}}"
<TextBlock Grid.Row="13" Grid.Column="0" Text="Serialize Script Bytecode" VerticalAlignment="Center" Margin="0 0 0 5" />
<CheckBox Grid.Row="13" Grid.Column="2" Content="{Binding IsChecked, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BoolToToggleConverter.Instance}}"
IsChecked="{Binding ReadScriptData, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}" Margin="0 5 0 10"/>
<TextBlock Grid.Row="15" Grid.Column="0" Text="Keep Directory Structure" VerticalAlignment="Center" Margin="0 0 0 5" ToolTip="Auto-save packages following their game directory" />
<CheckBox Grid.Row="15" Grid.Column="2" Content="{Binding IsChecked, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BoolToToggleConverter.Instance}}"
<TextBlock Grid.Row="14" Grid.Column="0" Text="Keep Directory Structure" VerticalAlignment="Center" Margin="0 0 0 5" ToolTip="Auto-save packages following their game directory" />
<CheckBox Grid.Row="14" Grid.Column="2" Content="{Binding IsChecked, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BoolToToggleConverter.Instance}}"
IsChecked="{Binding KeepDirectoryStructure, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}" Margin="0 5 0 10"/>
<TextBlock Grid.Row="16" Grid.Column="0" Text="Local Mapping File" VerticalAlignment="Center" Margin="0 0 0 5" />
<CheckBox Grid.Row="16" Grid.Column="2" Margin="0 5 0 10"
<TextBlock Grid.Row="15" Grid.Column="0" Text="Local Mapping File" VerticalAlignment="Center" Margin="0 0 0 5" />
<CheckBox Grid.Row="15" Grid.Column="2" Margin="0 5 0 10"
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.SettingsView}}}"
Content="{Binding IsChecked, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BoolToToggleConverter.Instance}}"
IsChecked="{Binding SettingsView.MappingEndpoint.Overwrite, Mode=TwoWay}" />
<TextBlock Grid.Row="17" Grid.Column="0" Text="Mapping File Path" VerticalAlignment="Center" Margin="0 0 0 5"
<TextBlock Grid.Row="16" Grid.Column="0" Text="Mapping File Path" VerticalAlignment="Center" Margin="0 0 0 5"
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.SettingsView}}}"
Visibility="{Binding SettingsView.MappingEndpoint.Overwrite, Converter={StaticResource BoolToVisibilityConverter}}" />
<TextBox Grid.Row="17" Grid.Column="2" Grid.ColumnSpan="3" Margin="0 0 0 5" Text="{Binding SettingsView.MappingEndpoint.FilePath, Mode=TwoWay}"
<TextBox Grid.Row="16" Grid.Column="2" Grid.ColumnSpan="3" Margin="0 0 0 5" Text="{Binding SettingsView.MappingEndpoint.FilePath, Mode=TwoWay}"
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.SettingsView}}}"
Visibility="{Binding SettingsView.MappingEndpoint.Overwrite, Converter={StaticResource BoolToVisibilityConverter}}" />
<Button Grid.Row="17" Grid.Column="6" Content="..." HorizontalAlignment="Right" Click="OnBrowseMappings" Margin="0 0 0 5"
<Button Grid.Row="16" Grid.Column="6" Content="..." HorizontalAlignment="Right" Click="OnBrowseMappings" Margin="0 0 0 5"
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.SettingsView}}}"
Visibility="{Binding SettingsView.MappingEndpoint.Overwrite, Converter={StaticResource BoolToVisibilityConverter}}" />
</Grid>

View File

@ -30,11 +30,6 @@ public partial class SettingsView
}
}
private async void OnLoaded(object sender, RoutedEventArgs e)
{
await _applicationView.SettingsView.InitPresets(_applicationView.CUE4Parse.Provider.GameName);
}
private async void OnClick(object sender, RoutedEventArgs e)
{
var restart = _applicationView.SettingsView.Save(out var whatShouldIDo);
@ -154,19 +149,9 @@ public partial class SettingsView
}
}
private void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (sender is not ComboBox { SelectedItem: string s }) return;
if (s == Constants._NO_PRESET_TRIGGER) _applicationView.SettingsView.ResetPreset();
else _applicationView.SettingsView.SwitchPreset(s);
}
private void OpenCustomVersions(object sender, RoutedEventArgs e)
{
var editor = new DictionaryEditor(
_applicationView.SettingsView.SelectedCustomVersions,
"Versioning Configuration (Custom Versions)",
_applicationView.SettingsView.EnableElements);
var editor = new DictionaryEditor(_applicationView.SettingsView.SelectedCustomVersions, "Versioning Configuration (Custom Versions)");
var result = editor.ShowDialog();
if (!result.HasValue || !result.Value)
return;
@ -176,10 +161,7 @@ public partial class SettingsView
private void OpenOptions(object sender, RoutedEventArgs e)
{
var editor = new DictionaryEditor(
_applicationView.SettingsView.SelectedOptions,
"Versioning Configuration (Options)",
_applicationView.SettingsView.EnableElements);
var editor = new DictionaryEditor(_applicationView.SettingsView.SelectedOptions, "Versioning Configuration (Options)");
var result = editor.ShowDialog();
if (!result.HasValue || !result.Value)
return;
@ -189,10 +171,7 @@ public partial class SettingsView
private void OpenMapStructTypes(object sender, RoutedEventArgs e)
{
var editor = new DictionaryEditor(
_applicationView.SettingsView.SelectedMapStructTypes,
"MapStructTypes",
_applicationView.SettingsView.EnableElements);
var editor = new DictionaryEditor(_applicationView.SettingsView.SelectedMapStructTypes, "Versioning Configuration (MapStructTypes)");
var result = editor.ShowDialog();
if (!result.HasValue || !result.Value)
return;

View File

@ -60,7 +60,7 @@ public class Options
["tl_next"] = new ("tl_next"),
};
_platform = UserSettings.Default.OverridedPlatform;
_platform = UserSettings.Default.CurrentDir.TexturePlatform;
_game = Services.ApplicationService.ApplicationView.CUE4Parse.Provider.GameName.ToUpper();
SelectModel(Guid.Empty);
@ -231,7 +231,7 @@ public class Options
MaterialFormat = UserSettings.Default.MaterialExportFormat,
TextureFormat = UserSettings.Default.TextureExportFormat,
SocketFormat = UserSettings.Default.SocketExportFormat,
Platform = UserSettings.Default.OverridedPlatform,
Platform = _platform,
ExportMorphTargets = UserSettings.Default.SaveMorphTargets
};
var toSave = new Exporter(export, exportOptions);