Updated ResourceBaseTypes, added Save method to YtdFile

This commit is contained in:
dexy 2019-01-27 17:14:10 +11:00
parent 3e2dd89702
commit 3819d53890
13 changed files with 966 additions and 535 deletions

View File

@ -45,5 +45,13 @@ namespace CodeWalker.GameFiles
} }
public byte[] Save()
{
byte[] data = ResourceBuilder.Build(TextureDict, 13); //ytd is type/version 13...
return data;
}
} }
} }

View File

@ -164,19 +164,20 @@ namespace CodeWalker.GameFiles
RpfMan.BuildExtendedJenkIndex = BuildExtendedJenkIndex; RpfMan.BuildExtendedJenkIndex = BuildExtendedJenkIndex;
RpfMan.Init(GTAFolder, UpdateStatus, ErrorLog);//, true); RpfMan.Init(GTAFolder, UpdateStatus, ErrorLog);//, true);
//RE test area!
//TestAudioRels();
InitGlobal(); InitGlobal();
InitDlc(); InitDlc();
//RE test area!
//TestAudioRels();
//TestAudioYmts(); //TestAudioYmts();
//TestMetas(); //TestMetas();
//TestPsos(); //TestPsos();
//TestYcds(); //TestYcds();
//TestYtds();
//TestYmaps(); //TestYmaps();
//TestPlacements(); //TestPlacements();
//TestDrawables(); //TestDrawables();
@ -2106,13 +2107,11 @@ namespace CodeWalker.GameFiles
private void AddTextureLookups(YtdFile ytd) private void AddTextureLookups(YtdFile ytd)
{ {
if (ytd == null) return; if (ytd?.TextureDict?.TextureNameHashes?.data_items == null) return;
if (ytd.TextureDict == null) return;
if (ytd.TextureDict.TextureNameHashes == null) return;
lock (textureSyncRoot) lock (textureSyncRoot)
{ {
foreach (uint hash in ytd.TextureDict.TextureNameHashes) foreach (uint hash in ytd.TextureDict.TextureNameHashes.data_items)
{ {
textureLookup[hash] = ytd.RpfFileEntry; textureLookup[hash] = ytd.RpfFileEntry;
} }
@ -2864,6 +2863,66 @@ namespace CodeWalker.GameFiles
//{ //{
//} //}
} }
public void TestYtds()
{
var errorfiles = new List<RpfEntry>();
foreach (RpfFile file in AllRpfs)
{
foreach (RpfEntry entry in file.AllEntries)
{
//try
{
if (entry.NameLower.EndsWith(".ytd"))
{
UpdateStatus(string.Format(entry.Path));
YtdFile ytdfile = null;
try
{
ytdfile = RpfMan.GetFile<YtdFile>(entry);
}
catch(Exception ex)
{
UpdateStatus("Error! " + ex.ToString());
errorfiles.Add(entry);
}
if ((ytdfile != null) && (ytdfile.TextureDict != null))
{
var fentry = entry as RpfFileEntry;
if (fentry == null)
{ continue; } //shouldn't happen
var bytes = ytdfile.Save();
string origlen = TextUtil.GetBytesReadable(fentry.FileSize);
string bytelen = TextUtil.GetBytesReadable(bytes.Length);
if (ytdfile.TextureDict.Textures?.Count == 0)
{ }
var ytd2 = new YtdFile();
//ytd2.Load(bytes, fentry);
RpfFile.LoadResourceFile(ytd2, bytes, 13);
if (ytd2.TextureDict == null)
{ continue; }
if (ytd2.TextureDict.Textures?.Count != ytdfile.TextureDict.Textures?.Count)
{ continue; }
}
}
}
//catch (Exception ex)
//{
// UpdateStatus("Error! " + ex.ToString());
//}
}
}
if (errorfiles.Count > 0)
{ }
}
public void TestYmaps() public void TestYmaps()
{ {
foreach (RpfFile file in AllRpfs) foreach (RpfFile file in AllRpfs)

View File

@ -54,6 +54,8 @@ namespace CodeWalker.GameFiles
public string Name { get; private set; } public string Name { get; private set; }
//public string[] Strings { get; set; } //public string[] Strings { get; set; }
private string_r NameBlock = null;
/// <summary> /// <summary>
/// Reads the data-block from a stream. /// Reads the data-block from a stream.
@ -107,6 +109,9 @@ namespace CodeWalker.GameFiles
(ulong)this.NamePointer // offset (ulong)this.NamePointer // offset
); );
if (!string.IsNullOrEmpty(Name))
{ }
//Strings = MetaTypes.GetStrings(this); //Strings = MetaTypes.GetStrings(this);
} }
@ -121,7 +126,7 @@ namespace CodeWalker.GameFiles
this.StructureInfosPointer = this.StructureInfos?.FilePosition ?? 0; this.StructureInfosPointer = this.StructureInfos?.FilePosition ?? 0;
this.EnumInfosPointer = this.EnumInfos?.FilePosition ?? 0; this.EnumInfosPointer = this.EnumInfos?.FilePosition ?? 0;
this.DataBlocksPointer = this.DataBlocks?.FilePosition ?? 0; this.DataBlocksPointer = this.DataBlocks?.FilePosition ?? 0;
//this.NamePointer = this.Name?.Position ?? 0; //TODO: fix this.NamePointer = this.NameBlock?.FilePosition ?? 0;
this.UselessPointer = 0; this.UselessPointer = 0;
this.StructureInfosCount = (short)(this.StructureInfos?.Count ?? 0); this.StructureInfosCount = (short)(this.StructureInfos?.Count ?? 0);
this.EnumInfosCount = (short)(this.EnumInfos?.Count ?? 0); this.EnumInfosCount = (short)(this.EnumInfos?.Count ?? 0);
@ -162,7 +167,11 @@ namespace CodeWalker.GameFiles
if ((StructureInfos != null) && (StructureInfos.Count > 0)) list.Add(StructureInfos); if ((StructureInfos != null) && (StructureInfos.Count > 0)) list.Add(StructureInfos);
if ((EnumInfos != null) && (EnumInfos.Count > 0)) list.Add(EnumInfos); if ((EnumInfos != null) && (EnumInfos.Count > 0)) list.Add(EnumInfos);
if ((DataBlocks != null) && (DataBlocks.Count > 0)) list.Add(DataBlocks); if ((DataBlocks != null) && (DataBlocks.Count > 0)) list.Add(DataBlocks);
//if (Name != null) list.Add(Name); //TODO: fix if (!string.IsNullOrEmpty(Name))
{
NameBlock = (string_r)Name;
list.Add(NameBlock);
}
return list.ToArray(); return list.ToArray();
} }

View File

@ -53,9 +53,7 @@ namespace CodeWalker.GameFiles
public uint Unknown_14h { get; set; } // 0x00000001 public uint Unknown_14h { get; set; } // 0x00000001
public uint Unknown_18h { get; set; } // 0x00000001 public uint Unknown_18h { get; set; } // 0x00000001
public uint Unknown_1Ch { get; set; } // 0x00000001 public uint Unknown_1Ch { get; set; } // 0x00000001
//public ResourceSimpleList64<uint_r> BoundNameHashes; public ResourceSimpleList64_uint BoundNameHashes;
public ResourceSimpleList64Ptr BoundNameHashesPtr { get; set; }
public uint[] BoundNameHashes { get; set; }
public ResourcePointerList64<Bounds> Bounds { get; set; } public ResourcePointerList64<Bounds> Bounds { get; set; }
/// <summary> /// <summary>
@ -70,9 +68,7 @@ namespace CodeWalker.GameFiles
this.Unknown_14h = reader.ReadUInt32(); this.Unknown_14h = reader.ReadUInt32();
this.Unknown_18h = reader.ReadUInt32(); this.Unknown_18h = reader.ReadUInt32();
this.Unknown_1Ch = reader.ReadUInt32(); this.Unknown_1Ch = reader.ReadUInt32();
//this.BoundNameHashes = reader.ReadBlock<ResourceSimpleList64<uint_r>>(); this.BoundNameHashes = reader.ReadBlock<ResourceSimpleList64_uint>();
this.BoundNameHashesPtr = reader.ReadStruct<ResourceSimpleList64Ptr>();
this.BoundNameHashes = reader.ReadUintsAt(this.BoundNameHashesPtr.EntriesPointer, this.BoundNameHashesPtr.EntriesCount);
this.Bounds = reader.ReadBlock<ResourcePointerList64<Bounds>>(); this.Bounds = reader.ReadBlock<ResourcePointerList64<Bounds>>();
} }
@ -88,14 +84,14 @@ namespace CodeWalker.GameFiles
writer.Write(this.Unknown_14h); writer.Write(this.Unknown_14h);
writer.Write(this.Unknown_18h); writer.Write(this.Unknown_18h);
writer.Write(this.Unknown_1Ch); writer.Write(this.Unknown_1Ch);
//writer.WriteBlock(this.BoundNameHashes); //TODO: fix! writer.WriteBlock(this.BoundNameHashes);
//writer.WriteBlock(this.Bounds); writer.WriteBlock(this.Bounds);
} }
public override Tuple<long, IResourceBlock>[] GetParts() public override Tuple<long, IResourceBlock>[] GetParts()
{ {
return new Tuple<long, IResourceBlock>[] { return new Tuple<long, IResourceBlock>[] {
//new Tuple<long, IResourceBlock>(0x20, BoundNameHashes), //TODO: fix! new Tuple<long, IResourceBlock>(0x20, BoundNameHashes),
new Tuple<long, IResourceBlock>(0x30, Bounds) new Tuple<long, IResourceBlock>(0x30, Bounds)
}; };
} }
@ -196,16 +192,16 @@ namespace CodeWalker.GameFiles
writer.Write(this.BoundingSphereRadius); writer.Write(this.BoundingSphereRadius);
writer.Write(this.Unknown_18h); writer.Write(this.Unknown_18h);
writer.Write(this.Unknown_1Ch); writer.Write(this.Unknown_1Ch);
//writer.WriteBlock(this.BoundingBoxMax); //TODO: FIX!! writer.Write(this.BoundingBoxMax);
writer.Write(this.Margin); writer.Write(this.Margin);
//writer.WriteBlock(this.BoundingBoxMin); writer.Write(this.BoundingBoxMin);
writer.Write(this.Unknown_3Ch); writer.Write(this.Unknown_3Ch);
//writer.WriteBlock(this.BoundingBoxCenter); writer.Write(this.BoundingBoxCenter);
writer.Write(this.MaterialIndex); writer.Write(this.MaterialIndex);
writer.Write(this.ProceduralId); writer.Write(this.ProceduralId);
writer.Write(this.RoomId_and_PedDensity); writer.Write(this.RoomId_and_PedDensity);
writer.Write(this.Unknown_4Fh); writer.Write(this.Unknown_4Fh);
//writer.WriteBlock(this.Center); writer.Write(this.Center);
writer.Write(this.PolyFlags); writer.Write(this.PolyFlags);
writer.Write(this.MaterialColorIndex); writer.Write(this.MaterialColorIndex);
writer.Write(this.Unknown_5Eh); writer.Write(this.Unknown_5Eh);
@ -329,9 +325,7 @@ namespace CodeWalker.GameFiles
public BoundVertex_s[] p1data { get; set; } public BoundVertex_s[] p1data { get; set; }
public BoundPolygon[] Polygons { get; set; } public BoundPolygon[] Polygons { get; set; }
public Vector3[] Vertices { get; set; } public Vector3[] Vertices { get; set; }
public uint[] Unknown_B8h_Data { get; set; } public uint[] Unknown_B8h_Data { get; set; }
public uint[] Unknown_C0h_Data { get; set; } public uint[] Unknown_C0h_Data { get; set; }
@ -408,10 +402,9 @@ namespace CodeWalker.GameFiles
if (this.Unknown_C0h_Data != null) if (this.Unknown_C0h_Data != null)
{ {
ulong[] ptrlist = reader.ReadUlongsAt(this.Unknown_C8h_Pointer, (uint)Unknown_C0h_Data.Length);//8 ulong[] ptrlist = reader.ReadUlongsAt(this.Unknown_C8h_Pointer, 8);//(uint)Unknown_C0h_Data.Length
//reader.Position += Unknown_C0h_Data.Length * 8; //account for ptrlist read Unknown_C8h_Data = new uint[8][]; //Unknown_C0h_Data.Length
Unknown_C8h_Data = new uint[Unknown_C0h_Data.Length][]; //8 for (int i = 0; i < 8; i++) //Unknown_C0h_Data.Length
for (int i = 0; i < Unknown_C0h_Data.Length; i++) //8
{ {
Unknown_C8h_Data[i] = reader.ReadUintsAt(ptrlist[i], Unknown_C0h_Data[i]); Unknown_C8h_Data[i] = reader.ReadUintsAt(ptrlist[i], Unknown_C0h_Data[i]);
} }
@ -1091,9 +1084,10 @@ namespace CodeWalker.GameFiles
} }
// structure data // structure data
public ulong NodesPointer { get; set; } //public ulong NodesPointer { get; set; }
public uint NodesCount { get; set; } //public uint NodesCount { get; set; }
public uint Count2 { get; set; } //public uint Count2 { get; set; }
public ResourceSimpleList64b_s<BVHNode_s> Nodes { get; set; }
public uint Unknown_10h { get; set; } // 0x00000000 public uint Unknown_10h { get; set; } // 0x00000000
public uint Unknown_14h { get; set; } // 0x00000000 public uint Unknown_14h { get; set; } // 0x00000000
public uint Unknown_18h { get; set; } // 0x00000000 public uint Unknown_18h { get; set; } // 0x00000000
@ -1103,14 +1097,12 @@ namespace CodeWalker.GameFiles
public Vector4 BoundingBoxCenter { get; set; } public Vector4 BoundingBoxCenter { get; set; }
public Vector4 QuantumInverse { get; set; } public Vector4 QuantumInverse { get; set; }
public Vector4 Quantum { get; set; } // bounding box dimension / 2^16 public Vector4 Quantum { get; set; } // bounding box dimension / 2^16
//public ResourceSimpleList64<BVHTreeInfo> Trees { get; set; } public ResourceSimpleList64_s<BVHTreeInfo_s> Trees { get; set; }
public ResourceSimpleList64Ptr TreesPtr { get; set; }
public BVHTreeInfo_s[] Trees { get; set; }
// reference data // reference data
//public ResourceSimpleArray2<BVHNode, BVHNode_Unknown_B_003> Nodes; ////public ResourceSimpleArray2<BVHNode, BVHNode_Unknown_B_003> Nodes;
public BVHNode_s[] Nodes { get; set; } //public BVHNode_s[] Nodes { get; set; }
public BVHNode_s[] Nodes_Unk1 { get; set; } //public BVHNode_s[] Nodes_Unk1 { get; set; }
/// <summary> /// <summary>
/// Reads the data-block from a stream. /// Reads the data-block from a stream.
@ -1118,40 +1110,34 @@ namespace CodeWalker.GameFiles
public override void Read(ResourceDataReader reader, params object[] parameters) public override void Read(ResourceDataReader reader, params object[] parameters)
{ {
// read structure data // read structure data
this.NodesPointer = reader.ReadUInt64(); //this.NodesPointer = reader.ReadUInt64();
this.NodesCount = reader.ReadUInt32(); //this.NodesCount = reader.ReadUInt32();
this.Count2 = reader.ReadUInt32(); //this.Count2 = reader.ReadUInt32();
this.Nodes = reader.ReadBlock<ResourceSimpleList64b_s<BVHNode_s>>();
this.Unknown_10h = reader.ReadUInt32(); this.Unknown_10h = reader.ReadUInt32();
this.Unknown_14h = reader.ReadUInt32(); this.Unknown_14h = reader.ReadUInt32();
this.Unknown_18h = reader.ReadUInt32(); this.Unknown_18h = reader.ReadUInt32();
this.Unknown_1Ch = reader.ReadUInt32(); this.Unknown_1Ch = reader.ReadUInt32();
//this.BoundingBoxMin = reader.ReadBlock<Vector4_r>();
//this.BoundingBoxMax = reader.ReadBlock<Vector4_r>();
//this.BoundingBoxCenter = reader.ReadBlock<Vector4_r>();
//this.QuantumInverse = reader.ReadBlock<Vector4_r>();
//this.Quantum = reader.ReadBlock<Vector4_r>();
this.BoundingBoxMin = reader.ReadStruct<Vector4>(); this.BoundingBoxMin = reader.ReadStruct<Vector4>();
this.BoundingBoxMax = reader.ReadStruct<Vector4>(); this.BoundingBoxMax = reader.ReadStruct<Vector4>();
this.BoundingBoxCenter = reader.ReadStruct<Vector4>(); this.BoundingBoxCenter = reader.ReadStruct<Vector4>();
this.QuantumInverse = reader.ReadStruct<Vector4>(); this.QuantumInverse = reader.ReadStruct<Vector4>();
this.Quantum = reader.ReadStruct<Vector4>(); this.Quantum = reader.ReadStruct<Vector4>();
//this.Trees = reader.ReadBlock<ResourceSimpleList64<BVHTreeInfo>>(); this.Trees = reader.ReadBlock<ResourceSimpleList64_s<BVHTreeInfo_s>>();
this.TreesPtr = reader.ReadStruct<ResourceSimpleList64Ptr>();
this.Trees = reader.ReadStructsAt<BVHTreeInfo_s>(this.TreesPtr.EntriesPointer, this.TreesPtr.EntriesCount);
// read reference data // read reference data
//this.Nodes = reader.ReadBlockAt<ResourceSimpleArray2<BVHNode, BVHNode_Unknown_B_003>>( ////this.Nodes = reader.ReadBlockAt<ResourceSimpleArray2<BVHNode, BVHNode_Unknown_B_003>>(
// this.NodesPointer, // offset //// this.NodesPointer, // offset
// this.NodesCount, //// this.NodesCount,
// this.Count2 - this.NodesCount //// this.Count2 - this.NodesCount
//); ////);
this.Nodes = reader.ReadStructsAt<BVHNode_s>(this.NodesPointer, this.NodesCount);
this.Nodes_Unk1 = reader.ReadStructsAt<BVHNode_s>(this.NodesPointer + NodesCount * 16 /*sizeof(BVHNode_s)*/, Count2 - NodesCount);
//this.Nodes = reader.ReadStructsAt<BVHNode_s>(this.NodesPointer, this.NodesCount);
//this.Nodes_Unk1 = reader.ReadStructsAt<BVHNode_s>(this.NodesPointer + NodesCount * 16 /*sizeof(BVHNode_s)*/, Count2 - NodesCount);
//if (Nodes_Unk1 != null)
//{ }
} }
/// <summary> /// <summary>
@ -1166,19 +1152,20 @@ namespace CodeWalker.GameFiles
//TODO: fix //TODO: fix
// write structure data // write structure data
writer.Write(this.NodesPointer); //writer.Write(this.NodesPointer);
writer.Write(this.NodesCount); //writer.Write(this.NodesCount);
writer.Write(this.Count2); //writer.Write(this.Count2);
writer.WriteBlock(this.Nodes);
writer.Write(this.Unknown_10h); writer.Write(this.Unknown_10h);
writer.Write(this.Unknown_14h); writer.Write(this.Unknown_14h);
writer.Write(this.Unknown_18h); writer.Write(this.Unknown_18h);
writer.Write(this.Unknown_1Ch); writer.Write(this.Unknown_1Ch);
//writer.WriteBlock(this.BoundingBoxMin); writer.Write(this.BoundingBoxMin);
//writer.WriteBlock(this.BoundingBoxMax); writer.Write(this.BoundingBoxMax);
//writer.WriteBlock(this.BoundingBoxCenter); writer.Write(this.BoundingBoxCenter);
//writer.WriteBlock(this.QuantumInverse); writer.Write(this.QuantumInverse);
//writer.WriteBlock(this.Quantum); writer.Write(this.Quantum);
//writer.WriteBlock(this.Trees); //TODO: fix writer.WriteBlock(this.Trees);
} }
/// <summary> /// <summary>
@ -1195,12 +1182,13 @@ namespace CodeWalker.GameFiles
public override Tuple<long, IResourceBlock>[] GetParts() public override Tuple<long, IResourceBlock>[] GetParts()
{ {
return new Tuple<long, IResourceBlock>[] { return new Tuple<long, IResourceBlock>[] {
new Tuple<long, IResourceBlock>(0x0, Nodes),
//new Tuple<long, IResourceBlock>(0x20, BoundingBoxMin), //new Tuple<long, IResourceBlock>(0x20, BoundingBoxMin),
//new Tuple<long, IResourceBlock>(0x30, BoundingBoxMax), //new Tuple<long, IResourceBlock>(0x30, BoundingBoxMax),
//new Tuple<long, IResourceBlock>(0x40, BoundingBoxCenter), //new Tuple<long, IResourceBlock>(0x40, BoundingBoxCenter),
//new Tuple<long, IResourceBlock>(0x50, QuantumInverse), //new Tuple<long, IResourceBlock>(0x50, QuantumInverse),
//new Tuple<long, IResourceBlock>(0x60, Quantum), //new Tuple<long, IResourceBlock>(0x60, Quantum),
//new Tuple<long, IResourceBlock>(0x70, Trees) //TODO: fix! new Tuple<long, IResourceBlock>(0x70, Trees)
}; };
} }
} }

