MetaTypes rearrangement, Archetype restructuring start

This commit is contained in:
dexyfex
2017-09-28 02:24:21 +10:00
Unverified
parent b6d77c9ca8
commit 7ddd88e561
9 changed files with 1210 additions and 1099 deletions
+431 -8
View File
@@ -5,13 +5,17 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SharpDX;
using TC = System.ComponentModel.TypeConverterAttribute;
using EXP = System.ComponentModel.ExpandableObjectConverter;
namespace CodeWalker.GameFiles
{
[TypeConverter(typeof(ExpandableObjectConverter))] public class Meta : ResourceFileBase
[TC(typeof(EXP))] public class Meta : ResourceFileBase
{
public override long BlockLength
{
@@ -202,7 +206,7 @@ namespace CodeWalker.GameFiles
}
[TypeConverter(typeof(ExpandableObjectConverter))] public class MetaStructureInfo : ResourceSystemBlock
[TC(typeof(EXP))] public class MetaStructureInfo : ResourceSystemBlock
{
public override long BlockLength
{
@@ -365,7 +369,7 @@ namespace CodeWalker.GameFiles
}
}
[TypeConverter(typeof(ExpandableObjectConverter))] public struct MetaStructureEntryInfo_s
[TC(typeof(EXP))] public struct MetaStructureEntryInfo_s
{
// structure data
public MetaName EntryNameHash { get; set; }
@@ -391,7 +395,7 @@ namespace CodeWalker.GameFiles
}
}
[TypeConverter(typeof(ExpandableObjectConverter))] public class MetaEnumInfo : ResourceSystemBlock
[TC(typeof(EXP))] public class MetaEnumInfo : ResourceSystemBlock
{
public override long BlockLength
{
@@ -484,7 +488,7 @@ namespace CodeWalker.GameFiles
}
}
[TypeConverter(typeof(ExpandableObjectConverter))] public struct MetaEnumEntryInfo_s
[TC(typeof(EXP))] public struct MetaEnumEntryInfo_s
{
// structure data
public MetaName EntryNameHash { get; set; }
@@ -502,7 +506,7 @@ namespace CodeWalker.GameFiles
}
}
[TypeConverter(typeof(ExpandableObjectConverter))] public class MetaDataBlock : ResourceSystemBlock
[TC(typeof(EXP))] public class MetaDataBlock : ResourceSystemBlock
{
public override long BlockLength
{
@@ -572,7 +576,420 @@ namespace CodeWalker.GameFiles
[TypeConverter(typeof(ExpandableObjectConverter))] public struct MetaHash
//derived types - manually created (array & pointer structs)
[TC(typeof(EXP))] public struct Array_StructurePointer //16 bytes - pointer for a structure pointer array
{
public uint Pointer { get; set; }
public uint Unk0 { get; set; }
public ushort Count1 { get; set; }
public ushort Count2 { get; set; }
public uint Unk1 { get; set; }
public uint PointerDataId { get { return (Pointer & 0xFFF); } }
public uint PointerDataIndex { get { return (Pointer & 0xFFF) - 1; } }
public uint PointerDataOffset { get { return ((Pointer >> 12) & 0xFFFFF); } }
public void SwapEnd()
{
Pointer = MetaTypes.SwapBytes(Pointer);
Count1 = MetaTypes.SwapBytes(Count1);
Count2 = MetaTypes.SwapBytes(Count2);
Unk1 = MetaTypes.SwapBytes(Unk1);
}
public override string ToString()
{
return "Array_StructurePointer: " + PointerDataIndex.ToString() + " (" + Count1.ToString() + "/" + Count2.ToString() + ")";
}
}
[TC(typeof(EXP))] public struct Array_Structure //16 bytes - pointer for a structure array
{
public uint Pointer { get; set; }
public uint Unk0 { get; set; }
public ushort Count1 { get; set; }
public ushort Count2 { get; set; }
public uint Unk1 { get; set; }
public uint PointerDataId { get { return (Pointer & 0xFFF); } }
public uint PointerDataIndex { get { return (Pointer & 0xFFF) - 1; } }
public uint PointerDataOffset { get { return ((Pointer >> 12) & 0xFFFFF); } }
public Array_Structure(uint ptr, int cnt)
{
Pointer = ptr;
Unk0 = 0;
Count1 = (ushort)cnt;
Count2 = Count1;
Unk1 = 0;
}
public Array_Structure(MetaBuilderPointer ptr)
{
Pointer = ptr.Pointer;
Unk0 = 0;
Count1 = (ushort)ptr.Length;
Count2 = Count1;
Unk1 = 0;
}
public void SwapEnd()
{
Pointer = MetaTypes.SwapBytes(Pointer);
Unk0 = MetaTypes.SwapBytes(Unk0);
Count1 = MetaTypes.SwapBytes(Count1);
Count2 = MetaTypes.SwapBytes(Count2);
Unk1 = MetaTypes.SwapBytes(Unk1);
}
public override string ToString()
{
return "Array_Structure: " + PointerDataIndex.ToString() + " (" + Count1.ToString() + "/" + Count2.ToString() + ")";
}
}
[TC(typeof(EXP))] public struct Array_uint //16 bytes - pointer for a uint array
{
public uint Pointer { get; set; }
public uint Unk0 { get; set; }
public ushort Count1 { get; set; }
public ushort Count2 { get; set; }
public uint Unk1 { get; set; }
public uint PointerDataId { get { return (Pointer & 0xFFF); } }
public uint PointerDataIndex { get { return (Pointer & 0xFFF) - 1; } }
public uint PointerDataOffset { get { return ((Pointer >> 12) & 0xFFFFF); } }
public Array_uint(uint ptr, int cnt)
{
Pointer = ptr;
Unk0 = 0;
Count1 = (ushort)cnt;
Count2 = Count1;
Unk1 = 0;
}
public Array_uint(MetaBuilderPointer ptr)
{
Pointer = ptr.Pointer;
Unk0 = 0;
Count1 = (ushort)ptr.Length;
Count2 = Count1;
Unk1 = 0;
}
public void SwapEnd()
{
Pointer = MetaTypes.SwapBytes(Pointer);
Unk0 = MetaTypes.SwapBytes(Unk0);
Count1 = MetaTypes.SwapBytes(Count1);
Count2 = MetaTypes.SwapBytes(Count2);
Unk1 = MetaTypes.SwapBytes(Unk1);
}
public override string ToString()
{
return "Array_uint: " + PointerDataIndex.ToString() + " (" + Count1.ToString() + "/" + Count2.ToString() + ")";
}
}
[TC(typeof(EXP))] public struct Array_ushort //16 bytes - pointer for a ushort array
{
public uint Pointer { get; set; }
public uint Unk0 { get; set; }
public ushort Count1 { get; set; }
public ushort Count2 { get; set; }
public uint Unk1 { get; set; }
public uint PointerDataId { get { return (Pointer & 0xFFF); } }
public uint PointerDataIndex { get { return (Pointer & 0xFFF) - 1; } }
public uint PointerDataOffset { get { return ((Pointer >> 12) & 0xFFFFF); } }
public Array_ushort(uint ptr, int cnt)
{
Pointer = ptr;
Unk0 = 0;
Count1 = (ushort)cnt;
Count2 = Count1;
Unk1 = 0;
}
public Array_ushort(MetaBuilderPointer ptr)
{
Pointer = ptr.Pointer;
Unk0 = 0;
Count1 = (ushort)ptr.Length;
Count2 = Count1;
Unk1 = 0;
}
public void SwapEnd()
{
Pointer = MetaTypes.SwapBytes(Pointer);
Unk0 = MetaTypes.SwapBytes(Unk0);
Count1 = MetaTypes.SwapBytes(Count1);
Count2 = MetaTypes.SwapBytes(Count2);
Unk1 = MetaTypes.SwapBytes(Unk1);
}
public override string ToString()
{
return "Array_ushort: " + PointerDataIndex.ToString() + " (" + Count1.ToString() + "/" + Count2.ToString() + ")";
}
}
[TC(typeof(EXP))] public struct Array_byte //16 bytes - pointer for a byte array
{
public uint Pointer { get; set; }
public uint Unk0 { get; set; }
public ushort Count1 { get; set; }
public ushort Count2 { get; set; }
public uint Unk1 { get; set; }
public uint PointerDataId { get { return (Pointer & 0xFFF); } }
public uint PointerDataIndex { get { return (Pointer & 0xFFF) - 1; } }
public uint PointerDataOffset { get { return ((Pointer >> 12) & 0xFFFFF); } }
public void SwapEnd()
{
Pointer = MetaTypes.SwapBytes(Pointer);
Unk0 = MetaTypes.SwapBytes(Unk0);
Count1 = MetaTypes.SwapBytes(Count1);
Count2 = MetaTypes.SwapBytes(Count2);
Unk1 = MetaTypes.SwapBytes(Unk1);
}
public override string ToString()
{
return "Array_byte: " + PointerDataIndex.ToString() + " (" + Count1.ToString() + "/" + Count2.ToString() + ")";
}
}
[TC(typeof(EXP))] public struct Array_float //16 bytes - pointer for a float array
{
public uint Pointer { get; set; }
public uint Unk0 { get; set; }
public ushort Count1 { get; set; }
public ushort Count2 { get; set; }
public uint Unk1 { get; set; }
public uint PointerDataId { get { return (Pointer & 0xFFF); } }
public uint PointerDataIndex { get { return (Pointer & 0xFFF) - 1; } }
public uint PointerDataOffset { get { return ((Pointer >> 12) & 0xFFFFF); } }
public void SwapEnd()
{
Pointer = MetaTypes.SwapBytes(Pointer);
Unk0 = MetaTypes.SwapBytes(Unk0);
Count1 = MetaTypes.SwapBytes(Count1);
Count2 = MetaTypes.SwapBytes(Count2);
Unk1 = MetaTypes.SwapBytes(Unk1);
}
public override string ToString()
{
return "Array_float: " + PointerDataIndex.ToString() + " (" + Count1.ToString() + "/" + Count2.ToString() + ")";
}
}
[TC(typeof(EXP))] public struct Array_Vector3 //16 bytes - pointer for a Vector3 array
{
public uint Pointer { get; set; }
public uint Unk0 { get; set; }
public ushort Count1 { get; set; }
public ushort Count2 { get; set; }
public uint Unk1 { get; set; }
public uint PointerDataId { get { return (Pointer & 0xFFF); } }
public uint PointerDataIndex { get { return (Pointer & 0xFFF) - 1; } }
public uint PointerDataOffset { get { return ((Pointer >> 12) & 0xFFFFF); } }
public void SwapEnd()
{
Pointer = MetaTypes.SwapBytes(Pointer);
Unk0 = MetaTypes.SwapBytes(Unk0);
Count1 = MetaTypes.SwapBytes(Count1);
Count2 = MetaTypes.SwapBytes(Count2);
Unk1 = MetaTypes.SwapBytes(Unk1);
}
public override string ToString()
{
return "Array_Vector3: " + PointerDataIndex.ToString() + " (" + Count1.ToString() + "/" + Count2.ToString() + ")";
}
}
[TC(typeof(EXP))] public struct CharPointer //16 bytes - pointer for a char array
{
public uint Pointer { get; set; }
public uint Unk0 { get; set; }
public ushort Count1 { get; set; }
public ushort Count2 { get; set; }
public uint Unk1 { get; set; }
public uint PointerDataId { get { return (Pointer & 0xFFF); } }
public uint PointerDataIndex { get { return (Pointer & 0xFFF) - 1; } }
public uint PointerDataOffset { get { return ((Pointer >> 12) & 0xFFFFF); } }
public CharPointer(uint ptr, int len)
{
Pointer = ptr;
Unk0 = 0;
Count1 = (ushort)len;
Count2 = Count1;
Unk1 = 0;
}
public CharPointer(MetaBuilderPointer ptr)
{
Pointer = ptr.Pointer;
Unk0 = 0;
Count1 = (ushort)ptr.Length;
Count2 = Count1;
Unk1 = 0;
}
public void SwapEnd()
{
Pointer = MetaTypes.SwapBytes(Pointer);
Unk0 = MetaTypes.SwapBytes(Unk0);
Count1 = MetaTypes.SwapBytes(Count1);
Count2 = MetaTypes.SwapBytes(Count2);
Unk1 = MetaTypes.SwapBytes(Unk1);
}
public override string ToString()
{
return "CharPointer: " + Pointer.ToString() + " (" + Count1.ToString() + "/" + Count2.ToString() + ")";
}
}
[TC(typeof(EXP))] public struct DataBlockPointer //8 bytes - pointer to data block
{
public uint Ptr0 { get; set; }
public uint Ptr1 { get; set; }
public uint PointerDataId { get { return (Ptr0 & 0xFFF); } }
public uint PointerDataIndex { get { return (Ptr0 & 0xFFF) - 1; } }
public uint PointerDataOffset { get { return ((Ptr0 >> 12) & 0xFFFFF); } }
public override string ToString()
{
return "DataBlockPointer: " + Ptr0.ToString() + ", " + Ptr1.ToString();
}
public void SwapEnd()
{
Ptr0 = MetaTypes.SwapBytes(Ptr0);
Ptr1 = MetaTypes.SwapBytes(Ptr1);
}
}
[TC(typeof(EXP))] public struct ArrayOfUshorts3 //array of 3 bytes
{
public ushort u0, u1, u2;
public override string ToString()
{
return u0.ToString() + ", " + u1.ToString() + ", " + u2.ToString();
}
}
[TC(typeof(EXP))] public struct ArrayOfBytes3 //array of 3 bytes
{
public byte b0, b1, b2;
public override string ToString()
{
return b0.ToString() + ", " + b1.ToString() + ", " + b2.ToString();
}
}
[TC(typeof(EXP))] public struct ArrayOfBytes4 //array of 4 bytes
{
public byte b0, b1, b2, b3;
public override string ToString()
{
return b0.ToString() + ", " + b1.ToString() + ", " + b2.ToString() + ", " + b3.ToString();
}
}
[TC(typeof(EXP))] public struct ArrayOfBytes5 //array of 5 bytes
{
public byte b0, b1, b2, b3, b4;
}
[TC(typeof(EXP))] public struct ArrayOfBytes6 //array of 6 bytes
{
public byte b0, b1, b2, b3, b4, b5;
}
[TC(typeof(EXP))] public struct ArrayOfBytes12 //array of 12 bytes
{
public byte b00, b01, b02, b03, b04, b05, b06, b07, b08, b09, b10, b11;
}
[TC(typeof(EXP))] public struct ArrayOfChars64 //array of 64 chars (bytes)
{
public byte
b00, b01, b02, b03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19,
b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, b34, b35, b36, b37, b38, b39,
b40, b41, b42, b43, b44, b45, b46, b47, b48, b49, b50, b51, b52, b53, b54, b55, b56, b57, b58, b59,
b60, b61, b62, b63;
public override string ToString()
{
byte[] bytes =
{
b00, b01, b02, b03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19,
b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, b34, b35, b36, b37, b38, b39,
b40, b41, b42, b43, b44, b45, b46, b47, b48, b49, b50, b51, b52, b53, b54, b55, b56, b57, b58, b59,
b60, b61, b62, b63
};
StringBuilder sb = new StringBuilder();
for (int i = 0; i < bytes.Length; i++)
{
if (bytes[i] == 0) break;
sb.Append((char)bytes[i]);
}
return sb.ToString();
}
}
[TC(typeof(EXP))] public struct MetaVECTOR3 //12 bytes, Key:2751397072
{
public float x { get; set; } //0 0: Float: 0: x
public float y { get; set; } //4 4: Float: 0: y
public float z { get; set; } //8 8: Float: 0: z
public override string ToString()
{
return x.ToString() + ", " + y.ToString() + ", " + z.ToString();
}
public Vector3 ToVector3()
{
return new Vector3(x, y, z);
}
}
[TC(typeof(EXP))] public struct MetaPOINTER //8 bytes - pointer to data item //SectionUNKNOWN10
{
public ushort BlockID { get; set; } //1-based ID
public ushort ItemOffset { get; set; } //byte offset / 16
public uint ExtraOffset { get; set; }
public MetaPOINTER(ushort blockID, ushort itemOffset, uint extra)
{
BlockID = blockID;
ItemOffset = itemOffset;
ExtraOffset = extra;
}
public override string ToString()
{
return BlockID.ToString() + ", " + ItemOffset.ToString() + ", " + ExtraOffset.ToString();
}
}
[TC(typeof(EXP))] public struct MetaHash
{
public uint Hash { get; set; }
@@ -606,7 +1023,7 @@ namespace CodeWalker.GameFiles
}
[TypeConverter(typeof(ExpandableObjectConverter))] public struct TextHash
[TC(typeof(EXP))] public struct TextHash
{
public uint Hash { get; set; }
@@ -638,4 +1055,10 @@ namespace CodeWalker.GameFiles
}
}
+3
View File
@@ -6648,6 +6648,9 @@ zRotation";
ActivateVehicleSiren = 3401359988,
AerialVehiclePoint = 1653545417,
MoveFollowMaster = 3724117664,
AggressiveVehicleDriving = 2626064871,
UseSearchlight = 1524211135,
IgnoreWeatherRestrictions = 176469077,
File diff suppressed because it is too large Load Diff