diff --git a/CUE4Parse b/CUE4Parse index 6e13883a..4e17d5ee 160000 --- a/CUE4Parse +++ b/CUE4Parse @@ -1 +1 @@ -Subproject commit 6e13883a127500e4a3798cf79cf216466a8764b7 +Subproject commit 4e17d5eec5c9cb998162ef75492fd4f3c1d113b2 diff --git a/FModel/App.xaml.cs b/FModel/App.xaml.cs index a38dd3bd..95007ca9 100644 --- a/FModel/App.xaml.cs +++ b/FModel/App.xaml.cs @@ -111,11 +111,11 @@ public partial class App .MinimumLevel.Verbose() .WriteTo.Console(outputTemplate: template, theme: AnsiConsoleTheme.Literate) .WriteTo.File(outputTemplate: template, - path: Path.Combine(UserSettings.Default.OutputDirectory, "Logs", $"FModel-Debug-Log-{DateTime.Now:yyyy-MM-dd}.txt")) + path: Path.Combine(UserSettings.Default.OutputDirectory, "Logs", $"FModel-Debug-Log-{DateTime.Now:yyyy-MM-dd}.log")) #else .Enrich.With() .WriteTo.File(outputTemplate: template, - path: Path.Combine(UserSettings.Default.OutputDirectory, "Logs", $"FModel-Log-{DateTime.Now:yyyy-MM-dd}.txt")) + path: Path.Combine(UserSettings.Default.OutputDirectory, "Logs", $"FModel-Log-{DateTime.Now:yyyy-MM-dd}.log")) #endif .CreateLogger(); diff --git a/FModel/Creator/Bases/FN/BaseIcon.cs b/FModel/Creator/Bases/FN/BaseIcon.cs index d8616c09..43fa2073 100644 --- a/FModel/Creator/Bases/FN/BaseIcon.cs +++ b/FModel/Creator/Bases/FN/BaseIcon.cs @@ -217,8 +217,8 @@ public class BaseIcon : UCreator if (uObject.TryGetValue(out FText displayName, "DisplayName")) name = displayName.Text; - var format = Utils.GetLocalizedResource("Fort.Cosmetics", "CosmeticItemDescription_SetMembership_NotRich", "\nPart of the {0} set."); - return string.Format(format, name); + var format = Utils.GetLocalizedResource("Fort.Cosmetics", "CosmeticItemDescription_SetMembership", "\nPart of the {0} set."); + return Utils.RemoveHtmlTags(string.Format(format, name)); } protected (int, int) GetInternalSID(int number) diff --git a/FModel/Creator/Utils.cs b/FModel/Creator/Utils.cs index d12814fd..f9c22dc5 100644 --- a/FModel/Creator/Utils.cs +++ b/FModel/Creator/Utils.cs @@ -128,7 +128,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(FSoftObjectPath softObjectPath) => GetBitmap(softObjectPath.Load()); public static SKBitmap GetBitmap(string fullPath) => TryLoadObject(fullPath, out UTexture2D texture) ? GetBitmap(texture) : null; public static SKBitmap GetBitmap(UTexture2D texture) => texture.Decode(UserSettings.Default.CurrentDir.TexturePlatform); public static SKBitmap GetBitmap(byte[] data) => SKBitmap.Decode(data); @@ -195,11 +195,11 @@ public static class Utils public static string GetLocalizedResource(string @namespace, string key, string defaultValue) { - return _applicationView.CUE4Parse.Provider.GetLocalizedString(@namespace, key, defaultValue); + return _applicationView.CUE4Parse.Provider.Internationalization.SafeGet(@namespace, key, defaultValue); } public static string GetLocalizedResource(T @enum) where T : Enum { - var resource = _applicationView.CUE4Parse.Provider.GetLocalizedString("", @enum.GetDescription(), @enum.ToString()); + var resource = _applicationView.CUE4Parse.Provider.Internationalization.SafeGet("", @enum.GetDescription(), @enum.ToString()); return CultureInfo.CurrentCulture.TextInfo.ToTitleCase(resource.ToLower()); } diff --git a/FModel/ViewModels/ApiEndpoints/FortniteCentralApiEndpoint.cs b/FModel/ViewModels/ApiEndpoints/FortniteCentralApiEndpoint.cs index 82af932f..47daac49 100644 --- a/FModel/ViewModels/ApiEndpoints/FortniteCentralApiEndpoint.cs +++ b/FModel/ViewModels/ApiEndpoints/FortniteCentralApiEndpoint.cs @@ -11,19 +11,19 @@ public class FortniteCentralApiEndpoint : AbstractApiProvider { public FortniteCentralApiEndpoint(RestClient client) : base(client) { } - public async Task>> GetHotfixesAsync(CancellationToken token, string language = "en") + public async Task>> GetHotfixesAsync(CancellationToken token, string language = "en") { var request = new FRestRequest("https://fortnitecentral.genxgames.gg/api/v1/hotfixes") { Interceptors = [_interceptor] }; request.AddParameter("lang", language); - var response = await _client.ExecuteAsync>>(request, token).ConfigureAwait(false); + var response = await _client.ExecuteAsync>>(request, token).ConfigureAwait(false); Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, response.ResponseUri?.OriginalString); return response.Data; } - public Dictionary> GetHotfixes(CancellationToken token, string language = "en") + public IDictionary> GetHotfixes(CancellationToken token, string language = "en") { return GetHotfixesAsync(token, language).GetAwaiter().GetResult(); } diff --git a/FModel/ViewModels/AudioPlayerViewModel.cs b/FModel/ViewModels/AudioPlayerViewModel.cs index cf577f52..3f4ad78d 100644 --- a/FModel/ViewModels/AudioPlayerViewModel.cs +++ b/FModel/ViewModels/AudioPlayerViewModel.cs @@ -564,9 +564,10 @@ public class AudioPlayerViewModel : ViewModel, ISource, IDisposable return false; } + case "rada": case "binka": { - if (TryDecode(out var rawFilePath)) + if (TryDecode(SelectedAudioFile.Extension, out var rawFilePath)) { var newAudio = new AudioFile(SelectedAudioFile.Id, new FileInfo(rawFilePath)); Replace(newAudio); @@ -608,11 +609,11 @@ public class AudioPlayerViewModel : ViewModel, ISource, IDisposable return vgmProcess?.ExitCode == 0 && File.Exists(wavFilePath); } - private bool TryDecode(out string rawFilePath) + private bool TryDecode(string extension, out string rawFilePath) { rawFilePath = string.Empty; - var binkadecPath = Path.Combine(UserSettings.Default.OutputDirectory, ".data", "binkadec.exe"); - if (!File.Exists(binkadecPath)) + var decoderPath = Path.Combine(UserSettings.Default.OutputDirectory, ".data", $"{extension}dec.exe"); + if (!File.Exists(decoderPath)) { return false; } @@ -621,16 +622,16 @@ public class AudioPlayerViewModel : ViewModel, ISource, IDisposable File.WriteAllBytes(SelectedAudioFile.FilePath, SelectedAudioFile.Data); rawFilePath = Path.ChangeExtension(SelectedAudioFile.FilePath, ".wav"); - var binkadecProcess = Process.Start(new ProcessStartInfo + var decoderProcess = Process.Start(new ProcessStartInfo { - FileName = binkadecPath, + FileName = decoderPath, Arguments = $"-i \"{SelectedAudioFile.FilePath}\" -o \"{rawFilePath}\"", UseShellExecute = false, CreateNoWindow = true }); - binkadecProcess?.WaitForExit(5000); + decoderProcess?.WaitForExit(5000); File.Delete(SelectedAudioFile.FilePath); - return binkadecProcess?.ExitCode == 0 && File.Exists(rawFilePath); + return decoderProcess?.ExitCode == 0 && File.Exists(rawFilePath); } } diff --git a/FModel/ViewModels/CUE4ParseViewModel.cs b/FModel/ViewModels/CUE4ParseViewModel.cs index 2d668df1..f748edfe 100644 --- a/FModel/ViewModels/CUE4ParseViewModel.cs +++ b/FModel/ViewModels/CUE4ParseViewModel.cs @@ -271,7 +271,7 @@ public class CUE4ParseViewModel : ViewModel } Provider.Initialize(); - Log.Information($"{Provider.Versions.Game} ({Provider.Versions.Platform}) | Archives: x{Provider.UnloadedVfs.Count} | AES: x{Provider.RequiredKeys.Count}"); + Log.Information($"{Provider.Versions.Game} ({Provider.Versions.Platform}) | Archives: x{Provider.UnloadedVfs.Count} | AES: x{Provider.RequiredKeys.Count} | Loose Files: x{Provider.Files.Count}"); }); } @@ -286,7 +286,7 @@ public class CUE4ParseViewModel : ViewModel var aesMax = Provider.RequiredKeys.Count + Provider.Keys.Count; var archiveMax = Provider.UnloadedVfs.Count + Provider.MountedVfs.Count; - Log.Information($"Project: {Provider.ProjectName} | Mounted: {Provider.MountedVfs.Count}/{archiveMax} | AES: {Provider.Keys.Count}/{aesMax}"); + Log.Information($"Project: {Provider.ProjectName} | Mounted: {Provider.MountedVfs.Count}/{archiveMax} | AES: {Provider.Keys.Count}/{aesMax} | Files: x{Provider.Files.Count}"); } public void ClearProvider() @@ -442,6 +442,8 @@ public class CUE4ParseViewModel : ViewModel { var snapshot = LocalizedResourcesCount; await Task.WhenAll(LoadGameLocalizedResources(), LoadHotfixedLocalizedResources()).ConfigureAwait(false); + + LocalizedResourcesCount = Provider.Internationalization.Count; if (snapshot != LocalizedResourcesCount) { FLogger.Append(ELog.Information, () => @@ -454,8 +456,7 @@ public class CUE4ParseViewModel : ViewModel if (LocalResourcesDone) return Task.CompletedTask; return Task.Run(() => { - LocalizedResourcesCount += Provider.LoadLocalization(UserSettings.Default.AssetLanguage); - LocalResourcesDone = true; + LocalResourcesDone = Provider.TryChangeCulture(Provider.GetLanguageCode(UserSettings.Default.AssetLanguage)); }); } private Task LoadHotfixedLocalizedResources() @@ -466,18 +467,8 @@ public class CUE4ParseViewModel : ViewModel var hotfixes = ApplicationService.ApiEndpointView.CentralApi.GetHotfixes(default, Provider.GetLanguageCode(UserSettings.Default.AssetLanguage)); if (hotfixes == null) return; + Provider.Internationalization.Override(hotfixes); HotfixedResourcesDone = true; - foreach (var entries in hotfixes) - { - if (!Provider.LocalizedResources.ContainsKey(entries.Key)) - Provider.LocalizedResources[entries.Key] = new Dictionary(); - - foreach (var keyValue in entries.Value) - { - Provider.LocalizedResources[entries.Key][keyValue.Key] = keyValue.Value; - LocalizedResourcesCount++; - } - } }); }