View File

@ -291,9 +291,9 @@ namespace CodeWalker.GameFiles
public uint Unknown_38h { get; set; } public uint Unknown_38h { get; set; }
public uint Unknown_3Ch { get; set; } public uint Unknown_3Ch { get; set; }
public ResourcePointerList64<Sequence> Sequences { get; set; } public ResourcePointerList64<Sequence> Sequences { get; set; }
//public ResourceSimpleList64<uint_r> Unknown_50h { get; set; } public ResourceSimpleList64_s<AnimationBoneId> BoneIds { get; set; }
public ResourceSimpleList64Ptr BoneIdsPtr { get; set; } //public ResourceSimpleList64Ptr BoneIdsPtr { get; set; }
public AnimationBoneId[] BoneIds { get; set; } //public AnimationBoneId[] BoneIds { get; set; }
public YcdFile Ycd { get; set; } public YcdFile Ycd { get; set; }
@ -323,10 +323,10 @@ namespace CodeWalker.GameFiles
this.Unknown_38h = reader.ReadUInt32(); //314 174 1238 390 sequences length? this.Unknown_38h = reader.ReadUInt32(); //314 174 1238 390 sequences length?
this.Unknown_3Ch = reader.ReadUInt32(); //2 2 2 2 material/type? this.Unknown_3Ch = reader.ReadUInt32(); //2 2 2 2 material/type?
this.Sequences = reader.ReadBlock<ResourcePointerList64<Sequence>>(); this.Sequences = reader.ReadBlock<ResourcePointerList64<Sequence>>();
//this.Unknown_50h = reader.ReadBlock<ResourceSimpleList64<uint_r>>(); this.BoneIds = reader.ReadBlock<ResourceSimpleList64_s<AnimationBoneId>>();
this.BoneIdsPtr = reader.ReadStruct<ResourceSimpleList64Ptr>(); //this.BoneIdsPtr = reader.ReadStruct<ResourceSimpleList64Ptr>();
//this.BoneIds = reader.ReadUintsAt(this.BoneIdsPtr.EntriesPointer, this.BoneIdsPtr.EntriesCount); ////this.BoneIds = reader.ReadUintsAt(this.BoneIdsPtr.EntriesPointer, this.BoneIdsPtr.EntriesCount);
this.BoneIds = reader.ReadStructsAt<AnimationBoneId>(this.BoneIdsPtr.EntriesPointer, this.BoneIdsPtr.EntriesCount); //this.BoneIds = reader.ReadStructsAt<AnimationBoneId>(this.BoneIdsPtr.EntriesPointer, this.BoneIdsPtr.EntriesCount);
} }
public override void Write(ResourceDataWriter writer, params object[] parameters) public override void Write(ResourceDataWriter writer, params object[] parameters)
@ -352,14 +352,14 @@ namespace CodeWalker.GameFiles
writer.Write(this.Unknown_38h); writer.Write(this.Unknown_38h);
writer.Write(this.Unknown_3Ch); writer.Write(this.Unknown_3Ch);
writer.WriteBlock(this.Sequences); writer.WriteBlock(this.Sequences);
//writer.WriteBlock(this.Unknown_50h);//todo: fix!! writer.WriteBlock(this.BoneIds);
} }
public override Tuple<long, IResourceBlock>[] GetParts() public override Tuple<long, IResourceBlock>[] GetParts()
{ {
return new Tuple<long, IResourceBlock>[] { return new Tuple<long, IResourceBlock>[] {
new Tuple<long, IResourceBlock>(0x40, Sequences), new Tuple<long, IResourceBlock>(0x40, Sequences),
//new Tuple<long, IResourceBlock>(0x50, Unknown_50h)//todo: fix! new Tuple<long, IResourceBlock>(0x50, BoneIds)
}; };
} }
} }

View File

