mirror of
https://github.com/4sval/FModel.git
synced 2026-09-26 02:58:38 -05:00
added /Plugins/GameFeatures/ icon detection support
This commit is contained in:
@@ -82,6 +82,7 @@ namespace FModel.Creator
|
||||
case "FortHomebaseNodeItemDefinition":
|
||||
case "FortWeaponRangedItemDefinition":
|
||||
case "FortNeverPersistItemDefinition":
|
||||
case "RadioContentSourceItemDefinition":
|
||||
case "FortPlaysetGrenadeItemDefinition":
|
||||
case "FortPersonalVehicleItemDefinition":
|
||||
case "FortHardcoreModifierItemDefinition":
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user