mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2026-05-14 17:05:10 +08:00
FBX importer v1, fix for YNDs DLC loading, fix for renamed NG encrypted RPFs, RelFile MetaNames addition
This commit is contained in:
@@ -4932,7 +4932,7 @@ namespace CodeWalker.GameFiles
|
||||
VehicleEngine = 4,
|
||||
Entity = 5, //not sure about this
|
||||
StaticEmitter = 6,//radio emitter?
|
||||
Prop = 7,//prop? eg. fan, radar
|
||||
Prop = 7,//prop? entity emitter? eg. fan, radar
|
||||
Helicopter = 8,
|
||||
Unk9 = 9,
|
||||
Unk11 = 11, //contains reference to Unk12
|
||||
|
||||
@@ -1014,33 +1014,41 @@ namespace CodeWalker.GameFiles
|
||||
//}
|
||||
if (entry.Name.EndsWith(".ymf"))// || entry.Name.EndsWith(".ymt"))
|
||||
{
|
||||
UpdateStatus(string.Format(entry.Path));
|
||||
YmfFile ymffile = RpfMan.GetFile<YmfFile>(entry);
|
||||
if (ymffile != null)
|
||||
try
|
||||
{
|
||||
AllManifests.Add(ymffile);
|
||||
|
||||
if (ymffile.Pso != null)
|
||||
{ }
|
||||
else if (ymffile.Rbf != null)
|
||||
{ }
|
||||
else if (ymffile.Meta != null)
|
||||
{ }
|
||||
else
|
||||
{ }
|
||||
|
||||
|
||||
if (ymffile.HDTxdAssetBindings != null)
|
||||
UpdateStatus(string.Format(entry.Path));
|
||||
YmfFile ymffile = RpfMan.GetFile<YmfFile>(entry);
|
||||
if (ymffile != null)
|
||||
{
|
||||
for (int i = 0; i < ymffile.HDTxdAssetBindings.Length; i++)
|
||||
{
|
||||
var b = ymffile.HDTxdAssetBindings[i];
|
||||
var targetasset = JenkHash.GenHash(b.targetAsset.ToString().ToLowerInvariant());
|
||||
var hdtxd = JenkHash.GenHash(b.HDTxd.ToString().ToLowerInvariant());
|
||||
hdtexturelookup[targetasset] = hdtxd;
|
||||
}
|
||||
}
|
||||
AllManifests.Add(ymffile);
|
||||
|
||||
if (ymffile.Pso != null)
|
||||
{ }
|
||||
else if (ymffile.Rbf != null)
|
||||
{ }
|
||||
else if (ymffile.Meta != null)
|
||||
{ }
|
||||
else
|
||||
{ }
|
||||
|
||||
|
||||
if (ymffile.HDTxdAssetBindings != null)
|
||||
{
|
||||
for (int i = 0; i < ymffile.HDTxdAssetBindings.Length; i++)
|
||||
{
|
||||
var b = ymffile.HDTxdAssetBindings[i];
|
||||
var targetasset = JenkHash.GenHash(b.targetAsset.ToString().ToLowerInvariant());
|
||||
var hdtxd = JenkHash.GenHash(b.HDTxd.ToString().ToLowerInvariant());
|
||||
hdtexturelookup[targetasset] = hdtxd;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string errstr = entry.Path + "\n" + ex.ToString();
|
||||
ErrorLog(errstr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2363,9 +2371,6 @@ namespace CodeWalker.GameFiles
|
||||
{
|
||||
UpdateStatus("Testing Audio REL files");
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder sbh = new StringBuilder();
|
||||
StringBuilder sbi = new StringBuilder();
|
||||
|
||||
bool savetest = true;
|
||||
bool xmltest = true;
|
||||
@@ -2386,82 +2391,6 @@ namespace CodeWalker.GameFiles
|
||||
RpfMan.LoadFile(rel, rfe);
|
||||
|
||||
|
||||
#region string building
|
||||
|
||||
if (rel.NameTable == null)
|
||||
{
|
||||
sb.AppendLine(rfe.Path + ": no strings found");
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.AppendLine(rfe.Path + ": " + rel.NameTable.Length.ToString() + " strings found:");
|
||||
foreach (string str in rel.NameTable)
|
||||
{
|
||||
sb.AppendLine(str);
|
||||
}
|
||||
}
|
||||
if (rel.IndexStrings != null)
|
||||
{
|
||||
sb.AppendLine("Config-specific:");
|
||||
foreach (var unk in rel.IndexStrings)
|
||||
{
|
||||
sb.AppendLine(unk.ToString());
|
||||
}
|
||||
}
|
||||
if (rel.IndexHashes != null)
|
||||
{
|
||||
sbh.AppendLine(rfe.Path + ": " + rel.IndexHashes.Length.ToString() + " entries:");
|
||||
foreach (var unk in rel.IndexHashes)
|
||||
{
|
||||
sbh.Append(unk.Name.Hash.ToString("X8"));
|
||||
string strval;
|
||||
if (JenkIndex.Index.TryGetValue(unk.Name, out strval))
|
||||
{
|
||||
sbh.Append(" - ");
|
||||
sbh.Append(strval);
|
||||
}
|
||||
sbh.AppendLine();
|
||||
//sbh.AppendLine(unk.ToString());
|
||||
}
|
||||
sbh.AppendLine();
|
||||
}
|
||||
if (rel.HashTable != null)
|
||||
{
|
||||
sbh.AppendLine(rfe.Path + ": " + rel.HashTable.Length.ToString() + " Hashes1:");
|
||||
foreach (var unk in rel.HashTable)
|
||||
{
|
||||
sbh.Append(unk.Hash.ToString("X8"));
|
||||
string strval;
|
||||
if (JenkIndex.Index.TryGetValue(unk, out strval))
|
||||
{
|
||||
sbh.Append(" - ");
|
||||
sbh.Append(strval);
|
||||
}
|
||||
sbh.AppendLine();
|
||||
}
|
||||
sbh.AppendLine();
|
||||
}
|
||||
if (rel.PackTable != null)
|
||||
{
|
||||
sbh.AppendLine(rfe.Path + ": " + rel.PackTable.Length.ToString() + " Hashes2:");
|
||||
foreach (var unk in rel.PackTable)
|
||||
{
|
||||
sbh.Append(unk.Hash.ToString("X8"));
|
||||
string strval;
|
||||
if (JenkIndex.Index.TryGetValue(unk, out strval))
|
||||
{
|
||||
sbh.Append(" - ");
|
||||
sbh.Append(strval);
|
||||
}
|
||||
sbh.AppendLine();
|
||||
}
|
||||
sbh.AppendLine();
|
||||
}
|
||||
|
||||
sb.AppendLine();
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
byte[] data;
|
||||
|
||||
@@ -2540,29 +2469,12 @@ namespace CodeWalker.GameFiles
|
||||
}
|
||||
|
||||
|
||||
//sbi.Clear();
|
||||
//foreach (var rd in rel.RelDatas)
|
||||
//{
|
||||
// sbi.AppendLine(new FlagsUint(rd.NameHash).Bin);
|
||||
//}
|
||||
//string indexbinstr = sbi.ToString();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//int ctot = Dat151RelData.TotCount;
|
||||
//StringBuilder sbp = new StringBuilder();
|
||||
//foreach (string s in Dat151RelData.FoundCoords)
|
||||
//{
|
||||
// sbp.AppendLine(s);
|
||||
//}
|
||||
//string posz = sbp.ToString();
|
||||
|
||||
string relstrs = sb.ToString();
|
||||
string hashstrs = sbh.ToString();
|
||||
|
||||
|
||||
var hashmap = RelFile.HashesMap;
|
||||
|
||||
@@ -3475,6 +3475,7 @@ namespace CodeWalker.GameFiles
|
||||
|
||||
silence = 3503773450, //used in game.dat151.rel
|
||||
null_sound = 3817852694, //used in game.dat151.rel
|
||||
constant_one = 3454258691, //used in dat .rels
|
||||
|
||||
run = 285848937, //used in game.dat151.rel
|
||||
cop_dispatch_interaction_settings = 778268174, //used in game.dat151.rel
|
||||
|
||||
@@ -775,8 +775,7 @@ namespace CodeWalker.GameFiles
|
||||
}
|
||||
}
|
||||
|
||||
[TC(typeof(EXP))]
|
||||
public struct BoundMaterial_s
|
||||
[TC(typeof(EXP))] public struct BoundMaterial_s
|
||||
{
|
||||
|
||||
public uint Data1;
|
||||
|
||||
@@ -122,13 +122,14 @@ namespace CodeWalker.GameFiles
|
||||
public MetaHash Name { get; set; } //530103687, 2401522793, 1912906641
|
||||
public uint Unknown_Ch { get; set; } // 0x00000000
|
||||
public byte ParameterCount { get; set; }
|
||||
public byte Unknown_11h { get; set; } // 2, 0,
|
||||
public ushort Unknown_12h { get; set; } // 32768
|
||||
public uint Unknown_14h { get; set; } //10485872, 17826000, 26214720
|
||||
public byte RenderBucket { get; set; } // 2, 0,
|
||||
public ushort Unknown_12h { get; set; } // 32768 HasComment?
|
||||
public ushort ParameterSize { get; set; } //112, 208, 320 (with 16h) 10485872, 17826000, 26214720
|
||||
public ushort ParameterDataSize { get; set; } //160, 272, 400
|
||||
public MetaHash FileName { get; set; } //2918136469, 2635608835, 2247429097
|
||||
public uint Unknown_1Ch { get; set; } // 0x00000000
|
||||
public uint Unknown_20h { get; set; } //65284, 65281
|
||||
public ushort Unknown_24h { get; set; } //0
|
||||
public uint RenderBucketMask { get; set; } //65284, 65281 DrawBucketMask? (1<<bucket) | 0xFF00
|
||||
public ushort Unknown_24h { get; set; } //0 Instanced?
|
||||
public byte Unknown_26h { get; set; } //0
|
||||
public byte TextureParametersCount { get; set; }
|
||||
public uint Unknown_28h { get; set; } // 0x00000000
|
||||
@@ -149,12 +150,13 @@ namespace CodeWalker.GameFiles
|
||||
this.Name = new MetaHash(reader.ReadUInt32());
|
||||
this.Unknown_Ch = reader.ReadUInt32();
|
||||
this.ParameterCount = reader.ReadByte();
|
||||
this.Unknown_11h = reader.ReadByte();
|
||||
this.RenderBucket = reader.ReadByte();
|
||||
this.Unknown_12h = reader.ReadUInt16();
|
||||
this.Unknown_14h = reader.ReadUInt32();
|
||||
this.ParameterSize = reader.ReadUInt16();
|
||||
this.ParameterDataSize = reader.ReadUInt16();
|
||||
this.FileName = new MetaHash(reader.ReadUInt32());
|
||||
this.Unknown_1Ch = reader.ReadUInt32();
|
||||
this.Unknown_20h = reader.ReadUInt32();
|
||||
this.RenderBucketMask = reader.ReadUInt32();
|
||||
this.Unknown_24h = reader.ReadUInt16();
|
||||
this.Unknown_26h = reader.ReadByte();
|
||||
this.TextureParametersCount = reader.ReadByte();
|
||||
@@ -182,12 +184,13 @@ namespace CodeWalker.GameFiles
|
||||
writer.Write(this.Name.Hash);
|
||||
writer.Write(this.Unknown_Ch);
|
||||
writer.Write(this.ParameterCount);
|
||||
writer.Write(this.Unknown_11h);
|
||||
writer.Write(this.RenderBucket);
|
||||
writer.Write(this.Unknown_12h);
|
||||
writer.Write(this.Unknown_14h);
|
||||
writer.Write(this.ParameterSize);
|
||||
writer.Write(this.ParameterDataSize);
|
||||
writer.Write(this.FileName.Hash);
|
||||
writer.Write(this.Unknown_1Ch);
|
||||
writer.Write(this.Unknown_20h);
|
||||
writer.Write(this.RenderBucketMask);
|
||||
writer.Write(this.Unknown_24h);
|
||||
writer.Write(this.Unknown_26h);
|
||||
writer.Write(this.TextureParametersCount);
|
||||
@@ -299,6 +302,32 @@ namespace CodeWalker.GameFiles
|
||||
}
|
||||
}
|
||||
|
||||
public ushort ParametersSize
|
||||
{
|
||||
get
|
||||
{
|
||||
ushort size = (ushort)((Parameters?.Length??0) * 16);
|
||||
foreach (var x in Parameters)
|
||||
{
|
||||
size += (ushort)(16 * x.DataType);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
}
|
||||
|
||||
public byte TextureParamsCount
|
||||
{
|
||||
get
|
||||
{
|
||||
byte c = 0;
|
||||
foreach (var x in Parameters)
|
||||
{
|
||||
if (x.DataType == 0) c++;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
public ShaderParameter[] Parameters { get; set; }
|
||||
public MetaName[] Hashes { get; set; }
|
||||
public int Count { get; set; }
|
||||
@@ -1049,8 +1078,9 @@ namespace CodeWalker.GameFiles
|
||||
public uint Unknown_14h { get; set; } // 0x00000000
|
||||
public ulong BoundsPointer { get; set; }
|
||||
public ulong ShaderMappingPointer { get; set; }
|
||||
public uint Unknown_28h { get; set; }
|
||||
public uint Unknown_2Ch { get; set; } //First byte is called "Mask" in GIMS EVO, third byte is always equal to GeometriesCount, is it ShaderMappingCount?
|
||||
public uint SkeletonBinding { get; set; }//4th byte is bone index, 2nd byte for skin meshes
|
||||
public ushort RenderMaskFlags { get; set; } //First byte is called "Mask" in GIMS EVO
|
||||
public ushort GeometriesCount3 { get; set; } //always equal to GeometriesCount, is it ShaderMappingCount?
|
||||
|
||||
// reference data
|
||||
public ResourcePointerArray64<DrawableGeometry> Geometries { get; set; }
|
||||
@@ -1116,8 +1146,10 @@ namespace CodeWalker.GameFiles
|
||||
this.Unknown_14h = reader.ReadUInt32();
|
||||
this.BoundsPointer = reader.ReadUInt64();
|
||||
this.ShaderMappingPointer = reader.ReadUInt64();
|
||||
this.Unknown_28h = reader.ReadUInt32();
|
||||
this.Unknown_2Ch = reader.ReadUInt32();
|
||||
this.SkeletonBinding = reader.ReadUInt32();
|
||||
this.RenderMaskFlags = reader.ReadUInt16();
|
||||
this.GeometriesCount3 = reader.ReadUInt16();
|
||||
|
||||
|
||||
// read reference data
|
||||
this.Geometries = reader.ReadBlockAt<ResourcePointerArray64<DrawableGeometry>>(
|
||||
@@ -1138,6 +1170,7 @@ namespace CodeWalker.GameFiles
|
||||
this.GeometriesPointer = (ulong)(this.Geometries != null ? this.Geometries.FilePosition : 0);
|
||||
this.GeometriesCount1 = (ushort)(this.Geometries != null ? this.Geometries.Count : 0);
|
||||
this.GeometriesCount2 = this.GeometriesCount1;//is this correct?
|
||||
this.GeometriesCount3 = this.GeometriesCount1;//is this correct?
|
||||
this.BoundsPointer = (ulong)(this.BoundsDataBlock != null ? this.BoundsDataBlock.FilePosition : 0);
|
||||
this.ShaderMappingPointer = (ulong)(this.ShaderMappingBlock != null ? this.ShaderMappingBlock.FilePosition : 0);
|
||||
|
||||
@@ -1151,8 +1184,9 @@ namespace CodeWalker.GameFiles
|
||||
writer.Write(this.Unknown_14h);
|
||||
writer.Write(this.BoundsPointer);
|
||||
writer.Write(this.ShaderMappingPointer);
|
||||
writer.Write(this.Unknown_28h);
|
||||
writer.Write(this.Unknown_2Ch);
|
||||
writer.Write(this.SkeletonBinding);
|
||||
writer.Write(this.RenderMaskFlags);
|
||||
writer.Write(this.GeometriesCount3);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -2137,16 +2171,17 @@ namespace CodeWalker.GameFiles
|
||||
public ulong DrawableModelsMediumPointer { get; set; }
|
||||
public ulong DrawableModelsLowPointer { get; set; }
|
||||
public ulong DrawableModelsVeryLowPointer { get; set; }
|
||||
public float LodGroupHigh { get; set; }
|
||||
public float LodGroupMed { get; set; }
|
||||
public float LodGroupLow { get; set; }
|
||||
public float LodGroupVlow { get; set; }
|
||||
public float LodDistHigh { get; set; }
|
||||
public float LodDistMed { get; set; }
|
||||
public float LodDistLow { get; set; }
|
||||
public float LodDistVlow { get; set; }
|
||||
public uint Unknown_80h { get; set; }
|
||||
public uint Unknown_84h { get; set; }
|
||||
public uint Unknown_88h { get; set; }
|
||||
public uint Unknown_8Ch { get; set; }
|
||||
public ulong JointsPointer { get; set; }
|
||||
public uint Unknown_98h { get; set; }
|
||||
public ushort Unknown_98h { get; set; }
|
||||
public ushort Unknown_9Ah { get; set; }
|
||||
public uint Unknown_9Ch { get; set; } // 0x00000000
|
||||
public ulong DrawableModelsXPointer { get; set; }
|
||||
|
||||
@@ -2207,16 +2242,17 @@ namespace CodeWalker.GameFiles
|
||||
this.DrawableModelsMediumPointer = reader.ReadUInt64();
|
||||
this.DrawableModelsLowPointer = reader.ReadUInt64();
|
||||
this.DrawableModelsVeryLowPointer = reader.ReadUInt64();
|
||||
this.LodGroupHigh = reader.ReadSingle();
|
||||
this.LodGroupMed = reader.ReadSingle();
|
||||
this.LodGroupLow = reader.ReadSingle();
|
||||
this.LodGroupVlow = reader.ReadSingle();
|
||||
this.LodDistHigh = reader.ReadSingle();
|
||||
this.LodDistMed = reader.ReadSingle();
|
||||
this.LodDistLow = reader.ReadSingle();
|
||||
this.LodDistVlow = reader.ReadSingle();
|
||||
this.Unknown_80h = reader.ReadUInt32();
|
||||
this.Unknown_84h = reader.ReadUInt32();
|
||||
this.Unknown_88h = reader.ReadUInt32();
|
||||
this.Unknown_8Ch = reader.ReadUInt32();
|
||||
this.JointsPointer = reader.ReadUInt64();
|
||||
this.Unknown_98h = reader.ReadUInt32();
|
||||
this.Unknown_98h = reader.ReadUInt16();
|
||||
this.Unknown_9Ah = reader.ReadUInt16();
|
||||
this.Unknown_9Ch = reader.ReadUInt32();
|
||||
this.DrawableModelsXPointer = reader.ReadUInt64();
|
||||
|
||||
@@ -2345,16 +2381,17 @@ namespace CodeWalker.GameFiles
|
||||
writer.Write(this.DrawableModelsMediumPointer);
|
||||
writer.Write(this.DrawableModelsLowPointer);
|
||||
writer.Write(this.DrawableModelsVeryLowPointer);
|
||||
writer.Write(this.LodGroupHigh);
|
||||
writer.Write(this.LodGroupMed);
|
||||
writer.Write(this.LodGroupLow);
|
||||
writer.Write(this.LodGroupVlow);
|
||||
writer.Write(this.LodDistHigh);
|
||||
writer.Write(this.LodDistMed);
|
||||
writer.Write(this.LodDistLow);
|
||||
writer.Write(this.LodDistVlow);
|
||||
writer.Write(this.Unknown_80h);
|
||||
writer.Write(this.Unknown_84h);
|
||||
writer.Write(this.Unknown_88h);
|
||||
writer.Write(this.Unknown_8Ch);
|
||||
writer.Write(this.JointsPointer);
|
||||
writer.Write(this.Unknown_98h);
|
||||
writer.Write(this.Unknown_9Ah);
|
||||
writer.Write(this.Unknown_9Ch);
|
||||
writer.Write(this.DrawableModelsXPointer);
|
||||
}
|
||||
|
||||
@@ -1644,7 +1644,7 @@ namespace CodeWalker.GameFiles
|
||||
//public ResourcePointerArray64<T> Entries;
|
||||
|
||||
public ulong[] data_pointers { get; private set; }
|
||||
public T[] data_items { get; private set; }
|
||||
public T[] data_items { get; set; }
|
||||
|
||||
private ResourcePointerArray64<T> data_block;//used for saving.
|
||||
|
||||
|
||||
@@ -74,6 +74,11 @@ namespace CodeWalker.GameFiles
|
||||
|
||||
rf.ScanStructure(updateStatus, errorLog);
|
||||
|
||||
if (rf.LastException != null) //incase of corrupted rpf (or renamed NG encrypted RPF)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
AddRpfFile(rf, false, false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -384,7 +389,7 @@ namespace CodeWalker.GameFiles
|
||||
}
|
||||
if (BuildExtendedJenkIndex)
|
||||
{
|
||||
if (nlow.EndsWith(".ydr") || nlow.EndsWith(".yft"))
|
||||
if (nlow.EndsWith(".ydr"))// || nlow.EndsWith(".yft")) //do yft's get lods?
|
||||
{
|
||||
var sname = nlow.Substring(0, nlow.Length - 4);
|
||||
JenkIndex.Ensure(sname + "_lod");
|
||||
|
||||
Reference in New Issue
Block a user