mirror of
https://github.com/4sval/FModel.git
synced 2026-12-04 23:02:22 -06:00
Ace Combat 8 localization / FN preview fix
This commit is contained in:
Submodule CUE4Parse updated: 52f96d60ea...6b8909bf96
@@ -47,14 +47,12 @@ public class BaseIcon : UCreator
|
||||
{
|
||||
if (isUsingDisplayAsset && Utils.TryGetDisplayAsset(Object, out var preview))
|
||||
Preview = preview;
|
||||
else if (Object.TryGetValue(out FPackageIndex itemDefinition, "HeroDefinition", "WeaponDefinition"))
|
||||
else if (Object.TryGetValue(out ILoadableObject itemDefinition, "HeroDefinition", "WeaponDefinition"))
|
||||
Preview = Utils.GetBitmap(itemDefinition);
|
||||
else if (Object.TryGetValue(out FSoftObjectPath largePreview, "LargePreviewImage", "EntryListIcon", "SmallPreviewImage", "BundleImage", "ItemDisplayAsset", "LargeIcon", "ToastIcon", "SmallIcon", "CartridgeIcon", "EffectIcon"))
|
||||
else if (Object.TryGetValue(out ILoadableObject largePreview, "LargePreviewImage", "EntryListIcon", "SmallPreviewImage", "BundleImage", "ItemDisplayAsset", "LargeIcon", "ToastIcon", "SmallIcon", "CartridgeIcon", "EffectIcon", "ToastIcon", "access_item"))
|
||||
Preview = Utils.GetBitmap(largePreview);
|
||||
else if (Object.TryGetValue(out string s, "LargePreviewImage") && !string.IsNullOrEmpty(s))
|
||||
Preview = Utils.GetBitmap(s);
|
||||
else if (Object.TryGetValue(out FPackageIndex otherPreview, "SmallPreviewImage", "ToastIcon", "access_item"))
|
||||
Preview = Utils.GetBitmap(otherPreview);
|
||||
else if (Object.TryGetValue(out UMaterialInstanceConstant materialInstancePreview, "EventCalloutImage"))
|
||||
Preview = Utils.GetBitmap(materialInstancePreview);
|
||||
else if (Object.TryGetValue(out FStructFallback brush, "IconBrush", "BuildingSymbolNormal") && brush.TryGetValue(out UTexture2D res, "ResourceObject"))
|
||||
|
||||
@@ -60,11 +60,11 @@ public static class Utils
|
||||
return preview != null;
|
||||
}
|
||||
|
||||
public static SKBitmap GetBitmap(FPackageIndex packageIndex)
|
||||
public static SKBitmap GetBitmap(ILoadableObject loadableObject)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
if (!TryGetPackageIndexExport(packageIndex, out UObject export)) return null;
|
||||
if (!loadableObject.TryLoad(out UObject export)) return null;
|
||||
switch (export)
|
||||
{
|
||||
case UTexture2D texture:
|
||||
@@ -74,13 +74,8 @@ public static class Utils
|
||||
default:
|
||||
{
|
||||
if (export.TryGetValue(out FInstancedStruct[] dataList, "DataList")) return GetBitmap(dataList);
|
||||
if (export.TryGetValue(out FSoftObjectPath previewImage, "LargePreviewImage", "SmallPreviewImage")) return GetBitmap(previewImage);
|
||||
if (export.TryGetValue(out ILoadableObject previewImage, "LargePreviewImage", "SmallPreviewImage")) return GetBitmap(previewImage);
|
||||
if (export.TryGetValue(out string largePreview, "LargePreviewImage")) return GetBitmap(largePreview);
|
||||
if (export.TryGetValue(out FPackageIndex smallPreview, "SmallPreviewImage"))
|
||||
{
|
||||
packageIndex = smallPreview;
|
||||
continue;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -128,7 +123,6 @@ 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.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).ToSkBitmap();
|
||||
public static SKBitmap GetBitmap(byte[] data) => SKBitmap.Decode(data);
|
||||
|
||||
@@ -19,6 +19,8 @@ using CUE4Parse.Encryption.Aes;
|
||||
using CUE4Parse.FileProvider;
|
||||
using CUE4Parse.FileProvider.Objects;
|
||||
using CUE4Parse.FileProvider.Vfs;
|
||||
using CUE4Parse.GameTypes.ACE8.Assets.Exports;
|
||||
using CUE4Parse.GameTypes.ACE8.Encryption;
|
||||
using CUE4Parse.GameTypes.Aion2.Objects;
|
||||
using CUE4Parse.GameTypes.AoC.Objects;
|
||||
using CUE4Parse.GameTypes.AshEchoes.FileProvider;
|
||||
@@ -749,6 +751,11 @@ public class CUE4ParseViewModel : ViewModel
|
||||
ProcessAion2DatFile(entry, updateUi, saveProperties);
|
||||
break;
|
||||
}
|
||||
case "dat" when Provider.Versions.Game is GAME_AceCombat8WingsofTheve:
|
||||
{
|
||||
ProcessACE8DatFile(entry, updateUi, saveProperties);
|
||||
break;
|
||||
}
|
||||
case "bytes" when Provider.Versions.Game is GAME_RocoKingdomWorld:
|
||||
{
|
||||
ProcessRocoBinFile(entry, updateUi, saveProperties);
|
||||
@@ -1067,6 +1074,7 @@ public class CUE4ParseViewModel : ViewModel
|
||||
}
|
||||
case "res": // just skip
|
||||
case "bytes": // wuthering waves
|
||||
case "ffxanim": // dead island 2
|
||||
break;
|
||||
default:
|
||||
{
|
||||
@@ -1190,6 +1198,43 @@ public class CUE4ParseViewModel : ViewModel
|
||||
|
||||
TabControl.SelectedTab.SetDocumentText(JsonConvert.SerializeObject(dbc, Formatting.Indented), saveProperties, updateUi);
|
||||
}
|
||||
|
||||
// Ace Combat 8
|
||||
void ProcessACE8DatFile(GameFile entry, bool updateUi, bool saveProperties)
|
||||
{
|
||||
TabControl.SelectedTab.Highlighter = AvalonExtensions.HighlighterSelector("json");
|
||||
|
||||
if (entry.NameWithoutExtension.EndsWith("_Cmn"))
|
||||
{
|
||||
TabControl.SelectedTab.SetDocumentText(JsonConvert.SerializeObject(ACE8LocDecrypt.ReadKeysDatFile(entry), Formatting.Indented), saveProperties, updateUi);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Provider.TryGetGameFile(entry.PathWithoutExtension[..^1] + "Cmn." + entry.Extension, out var keysDatFile))
|
||||
{
|
||||
var keys = ACE8LocDecrypt.ReadKeysDatFile(keysDatFile);
|
||||
var values = ACE8LocDecrypt.ReadDatFile(entry);
|
||||
var locTable = new Dictionary<string, string>(Math.Max(keys.Count, values.Length));
|
||||
var k = 0;
|
||||
for (var i = 0; i < values.Length; i++)
|
||||
{
|
||||
if (keys.TryGetValue(i, out var key))
|
||||
{
|
||||
locTable[key] = values[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
locTable[$"UnknownKey_{k++}"] = values[i];
|
||||
}
|
||||
}
|
||||
TabControl.SelectedTab.SetDocumentText(JsonConvert.SerializeObject(locTable, Formatting.Indented), saveProperties, updateUi);
|
||||
}
|
||||
else
|
||||
{
|
||||
TabControl.SelectedTab.SetDocumentText(JsonConvert.SerializeObject(ACE8LocDecrypt.ReadDatFile(entry), Formatting.Indented), saveProperties, updateUi);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private byte[] ProcessLuaFile(byte[] data)
|
||||
@@ -1259,6 +1304,8 @@ public class CUE4ParseViewModel : ViewModel
|
||||
if (CheckExport(cancellationToken, result.Package, i, ref showSnooper))
|
||||
break;
|
||||
}
|
||||
|
||||
if (showSnooper) SnooperViewer.Run();
|
||||
}
|
||||
|
||||
private bool CheckExport(CancellationToken cancellationToken, IPackage pkg, int index, ref bool showSnooper, EBulkType bulk = EBulkType.None) // return true once you want to stop searching for exports
|
||||
@@ -1276,11 +1323,21 @@ public class CUE4ParseViewModel : ViewModel
|
||||
{
|
||||
case UVerseDigest when isNone && pointer.Object.Value is UVerseDigest verseDigest:
|
||||
{
|
||||
if (!TabControl.CanAddTabs) return false;
|
||||
if (verseDigest.ReadableCode is null || !TabControl.CanAddTabs) return false;
|
||||
|
||||
TabControl.AddTab($"{verseDigest.Name}.verse");
|
||||
TabControl.SelectedTab.Highlighter = AvalonExtensions.HighlighterSelector("verse");
|
||||
TabControl.SelectedTab.SetDocumentText(verseDigest.ReadableCode, false, false);
|
||||
TabControl.SelectedTab.SetDocumentText(Encoding.UTF8.GetString(verseDigest.ReadableCode), false, false);
|
||||
return true;
|
||||
}
|
||||
// Ace Combat 8
|
||||
case ULuaScript when isNone && pointer.Object.Value is ULuaScript luaScript:
|
||||
{
|
||||
if (!TabControl.CanAddTabs) return false;
|
||||
|
||||
TabControl.AddTab($"{luaScript.Name}.lua");
|
||||
TabControl.SelectedTab.Highlighter = AvalonExtensions.HighlighterSelector("lua");
|
||||
TabControl.SelectedTab.SetDocumentText(luaScript.Code, false, false);
|
||||
return true;
|
||||
}
|
||||
case UTexture when (isNone || saveTextures) && pointer.Object.Value is UTexture texture:
|
||||
|
||||
Reference in New Issue
Block a user