mirror of
https://github.com/4sval/FModel.git
synced 2026-03-21 17:24:26 -05:00
as long as c4p knows the format and the decoder is named *dec.exe with -i -o args in .data/
This commit is contained in:
parent
ae0e638854
commit
91edf0352e
|
|
@ -1 +1 @@
|
|||
Subproject commit 6e13883a127500e4a3798cf79cf216466a8764b7
|
||||
Subproject commit 4e17d5eec5c9cb998162ef75492fd4f3c1d113b2
|
||||
|
|
@ -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<CallerEnricher>()
|
||||
.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();
|
||||
|
||||
|
|
|
|||
|
|
@ -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 <SetName>{0}</> set.");
|
||||
return Utils.RemoveHtmlTags(string.Format(format, name));
|
||||
}
|
||||
|
||||
protected (int, int) GetInternalSID(int number)
|
||||
|
|
|
|||
|
|
@ -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<UTexture2D>());
|
||||
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>(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());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,19 +11,19 @@ public class FortniteCentralApiEndpoint : AbstractApiProvider
|
|||
{
|
||||
public FortniteCentralApiEndpoint(RestClient client) : base(client) { }
|
||||
|
||||
public async Task<Dictionary<string, Dictionary<string, string>>> GetHotfixesAsync(CancellationToken token, string language = "en")
|
||||
public async Task<IDictionary<string, IDictionary<string, string>>> 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<Dictionary<string, Dictionary<string, string>>>(request, token).ConfigureAwait(false);
|
||||
var response = await _client.ExecuteAsync<IDictionary<string, IDictionary<string, string>>>(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<string, Dictionary<string, string>> GetHotfixes(CancellationToken token, string language = "en")
|
||||
public IDictionary<string, IDictionary<string, string>> GetHotfixes(CancellationToken token, string language = "en")
|
||||
{
|
||||
return GetHotfixesAsync(token, language).GetAwaiter().GetResult();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<string, string>();
|
||||
|
||||
foreach (var keyValue in entries.Value)
|
||||
{
|
||||
Provider.LocalizedResources[entries.Key][keyValue.Key] = keyValue.Value;
|
||||
LocalizedResourcesCount++;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user