@ -2345,18 +2345,13 @@ namespace CodeWalker.GameFiles
// structure data // structure data
public ulong NamePointer { get; set; } public ulong NamePointer { get; set; }
public ulong LightAttributesPointer { get; set; } public ResourceSimpleList64_s<LightAttributes_s> LightAttributes { get; set; }
public ushort LightAttributesCount1 { get; set; }
public ushort LightAttributesCount2 { get; set; }
public uint Unknown_BCh { get; set; } // 0x00000000
public uint Unknown_C0h { get; set; } // 0x00000000 public uint Unknown_C0h { get; set; } // 0x00000000
public uint Unknown_C4h { get; set; } // 0x00000000 public uint Unknown_C4h { get; set; } // 0x00000000
public ulong BoundPointer { get; set; } public ulong BoundPointer { get; set; }
// reference data // reference data
public string Name { get; set; } public string Name { get; set; }
//public ResourceSimpleArray<LightAttributes> LightAttributes { get; set; }
public LightAttributes_s[] LightAttributes { get; set; }
public Bounds Bound { get; set; } public Bounds Bound { get; set; }
public string ErrorMessage { get; set; } public string ErrorMessage { get; set; }
@ -2370,10 +2365,7 @@ namespace CodeWalker.GameFiles
// read structure data // read structure data
this.NamePointer = reader.ReadUInt64(); this.NamePointer = reader.ReadUInt64();
this.LightAttributesPointer = reader.ReadUInt64(); this.LightAttributes = reader.ReadBlock<ResourceSimpleList64_s<LightAttributes_s>>();
this.LightAttributesCount1 = reader.ReadUInt16();
this.LightAttributesCount2 = reader.ReadUInt16();
this.Unknown_BCh = reader.ReadUInt32();
this.Unknown_C0h = reader.ReadUInt32(); this.Unknown_C0h = reader.ReadUInt32();
this.Unknown_C4h = reader.ReadUInt32(); this.Unknown_C4h = reader.ReadUInt32();
this.BoundPointer = reader.ReadUInt64(); this.BoundPointer = reader.ReadUInt64();
@ -2385,11 +2377,6 @@ namespace CodeWalker.GameFiles
this.Name = reader.ReadStringAt(//BlockAt<string_r>( this.Name = reader.ReadStringAt(//BlockAt<string_r>(
this.NamePointer // offset this.NamePointer // offset
); );
//this.LightAttributes = reader.ReadBlockAt<ResourceSimpleArray<LightAttributes>>(
// this.LightAttributesPointer, // offset
// this.LightAttributesCount1
//);
this.LightAttributes = reader.ReadStructsAt<LightAttributes_s>(this.LightAttributesPointer, this.LightAttributesCount1);
this.Bound = reader.ReadBlockAt<Bounds>( this.Bound = reader.ReadBlockAt<Bounds>(
this.BoundPointer // offset this.BoundPointer // offset
@ -2410,16 +2397,11 @@ namespace CodeWalker.GameFiles
// update structure data // update structure data
//this.NamePointer = (ulong)(this.Name != null ? this.Name.Position : 0); //TODO: fix //this.NamePointer = (ulong)(this.Name != null ? this.Name.Position : 0); //TODO: fix
//this.LightAttributesPointer = (ulong)(this.LightAttributes != null ? this.LightAttributes.Position : 0);
this.BoundPointer = (ulong)(this.Bound != null ? this.Bound.FilePosition : 0); this.BoundPointer = (ulong)(this.Bound != null ? this.Bound.FilePosition : 0);
//TODO: fix
// write structure data // write structure data
writer.Write(this.NamePointer); writer.Write(this.NamePointer);
writer.Write(this.LightAttributesPointer); writer.WriteBlock(this.LightAttributes);
writer.Write(this.LightAttributesCount1);
writer.Write(this.LightAttributesCount2);
writer.Write(this.Unknown_BCh);
writer.Write(this.Unknown_C0h); writer.Write(this.Unknown_C0h);
writer.Write(this.Unknown_C4h); writer.Write(this.Unknown_C4h);
writer.Write(this.BoundPointer); writer.Write(this.BoundPointer);
@ -2432,10 +2414,15 @@ namespace CodeWalker.GameFiles
{ {
var list = new List<IResourceBlock>(base.GetReferences()); var list = new List<IResourceBlock>(base.GetReferences());
//if (Name != null) list.Add(Name); //TODO: fix //if (Name != null) list.Add(Name); //TODO: fix
//if (LightAttributes != null) list.Add(LightAttributes); //TODO: fix
if (Bound != null) list.Add(Bound); if (Bound != null) list.Add(Bound);
return list.ToArray(); return list.ToArray();
} }
public override Tuple<long, IResourceBlock>[] GetParts()
{
return new Tuple<long, IResourceBlock>[] {
new Tuple<long, IResourceBlock>(0xB0, LightAttributes),
};
}
public override string ToString() public override string ToString()

View File

@ -101,9 +101,9 @@ namespace CodeWalker.GameFiles
public uint Unknown_104h { get; set; } // 0x00000000 public uint Unknown_104h { get; set; } // 0x00000000
public uint Unknown_108h { get; set; } // 0x00000000 public uint Unknown_108h { get; set; } // 0x00000000
public uint Unknown_10Ch { get; set; } // 0x00000000 public uint Unknown_10Ch { get; set; } // 0x00000000
//public ResourceSimpleList64<LightAttributes> LightAttributes { get; set; } public ResourceSimpleList64_s<LightAttributes_s> LightAttributes { get; set; }
public ResourceSimpleList64Ptr LightAttributesPtr { get; set; } //public ResourceSimpleList64Ptr LightAttributesPtr { get; set; }
public LightAttributes_s[] LightAttributes { get; set; } //public LightAttributes_s[] LightAttributes { get; set; }
public ulong Unknown_120h_Pointer { get; set; } public ulong Unknown_120h_Pointer { get; set; }
public uint Unknown_128h { get; set; } // 0x00000000 public uint Unknown_128h { get; set; } // 0x00000000
public uint Unknown_12Ch { get; set; } // 0x00000000 public uint Unknown_12Ch { get; set; } // 0x00000000
@ -182,9 +182,7 @@ namespace CodeWalker.GameFiles
this.Unknown_104h = reader.ReadUInt32(); this.Unknown_104h = reader.ReadUInt32();
this.Unknown_108h = reader.ReadUInt32(); this.Unknown_108h = reader.ReadUInt32();
this.Unknown_10Ch = reader.ReadUInt32(); this.Unknown_10Ch = reader.ReadUInt32();
//this.LightAttributes = reader.ReadBlock<ResourceSimpleList64<LightAttributes>>(); this.LightAttributes = reader.ReadBlock<ResourceSimpleList64_s<LightAttributes_s>>();
this.LightAttributesPtr = reader.ReadStruct<ResourceSimpleList64Ptr>();
this.LightAttributes = reader.ReadStructsAt<LightAttributes_s>(LightAttributesPtr.EntriesPointer, LightAttributesPtr.EntriesCount);
this.Unknown_120h_Pointer = reader.ReadUInt64(); this.Unknown_120h_Pointer = reader.ReadUInt64();
this.Unknown_128h = reader.ReadUInt32(); this.Unknown_128h = reader.ReadUInt32();
this.Unknown_12Ch = reader.ReadUInt32(); this.Unknown_12Ch = reader.ReadUInt32();
@ -276,15 +274,13 @@ namespace CodeWalker.GameFiles
this.DrawablePointer = (ulong)(this.Drawable != null ? this.Drawable.FilePosition : 0); this.DrawablePointer = (ulong)(this.Drawable != null ? this.Drawable.FilePosition : 0);
this.Unknown_28h_Pointer = (ulong)(this.Unknown_28h_Data != null ? this.Unknown_28h_Data.FilePosition : 0); this.Unknown_28h_Pointer = (ulong)(this.Unknown_28h_Data != null ? this.Unknown_28h_Data.FilePosition : 0);
this.Unknown_30h_Pointer = (ulong)(this.Unknown_30h_Data != null ? this.Unknown_30h_Data.FilePosition : 0); this.Unknown_30h_Pointer = (ulong)(this.Unknown_30h_Data != null ? this.Unknown_30h_Data.FilePosition : 0);
//this.cc00 = (uint)(this.pxxxxx_0data != null ? this.pxxxxx_0data.Count : 0); this.Count0 = (uint)(this.Unknown_28h_Data != null ? this.Unknown_28h_Data.Count : 0);
////this.NamePointer = (ulong)(this.Name != null ? this.Name.Position : 0); //TODO: fix!!! ////this.NamePointer = (ulong)(this.Name != null ? this.Name.Position : 0); //TODO: fix!!!
//this.cnt1 = (ushort)(this.pxxxxx_2data != null ? this.pxxxxx_2data.Count : 0);
this.Unknown_A8h_Pointer = (ulong)(this.Unknown_A8h_Data != null ? this.Unknown_A8h_Data.FilePosition : 0); this.Unknown_A8h_Pointer = (ulong)(this.Unknown_A8h_Data != null ? this.Unknown_A8h_Data.FilePosition : 0);
//this.anotherCount = (byte)(this.pxxxxx_3data != null ? this.pxxxxx_3data.Count : 0); this.Count3 = (byte)(this.Unknown_E0h_Data != null ? this.Unknown_E0h_Data.Count : 0);
this.Unknown_E0h_Pointer = (ulong)(this.Unknown_E0h_Data != null ? this.Unknown_E0h_Data.FilePosition : 0); this.Unknown_E0h_Pointer = (ulong)(this.Unknown_E0h_Data != null ? this.Unknown_E0h_Data.FilePosition : 0);
this.PhysicsLODGroupPointer = (ulong)(this.PhysicsLODGroup != null ? this.PhysicsLODGroup.FilePosition : 0); this.PhysicsLODGroupPointer = (ulong)(this.PhysicsLODGroup != null ? this.PhysicsLODGroup.FilePosition : 0);
this.Drawable2Pointer = (ulong)(this.Drawable2 != null ? this.Drawable2.FilePosition : 0); this.Drawable2Pointer = (ulong)(this.Drawable2 != null ? this.Drawable2.FilePosition : 0);
//this.cntxx51a = (ushort)(this.pxxxxx_5data != null ? this.pxxxxx_5data.Count : 0);
this.Unknown_120h_Pointer = (ulong)(this.Unknown_120h_Data != null ? this.Unknown_120h_Data.FilePosition : 0); this.Unknown_120h_Pointer = (ulong)(this.Unknown_120h_Data != null ? this.Unknown_120h_Data.FilePosition : 0);
// write structure data // write structure data
@ -343,7 +339,7 @@ namespace CodeWalker.GameFiles
writer.Write(this.Unknown_104h); writer.Write(this.Unknown_104h);
writer.Write(this.Unknown_108h); writer.Write(this.Unknown_108h);
writer.Write(this.Unknown_10Ch); writer.Write(this.Unknown_10Ch);
//writer.WriteBlock(this.LightAttributes); //TODO: fix! writer.WriteBlock(this.LightAttributes);
writer.Write(this.Unknown_120h_Pointer); writer.Write(this.Unknown_120h_Pointer);
writer.Write(this.Unknown_128h); writer.Write(this.Unknown_128h);
writer.Write(this.Unknown_12Ch); writer.Write(this.Unknown_12Ch);
@ -371,7 +367,7 @@ namespace CodeWalker.GameFiles
{ {
return new Tuple<long, IResourceBlock>[] { return new Tuple<long, IResourceBlock>[] {
new Tuple<long, IResourceBlock>(0x60, Clothes), new Tuple<long, IResourceBlock>(0x60, Clothes),
//new Tuple<long, IResourceBlock>(0x110, LightAttributes) //TODO: fix! new Tuple<long, IResourceBlock>(0x110, LightAttributes)
}; };
} }
} }
@ -777,63 +773,37 @@ namespace CodeWalker.GameFiles
public uint Unknown_14h { get; set; } public uint Unknown_14h { get; set; }
public uint Unknown_18h { get; set; } public uint Unknown_18h { get; set; }
public uint Unknown_1Ch { get; set; } // 0x00000000 public uint Unknown_1Ch { get; set; } // 0x00000000
//public ResourceSimpleList64<uint_r> Unknown_20h { get; set; } public ResourceSimpleList64_float Unknown_20h { get; set; }
//public ResourceSimpleList64<uint_r> Unknown_30h { get; set; } public ResourceSimpleList64_float Unknown_30h { get; set; }
//public ResourceSimpleList64<uint_r> Unknown_40h { get; set; } public ResourceSimpleList64_float Unknown_40h { get; set; }
public ResourceSimpleList64Ptr Unknown_20hPtr { get; set; }
public ResourceSimpleList64Ptr Unknown_30hPtr { get; set; }
public ResourceSimpleList64Ptr Unknown_40hPtr { get; set; }
public float[] Unknown_20h { get; set; }
public float[] Unknown_30h { get; set; }
public float[] Unknown_40h { get; set; }
public uint Unknown_50h { get; set; } // 0x00000000 public uint Unknown_50h { get; set; } // 0x00000000
public uint Unknown_54h { get; set; } // 0x00000000 public uint Unknown_54h { get; set; } // 0x00000000
public uint Unknown_58h { get; set; } // 0x00000000 public uint Unknown_58h { get; set; } // 0x00000000
public uint Unknown_5Ch { get; set; } // 0x00000000 public uint Unknown_5Ch { get; set; } // 0x00000000
//public ResourceSimpleList64<float_r> Unknown_60h { get; set; } public ResourceSimpleList64_float Unknown_60h { get; set; }
//public ResourceSimpleList64<uint_r> Unknown_70h { get; set; } public ResourceSimpleList64_uint Unknown_70h { get; set; }
//public ResourceSimpleList64<uint_r> Unknown_80h { get; set; } public ResourceSimpleList64_uint Unknown_80h { get; set; }
public ResourceSimpleList64Ptr Unknown_60hPtr { get; set; }
public ResourceSimpleList64Ptr Unknown_70hPtr { get; set; }
public ResourceSimpleList64Ptr Unknown_80hPtr { get; set; }
public float[] Unknown_60h { get; set; }
public uint[] Unknown_70h { get; set; }
public uint[] Unknown_80h { get; set; }
public uint Unknown_90h { get; set; } // 0x00000000 public uint Unknown_90h { get; set; } // 0x00000000
public uint Unknown_94h { get; set; } // 0x00000000 public uint Unknown_94h { get; set; } // 0x00000000
public uint Unknown_98h { get; set; } // 0x00000000 public uint Unknown_98h { get; set; } // 0x00000000
public uint Unknown_9Ch { get; set; } // 0x00000000 public uint Unknown_9Ch { get; set; } // 0x00000000
//public ResourceSimpleList64<float_r> Unknown_A0h { get; set; } public ResourceSimpleList64_float Unknown_A0h { get; set; }
//public ResourceSimpleList64<uint_r> Unknown_B0h { get; set; } public ResourceSimpleList64_uint Unknown_B0h { get; set; }
//public ResourceSimpleList64<uint_r> Unknown_C0h { get; set; } public ResourceSimpleList64_uint Unknown_C0h { get; set; }
public ResourceSimpleList64Ptr Unknown_A0hPtr { get; set; }
public ResourceSimpleList64Ptr Unknown_B0hPtr { get; set; }
public ResourceSimpleList64Ptr Unknown_C0hPtr { get; set; }
public float[] Unknown_A0h { get; set; }
public uint[] Unknown_B0h { get; set; }
public uint[] Unknown_C0h { get; set; }
public uint Unknown_D0h { get; set; } // 0x00000000 public uint Unknown_D0h { get; set; } // 0x00000000
public uint Unknown_D4h { get; set; } // 0x00000000 public uint Unknown_D4h { get; set; } // 0x00000000
public uint Unknown_D8h { get; set; } // 0x00000000 public uint Unknown_D8h { get; set; } // 0x00000000
public uint Unknown_DCh { get; set; } // 0x00000000 public uint Unknown_DCh { get; set; } // 0x00000000
//public ResourceSimpleList64<ushort_r> Unknown_E0h { get; set; } public ResourceSimpleList64_ushort Unknown_E0h { get; set; }
//public ResourceSimpleList64<ushort_r> Unknown_F0h { get; set; } public ResourceSimpleList64_ushort Unknown_F0h { get; set; }
//public ResourceSimpleList64<ushort_r> Unknown_100h { get; set; } public ResourceSimpleList64_ushort Unknown_100h { get; set; }
public ResourceSimpleList64Ptr Unknown_E0hPtr { get; set; }
public ResourceSimpleList64Ptr Unknown_F0hPtr { get; set; }
public ResourceSimpleList64Ptr Unknown_100hPtr { get; set; }
public ushort[] Unknown_E0h { get; set; }
public ushort[] Unknown_F0h { get; set; }
public ushort[] Unknown_100h { get; set; }
public uint Unknown_110h { get; set; } // 0x00000000 public uint Unknown_110h { get; set; } // 0x00000000
public uint Unknown_114h { get; set; } // 0x00000000 public uint Unknown_114h { get; set; } // 0x00000000
public uint Unknown_118h { get; set; } // 0x00000000 public uint Unknown_118h { get; set; } // 0x00000000
public uint Unknown_11Ch { get; set; } // 0x00000000 public uint Unknown_11Ch { get; set; } // 0x00000000
public uint Unknown_120h { get; set; } // 0x00000000 public uint Unknown_120h { get; set; } // 0x00000000
public uint Unknown_124h { get; set; } // 0x00000000 public uint Unknown_124h { get; set; } // 0x00000000
//public ResourceSimpleList64<uint_r> Unknown_128h { get; set; } public ResourceSimpleList64_uint Unknown_128h { get; set; }
public ResourceSimpleList64Ptr Unknown_128hPtr { get; set; }
public uint[] Unknown_128h { get; set; }
public uint Unknown_138h { get; set; } // 0x00000000 public uint Unknown_138h { get; set; } // 0x00000000
public uint Unknown_13Ch { get; set; } // 0x00000000 public uint Unknown_13Ch { get; set; } // 0x00000000
@ -851,50 +821,37 @@ namespace CodeWalker.GameFiles
this.Unknown_14h = reader.ReadUInt32(); this.Unknown_14h = reader.ReadUInt32();
this.Unknown_18h = reader.ReadUInt32(); this.Unknown_18h = reader.ReadUInt32();
this.Unknown_1Ch = reader.ReadUInt32(); this.Unknown_1Ch = reader.ReadUInt32();
this.Unknown_20hPtr = reader.ReadStruct<ResourceSimpleList64Ptr>(); this.Unknown_20h = reader.ReadBlock<ResourceSimpleList64_float>();
this.Unknown_30hPtr = reader.ReadStruct<ResourceSimpleList64Ptr>(); this.Unknown_30h = reader.ReadBlock<ResourceSimpleList64_float>();
this.Unknown_40hPtr = reader.ReadStruct<ResourceSimpleList64Ptr>(); this.Unknown_40h = reader.ReadBlock<ResourceSimpleList64_float>();
this.Unknown_20h = reader.ReadFloatsAt(Unknown_20hPtr.EntriesPointer, Unknown_20hPtr.EntriesCount);
this.Unknown_30h = reader.ReadFloatsAt(Unknown_30hPtr.EntriesPointer, Unknown_30hPtr.EntriesCount);
this.Unknown_40h = reader.ReadFloatsAt(Unknown_40hPtr.EntriesPointer, Unknown_40hPtr.EntriesCount);
this.Unknown_50h = reader.ReadUInt32(); this.Unknown_50h = reader.ReadUInt32();
this.Unknown_54h = reader.ReadUInt32(); this.Unknown_54h = reader.ReadUInt32();
this.Unknown_58h = reader.ReadUInt32(); this.Unknown_58h = reader.ReadUInt32();
this.Unknown_5Ch = reader.ReadUInt32(); this.Unknown_5Ch = reader.ReadUInt32();
this.Unknown_60hPtr = reader.ReadStruct<ResourceSimpleList64Ptr>(); this.Unknown_60h = reader.ReadBlock<ResourceSimpleList64_float>();
this.Unknown_70hPtr = reader.ReadStruct<ResourceSimpleList64Ptr>(); this.Unknown_70h = reader.ReadBlock<ResourceSimpleList64_uint>();
this.Unknown_80hPtr = reader.ReadStruct<ResourceSimpleList64Ptr>(); this.Unknown_80h = reader.ReadBlock<ResourceSimpleList64_uint>();
this.Unknown_60h = reader.ReadFloatsAt(Unknown_60hPtr.EntriesPointer, Unknown_60hPtr.EntriesCount);
this.Unknown_70h = reader.ReadUintsAt(Unknown_70hPtr.EntriesPointer, Unknown_70hPtr.EntriesCount);
this.Unknown_80h = reader.ReadUintsAt(Unknown_80hPtr.EntriesPointer, Unknown_80hPtr.EntriesCount);
this.Unknown_90h = reader.ReadUInt32(); this.Unknown_90h = reader.ReadUInt32();
this.Unknown_94h = reader.ReadUInt32(); this.Unknown_94h = reader.ReadUInt32();
this.Unknown_98h = reader.ReadUInt32(); this.Unknown_98h = reader.ReadUInt32();
this.Unknown_9Ch = reader.ReadUInt32(); this.Unknown_9Ch = reader.ReadUInt32();
this.Unknown_A0hPtr = reader.ReadStruct<ResourceSimpleList64Ptr>(); this.Unknown_A0h = reader.ReadBlock<ResourceSimpleList64_float>();
this.Unknown_B0hPtr = reader.ReadStruct<ResourceSimpleList64Ptr>(); this.Unknown_B0h = reader.ReadBlock<ResourceSimpleList64_uint>();
this.Unknown_C0hPtr = reader.ReadStruct<ResourceSimpleList64Ptr>(); this.Unknown_C0h = reader.ReadBlock<ResourceSimpleList64_uint>();
this.Unknown_A0h = reader.ReadFloatsAt(Unknown_A0hPtr.EntriesPointer, Unknown_A0hPtr.EntriesCount);
this.Unknown_B0h = reader.ReadUintsAt(Unknown_B0hPtr.EntriesPointer, Unknown_B0hPtr.EntriesCount);
this.Unknown_C0h = reader.ReadUintsAt(Unknown_C0hPtr.EntriesPointer, Unknown_C0hPtr.EntriesCount);
this.Unknown_D0h = reader.ReadUInt32(); this.Unknown_D0h = reader.ReadUInt32();
this.Unknown_D4h = reader.ReadUInt32(); this.Unknown_D4h = reader.ReadUInt32();
this.Unknown_D8h = reader.ReadUInt32(); this.Unknown_D8h = reader.ReadUInt32();
this.Unknown_DCh = reader.ReadUInt32(); this.Unknown_DCh = reader.ReadUInt32();
this.Unknown_E0hPtr = reader.ReadStruct<ResourceSimpleList64Ptr>(); this.Unknown_E0h = reader.ReadBlock<ResourceSimpleList64_ushort>();
this.Unknown_F0hPtr = reader.ReadStruct<ResourceSimpleList64Ptr>(); this.Unknown_F0h = reader.ReadBlock<ResourceSimpleList64_ushort>();
this.Unknown_100hPtr = reader.ReadStruct<ResourceSimpleList64Ptr>(); this.Unknown_100h = reader.ReadBlock<ResourceSimpleList64_ushort>();
this.Unknown_E0h = reader.ReadUshortsAt(Unknown_E0hPtr.EntriesPointer, Unknown_E0hPtr.EntriesCount);
this.Unknown_F0h = reader.ReadUshortsAt(Unknown_F0hPtr.EntriesPointer, Unknown_F0hPtr.EntriesCount);
this.Unknown_100h = reader.ReadUshortsAt(Unknown_100hPtr.EntriesPointer, Unknown_100hPtr.EntriesCount);
this.Unknown_110h = reader.ReadUInt32(); this.Unknown_110h = reader.ReadUInt32();
this.Unknown_114h = reader.ReadUInt32(); this.Unknown_114h = reader.ReadUInt32();
this.Unknown_118h = reader.ReadUInt32(); this.Unknown_118h = reader.ReadUInt32();
this.Unknown_11Ch = reader.ReadUInt32(); this.Unknown_11Ch = reader.ReadUInt32();
this.Unknown_120h = reader.ReadUInt32(); this.Unknown_120h = reader.ReadUInt32();
this.Unknown_124h = reader.ReadUInt32(); this.Unknown_124h = reader.ReadUInt32();
this.Unknown_128hPtr = reader.ReadStruct<ResourceSimpleList64Ptr>(); this.Unknown_128h = reader.ReadBlock<ResourceSimpleList64_uint>();
this.Unknown_128h = reader.ReadUintsAt(Unknown_128hPtr.EntriesPointer, Unknown_128hPtr.EntriesCount);
this.Unknown_138h = reader.ReadUInt32(); this.Unknown_138h = reader.ReadUInt32();
this.Unknown_13Ch = reader.ReadUInt32(); this.Unknown_13Ch = reader.ReadUInt32();
} }
@ -913,37 +870,37 @@ namespace CodeWalker.GameFiles
writer.Write(this.Unknown_14h); writer.Write(this.Unknown_14h);
writer.Write(this.Unknown_18h); writer.Write(this.Unknown_18h);
writer.Write(this.Unknown_1Ch); writer.Write(this.Unknown_1Ch);
//writer.WriteBlock(this.Unknown_20h); //TODO: fix! writer.WriteBlock(this.Unknown_20h);
//writer.WriteBlock(this.Unknown_30h); writer.WriteBlock(this.Unknown_30h);
//writer.WriteBlock(this.Unknown_40h); writer.WriteBlock(this.Unknown_40h);
writer.Write(this.Unknown_50h); writer.Write(this.Unknown_50h);
writer.Write(this.Unknown_54h); writer.Write(this.Unknown_54h);
writer.Write(this.Unknown_58h); writer.Write(this.Unknown_58h);
writer.Write(this.Unknown_5Ch); writer.Write(this.Unknown_5Ch);
//writer.WriteBlock(this.Unknown_60h); writer.WriteBlock(this.Unknown_60h);
//writer.WriteBlock(this.Unknown_70h); writer.WriteBlock(this.Unknown_70h);
//writer.WriteBlock(this.Unknown_80h); writer.WriteBlock(this.Unknown_80h);
writer.Write(this.Unknown_90h); writer.Write(this.Unknown_90h);
writer.Write(this.Unknown_94h); writer.Write(this.Unknown_94h);
writer.Write(this.Unknown_98h); writer.Write(this.Unknown_98h);
writer.Write(this.Unknown_9Ch); writer.Write(this.Unknown_9Ch);
//writer.WriteBlock(this.Unknown_A0h); writer.WriteBlock(this.Unknown_A0h);
//writer.WriteBlock(this.Unknown_B0h); writer.WriteBlock(this.Unknown_B0h);
//writer.WriteBlock(this.Unknown_C0h); writer.WriteBlock(this.Unknown_C0h);
writer.Write(this.Unknown_D0h); writer.Write(this.Unknown_D0h);
writer.Write(this.Unknown_D4h); writer.Write(this.Unknown_D4h);
writer.Write(this.Unknown_D8h); writer.Write(this.Unknown_D8h);
writer.Write(this.Unknown_DCh); writer.Write(this.Unknown_DCh);
//writer.WriteBlock(this.Unknown_E0h); writer.WriteBlock(this.Unknown_E0h);
//writer.WriteBlock(this.Unknown_F0h); writer.WriteBlock(this.Unknown_F0h);
//writer.WriteBlock(this.Unknown_100h); writer.WriteBlock(this.Unknown_100h);
writer.Write(this.Unknown_110h); writer.Write(this.Unknown_110h);
writer.Write(this.Unknown_114h); writer.Write(this.Unknown_114h);
writer.Write(this.Unknown_118h); writer.Write(this.Unknown_118h);
writer.Write(this.Unknown_11Ch); writer.Write(this.Unknown_11Ch);
writer.Write(this.Unknown_120h); writer.Write(this.Unknown_120h);
writer.Write(this.Unknown_124h); writer.Write(this.Unknown_124h);
//writer.WriteBlock(this.Unknown_128h); writer.WriteBlock(this.Unknown_128h);
writer.Write(this.Unknown_138h); writer.Write(this.Unknown_138h);
writer.Write(this.Unknown_13Ch); writer.Write(this.Unknown_13Ch);
} }
@ -951,19 +908,19 @@ namespace CodeWalker.GameFiles
public override Tuple<long, IResourceBlock>[] GetParts() public override Tuple<long, IResourceBlock>[] GetParts()
{ {
return new Tuple<long, IResourceBlock>[] { return new Tuple<long, IResourceBlock>[] {
//new Tuple<long, IResourceBlock>(0x20, Unknown_20h), //TODO: fix! new Tuple<long, IResourceBlock>(0x20, Unknown_20h),
//new Tuple<long, IResourceBlock>(0x30, Unknown_30h), new Tuple<long, IResourceBlock>(0x30, Unknown_30h),
//new Tuple<long, IResourceBlock>(0x40, Unknown_40h), new Tuple<long, IResourceBlock>(0x40, Unknown_40h),
//new Tuple<long, IResourceBlock>(0x60, Unknown_60h), new Tuple<long, IResourceBlock>(0x60, Unknown_60h),
//new Tuple<long, IResourceBlock>(0x70, Unknown_70h), new Tuple<long, IResourceBlock>(0x70, Unknown_70h),
//new Tuple<long, IResourceBlock>(0x80, Unknown_80h), new Tuple<long, IResourceBlock>(0x80, Unknown_80h),
//new Tuple<long, IResourceBlock>(0xA0, Unknown_A0h), new Tuple<long, IResourceBlock>(0xA0, Unknown_A0h),
//new Tuple<long, IResourceBlock>(0xB0, Unknown_B0h), new Tuple<long, IResourceBlock>(0xB0, Unknown_B0h),
//new Tuple<long, IResourceBlock>(0xC0, Unknown_C0h), new Tuple<long, IResourceBlock>(0xC0, Unknown_C0h),
//new Tuple<long, IResourceBlock>(0xE0, Unknown_E0h), new Tuple<long, IResourceBlock>(0xE0, Unknown_E0h),
//new Tuple<long, IResourceBlock>(0xF0, Unknown_F0h), new Tuple<long, IResourceBlock>(0xF0, Unknown_F0h),
//new Tuple<long, IResourceBlock>(0x100, Unknown_100h), new Tuple<long, IResourceBlock>(0x100, Unknown_100h),
//new Tuple<long, IResourceBlock>(0x128, Unknown_128h) new Tuple<long, IResourceBlock>(0x128, Unknown_128h)
}; };
} }
} }
@ -1092,36 +1049,16 @@ namespace CodeWalker.GameFiles
public uint Unknown_44h { get; set; } // 0x00000000 public uint Unknown_44h { get; set; } // 0x00000000
public uint Unknown_48h { get; set; } // 0x00000000 public uint Unknown_48h { get; set; } // 0x00000000
public uint Unknown_4Ch { get; set; } // 0x00000000 public uint Unknown_4Ch { get; set; } // 0x00000000
//public ResourceSimpleList64<Vector4_r> Unknown_50h { get; set; } public ResourceSimpleList64_s<Vector4> Unknown_50h { get; set; }
//public ResourceSimpleList64<ushort_r> Unknown_60h { get; set; } public ResourceSimpleList64_ushort Unknown_60h { get; set; }
//public ResourceSimpleList64<ushort_r> Unknown_70h { get; set; } public ResourceSimpleList64_ushort Unknown_70h { get; set; }
//public ResourceSimpleList64<ushort_r> Unknown_80h { get; set; } public ResourceSimpleList64_ushort Unknown_80h { get; set; }
//public ResourceSimpleList64<ushort_r> Unknown_90h { get; set; } public ResourceSimpleList64_ushort Unknown_90h { get; set; }
//public ResourceSimpleList64<Vector4_r> Unknown_A0h { get; set; } public ResourceSimpleList64_s<Vector4> Unknown_A0h { get; set; }
//public ResourceSimpleList64<ushort_r> Unknown_B0h { get; set; } public ResourceSimpleList64_ushort Unknown_B0h { get; set; }
//public ResourceSimpleList64<ushort_r> Unknown_C0h { get; set; } public ResourceSimpleList64_ushort Unknown_C0h { get; set; }
//public ResourceSimpleList64<ushort_r> Unknown_D0h { get; set; } public ResourceSimpleList64_ushort Unknown_D0h { get; set; }
//public ResourceSimpleList64<ushort_r> Unknown_E0h { get; set; } public ResourceSimpleList64_ushort Unknown_E0h { get; set; }
public ResourceSimpleList64Ptr Unknown_50hPtr { get; set; }
public ResourceSimpleList64Ptr Unknown_60hPtr { get; set; }
public ResourceSimpleList64Ptr Unknown_70hPtr { get; set; }
public ResourceSimpleList64Ptr Unknown_80hPtr { get; set; }
public ResourceSimpleList64Ptr Unknown_90hPtr { get; set; }
public ResourceSimpleList64Ptr Unknown_A0hPtr { get; set; }
public ResourceSimpleList64Ptr Unknown_B0hPtr { get; set; }
public ResourceSimpleList64Ptr Unknown_C0hPtr { get; set; }
public ResourceSimpleList64Ptr Unknown_D0hPtr { get; set; }
public ResourceSimpleList64Ptr Unknown_E0hPtr { get; set; }
public Vector4[] Unknown_50h { get; set; }
public ushort[] Unknown_60h { get; set; }
public ushort[] Unknown_70h { get; set; }
public ushort[] Unknown_80h { get; set; }
public ushort[] Unknown_90h { get; set; }
public Vector4[] Unknown_A0h { get; set; }
public ushort[] Unknown_B0h { get; set; }
public ushort[] Unknown_C0h { get; set; }
public ushort[] Unknown_D0h { get; set; }
public ushort[] Unknown_E0h { get; set; }
public uint Unknown_F0h { get; set; } // 0x00000000 public uint Unknown_F0h { get; set; } // 0x00000000
public uint Unknown_F4h { get; set; } // 0x00000000 public uint Unknown_F4h { get; set; } // 0x00000000
public uint Unknown_F8h { get; set; } // 0x00000000 public uint Unknown_F8h { get; set; } // 0x00000000
@ -1146,12 +1083,8 @@ namespace CodeWalker.GameFiles
public uint Unknown_144h { get; set; } // 0x00000000 public uint Unknown_144h { get; set; } // 0x00000000
public uint Unknown_148h { get; set; } // 0x00000000 public uint Unknown_148h { get; set; } // 0x00000000
public uint Unknown_14Ch { get; set; } // 0x00000000 public uint Unknown_14Ch { get; set; } // 0x00000000
//public ResourceSimpleList64<ushort_r> Unknown_150h { get; set; } public ResourceSimpleList64_ushort Unknown_150h { get; set; }
//public ResourceSimpleList64<ushort_r> Unknown_160h { get; set; } public ResourceSimpleList64_ushort Unknown_160h { get; set; }
public ResourceSimpleList64Ptr Unknown_150hPtr { get; set; }
public ResourceSimpleList64Ptr Unknown_160hPtr { get; set; }
public ushort[] Unknown_150h { get; set; }
public ushort[] Unknown_160h { get; set; }
public uint Unknown_170h { get; set; } // 0x00000000 public uint Unknown_170h { get; set; } // 0x00000000
public uint Unknown_174h { get; set; } // 0x00000000 public uint Unknown_174h { get; set; } // 0x00000000
public uint Unknown_178h { get; set; } // 0x00000000 public uint Unknown_178h { get; set; } // 0x00000000
@ -1187,36 +1120,16 @@ namespace CodeWalker.GameFiles
this.Unknown_44h = reader.ReadUInt32(); this.Unknown_44h = reader.ReadUInt32();
this.Unknown_48h = reader.ReadUInt32(); this.Unknown_48h = reader.ReadUInt32();
this.Unknown_4Ch = reader.ReadUInt32(); this.Unknown_4Ch = reader.ReadUInt32();
//this.Unknown_50h = reader.ReadBlock<ResourceSimpleList64<Vector4_r>>(); this.Unknown_50h = reader.ReadBlock<ResourceSimpleList64_s<Vector4>>();
//this.Unknown_60h = reader.ReadBlock<ResourceSimpleList64<ushort_r>>(); this.Unknown_60h = reader.ReadBlock<ResourceSimpleList64_ushort>();
//this.Unknown_70h = reader.ReadBlock<ResourceSimpleList64<ushort_r>>(); this.Unknown_70h = reader.ReadBlock<ResourceSimpleList64_ushort>();
//this.Unknown_80h = reader.ReadBlock<ResourceSimpleList64<ushort_r>>(); this.Unknown_80h = reader.ReadBlock<ResourceSimpleList64_ushort>();
//this.Unknown_90h = reader.ReadBlock<ResourceSimpleList64<ushort_r>>(); this.Unknown_90h = reader.ReadBlock<ResourceSimpleList64_ushort>();
//this.Unknown_A0h = reader.ReadBlock<ResourceSimpleList64<Vector4_r>>(); this.Unknown_A0h = reader.ReadBlock<ResourceSimpleList64_s<Vector4>>();
//this.Unknown_B0h = reader.ReadBlock<ResourceSimpleList64<ushort_r>>(); this.Unknown_B0h = reader.ReadBlock<ResourceSimpleList64_ushort>();
//this.Unknown_C0h = reader.ReadBlock<ResourceSimpleList64<ushort_r>>(); this.Unknown_C0h = reader.ReadBlock<ResourceSimpleList64_ushort>();
//this.Unknown_D0h = reader.ReadBlock<ResourceSimpleList64<ushort_r>>(); this.Unknown_D0h = reader.ReadBlock<ResourceSimpleList64_ushort>();
//this.Unknown_E0h = reader.ReadBlock<ResourceSimpleList64<ushort_r>>(); this.Unknown_E0h = reader.ReadBlock<ResourceSimpleList64_ushort>();
this.Unknown_50hPtr = reader.ReadStruct<ResourceSimpleList64Ptr>();
this.Unknown_60hPtr = reader.ReadStruct<ResourceSimpleList64Ptr>();
this.Unknown_70hPtr = reader.ReadStruct<ResourceSimpleList64Ptr>();
this.Unknown_80hPtr = reader.ReadStruct<ResourceSimpleList64Ptr>();
this.Unknown_90hPtr = reader.ReadStruct<ResourceSimpleList64Ptr>();
this.Unknown_A0hPtr = reader.ReadStruct<ResourceSimpleList64Ptr>();
this.Unknown_B0hPtr = reader.ReadStruct<ResourceSimpleList64Ptr>();
this.Unknown_C0hPtr = reader.ReadStruct<ResourceSimpleList64Ptr>();
this.Unknown_D0hPtr = reader.ReadStruct<ResourceSimpleList64Ptr>();
this.Unknown_E0hPtr = reader.ReadStruct<ResourceSimpleList64Ptr>();
this.Unknown_50h = reader.ReadStructsAt<Vector4>(Unknown_50hPtr.EntriesPointer, Unknown_50hPtr.EntriesCount);
this.Unknown_60h = reader.ReadUshortsAt(Unknown_60hPtr.EntriesPointer, Unknown_60hPtr.EntriesCount);
this.Unknown_70h = reader.ReadUshortsAt(Unknown_70hPtr.EntriesPointer, Unknown_70hPtr.EntriesCount);
this.Unknown_80h = reader.ReadUshortsAt(Unknown_80hPtr.EntriesPointer, Unknown_80hPtr.EntriesCount);
this.Unknown_90h = reader.ReadUshortsAt(Unknown_90hPtr.EntriesPointer, Unknown_90hPtr.EntriesCount);
this.Unknown_A0h = reader.ReadStructsAt<Vector4>(Unknown_A0hPtr.EntriesPointer, Unknown_A0hPtr.EntriesCount);
this.Unknown_B0h = reader.ReadUshortsAt(Unknown_B0hPtr.EntriesPointer, Unknown_B0hPtr.EntriesCount);
this.Unknown_C0h = reader.ReadUshortsAt(Unknown_C0hPtr.EntriesPointer, Unknown_C0hPtr.EntriesCount);
this.Unknown_D0h = reader.ReadUshortsAt(Unknown_D0hPtr.EntriesPointer, Unknown_D0hPtr.EntriesCount);
this.Unknown_E0h = reader.ReadUshortsAt(Unknown_E0hPtr.EntriesPointer, Unknown_E0hPtr.EntriesCount);
this.Unknown_F0h = reader.ReadUInt32(); this.Unknown_F0h = reader.ReadUInt32();
this.Unknown_F4h = reader.ReadUInt32(); this.Unknown_F4h = reader.ReadUInt32();
this.Unknown_F8h = reader.ReadUInt32(); this.Unknown_F8h = reader.ReadUInt32();
@ -1241,12 +1154,8 @@ namespace CodeWalker.GameFiles
this.Unknown_144h = reader.ReadUInt32(); this.Unknown_144h = reader.ReadUInt32();
this.Unknown_148h = reader.ReadUInt32(); this.Unknown_148h = reader.ReadUInt32();
this.Unknown_14Ch = reader.ReadUInt32(); this.Unknown_14Ch = reader.ReadUInt32();
//this.Unknown_150h = reader.ReadBlock<ResourceSimpleList64<ushort_r>>(); this.Unknown_150h = reader.ReadBlock<ResourceSimpleList64_ushort>();
//this.Unknown_160h = reader.ReadBlock<ResourceSimpleList64<ushort_r>>(); this.Unknown_160h = reader.ReadBlock<ResourceSimpleList64_ushort>();
this.Unknown_150hPtr = reader.ReadStruct<ResourceSimpleList64Ptr>();
this.Unknown_160hPtr = reader.ReadStruct<ResourceSimpleList64Ptr>();
this.Unknown_150h = reader.ReadUshortsAt(Unknown_150hPtr.EntriesPointer, Unknown_150hPtr.EntriesCount);
this.Unknown_160h = reader.ReadUshortsAt(Unknown_160hPtr.EntriesPointer, Unknown_160hPtr.EntriesCount);
this.Unknown_170h = reader.ReadUInt32(); this.Unknown_170h = reader.ReadUInt32();
this.Unknown_174h = reader.ReadUInt32(); this.Unknown_174h = reader.ReadUInt32();
this.Unknown_178h = reader.ReadUInt32(); this.Unknown_178h = reader.ReadUInt32();
@ -1283,16 +1192,16 @@ namespace CodeWalker.GameFiles
writer.Write(this.Unknown_44h); writer.Write(this.Unknown_44h);
writer.Write(this.Unknown_48h); writer.Write(this.Unknown_48h);
writer.Write(this.Unknown_4Ch); writer.Write(this.Unknown_4Ch);
//writer.WriteBlock(this.Unknown_50h); //TODO: fix this! writer.WriteBlock(this.Unknown_50h);
//writer.WriteBlock(this.Unknown_60h); writer.WriteBlock(this.Unknown_60h);
//writer.WriteBlock(this.Unknown_70h); writer.WriteBlock(this.Unknown_70h);
//writer.WriteBlock(this.Unknown_80h); writer.WriteBlock(this.Unknown_80h);
//writer.WriteBlock(this.Unknown_90h); writer.WriteBlock(this.Unknown_90h);
//writer.WriteBlock(this.Unknown_A0h); writer.WriteBlock(this.Unknown_A0h);
//writer.WriteBlock(this.Unknown_B0h); writer.WriteBlock(this.Unknown_B0h);
//writer.WriteBlock(this.Unknown_C0h); writer.WriteBlock(this.Unknown_C0h);
//writer.WriteBlock(this.Unknown_D0h); writer.WriteBlock(this.Unknown_D0h);
//writer.WriteBlock(this.Unknown_E0h); writer.WriteBlock(this.Unknown_E0h);
writer.Write(this.Unknown_F0h); writer.Write(this.Unknown_F0h);
writer.Write(this.Unknown_F4h); writer.Write(this.Unknown_F4h);
writer.Write(this.Unknown_F8h); writer.Write(this.Unknown_F8h);
@ -1317,8 +1226,8 @@ namespace CodeWalker.GameFiles
writer.Write(this.Unknown_144h); writer.Write(this.Unknown_144h);
writer.Write(this.Unknown_148h); writer.Write(this.Unknown_148h);
writer.Write(this.Unknown_14Ch); writer.Write(this.Unknown_14Ch);
//writer.WriteBlock(this.Unknown_150h); //TODO: fix writer.WriteBlock(this.Unknown_150h);
//writer.WriteBlock(this.Unknown_160h); writer.WriteBlock(this.Unknown_160h);
writer.Write(this.Unknown_170h); writer.Write(this.Unknown_170h);
writer.Write(this.Unknown_174h); writer.Write(this.Unknown_174h);
writer.Write(this.Unknown_178h); writer.Write(this.Unknown_178h);
@ -1332,18 +1241,18 @@ namespace CodeWalker.GameFiles
public override Tuple<long, IResourceBlock>[] GetParts() public override Tuple<long, IResourceBlock>[] GetParts()
{ {
return new Tuple<long, IResourceBlock>[] { return new Tuple<long, IResourceBlock>[] {
//new Tuple<long, IResourceBlock>(0x50, Unknown_50h), //TODO: fix this new Tuple<long, IResourceBlock>(0x50, Unknown_50h),
//new Tuple<long, IResourceBlock>(0x60, Unknown_60h), new Tuple<long, IResourceBlock>(0x60, Unknown_60h),
//new Tuple<long, IResourceBlock>(0x70, Unknown_70h), new Tuple<long, IResourceBlock>(0x70, Unknown_70h),
//new Tuple<long, IResourceBlock>(0x80, Unknown_80h), new Tuple<long, IResourceBlock>(0x80, Unknown_80h),
//new Tuple<long, IResourceBlock>(0x90, Unknown_90h), new Tuple<long, IResourceBlock>(0x90, Unknown_90h),
//new Tuple<long, IResourceBlock>(0xA0, Unknown_A0h), new Tuple<long, IResourceBlock>(0xA0, Unknown_A0h),
//new Tuple<long, IResourceBlock>(0xB0, Unknown_B0h), new Tuple<long, IResourceBlock>(0xB0, Unknown_B0h),
//new Tuple<long, IResourceBlock>(0xC0, Unknown_C0h), new Tuple<long, IResourceBlock>(0xC0, Unknown_C0h),
//new Tuple<long, IResourceBlock>(0xD0, Unknown_D0h), new Tuple<long, IResourceBlock>(0xD0, Unknown_D0h),
//new Tuple<long, IResourceBlock>(0xE0, Unknown_E0h), new Tuple<long, IResourceBlock>(0xE0, Unknown_E0h),
//new Tuple<long, IResourceBlock>(0x150, Unknown_150h), new Tuple<long, IResourceBlock>(0x150, Unknown_150h),
//new Tuple<long, IResourceBlock>(0x160, Unknown_160h) new Tuple<long, IResourceBlock>(0x160, Unknown_160h)
}; };
} }
} }
@ -1382,15 +1291,8 @@ namespace CodeWalker.GameFiles
public uint Unknown_64h { get; set; } // 0x00000000 public uint Unknown_64h { get; set; } // 0x00000000
public uint Unknown_68h { get; set; } // 0x00000000 public uint Unknown_68h { get; set; } // 0x00000000
public uint Unknown_6Ch { get; set; } // 0x00000000 public uint Unknown_6Ch { get; set; } // 0x00000000
public ResourceSimpleList64Ptr Unknown_70hPtr { get; set; } public ResourceSimpleList64_s<Vector4> Unknown_70h { get; set; }
public Vector4[] Unknown_70h { get; set; } public ResourceSimpleList64_s<Vector4> Unknown_80h { get; set; }
//public uint Unknown_70h { get; set; } // 0x00000000
//public uint Unknown_74h { get; set; } // 0x00000000
//public uint Unknown_78h { get; set; } // 0x00000000
//public uint Unknown_7Ch { get; set; } // 0x00000000
//public ResourceSimpleList64<Vector4_r> Unknown_80h { get; set; }
public ResourceSimpleList64Ptr Unknown_80hPtr { get; set; }
public Vector4[] Unknown_80h { get; set; }
public uint Unknown_90h { get; set; } // 0x00000000 public uint Unknown_90h { get; set; } // 0x00000000
public uint Unknown_94h { get; set; } // 0x00000000 public uint Unknown_94h { get; set; } // 0x00000000
public uint Unknown_98h { get; set; } // 0x00000000 public uint Unknown_98h { get; set; } // 0x00000000
@ -1419,12 +1321,8 @@ namespace CodeWalker.GameFiles
public uint Unknown_F4h { get; set; } // 0x00000000 public uint Unknown_F4h { get; set; } // 0x00000000
public uint Unknown_F8h { get; set; } public uint Unknown_F8h { get; set; }
public uint Unknown_FCh { get; set; } // 0x00000000 public uint Unknown_FCh { get; set; } // 0x00000000
//public ResourceSimpleList64<Vector4_r> Unknown_100h { get; set; } public ResourceSimpleList64_s<Vector4> Unknown_100h { get; set; }
//public ResourceSimpleList64<Vector4_r> Unknown_110h { get; set; } public ResourceSimpleList64_s<Vector4> Unknown_110h { get; set; }
public ResourceSimpleList64Ptr Unknown_100hPtr { get; set; }
public ResourceSimpleList64Ptr Unknown_110hPtr { get; set; }
public Vector4[] Unknown_100h { get; set; }
public Vector4[] Unknown_110h { get; set; }
public uint Unknown_120h { get; set; } // 0x00000000 public uint Unknown_120h { get; set; } // 0x00000000
public uint Unknown_124h { get; set; } // 0x00000000 public uint Unknown_124h { get; set; } // 0x00000000
public uint Unknown_128h { get; set; } // 0x00000000 public uint Unknown_128h { get; set; } // 0x00000000
@ -1486,15 +1384,8 @@ namespace CodeWalker.GameFiles
this.Unknown_64h = reader.ReadUInt32(); this.Unknown_64h = reader.ReadUInt32();
this.Unknown_68h = reader.ReadUInt32(); this.Unknown_68h = reader.ReadUInt32();
this.Unknown_6Ch = reader.ReadUInt32(); this.Unknown_6Ch = reader.ReadUInt32();
this.Unknown_70hPtr = reader.ReadStruct<ResourceSimpleList64Ptr>(); this.Unknown_70h = reader.ReadBlock<ResourceSimpleList64_s<Vector4>>();
this.Unknown_70h = reader.ReadStructsAt<Vector4>(Unknown_70hPtr.EntriesPointer, Unknown_70hPtr.EntriesCount); this.Unknown_80h = reader.ReadBlock<ResourceSimpleList64_s<Vector4>>();
//this.Unknown_70h = reader.ReadUInt32();
//this.Unknown_74h = reader.ReadUInt32();
//this.Unknown_78h = reader.ReadUInt32();
//this.Unknown_7Ch = reader.ReadUInt32();
//this.Unknown_80h = reader.ReadBlock<ResourceSimpleList64<Vector4_r>>();
this.Unknown_80hPtr = reader.ReadStruct<ResourceSimpleList64Ptr>();
this.Unknown_80h = reader.ReadStructsAt<Vector4>(Unknown_80hPtr.EntriesPointer, Unknown_80hPtr.EntriesCount);
this.Unknown_90h = reader.ReadUInt32(); this.Unknown_90h = reader.ReadUInt32();
this.Unknown_94h = reader.ReadUInt32(); this.Unknown_94h = reader.ReadUInt32();
this.Unknown_98h = reader.ReadUInt32(); this.Unknown_98h = reader.ReadUInt32();
@ -1523,12 +1414,8 @@ namespace CodeWalker.GameFiles
this.Unknown_F4h = reader.ReadUInt32(); this.Unknown_F4h = reader.ReadUInt32();
this.Unknown_F8h = reader.ReadUInt32(); this.Unknown_F8h = reader.ReadUInt32();
this.Unknown_FCh = reader.ReadUInt32(); this.Unknown_FCh = reader.ReadUInt32();
//this.Unknown_100h = reader.ReadBlock<ResourceSimpleList64<Vector4_r>>(); this.Unknown_100h = reader.ReadBlock<ResourceSimpleList64_s<Vector4>>();
//this.Unknown_110h = reader.ReadBlock<ResourceSimpleList64<Vector4_r>>(); this.Unknown_110h = reader.ReadBlock<ResourceSimpleList64_s<Vector4>>();
this.Unknown_100hPtr = reader.ReadStruct<ResourceSimpleList64Ptr>();
this.Unknown_110hPtr = reader.ReadStruct<ResourceSimpleList64Ptr>();
this.Unknown_100h = reader.ReadStructsAt<Vector4>(Unknown_100hPtr.EntriesPointer, Unknown_100hPtr.EntriesCount);
this.Unknown_110h = reader.ReadStructsAt<Vector4>(Unknown_110hPtr.EntriesPointer, Unknown_110hPtr.EntriesCount);
this.Unknown_120h = reader.ReadUInt32(); this.Unknown_120h = reader.ReadUInt32();
this.Unknown_124h = reader.ReadUInt32(); this.Unknown_124h = reader.ReadUInt32();
this.Unknown_128h = reader.ReadUInt32(); this.Unknown_128h = reader.ReadUInt32();
@ -1602,11 +1489,8 @@ namespace CodeWalker.GameFiles
writer.Write(this.Unknown_64h); writer.Write(this.Unknown_64h);
writer.Write(this.Unknown_68h); writer.Write(this.Unknown_68h);
writer.Write(this.Unknown_6Ch); writer.Write(this.Unknown_6Ch);
//writer.Write(this.Unknown_70h); writer.WriteBlock(this.Unknown_70h);
//writer.Write(this.Unknown_74h); writer.WriteBlock(this.Unknown_80h);
//writer.Write(this.Unknown_78h);
//writer.Write(this.Unknown_7Ch);
//writer.WriteBlock(this.Unknown_80h); //TODO: fix
writer.Write(this.Unknown_90h); writer.Write(this.Unknown_90h);
writer.Write(this.Unknown_94h); writer.Write(this.Unknown_94h);
writer.Write(this.Unknown_98h); writer.Write(this.Unknown_98h);
@ -1635,8 +1519,8 @@ namespace CodeWalker.GameFiles
writer.Write(this.Unknown_F4h); writer.Write(this.Unknown_F4h);
writer.Write(this.Unknown_F8h); writer.Write(this.Unknown_F8h);
writer.Write(this.Unknown_FCh); writer.Write(this.Unknown_FCh);
//writer.WriteBlock(this.Unknown_100h); //TODO: fix writer.WriteBlock(this.Unknown_100h);
//writer.WriteBlock(this.Unknown_110h); writer.WriteBlock(this.Unknown_110h);
writer.Write(this.Unknown_120h); writer.Write(this.Unknown_120h);
writer.Write(this.Unknown_124h); writer.Write(this.Unknown_124h);
writer.Write(this.Unknown_128h); writer.Write(this.Unknown_128h);
@ -1676,9 +1560,10 @@ namespace CodeWalker.GameFiles
public override Tuple<long, IResourceBlock>[] GetParts() public override Tuple<long, IResourceBlock>[] GetParts()
{ {
return new Tuple<long, IResourceBlock>[] { return new Tuple<long, IResourceBlock>[] {
//new Tuple<long, IResourceBlock>(0x80, Unknown_80h), //TODO: fix new Tuple<long, IResourceBlock>(0x70, Unknown_70h),
//new Tuple<long, IResourceBlock>(0x100, Unknown_100h), new Tuple<long, IResourceBlock>(0x80, Unknown_80h),
//new Tuple<long, IResourceBlock>(0x110, Unknown_110h) new Tuple<long, IResourceBlock>(0x100, Unknown_100h),
new Tuple<long, IResourceBlock>(0x110, Unknown_110h)
}; };
} }
} }

