added /Plugins/GameFeatures/ icon detection support

This commit is contained in:
iAmAsval
2020-08-30 23:32:09 +02:00
parent c6fb79de67
commit 1e905ae7c2
7 changed files with 43 additions and 13 deletions

View File

@@ -82,6 +82,7 @@ namespace FModel.Creator
case "FortHomebaseNodeItemDefinition":
case "FortWeaponRangedItemDefinition":
case "FortNeverPersistItemDefinition":
case "RadioContentSourceItemDefinition":
case "FortPlaysetGrenadeItemDefinition":
case "FortPersonalVehicleItemDefinition":
case "FortHardcoreModifierItemDefinition":

View File

@@ -65,7 +65,7 @@ namespace PakReader.Pak
}
public bool TestAesKey(byte[] bytes, byte[] key)
{
BinaryReader IndexReader = new BinaryReader(new MemoryStream(AESDecryptor.DecryptAES(bytes, key)));
using BinaryReader IndexReader = new BinaryReader(new MemoryStream(AESDecryptor.DecryptAES(bytes, key)));
int stringLen = IndexReader.ReadInt32();
if (stringLen > 128 || stringLen < -128)
{
@@ -190,9 +190,7 @@ namespace PakReader.Pak
}
}
Paks.Merge(tempFiles, out var files, MountPoint);
Entries = files;
Paks.Merge(tempFiles, out Entries, MountPoint);
DebugHelper.WriteLine("{0} {1} {2} {3}", "[FModel]", "[PakFileReader]", "[ReadIndexInternal]", $"{FileName} contains {Entries.Count} files, mount point: \"{this.MountPoint}\", version: {(int)this.Info.Version}");
if (Info.bEncryptedIndex)

View File

@@ -114,6 +114,17 @@ namespace PakReader.Pak
}
return default;
}
public T GetTypedExport<T>(string exportType) where T : IUExport
{
int index = 0;
var exportTypes = ExportTypes;
for (int i = 0; i < exportTypes.Length; i++)
{
if (exportTypes[i].String == exportType)
index = i;
}
return (T)Exports[index];
}
public bool HasExport() => exports != null;

View File

@@ -23,10 +23,18 @@ namespace PakReader.Parsers.Class
List<byte> data = new List<byte>();
if (PlatformDatas[0].Mips.Length > 0)
{
sizeX = PlatformDatas[0].Mips[0].SizeX;
sizeY = PlatformDatas[0].Mips[0].SizeY;
sizeZ = PlatformDatas[0].Mips[0].SizeZ;
data.AddRange(PlatformDatas[0].Mips[0].BulkData.Data);
int i = 0;
byte[] d = PlatformDatas[0].Mips[i].BulkData.Data;
while (d == null)
{
i++;
d = PlatformDatas[0].Mips[i].BulkData.Data;
}
sizeX = PlatformDatas[0].Mips[i].SizeX;
sizeY = PlatformDatas[0].Mips[i].SizeY;
sizeZ = PlatformDatas[0].Mips[i].SizeZ;
data.AddRange(d);
}
//if (PlatformDatas[0].bIsVirtual)

View File

@@ -23,7 +23,6 @@ using System.Threading;
using SkiaSharp;
using System.Text;
using FModel.ViewModels.DataGrid;
using FModel.PakReader;
using ICSharpCode.AvalonEdit.Highlighting;
using static FModel.Creator.Creator;

View File

@@ -21,8 +21,22 @@ namespace FModel.Utils
if (string.IsNullOrWhiteSpace(path))
return string.Empty;
Regex regexGame = new Regex(Regex.Escape("Game"));
string fixedPath = regexGame.Replace(path, $"{Folders.GetGameName()}/Content", 1);
string trigger;
{
string tempPath = path.Substring(1);
trigger = tempPath.Substring(0, tempPath.IndexOf("/"));
if (trigger.Equals("SrirachaRanch"))
trigger = $"{trigger}/{trigger}Core";
}
Regex regex = new Regex(Regex.Escape(trigger));
string fixedPath = trigger switch
{
"Game" => regex.Replace(path, $"{Folders.GetGameName()}/Content", 1),
_ => regex.Replace(path, $"{Folders.GetGameName()}/Plugins/GameFeatures/{trigger}/Content", 1)
};
int sep = fixedPath.LastIndexOf('.');
return fixedPath.Substring(0, sep > 0 ? sep : fixedPath.Length);
}