View File

@ -116,12 +116,12 @@ namespace CodeWalker.GameFiles
base.Write(writer, parameters); base.Write(writer, parameters);
// update structure data // update structure data
//this.NamePointer = (ulong)(this.Name != null ? this.Name.Position : 0);//TODO: fix?! this.NamePointer = (ulong)(this.Name != null ? this.Name.FilePosition : 0);
//this.TextureDictionaryPointer = (ulong)(this.TextureDictionary != null ? this.TextureDictionary.Position : 0); this.TextureDictionaryPointer = (ulong)(this.TextureDictionary != null ? this.TextureDictionary.FilePosition : 0);
//this.DrawableDictionaryPointer = (ulong)(this.DrawableDictionary != null ? this.DrawableDictionary.Position : 0); this.DrawableDictionaryPointer = (ulong)(this.DrawableDictionary != null ? this.DrawableDictionary.FilePosition : 0);
//this.ParticleRuleDictionaryPointer = (ulong)(this.ParticleRuleDictionary != null ? this.ParticleRuleDictionary.Position : 0); this.ParticleRuleDictionaryPointer = (ulong)(this.ParticleRuleDictionary != null ? this.ParticleRuleDictionary.FilePosition : 0);
//this.EmitterRuleDictionaryPointer = (ulong)(this.EffectRuleDictionary != null ? this.EffectRuleDictionary.Position : 0); this.EmitterRuleDictionaryPointer = (ulong)(this.EffectRuleDictionary != null ? this.EffectRuleDictionary.FilePosition : 0);
//this.EffectRuleDictionaryPointer = (ulong)(this.EmitterRuleDictionary != null ? this.EmitterRuleDictionary.Position : 0); this.EffectRuleDictionaryPointer = (ulong)(this.EmitterRuleDictionary != null ? this.EmitterRuleDictionary.FilePosition : 0);
// write structure data // write structure data
writer.Write(this.NamePointer); writer.Write(this.NamePointer);
@ -142,13 +142,13 @@ namespace CodeWalker.GameFiles
public override IResourceBlock[] GetReferences() public override IResourceBlock[] GetReferences()
{ {
var list = new List<IResourceBlock>(base.GetReferences()); //TODO: fix!! var list = new List<IResourceBlock>(base.GetReferences());
//if (Name != null) list.Add(Name); if (Name != null) list.Add(Name);
//if (TextureDictionary != null) list.Add(TextureDictionary); if (TextureDictionary != null) list.Add(TextureDictionary);
//if (DrawableDictionary != null) list.Add(DrawableDictionary); if (DrawableDictionary != null) list.Add(DrawableDictionary);
//if (ParticleRuleDictionary != null) list.Add(ParticleRuleDictionary); if (ParticleRuleDictionary != null) list.Add(ParticleRuleDictionary);
//if (EffectRuleDictionary != null) list.Add(EffectRuleDictionary); if (EffectRuleDictionary != null) list.Add(EffectRuleDictionary);
//if (EmitterRuleDictionary != null) list.Add(EmitterRuleDictionary); if (EmitterRuleDictionary != null) list.Add(EmitterRuleDictionary);
return list.ToArray(); return list.ToArray();
} }
} }
@ -350,10 +350,12 @@ namespace CodeWalker.GameFiles
public override void Write(ResourceDataWriter writer, params object[] parameters) public override void Write(ResourceDataWriter writer, params object[] parameters)
{ {
// update structure data // update structure data
//this.HashesPointer = (ulong)(this.Hashes != null ? this.Hashes.Position : 0); this.HashesPointer = (ulong)(this.Hashes != null ? this.Hashes.FilePosition : 0);
////this.HashesCount1 = (ushort)(this.Hashes != null ? this.Hashes.Count : 0); this.HashesCount1 = (ushort)(this.Hashes != null ? this.Hashes.Count : 0);
//this.EffectRulesPointer = (ulong)(this.EmitterRules != null ? this.EmitterRules.Position : 0); this.HashesCount2 = this.HashesCount1;
////this.EffectRulesCount1 = (ushort)(this.EffectRules != null ? this.EffectRules.Count : 0); this.EffectRulesPointer = (ulong)(this.EmitterRules != null ? this.EmitterRules.FilePosition : 0);
this.EffectRulesCount1 = (ushort)(this.EmitterRules != null ? this.EmitterRules.Count : 0);
this.EffectRulesCount2 = this.EffectRulesCount1;
// write structure data // write structure data
writer.Write(this.VFT); writer.Write(this.VFT);
@ -548,10 +550,10 @@ namespace CodeWalker.GameFiles
public override void Write(ResourceDataWriter writer, params object[] parameters) public override void Write(ResourceDataWriter writer, params object[] parameters)
{ {
//// update structure data //TODO: fix! // update structure data
//this.NamePointer = (ulong)(this.Name != null ? this.Name.Position : 0); this.NamePointer = (ulong)(this.Name != null ? this.Name.FilePosition : 0);
//this.p9 = (ulong)(this.p9data != null ? this.p9data.Position : 0); this.p9 = (ulong)(this.p9data != null ? this.p9data.FilePosition : 0);
//this.p10 = (ulong)(this.p10data != null ? this.p10data.Position : 0); this.p10 = (ulong)(this.p10data != null ? this.p10data.FilePosition : 0);
// write structure data // write structure data
writer.Write(this.VFT); writer.Write(this.VFT);
@ -622,9 +624,9 @@ namespace CodeWalker.GameFiles
public override IResourceBlock[] GetReferences() public override IResourceBlock[] GetReferences()
{ {
var list = new List<IResourceBlock>(); var list = new List<IResourceBlock>();
//if (Name != null) list.Add(Name); if (Name != null) list.Add(Name);
//if (p9data != null) list.Add(p9data); if (p9data != null) list.Add(p9data);
//if (p10data != null) list.Add(p10data); if (p10data != null) list.Add(p10data);
return list.ToArray(); return list.ToArray();
} }
@ -732,9 +734,9 @@ namespace CodeWalker.GameFiles
/// </summary> /// </summary>
public override void Write(ResourceDataWriter writer, params object[] parameters) public override void Write(ResourceDataWriter writer, params object[] parameters)
{ {
// update structure data //TODO: fix!! // update structure data
//this.EmitterRulePointer = (ulong)(this.EmitterRule != null ? this.EmitterRule.Position : 0); this.EmitterRulePointer = (ulong)(this.EmitterRule != null ? this.EmitterRule.FilePosition : 0);
//this.p1 = (ulong)(this.p1data != null ? this.p1data.Position : 0); this.p1 = (ulong)(this.p1data != null ? this.p1data.FilePosition : 0);
// write structure data // write structure data
writer.Write(this.VFT); writer.Write(this.VFT);
@ -943,13 +945,13 @@ namespace CodeWalker.GameFiles
public override void Write(ResourceDataWriter writer, params object[] parameters) public override void Write(ResourceDataWriter writer, params object[] parameters)
{ {
//// update structure data // update structure data
//this.NamePointer = (ulong)(this.Name != null ? this.Name.Position : 0); this.NamePointer = (ulong)(this.Name != null ? this.Name.FilePosition : 0);
//this.EventEmittersPointer = (ulong)(this.EventEmitters != null ? this.EventEmitters.Position : 0); this.EventEmittersPointer = (ulong)(this.EventEmitters != null ? this.EventEmitters.FilePosition : 0);
////this.c3b = (ushort)(this.p3data != null ? this.p3data.Count : 0); //this.c3b = (ushort)(this.p3data != null ? this.p3data.Count : 0);
//this.p4 = (ulong)(this.p4data != null ? this.p4data.Position : 0); this.p4 = (ulong)(this.p4data != null ? this.p4data.FilePosition : 0);
//this.KeyframePropsPointer = (ulong)(this.KeyframeProps != null ? this.KeyframeProps.Position : 0); this.KeyframePropsPointer = (ulong)(this.KeyframeProps != null ? this.KeyframeProps.FilePosition : 0);
////this.refcnt2 = (ushort)(this.refs != null ? this.refs.Count : 0); //this.refcnt2 = (ushort)(this.refs != null ? this.refs.Count : 0);
// write structure data // write structure data
writer.Write(this.VFT); writer.Write(this.VFT);
@ -1020,10 +1022,10 @@ namespace CodeWalker.GameFiles
public override IResourceBlock[] GetReferences() public override IResourceBlock[] GetReferences()
{ {
var list = new List<IResourceBlock>(); var list = new List<IResourceBlock>();
//if (Name != null) list.Add(Name); if (Name != null) list.Add(Name);
//if (EventEmitters != null) list.Add(EventEmitters); if (EventEmitters != null) list.Add(EventEmitters);
//if (p4data != null) list.Add(p4data); if (p4data != null) list.Add(p4data);
//if (KeyframeProps != null) list.Add(KeyframeProps); if (KeyframeProps != null) list.Add(KeyframeProps);
return list.ToArray(); return list.ToArray();
} }
@ -1302,11 +1304,11 @@ namespace CodeWalker.GameFiles
public override void Write(ResourceDataWriter writer, params object[] parameters) public override void Write(ResourceDataWriter writer, params object[] parameters)
{ {
// update structure data // update structure data
//this.p1 = (ulong)(this.p1data != null ? this.p1data.Position : 0); this.p1 = (ulong)(this.p1data != null ? this.p1data.FilePosition : 0);
//this.p2 = (ulong)(this.p2data != null ? this.p2data.Position : 0); this.p2 = (ulong)(this.p2data != null ? this.p2data.FilePosition : 0);
//this.p3 = (ulong)(this.p3data != null ? this.p3data.Position : 0); this.p3 = (ulong)(this.p3data != null ? this.p3data.FilePosition : 0);
//this.p4 = (ulong)(this.EmitterRule != null ? this.EmitterRule.Position : 0); this.p4 = (ulong)(this.EmitterRule != null ? this.EmitterRule.FilePosition : 0);
//this.p5 = (ulong)(this.ParticleRule != null ? this.ParticleRule.Position : 0); this.p5 = (ulong)(this.ParticleRule != null ? this.ParticleRule.FilePosition : 0);
// write structure data // write structure data
writer.Write(this.VFT); writer.Write(this.VFT);
@ -1337,11 +1339,11 @@ namespace CodeWalker.GameFiles
public override IResourceBlock[] GetReferences() public override IResourceBlock[] GetReferences()
{ {
var list = new List<IResourceBlock>(); var list = new List<IResourceBlock>();
//if (p1data != null) list.Add(p1data); if (p1data != null) list.Add(p1data);
//if (p2data != null) list.Add(p2data); if (p2data != null) list.Add(p2data);
//if (p3data != null) list.Add(p3data); if (p3data != null) list.Add(p3data);
//if (EmitterRule != null) list.Add(EmitterRule); if (EmitterRule != null) list.Add(EmitterRule);
//if (ParticleRule != null) list.Add(ParticleRule); if (ParticleRule != null) list.Add(ParticleRule);
return list.ToArray(); return list.ToArray();
} }
} }
@ -1426,7 +1428,7 @@ namespace CodeWalker.GameFiles
public override void Write(ResourceDataWriter writer, params object[] parameters) public override void Write(ResourceDataWriter writer, params object[] parameters)
{ {
// update structure data // update structure data
//this.p1 = (ulong)(this.p1data != null ? this.p1data.Position : 0); this.p1 = (ulong)(this.p1data != null ? this.p1data.FilePosition : 0);
// write structure data // write structure data
writer.Write(this.p1); writer.Write(this.p1);
@ -1597,7 +1599,7 @@ namespace CodeWalker.GameFiles
public override void Write(ResourceDataWriter writer, params object[] parameters) public override void Write(ResourceDataWriter writer, params object[] parameters)
{ {
// update structure data // update structure data
//this.Unknown_8h_Pointer = (ulong)(this.Unknown_8h_Data != null ? this.Unknown_8h_Data.Position : 0); this.Unknown_8h_Pointer = (ulong)(this.Unknown_8h_Data != null ? this.Unknown_8h_Data.FilePosition : 0);
// write structure data // write structure data
writer.Write(this.Unknown_0h); writer.Write(this.Unknown_0h);
@ -1741,12 +1743,12 @@ namespace CodeWalker.GameFiles
public override void Write(ResourceDataWriter writer, params object[] parameters) public override void Write(ResourceDataWriter writer, params object[] parameters)
{ {
// update structure data // update structure data
//this.NamePointer = (ulong)(this.Name != null ? this.Name.Position : 0); this.NamePointer = (ulong)(this.Name != null ? this.Name.FilePosition : 0);
//this.p2 = (ulong)(this.p2data != null ? this.p2data.Position : 0); this.p2 = (ulong)(this.p2data != null ? this.p2data.FilePosition : 0);
//this.p3 = (ulong)(this.p3data != null ? this.p3data.Position : 0); this.p3 = (ulong)(this.p3data != null ? this.p3data.FilePosition : 0);
//this.p4 = (ulong)(this.p4data != null ? this.p4data.Position : 0); this.p4 = (ulong)(this.p4data != null ? this.p4data.FilePosition : 0);
//this.KeyframePropsPointer = (ulong)(this.KeyframeProps != null ? this.KeyframeProps.Position : 0); this.KeyframePropsPointer = (ulong)(this.KeyframeProps != null ? this.KeyframeProps.FilePosition : 0);
////this.refcnt2 = (ushort)(this.refs != null ? this.refs.Count : 0); //this.refcnt2 = (ushort)(this.refs != null ? this.refs.Count : 0);
// write structure data // write structure data
writer.Write(this.VFT); writer.Write(this.VFT);
@ -1796,11 +1798,11 @@ namespace CodeWalker.GameFiles
public override IResourceBlock[] GetReferences() public override IResourceBlock[] GetReferences()
{ {
var list = new List<IResourceBlock>(); var list = new List<IResourceBlock>();
//if (Name != null) list.Add(Name); if (Name != null) list.Add(Name);
//if (p2data != null) list.Add(p2data); if (p2data != null) list.Add(p2data);
//if (p3data != null) list.Add(p3data); if (p3data != null) list.Add(p3data);
//if (p4data != null) list.Add(p4data); if (p4data != null) list.Add(p4data);
//if (KeyframeProps != null) list.Add(KeyframeProps); if (KeyframeProps != null) list.Add(KeyframeProps);
return list.ToArray(); return list.ToArray();
} }
@ -2027,7 +2029,7 @@ namespace CodeWalker.GameFiles
public override void Write(ResourceDataWriter writer, params object[] parameters) public override void Write(ResourceDataWriter writer, params object[] parameters)
{ {
// update structure data // update structure data
////this.p1 = (ulong)(this.p1data != null ? this.p1data.Position : 0); this.p1 = (ulong)(this.p1data != null ? this.p1data.FilePosition : 0);
// write structure data // write structure data
writer.Write(this.p1); writer.Write(this.p1);
@ -2073,7 +2075,7 @@ namespace CodeWalker.GameFiles
public override void Write(ResourceDataWriter writer, params object[] parameters) public override void Write(ResourceDataWriter writer, params object[] parameters)
{ {
// update structure data // update structure data
////this.p1 = (ulong)(this.p1data != null ? this.p1data.Position : 0); this.p1 = (ulong)(this.p1data != null ? this.p1data.FilePosition : 0);
// write structure data // write structure data
writer.Write(this.Unknown_0h); writer.Write(this.Unknown_0h);
@ -4074,8 +4076,8 @@ namespace CodeWalker.GameFiles
base.Write(writer, parameters); base.Write(writer, parameters);
// update structure data // update structure data
//this.TexturePointer = (ulong)(this.Texture != null ? this.Texture.Position : 0); this.TexturePointer = (ulong)(this.Texture != null ? this.Texture.FilePosition : 0);
//this.NamePointer = (ulong)(this.Name != null ? this.Name.Position : 0); this.NamePointer = (ulong)(this.Name != null ? this.Name.FilePosition : 0);
// write structure data // write structure data
writer.Write(this.Unknown_18h); writer.Write(this.Unknown_18h);
@ -4091,8 +4093,8 @@ namespace CodeWalker.GameFiles
public override IResourceBlock[] GetReferences() public override IResourceBlock[] GetReferences()
{ {
var list = new List<IResourceBlock>(base.GetReferences()); var list = new List<IResourceBlock>(base.GetReferences());
//if (Texture != null) list.Add(Texture); if (Texture != null) list.Add(Texture);
//if (Name != null) list.Add(Name); if (Name != null) list.Add(Name);
return list.ToArray(); return list.ToArray();
} }
} }
@ -4248,9 +4250,9 @@ namespace CodeWalker.GameFiles
public override void Write(ResourceDataWriter writer, params object[] parameters) public override void Write(ResourceDataWriter writer, params object[] parameters)
{ {
//// update structure data // update structure data
//this.Unknown_10h_Pointer = (ulong)(this.Unknown_10h_Data != null ? this.Unknown_10h_Data.Position : 0); this.Unknown_10h_Pointer = (ulong)(this.Unknown_10h_Data != null ? this.Unknown_10h_Data.FilePosition : 0);
//this.DrawablePointer = (ulong)(this.Drawable != null ? this.Drawable.Position : 0); this.DrawablePointer = (ulong)(this.Drawable != null ? this.Drawable.FilePosition : 0);
// write structure data // write structure data
writer.Write(this.Unknown_0h); writer.Write(this.Unknown_0h);

View File

@ -658,6 +658,9 @@ namespace CodeWalker.GameFiles
//public ResourceSimpleArray<T> Entries; //public ResourceSimpleArray<T> Entries;
public T[] data_items { get; private set; } public T[] data_items { get; private set; }
private ResourceSimpleArray<T> data_block;//used for saving.
/// <summary> /// <summary>
/// Reads the data-block from a stream. /// Reads the data-block from a stream.
/// </summary> /// </summary>
@ -693,9 +696,9 @@ namespace CodeWalker.GameFiles
public override void Write(ResourceDataWriter writer, params object[] parameters) public override void Write(ResourceDataWriter writer, params object[] parameters)
{ {
// update structure data //TODO: fix // update structure data //TODO: fix
//this.EntriesPointer = (ulong)(this.Entries != null ? this.Entries.Position : 0); this.EntriesPointer = (ulong)(this.data_block != null ? this.data_block.FilePosition : 0);
//this.EntriesCount = (ushort)(this.Entries != null ? this.Entries.Count : 0); this.EntriesCount = (ushort)(this.data_block != null ? this.data_block.Count : 0);
//this.EntriesCapacity = (ushort)(this.Entries != null ? this.Entries.Count : 0); this.EntriesCapacity = (ushort)(this.data_block != null ? this.data_block.Count : 0);
// write structure data // write structure data
writer.Write(this.EntriesPointer); writer.Write(this.EntriesPointer);
@ -711,6 +714,518 @@ namespace CodeWalker.GameFiles
{ {
var list = new List<IResourceBlock>(); var list = new List<IResourceBlock>();
//if (Entries != null) list.Add(Entries); //if (Entries != null) list.Add(Entries);
data_block = new ResourceSimpleArray<T>();
data_block.Data = new List<T>();
data_block.Data.AddRange(data_items);
list.Add(data_block);
return list.ToArray();
}
public override string ToString()
{
return "(Count: " + EntriesCount.ToString() + ")";
}
}
[TypeConverter(typeof(ExpandableObjectConverter))] public class ResourceSimpleList64_s<T> : ResourceSystemBlock where T : struct
{
public override long BlockLength
{
get { return 16; }
}
// structure data
public ulong EntriesPointer { get; private set; }
public ushort EntriesCount { get; private set; }
public ushort EntriesCapacity { get; private set; }
// reference data
public T[] data_items { get; private set; }
private ResourceSystemStructBlock<T> data_block;//used for saving.
/// <summary>
/// Reads the data-block from a stream.
/// </summary>
public override void Read(ResourceDataReader reader, params object[] parameters)
{
// read structure data
this.EntriesPointer = reader.ReadUInt64();
this.EntriesCount = reader.ReadUInt16();
this.EntriesCapacity = reader.ReadUInt16();
reader.Position += 4;
// read reference data
//TODO: NEEDS TO BE TESTED!!!
data_items = reader.ReadStructsAt<T>(EntriesPointer, EntriesCount);
}
/// <summary>
/// Writes the data-block to a stream.
/// </summary>
public override void Write(ResourceDataWriter writer, params object[] parameters)
{
// update structure data //TODO: fix
this.EntriesPointer = (ulong)(this.data_block != null ? this.data_block.FilePosition : 0);
this.EntriesCount = (ushort)(this.data_block != null ? this.data_block.ItemCount : 0);
this.EntriesCapacity = (ushort)(this.data_block != null ? this.data_block.ItemCount : 0);
// write structure data
writer.Write(this.EntriesPointer);
writer.Write(this.EntriesCount);
writer.Write(this.EntriesCapacity);
writer.Write((uint)0x00000000);
}
/// <summary>
/// Returns a list of data blocks which are referenced by this block.
/// </summary>
public override IResourceBlock[] GetReferences()
{
var list = new List<IResourceBlock>();
//if (Entries != null) list.Add(Entries);
data_block = new ResourceSystemStructBlock<T>(data_items);
list.Add(data_block);
return list.ToArray();
}
public override string ToString()
{
return "(Count: " + EntriesCount.ToString() + ")";
}
}
[TypeConverter(typeof(ExpandableObjectConverter))] public class ResourceSimpleList64b_s<T> : ResourceSystemBlock where T : struct
{
//this version uses uints for the count/cap!
public override long BlockLength
{
get { return 16; }
}
// structure data
public ulong EntriesPointer { get; private set; }
public uint EntriesCount { get; private set; }
public uint EntriesCapacity { get; private set; }
// reference data
public T[] data_items { get; private set; }
private ResourceSystemStructBlock<T> data_block;//used for saving.
/// <summary>
/// Reads the data-block from a stream.
/// </summary>
public override void Read(ResourceDataReader reader, params object[] parameters)
{
// read structure data
this.EntriesPointer = reader.ReadUInt64();
this.EntriesCount = reader.ReadUInt32();
this.EntriesCapacity = reader.ReadUInt32();
//reader.Position += 4;
// read reference data
//TODO: NEEDS TO BE TESTED!!!
data_items = reader.ReadStructsAt<T>(EntriesPointer, EntriesCount);
}
/// <summary>
/// Writes the data-block to a stream.
/// </summary>
public override void Write(ResourceDataWriter writer, params object[] parameters)
{
// update structure data //TODO: fix
this.EntriesPointer = (ulong)(this.data_block != null ? this.data_block.FilePosition : 0);
this.EntriesCount = (ushort)(this.data_block != null ? this.data_block.ItemCount : 0);
this.EntriesCapacity = (ushort)(this.data_block != null ? this.data_block.ItemCount : 0);
// write structure data
writer.Write(this.EntriesPointer);
writer.Write(this.EntriesCount);
writer.Write(this.EntriesCapacity);
//writer.Write((uint)0x00000000);
}
/// <summary>
/// Returns a list of data blocks which are referenced by this block.
/// </summary>
public override IResourceBlock[] GetReferences()
{
var list = new List<IResourceBlock>();
//if (Entries != null) list.Add(Entries);
data_block = new ResourceSystemStructBlock<T>(data_items);
list.Add(data_block);
return list.ToArray();
}
public override string ToString()
{
return "(Count: " + EntriesCount.ToString() + ")";
}
}
[TypeConverter(typeof(ExpandableObjectConverter))] public class ResourceSimpleList64_byte : ResourceSystemBlock
{
public override long BlockLength
{
get { return 16; }
}
// structure data
public ulong EntriesPointer { get; private set; }
public ushort EntriesCount { get; private set; }
public ushort EntriesCapacity { get; private set; }
// reference data
public byte[] data_items { get; private set; }
private ResourceSystemStructBlock<byte> data_block;//used for saving.
/// <summary>
/// Reads the data-block from a stream.
/// </summary>
public override void Read(ResourceDataReader reader, params object[] parameters)
{
// read structure data
this.EntriesPointer = reader.ReadUInt64();
this.EntriesCount = reader.ReadUInt16();
this.EntriesCapacity = reader.ReadUInt16();
reader.Position += 4;
// read reference data
//TODO: NEEDS TO BE TESTED!!!
data_items = reader.ReadBytesAt(EntriesPointer, EntriesCount);
}
/// <summary>
/// Writes the data-block to a stream.
/// </summary>
public override void Write(ResourceDataWriter writer, params object[] parameters)
{
// update structure data //TODO: fix
this.EntriesPointer = (ulong)(this.data_block != null ? this.data_block.FilePosition : 0);
this.EntriesCount = (ushort)(this.data_block != null ? this.data_block.ItemCount : 0);
this.EntriesCapacity = (ushort)(this.data_block != null ? this.data_block.ItemCount : 0);
// write structure data
writer.Write(this.EntriesPointer);
writer.Write(this.EntriesCount);
writer.Write(this.EntriesCapacity);
writer.Write((uint)0x00000000);
}
/// <summary>
/// Returns a list of data blocks which are referenced by this block.
/// </summary>
public override IResourceBlock[] GetReferences()
{
var list = new List<IResourceBlock>();
//if (Entries != null) list.Add(Entries);
data_block = new ResourceSystemStructBlock<byte>(data_items);
list.Add(data_block);
return list.ToArray();
}
public override string ToString()
{
return "(Count: " + EntriesCount.ToString() + ")";
}
}
[TypeConverter(typeof(ExpandableObjectConverter))] public class ResourceSimpleList64_ushort : ResourceSystemBlock
{
public override long BlockLength
{
get { return 16; }
}
// structure data
public ulong EntriesPointer { get; private set; }
public ushort EntriesCount { get; private set; }
public ushort EntriesCapacity { get; private set; }
// reference data
public ushort[] data_items { get; private set; }
private ResourceSystemStructBlock<ushort> data_block;//used for saving.
/// <summary>
/// Reads the data-block from a stream.
/// </summary>
public override void Read(ResourceDataReader reader, params object[] parameters)
{
// read structure data
this.EntriesPointer = reader.ReadUInt64();
this.EntriesCount = reader.ReadUInt16();
this.EntriesCapacity = reader.ReadUInt16();
reader.Position += 4;
// read reference data
//TODO: NEEDS TO BE TESTED!!!
data_items = reader.ReadUshortsAt(EntriesPointer, EntriesCount);
}
/// <summary>
/// Writes the data-block to a stream.
/// </summary>
public override void Write(ResourceDataWriter writer, params object[] parameters)
{
// update structure data //TODO: fix
this.EntriesPointer = (ulong)(this.data_block != null ? this.data_block.FilePosition : 0);
this.EntriesCount = (ushort)(this.data_block != null ? this.data_block.ItemCount : 0);
this.EntriesCapacity = (ushort)(this.data_block != null ? this.data_block.ItemCount : 0);
// write structure data
writer.Write(this.EntriesPointer);
writer.Write(this.EntriesCount);
writer.Write(this.EntriesCapacity);
writer.Write((uint)0x00000000);
}
/// <summary>
/// Returns a list of data blocks which are referenced by this block.
/// </summary>
public override IResourceBlock[] GetReferences()
{
var list = new List<IResourceBlock>();
//if (Entries != null) list.Add(Entries);
data_block = new ResourceSystemStructBlock<ushort>(data_items);
list.Add(data_block);
return list.ToArray();
}
public override string ToString()
{
return "(Count: " + EntriesCount.ToString() + ")";
}
}
[TypeConverter(typeof(ExpandableObjectConverter))] public class ResourceSimpleList64_uint : ResourceSystemBlock
{
public override long BlockLength
{
get { return 16; }
}
// structure data
public ulong EntriesPointer { get; private set; }
public ushort EntriesCount { get; private set; }
public ushort EntriesCapacity { get; private set; }
// reference data
public uint[] data_items { get; private set; }
private ResourceSystemStructBlock<uint> data_block;//used for saving.
/// <summary>
/// Reads the data-block from a stream.
/// </summary>
public override void Read(ResourceDataReader reader, params object[] parameters)
{
// read structure data
this.EntriesPointer = reader.ReadUInt64();
this.EntriesCount = reader.ReadUInt16();
this.EntriesCapacity = reader.ReadUInt16();
reader.Position += 4;
// read reference data
//TODO: NEEDS TO BE TESTED!!!
data_items = reader.ReadUintsAt(EntriesPointer, EntriesCount);
}
/// <summary>
/// Writes the data-block to a stream.
/// </summary>
public override void Write(ResourceDataWriter writer, params object[] parameters)
{
// update structure data //TODO: fix
this.EntriesPointer = (ulong)(this.data_block != null ? this.data_block.FilePosition : 0);
this.EntriesCount = (ushort)(this.data_block != null ? this.data_block.ItemCount : 0);
this.EntriesCapacity = (ushort)(this.data_block != null ? this.data_block.ItemCount : 0);
// write structure data
writer.Write(this.EntriesPointer);
writer.Write(this.EntriesCount);
writer.Write(this.EntriesCapacity);
writer.Write((uint)0x00000000);
}
/// <summary>
/// Returns a list of data blocks which are referenced by this block.
/// </summary>
public override IResourceBlock[] GetReferences()
{
var list = new List<IResourceBlock>();
//if (Entries != null) list.Add(Entries);
data_block = new ResourceSystemStructBlock<uint>(data_items);
list.Add(data_block);
return list.ToArray();
}
public override string ToString()
{
return "(Count: " + EntriesCount.ToString() + ")";
}
}
[TypeConverter(typeof(ExpandableObjectConverter))] public class ResourceSimpleList64_ulong : ResourceSystemBlock
{
public override long BlockLength
{
get { return 16; }
}
// structure data
public ulong EntriesPointer { get; private set; }
public ushort EntriesCount { get; private set; }
public ushort EntriesCapacity { get; private set; }
// reference data
public ulong[] data_items { get; private set; }
private ResourceSystemStructBlock<ulong> data_block;//used for saving.
/// <summary>
/// Reads the data-block from a stream.
/// </summary>
public override void Read(ResourceDataReader reader, params object[] parameters)
{
// read structure data
this.EntriesPointer = reader.ReadUInt64();
this.EntriesCount = reader.ReadUInt16();
this.EntriesCapacity = reader.ReadUInt16();
reader.Position += 4;
// read reference data
//TODO: NEEDS TO BE TESTED!!!
data_items = reader.ReadUlongsAt(EntriesPointer, EntriesCount);
}
/// <summary>
/// Writes the data-block to a stream.
/// </summary>
public override void Write(ResourceDataWriter writer, params object[] parameters)
{
// update structure data //TODO: fix
this.EntriesPointer = (ulong)(this.data_block != null ? this.data_block.FilePosition : 0);
this.EntriesCount = (ushort)(this.data_block != null ? this.data_block.ItemCount : 0);
this.EntriesCapacity = (ushort)(this.data_block != null ? this.data_block.ItemCount : 0);
// write structure data
writer.Write(this.EntriesPointer);
writer.Write(this.EntriesCount);
writer.Write(this.EntriesCapacity);
writer.Write((uint)0x00000000);
}
/// <summary>
/// Returns a list of data blocks which are referenced by this block.
/// </summary>
public override IResourceBlock[] GetReferences()
{
var list = new List<IResourceBlock>();
//if (Entries != null) list.Add(Entries);
data_block = new ResourceSystemStructBlock<ulong>(data_items);
list.Add(data_block);
return list.ToArray();
}
public override string ToString()
{
return "(Count: " + EntriesCount.ToString() + ")";
}
}
[TypeConverter(typeof(ExpandableObjectConverter))] public class ResourceSimpleList64_float : ResourceSystemBlock
{
public override long BlockLength
{
get { return 16; }
}
// structure data
public ulong EntriesPointer { get; private set; }
public ushort EntriesCount { get; private set; }
public ushort EntriesCapacity { get; private set; }
// reference data
public float[] data_items { get; private set; }
private ResourceSystemStructBlock<float> data_block;//used for saving.
/// <summary>
/// Reads the data-block from a stream.
/// </summary>
public override void Read(ResourceDataReader reader, params object[] parameters)
{
// read structure data
this.EntriesPointer = reader.ReadUInt64();
this.EntriesCount = reader.ReadUInt16();
this.EntriesCapacity = reader.ReadUInt16();
reader.Position += 4;
// read reference data
//TODO: NEEDS TO BE TESTED!!!
data_items = reader.ReadFloatsAt(EntriesPointer, EntriesCount);
}
/// <summary>
/// Writes the data-block to a stream.
/// </summary>
public override void Write(ResourceDataWriter writer, params object[] parameters)
{
// update structure data //TODO: fix
this.EntriesPointer = (ulong)(this.data_block != null ? this.data_block.FilePosition : 0);
this.EntriesCount = (ushort)(this.data_block != null ? this.data_block.ItemCount : 0);
this.EntriesCapacity = (ushort)(this.data_block != null ? this.data_block.ItemCount : 0);
// write structure data
writer.Write(this.EntriesPointer);
writer.Write(this.EntriesCount);
writer.Write(this.EntriesCapacity);
writer.Write((uint)0x00000000);
}
/// <summary>
/// Returns a list of data blocks which are referenced by this block.
/// </summary>
public override IResourceBlock[] GetReferences()
{
var list = new List<IResourceBlock>();
//if (Entries != null) list.Add(Entries);
data_block = new ResourceSystemStructBlock<float>(data_items);
list.Add(data_block);
return list.ToArray(); return list.ToArray();
} }
@ -752,53 +1267,23 @@ namespace CodeWalker.GameFiles
} }
//// structure data
//public List<ulong> data_pointers;
//// reference data
//public List<T> data_items;
public ulong[] data_pointers { get; private set; } public ulong[] data_pointers { get; private set; }
public T[] data_items { get; private set; } public T[] data_items { get; set; }
public ResourcePointerArray64() public ResourcePointerArray64()
{ {
//data_items = new List<T>();
} }
public override void Read(ResourceDataReader reader, params object[] parameters) public override void Read(ResourceDataReader reader, params object[] parameters)
{ {
int numElements = Convert.ToInt32(parameters[0]); int numElements = Convert.ToInt32(parameters[0]);
// read structure data
//data_pointers = new List<ulong>();
//for (int i = 0; i < numElements; i++)
//{
// data_pointers.Add(reader.ReadUInt64());
//}
data_pointers = reader.ReadUlongsAt((ulong)reader.Position, (uint)numElements); data_pointers = reader.ReadUlongsAt((ulong)reader.Position, (uint)numElements);
//foreach (var dp in data_pointers)
//{
// if (dp == 0)
// {
// }
//}
// read reference data
//data_items = new List<T>();
//for (int i = 0; i < numElements; i++)
//{
// data_items.Add(
// reader.ReadBlockAt<T>(data_pointers[i])
// );
//}
data_items = new T[numElements]; data_items = new T[numElements];
for (int i = 0; i < numElements; i++) for (int i = 0; i < numElements; i++)
{ {
@ -811,13 +1296,13 @@ namespace CodeWalker.GameFiles
public override void Write(ResourceDataWriter writer, params object[] parameters) public override void Write(ResourceDataWriter writer, params object[] parameters)
{ {
// update... // update...
//data_pointers = new List<ulong>(); var list = new List<ulong>();
//foreach (var x in data_items) foreach (var x in data_items)
// if (x != null) if (x != null)
// data_pointers.Add((uint)x.Position); list.Add((uint)x.FilePosition);
// else else
// data_pointers.Add((uint)0); list.Add((uint)0);
//TODO: fix! data_pointers = list.ToArray();
// write... // write...
foreach (var x in data_pointers) foreach (var x in data_pointers)
@ -928,68 +1413,29 @@ namespace CodeWalker.GameFiles
[TypeConverter(typeof(ExpandableObjectConverter))] public class ResourcePointerArray64_s<T> : ResourceSystemBlock, IList<T> where T : struct [TypeConverter(typeof(ExpandableObjectConverter))] public class ResourcePointerArray64_s<T> : ResourceSystemBlock, IList<T> where T : struct
{ {
//public int GetNonEmptyNumber()
//{
// int i = 0;
// foreach (var q in data_items)
// if (q != null)
// i++;
// return i;
//}
public override long BlockLength public override long BlockLength
{ {
get { return (data_items != null) ? 8 * data_items.Length : 0; } get { return (data_items != null) ? 8 * data_items.Length : 0; }
} }
//// structure data
//public List<ulong> data_pointers;
//// reference data
//public List<T> data_items;
public ulong[] data_pointers { get; private set; } public ulong[] data_pointers { get; private set; }
public T[] data_items { get; private set; } public T[] data_items { get; private set; }
private ResourceSystemStructBlock<T>[] data_blocks = null;
public ResourcePointerArray64_s() public ResourcePointerArray64_s()
{ {
//data_items = new List<T>();
} }
public override void Read(ResourceDataReader reader, params object[] parameters) public override void Read(ResourceDataReader reader, params object[] parameters)
{ {
int numElements = Convert.ToInt32(parameters[0]); int numElements = Convert.ToInt32(parameters[0]);
// read structure data
//data_pointers = new List<ulong>();
//for (int i = 0; i < numElements; i++)
//{
// data_pointers.Add(reader.ReadUInt64());
//}
data_pointers = reader.ReadUlongsAt((ulong)reader.Position, (uint)numElements); data_pointers = reader.ReadUlongsAt((ulong)reader.Position, (uint)numElements);
//foreach (var dp in data_pointers)
//{
// if (dp == 0)
// {
// }
//}
// read reference data
//data_items = new List<T>();
//for (int i = 0; i < numElements; i++)
//{
// data_items.Add(
// reader.ReadBlockAt<T>(data_pointers[i])
// );
//}
data_items = new T[numElements]; data_items = new T[numElements];
for (int i = 0; i < numElements; i++) for (int i = 0; i < numElements; i++)
{ {
@ -1001,13 +1447,20 @@ namespace CodeWalker.GameFiles
public override void Write(ResourceDataWriter writer, params object[] parameters) public override void Write(ResourceDataWriter writer, params object[] parameters)
{ {
// update... // update...
//data_pointers = new List<ulong>(); var list = new List<ulong>();
if (data_blocks != null)
{
foreach (var x in data_blocks)
{
list.Add((ulong)x.FilePosition);
}
}
//foreach (var x in data_items) //foreach (var x in data_items)
// if (x != null) // if (x != null)
// data_pointers.Add((uint)x.Position); // data_pointers.Add((uint)x.Position);
// else // else
// data_pointers.Add((uint)0); // data_pointers.Add((uint)0);
//TODO: fix! data_pointers = list.ToArray();
// write... // write...
foreach (var x in data_pointers) foreach (var x in data_pointers)
@ -1019,7 +1472,18 @@ namespace CodeWalker.GameFiles
{ {
var list = new List<IResourceBlock>(); var list = new List<IResourceBlock>();
//foreach (var x in data_items) //TODO: fix var blocks = new List<ResourceSystemStructBlock<T>>();
if (data_items != null)
{
foreach (var x in data_items)
{
var block = new ResourceSystemStructBlock<T>(new[] { x });
blocks.Add(block);
list.Add(block);
}
}
data_blocks = blocks.ToArray();
//foreach (var x in data_items)
// list.Add(x); // list.Add(x);
return list.ToArray(); return list.ToArray();
@ -1133,6 +1597,7 @@ namespace CodeWalker.GameFiles
public ulong[] data_pointers { get; private set; } public ulong[] data_pointers { get; private set; }
public T[] data_items { get; private set; } public T[] data_items { get; private set; }
private ResourcePointerArray64<T> data_block;//used for saving.
public override void Read(ResourceDataReader reader, params object[] parameters) public override void Read(ResourceDataReader reader, params object[] parameters)
@ -1159,10 +1624,11 @@ namespace CodeWalker.GameFiles
public override void Write(ResourceDataWriter writer, params object[] parameters) public override void Write(ResourceDataWriter writer, params object[] parameters)
{ {
// update... //TODO: fix... // update...
//this.EntriesPointer = (ulong)(this.Entries != null ? this.Entries.Position : 0); this.EntriesPointer = (ulong)(this.data_block != null ? this.data_block.FilePosition : 0);
//this.EntriesCount = (ushort)(this.Entries != null ? this.Entries.Count : 0); this.EntriesCount = (ushort)(this.data_block != null ? this.data_block.Count : 0);
//this.EntriesCapacity = (ushort)(this.Entries != null ? this.Entries.Count : 0); this.EntriesCapacity = (ushort)(this.data_block != null ? this.data_block.Count : 0);
// write... // write...
writer.Write(EntriesPointer); writer.Write(EntriesPointer);
@ -1174,7 +1640,12 @@ namespace CodeWalker.GameFiles
public override IResourceBlock[] GetReferences() public override IResourceBlock[] GetReferences()
{ {
var list = new List<IResourceBlock>(); var list = new List<IResourceBlock>();
//if (Entries != null) list.Add(Entries); //TODO: fix..
//if (Entries != null) list.Add(Entries);
data_block = new ResourcePointerArray64<T>();
data_block.data_items = data_items;
list.Add(data_block);
return list.ToArray(); return list.ToArray();
} }
@ -1358,8 +1829,8 @@ namespace CodeWalker.GameFiles
foreach (var x in ptr_list) foreach (var x in ptr_list)
writer.Write(x); writer.Write(x);
foreach (var x in Data) //foreach (var x in Data)
x.Write(writer); // x.Write(writer);
} }
@ -1369,7 +1840,7 @@ namespace CodeWalker.GameFiles
{ {
var children = new List<IResourceBlock>(); var children = new List<IResourceBlock>();
//if (Data != null) children.AddRange(Data); if (Data != null) children.AddRange(Data);
return children.ToArray(); return children.ToArray();
} }
@ -1378,15 +1849,15 @@ namespace CodeWalker.GameFiles
{ {
var children = new List<Tuple<long, IResourceBlock>>(); var children = new List<Tuple<long, IResourceBlock>>();
if (Data != null) //if (Data != null)
{ //{
long len = 8 * Data.Count; // long len = 8 * Data.Count;
foreach (var f in Data) // foreach (var f in Data)
{ // {
children.Add(new Tuple<long, IResourceBlock>(len, f)); // children.Add(new Tuple<long, IResourceBlock>(len, f));
len += f.BlockLength; // len += f.BlockLength;
} // }
} //}
return children.ToArray(); return children.ToArray();
} }

View File

@ -87,6 +87,19 @@ namespace CodeWalker.GameFiles
var systemSize = resentry.SystemSize; var systemSize = resentry.SystemSize;
var graphicsSize = resentry.GraphicsSize; var graphicsSize = resentry.GraphicsSize;
//if (data != null)
//{
// if (systemSize > data.Length)
// {
// systemSize = data.Length;
// graphicsSize = 0;
// }
// else if ((systemSize + graphicsSize) > data.Length)
// {
// graphicsSize = data.Length - systemSize;
// }
//}
this.systemStream = new MemoryStream(data, 0, systemSize); this.systemStream = new MemoryStream(data, 0, systemSize);
this.graphicsStream = new MemoryStream(data, systemSize, graphicsSize); this.graphicsStream = new MemoryStream(data, systemSize, graphicsSize);
this.blockPool = new Dictionary<long, List<IResourceBlock>>(); this.blockPool = new Dictionary<long, List<IResourceBlock>>();
@ -735,10 +748,14 @@ namespace CodeWalker.GameFiles
public override void Write(ResourceDataWriter writer, params object[] parameters) public override void Write(ResourceDataWriter writer, params object[] parameters)
{ {
byte[] data = MetaTypes.ConvertArrayToBytes(Items); byte[] data = MetaTypes.ConvertArrayToBytes(Items);
if (data != null)
{
writer.Write(data); writer.Write(data);
} }
} }
}
//public interface ResourceDataStruct //public interface ResourceDataStruct

View File

@ -24,12 +24,12 @@ namespace CodeWalker.GameFiles
public uint Unknown_14h { get; set; } // 0x00000000 public uint Unknown_14h { get; set; } // 0x00000000
public uint Unknown_18h { get; set; } // 0x00000001 public uint Unknown_18h { get; set; } // 0x00000001
public uint Unknown_1Ch { get; set; } // 0x00000000 public uint Unknown_1Ch { get; set; } // 0x00000000
public ResourceSimpleList64Ptr TextureNameHashesPtr { get; set; } public ResourceSimpleList64_uint TextureNameHashes { get; set; }
public uint[] TextureNameHashes { get; set; }
public ResourcePointerList64<Texture> Textures { get; set; } public ResourcePointerList64<Texture> Textures { get; set; }
public Dictionary<uint, Texture> Dict { get; set; } public Dictionary<uint, Texture> Dict { get; set; }
public long MemoryUsage public long MemoryUsage
{ {
get get
@ -51,8 +51,8 @@ namespace CodeWalker.GameFiles
public TextureDictionary() public TextureDictionary()
{ {
//this.TextureNameHashes = new ResourceSimpleList64<uint_r>(); //this.TextureNameHashes = new ResourceSimpleList64_uint();
this.Textures = new ResourcePointerList64<Texture>(); //this.Textures = new ResourcePointerList64<Texture>();
} }
/// <summary> /// <summary>
@ -67,18 +67,16 @@ namespace CodeWalker.GameFiles
this.Unknown_14h = reader.ReadUInt32(); this.Unknown_14h = reader.ReadUInt32();
this.Unknown_18h = reader.ReadUInt32(); this.Unknown_18h = reader.ReadUInt32();
this.Unknown_1Ch = reader.ReadUInt32(); this.Unknown_1Ch = reader.ReadUInt32();
this.TextureNameHashesPtr = reader.ReadStruct<ResourceSimpleList64Ptr>(); this.TextureNameHashes = reader.ReadBlock<ResourceSimpleList64_uint>();
this.TextureNameHashes = reader.ReadUintsAt(this.TextureNameHashesPtr.EntriesPointer, this.TextureNameHashesPtr.EntriesCount);
//this.TextureNameHashes = reader.ReadBlock<ResourceSimpleList64<uint_r>>();
this.Textures = reader.ReadBlock<ResourcePointerList64<Texture>>(); this.Textures = reader.ReadBlock<ResourcePointerList64<Texture>>();
var dict = new Dictionary<uint, Texture>(); var dict = new Dictionary<uint, Texture>();
if ((Textures != null) && (Textures.data_items != null) && (TextureNameHashes != null)) if ((Textures?.data_items != null) && (TextureNameHashes?.data_items != null))
{ {
for (int i = 0; (i < Textures.data_items.Length) && (i < TextureNameHashes.Length); i++) for (int i = 0; (i < Textures.data_items.Length) && (i < TextureNameHashes.data_items.Length); i++)
{ {
var tex = Textures.data_items[i]; var tex = Textures.data_items[i];
var hash = TextureNameHashes[i]; var hash = TextureNameHashes.data_items[i];
dict[hash] = tex; dict[hash] = tex;
} }
} }
@ -92,19 +90,20 @@ namespace CodeWalker.GameFiles
{ {
base.Write(writer, parameters); base.Write(writer, parameters);
// write structure data // write structure data
writer.Write(this.Unknown_10h); writer.Write(this.Unknown_10h);
writer.Write(this.Unknown_14h); writer.Write(this.Unknown_14h);
writer.Write(this.Unknown_18h); writer.Write(this.Unknown_18h);
writer.Write(this.Unknown_1Ch); writer.Write(this.Unknown_1Ch);
//writer.WriteBlock(this.TextureNameHashes); //TODO: fix! writer.WriteBlock(this.TextureNameHashes);
//writer.WriteBlock(this.Textures); writer.WriteBlock(this.Textures);
} }
public override Tuple<long, IResourceBlock>[] GetParts() public override Tuple<long, IResourceBlock>[] GetParts()
{ {
return new Tuple<long, IResourceBlock>[] { return new Tuple<long, IResourceBlock>[] {
//new Tuple<long, IResourceBlock>(0x20, TextureNameHashes), //TODO: fix! new Tuple<long, IResourceBlock>(0x20, TextureNameHashes),
new Tuple<long, IResourceBlock>(0x30, Textures) new Tuple<long, IResourceBlock>(0x30, Textures)
}; };
} }
@ -163,6 +162,8 @@ namespace CodeWalker.GameFiles
public string Name { get; set; } public string Name { get; set; }
public uint NameHash { get; set; } public uint NameHash { get; set; }
private string_r NameBlock = null;
/// <summary> /// <summary>
/// Reads the data-block from a stream. /// Reads the data-block from a stream.
/// </summary> /// </summary>
@ -202,7 +203,7 @@ namespace CodeWalker.GameFiles
public override void Write(ResourceDataWriter writer, params object[] parameters) public override void Write(ResourceDataWriter writer, params object[] parameters)
{ {
// update structure data // update structure data
//this.NamePointer = (ulong)(this.Name != null ? this.Name.Position : 0); //TODO: fix this.NamePointer = (ulong)(this.NameBlock != null ? this.NameBlock.FilePosition : 0);
// write structure data // write structure data
writer.Write(this.VFT); writer.Write(this.VFT);
@ -228,7 +229,11 @@ namespace CodeWalker.GameFiles
public override IResourceBlock[] GetReferences() public override IResourceBlock[] GetReferences()
{ {
var list = new List<IResourceBlock>(); var list = new List<IResourceBlock>();
//if (Name != null) list.Add(Name); //TODO: fix if (!string.IsNullOrEmpty(Name))
{
NameBlock = (string_r)Name;
list.Add(NameBlock);
}
return list.ToArray(); return list.ToArray();
} }

View File

@ -1285,7 +1285,7 @@ namespace CodeWalker.World
{ continue; } { continue; }
if (bgeom.Polygons == null) if (bgeom.Polygons == null)
{ continue; } { continue; }
if ((bgeom.BVH == null) || (bgeom.BVH.Trees == null)) if ((bgeom.BVH?.Nodes?.data_items == null) || (bgeom.BVH?.Trees?.data_items == null))
{ continue; } { continue; }
box.Minimum = bgeom.BoundingBoxMin; box.Minimum = bgeom.BoundingBoxMin;
@ -1299,9 +1299,9 @@ namespace CodeWalker.World
var q = bgeom.BVH.Quantum.XYZ(); var q = bgeom.BVH.Quantum.XYZ();
var c = bgeom.BVH.BoundingBoxCenter.XYZ(); var c = bgeom.BVH.BoundingBoxCenter.XYZ();
var cg = bgeom.CenterGeom; var cg = bgeom.CenterGeom;
for (int t = 0; t < bgeom.BVH.Trees.Length; t++) for (int t = 0; t < bgeom.BVH.Trees.data_items.Length; t++)
{ {
var tree = bgeom.BVH.Trees[t]; var tree = bgeom.BVH.Trees.data_items[t];
box.Minimum = new Vector3(tree.MinX, tree.MinY, tree.MinZ) * q + c; box.Minimum = new Vector3(tree.MinX, tree.MinY, tree.MinZ) * q + c;
box.Maximum = new Vector3(tree.MaxX, tree.MaxY, tree.MaxZ) * q + c; box.Maximum = new Vector3(tree.MaxX, tree.MaxY, tree.MaxZ) * q + c;
if (!ray.Intersects(ref box, out bvhboxhittest)) if (!ray.Intersects(ref box, out bvhboxhittest))
@ -1315,7 +1315,7 @@ namespace CodeWalker.World
int lastind = tree.NodeIndex2; int lastind = tree.NodeIndex2;
while (nodeind < lastind) while (nodeind < lastind)
{ {
var node = bgeom.BVH.Nodes[nodeind]; var node = bgeom.BVH.Nodes.data_items[nodeind];
box.Minimum = new Vector3(node.MinX, node.MinY, node.MinZ) * q + c; box.Minimum = new Vector3(node.MinX, node.MinY, node.MinZ) * q + c;
box.Maximum = new Vector3(node.MaxX, node.MaxY, node.MaxZ) * q + c; box.Maximum = new Vector3(node.MaxX, node.MaxY, node.MaxZ) * q + c;
bool nodehit = ray.Intersects(ref box, out bvhboxhittest); bool nodehit = ray.Intersects(ref box, out bvhboxhittest);
@ -1567,7 +1567,7 @@ namespace CodeWalker.World
{ continue; } { continue; }
if (bgeom.Polygons == null) if (bgeom.Polygons == null)
{ continue; } { continue; }
if ((bgeom.BVH == null) || (bgeom.BVH.Trees == null)) if ((bgeom.BVH?.Nodes?.data_items == null) || (bgeom.BVH?.Trees?.data_items == null))
{ continue; } { continue; }
box.Minimum = bgeom.BoundingBoxMin; box.Minimum = bgeom.BoundingBoxMin;
@ -1578,9 +1578,9 @@ namespace CodeWalker.World
var q = bgeom.BVH.Quantum.XYZ(); var q = bgeom.BVH.Quantum.XYZ();
var c = bgeom.BVH.BoundingBoxCenter.XYZ(); var c = bgeom.BVH.BoundingBoxCenter.XYZ();
var cg = bgeom.CenterGeom; var cg = bgeom.CenterGeom;
for (int t = 0; t < bgeom.BVH.Trees.Length; t++) for (int t = 0; t < bgeom.BVH.Trees.data_items.Length; t++)
{ {
var tree = bgeom.BVH.Trees[t]; var tree = bgeom.BVH.Trees.data_items[t];
box.Minimum = new Vector3(tree.MinX, tree.MinY, tree.MinZ) * q + c; box.Minimum = new Vector3(tree.MinX, tree.MinY, tree.MinZ) * q + c;
box.Maximum = new Vector3(tree.MaxX, tree.MaxY, tree.MaxZ) * q + c; box.Maximum = new Vector3(tree.MaxX, tree.MaxY, tree.MaxZ) * q + c;
if (!sph.Intersects(ref box)) if (!sph.Intersects(ref box))
@ -1590,7 +1590,7 @@ namespace CodeWalker.World
int lastind = tree.NodeIndex2; int lastind = tree.NodeIndex2;
while (nodeind < lastind) while (nodeind < lastind)
{ {
var node = bgeom.BVH.Nodes[nodeind]; var node = bgeom.BVH.Nodes.data_items[nodeind];
box.Minimum = new Vector3(node.MinX, node.MinY, node.MinZ) * q + c; box.Minimum = new Vector3(node.MinX, node.MinY, node.MinZ) * q + c;
box.Maximum = new Vector3(node.MaxX, node.MaxY, node.MaxZ) * q + c; box.Maximum = new Vector3(node.MaxX, node.MaxY, node.MaxZ) * q + c;
bool nodehit = sph.Intersects(ref box); bool nodehit = sph.Intersects(ref box);

View File

@ -123,11 +123,11 @@ namespace CodeWalker.Project.Panels
LightAttributes_s[] lightAttrs = null; LightAttributes_s[] lightAttrs = null;
if (ddwbl != null) if (ddwbl != null)
{ {
lightAttrs = ddwbl.LightAttributes; lightAttrs = ddwbl.LightAttributes?.data_items;
} }
else if (fdwbl != null) else if (fdwbl != null)
{ {
lightAttrs = fdwbl.OwnerFragment?.LightAttributes; lightAttrs = fdwbl.OwnerFragment?.LightAttributes?.data_items;
} }
if (lightAttrs != null) if (lightAttrs != null)
{ {