From d3fa4d7a3ed3a10fcbb7eb9ac8f2574ff1a48562 Mon Sep 17 00:00:00 2001 From: dexyfex Date: Mon, 18 Dec 2017 06:35:08 +1100 Subject: [PATCH] Dat54.rel structures from CamxxCore/RageAudioTool, Removed file names with extensions from main jenk index --- GameFiles/FileTypes/RelFile.cs | 1482 +++++++++++++++++++++++++++-- GameFiles/Resources/RpfManager.cs | 11 +- 2 files changed, 1423 insertions(+), 70 deletions(-) diff --git a/GameFiles/FileTypes/RelFile.cs b/GameFiles/FileTypes/RelFile.cs index 89ed584..12154e9 100644 --- a/GameFiles/FileTypes/RelFile.cs +++ b/GameFiles/FileTypes/RelFile.cs @@ -5,11 +5,13 @@ using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; +using TC = System.ComponentModel.TypeConverterAttribute; +using EXP = System.ComponentModel.ExpandableObjectConverter; +using SharpDX; namespace CodeWalker.GameFiles { - [TypeConverter(typeof(ExpandableObjectConverter))] - public class RelFile : PackedFile + [TC(typeof(EXP))] public class RelFile : PackedFile { public RpfFileEntry FileEntry { get; set; } public string Name { get; set; } @@ -57,7 +59,7 @@ namespace CodeWalker.GameFiles Type = br.ReadUInt32(); //type/version? DataLength = br.ReadUInt32(); //length of data block - DataBlock = br.ReadBytes((int)DataLength); //data block... synth infos? script? + DataBlock = br.ReadBytes((int)DataLength); //main data block... NameTableLength = br.ReadUInt32(); //length of this nametable block NameTableCount = br.ReadUInt32(); @@ -181,7 +183,7 @@ namespace CodeWalker.GameFiles MemoryStream ms = new MemoryStream(DataBlock); BinaryReader br = new BinaryReader(ms); - DataUnkVal = br.ReadUInt32(); //3 bytes used... for? ..version? + DataUnkVal = br.ReadUInt32(); //3 bytes used... for? ..version? flags? switch (DataUnkVal) { case 5252715: //dlcbusiness_amp.dat10.rel @@ -222,26 +224,14 @@ namespace CodeWalker.GameFiles { foreach (var indexhash in IndexHashes) { - ms.Position = indexhash.Offset; - RelData d = new RelData(); - d.NameHash = indexhash.Name; - d.Offset = indexhash.Offset; - d.Length = indexhash.Length; - d.Data = br.ReadBytes((int)indexhash.Length); - reldatas.Add(d); + reldatas.Add(ReadRelData(br, indexhash)); } } else if (IndexStrings != null) { foreach (var indexstr in IndexStrings) { - ms.Position = indexstr.Offset; - RelData d = new RelData(); - d.Name = indexstr.Name; - d.Offset = indexstr.Offset; - d.Length = indexstr.Length; - d.Data = br.ReadBytes((int)indexstr.Length); - reldatas.Add(d); + reldatas.Add(ReadRelData(br, indexstr)); } } RelDatas = reldatas.ToArray(); @@ -254,48 +244,199 @@ namespace CodeWalker.GameFiles ms.Dispose(); - foreach (var d in RelDatas) - { - using (BinaryReader dbr = new BinaryReader(new MemoryStream(d.Data))) - { - switch (Type) - { - case 4: //00000100 //speech.dat4.rel, audioconfig.dat4.rel - ParseData4(d, dbr); - break; - case 10: //00001010 //amp.dat10.rel - ParseData10(d, dbr); - break; - case 15: //00001111 //mix.dat15.rel - ParseData15(d, dbr); - break; - case 16: //00010000 //curves.dat16.rel - ParseData16(d, dbr); - break; - case 22: //00010110 //categories.dat22.rel - ParseData22(d, dbr); - break; - case 54: //00110110 //sounds.dat54.rel - ParseData54(d, dbr); - break; - case 149: //10010101 //game.dat149.rel - ParseData149(d, dbr); - break; - case 150: //10010110 //game.dat150.rel - ParseData150(d, dbr); - break; - case 151: //10010111 //game.dat151.rel - ParseData151(d, dbr); - break; - default: - break; - } - } - } + //foreach (var d in RelDatas) + //{ + // using (BinaryReader dbr = new BinaryReader(new MemoryStream(d.Data))) + // { + // switch (Type) + // { + // case 4: //00000100 //speech.dat4.rel, audioconfig.dat4.rel + // ParseData4(d, dbr); + // break; + // case 10: //00001010 //amp.dat10.rel + // ParseData10(d, dbr); + // break; + // case 15: //00001111 //mix.dat15.rel + // ParseData15(d, dbr); + // break; + // case 16: //00010000 //curves.dat16.rel + // ParseData16(d, dbr); + // break; + // case 22: //00010110 //categories.dat22.rel + // ParseData22(d, dbr); + // break; + // case 54: //00110110 //sounds.dat54.rel + // ParseData54(d, dbr); + // break; + // case 149: //10010101 //game.dat149.rel + // ParseData149(d, dbr); + // break; + // case 150: //10010110 //game.dat150.rel + // ParseData150(d, dbr); + // break; + // case 151: //10010111 //game.dat151.rel + // ParseData151(d, dbr); + // break; + // default: + // break; + // } + // } + //} } + + + + private RelData ReadRelData(BinaryReader br, RelIndexHash h) + { + return ReadRelData(br, null, h.Name, h.Offset, h.Length); + } + private RelData ReadRelData(BinaryReader br, RelIndexString s) + { + return ReadRelData(br, s.Name, 0, s.Offset, s.Length); + } + private RelData ReadRelData(BinaryReader br, string name, MetaHash hash, uint offset, uint length) + { + br.BaseStream.Position = offset; + byte[] data = br.ReadBytes((int)length); + + + RelData d = new RelData(); //use this base object to construct the derived one... + d.Name = name; + d.NameHash = hash; + d.Offset = offset; + d.Length = length; + d.Data = data; + + + using (BinaryReader dbr = new BinaryReader(new MemoryStream(data))) + { + d.ReadType(dbr); + + switch (Type) + { + case 4: //speech.dat4.rel, audioconfig.dat4.rel + return ReadData4(d, dbr); + case 10: //amp.dat10.rel + return ReadData10(d, dbr); + case 15: //mix.dat15.rel + return ReadData15(d, dbr); + case 16: //curves.dat16.rel + return ReadData16(d, dbr); + case 22: //categories.dat22.rel + return ReadData22(d, dbr); + case 54: //sounds.dat54.rel + return ReadData54(d, dbr); + case 149: //game.dat149.rel + return ReadData149(d, dbr); + case 150: //game.dat150.rel + return ReadData150(d, dbr); + case 151: //game.dat151.rel + return ReadData151(d, dbr); + default: + return d; //shouldn't get here... + } + } + } + + + + private RelData ReadData4(RelData d, BinaryReader br) + { + if (NameTableLength == 4) //(for audioconfig.dat4.rel) + { + } + else //(for eg speech.dat4.rel) + { + } + return d; + } + private RelData ReadData10(RelData d, BinaryReader br) + { + return d; + } + private RelData ReadData15(RelData d, BinaryReader br) + { + return d; + } + private RelData ReadData16(RelData d, BinaryReader br) + { + return d; + } + private RelData ReadData22(RelData d, BinaryReader br) + { + RelSound s = new RelSound(d, br); + return s; + } + private RelData ReadData54(RelData d, BinaryReader br) + { + switch ((Dat54SoundType)d.TypeID) + { + case Dat54SoundType.LoopingSound: return new Dat54LoopingSound(d, br); + case Dat54SoundType.EnvelopeSound: return new Dat54EnvelopeSound(d, br); + case Dat54SoundType.TwinLoopSound: return new Dat54TwinLoopSound(d, br); + case Dat54SoundType.SpeechSound: return new Dat54SpeechSound(d, br); + case Dat54SoundType.OnStopSound: return new Dat54OnStopSound(d, br); + case Dat54SoundType.WrapperSound: return new Dat54WrapperSound(d, br); + case Dat54SoundType.SequentialSound: return new Dat54SequentialSound(d, br); + case Dat54SoundType.StreamingSound: return new Dat54StreamingSound(d, br); + case Dat54SoundType.RetriggeredOverlappedSound: return new Dat54RetriggeredOverlappedSound(d, br); + case Dat54SoundType.CrossfadeSound: return new Dat54CrossfadeSound(d, br); + case Dat54SoundType.CollapsingStereoSound: return new Dat54CollapsingStereoSound(d, br); + case Dat54SoundType.SimpleSound: return new Dat54SimpleSound(d, br); + case Dat54SoundType.MultitrackSound: return new Dat54MultitrackSound(d, br); + case Dat54SoundType.RandomizedSound: return new Dat54RandomizedSound(d, br); + case Dat54SoundType.EnvironmentSound: return new Dat54EnvironmentSound(d, br); + case Dat54SoundType.DynamicEntitySound: return new Dat54DynamicEntitySound(d, br); + case Dat54SoundType.SequentialOverlapSound: return new Dat54SequentialOverlapSound(d, br); + case Dat54SoundType.ModularSynthSound: return new Dat54ModularSynthSound(d, br); + case Dat54SoundType.GranularSound: return new Dat54GranularSound(d, br); + case Dat54SoundType.DirectionalSound: return new Dat54DirectionalSound(d, br); + case Dat54SoundType.KineticSound: return new Dat54KineticSound(d, br); + case Dat54SoundType.SwitchSound: return new Dat54SwitchSound(d, br); + case Dat54SoundType.VariableCurveSound: return new Dat54VariableCurveSound(d, br); + case Dat54SoundType.VariablePrintValueSound: return new Dat54VariablePrintValueSound(d, br); + case Dat54SoundType.VariableBlockSound: return new Dat54VariableBlockSound(d, br); + case Dat54SoundType.IfSound: return new Dat54IfSound(d, br); + case Dat54SoundType.MathOperationSound: return new Dat54MathOperationSound(d, br); + case Dat54SoundType.ParameterTransformSound: return new Dat54ParameterTransformSound(d, br); + case Dat54SoundType.FluctuatorSound: return new Dat54FluctuatorSound(d, br); + case Dat54SoundType.AutomationSound: return new Dat54AutomationSound(d, br); + case Dat54SoundType.ExternalStreamSound: return new Dat54ExternalStreamSound(d, br); + case Dat54SoundType.SoundSet: return new Dat54SoundSet(d, br); + case Dat54SoundType.Unknown: return new Dat54UnknownSound(d, br); + case Dat54SoundType.Unknown2: return new Dat54UnknownSound2(d, br); + case Dat54SoundType.SoundList: return new Dat54SoundList(d, br); + default: + return new Dat54Sound(d, br); //shouldn't get here + } + } + private RelData ReadData149(RelData d, BinaryReader br) + { + RelSound s = new RelSound(d, br); + return s; + } + private RelData ReadData150(RelData d, BinaryReader br) + { + return d; + } + private RelData ReadData151(RelData d, BinaryReader br) + { + switch ((Dat151RelType)d.TypeID) + { + case Dat151RelType.ShoreLineList: + default: return new Dat151RelData(d, br); + } + } + + + + + + #region first research + private void ParseData4(RelData d, BinaryReader br) { //speech.dat4.rel, audioconfig.dat4.rel @@ -742,7 +883,7 @@ namespace CodeWalker.GameFiles } } - + #endregion @@ -752,8 +893,7 @@ namespace CodeWalker.GameFiles } } - [TypeConverter(typeof(ExpandableObjectConverter))] - public struct RelIndexHash + [TC(typeof(EXP))] public struct RelIndexHash { public MetaHash Name { get; set; } public uint Offset { get; set; } @@ -766,8 +906,7 @@ namespace CodeWalker.GameFiles } - [TypeConverter(typeof(ExpandableObjectConverter))] - public struct RelIndexString + [TC(typeof(EXP))] public struct RelIndexString { public string Name { get; set; } public uint Offset { get; set; } @@ -780,21 +919,1232 @@ namespace CodeWalker.GameFiles } - [TypeConverter(typeof(ExpandableObjectConverter))] - public class RelData + + [TC(typeof(EXP))] public class RelData { public MetaHash NameHash { get; set; } public string Name { get; set; } public uint Offset { get; set; } public uint Length { get; set; } public byte[] Data { get; set; } + public byte TypeID { get; set; } + public RelData() { } + public RelData(RelData d) + { + NameHash = d.NameHash; + Name = d.Name; + Offset = d.Offset; + Length = d.Length; + Data = d.Data; + TypeID = d.TypeID; + } + + public void ReadType(BinaryReader br) + { + TypeID = br.ReadByte(); + } + + public string GetNameString() + { + return (string.IsNullOrEmpty(Name)) ? NameHash.ToString() : Name; + } + public string GetBaseString() + { + return Offset.ToString() + ", " + Length.ToString() + ": " + GetNameString(); + } public override string ToString() { - string ol= ", " + Offset.ToString() + ", " + Length.ToString(); - if (!string.IsNullOrEmpty(Name)) return Name + ol; - return NameHash.ToString() + ol; + return GetBaseString() + ": " + TypeID.ToString(); } } + [TC(typeof(EXP))] public class RelSoundHeader + { + public uint Flags { get; set; } + + public FlagsUint UnkFlags { get; set; } + public ushort Unk01 { get; set; } + public ushort Unk02 { get; set; } + public ushort Unk03 { get; set; } //0xD-0xF + public ushort Unk04 { get; set; } //0xF-0x11 + public ushort Unk05 { get; set; } //0x11-0x13 + public ushort Unk06 { get; set; } //0x13-0x15 + public ushort Unk07 { get; set; } //0x15-0x17 + public ushort Unk08 { get; set; } //0x17-0x19 + public ushort Unk09 { get; set; } //0x19-0x1B + public MetaHash UnkHash1 { get; set; } //0x1B-0x1F + public MetaHash UnkHash2 { get; set; } //0x1F-0x23 + public ushort Unk10 { get; set; } //0x23-0x25 + public ushort Unk11 { get; set; } //0x25-0x27 + public ushort Unk12 { get; set; } //0x27-0x29 + public MetaHash CategoryHash { get; set; } //0x29-0x2D + public ushort Unk14 { get; set; } //0x2D-0x2F + public ushort Unk15 { get; set; } //0x2F-0x31 + public ushort Unk16 { get; set; } //0x31-0x33 + public ushort Unk17 { get; set; } //0x33-0x35 + public MetaHash UnkHash3 { get; set; } //0x35-0x39 + public ushort Unk18 { get; set; } //0x39-0x3B + public byte Unk19 { get; set; } //0x3B-0x3C + public byte Unk20 { get; set; } //0x3C-0x3D + public byte Unk21 { get; set; } //0x3D-0x3E + public MetaHash UnkHash4 { get; set; } //0x3E-0x42 + public MetaHash UnkHash5 { get; set; } //0x42-0x46 + public ushort Unk22 { get; set; } //0x46-0x48 + public ushort Unk23 { get; set; } //0x48-0x4A + public ushort Unk24 { get; set; } //0x4A-0x4C + + + + public void Read(BinaryReader br) + { + Flags = br.ReadUInt32(); + + + if (Flags != 0xAAAAAAAA) + { + if (Bit(0)) UnkFlags = br.ReadUInt32(); + if (Bit(1)) Unk01 = br.ReadUInt16(); + if (Bit(2)) Unk02 = br.ReadUInt16(); + if (Bit(3)) Unk03 = br.ReadUInt16(); + if (Bit(4)) Unk04 = br.ReadUInt16(); + if (Bit(5)) Unk05 = br.ReadUInt16(); + if (Bit(6)) Unk06 = br.ReadUInt16(); + if (Bit(7)) Unk07 = br.ReadUInt16(); + if (Bit(8)) Unk08 = br.ReadUInt16(); + if (Bit(9)) Unk09 = br.ReadUInt16(); + if (Bit(10)) UnkHash1 = br.ReadUInt32(); + if (Bit(11)) UnkHash2 = br.ReadUInt32(); + if (Bit(12)) Unk10 = br.ReadUInt16(); + if (Bit(13)) Unk11 = br.ReadUInt16(); + if (Bit(14)) Unk12 = br.ReadUInt16(); + if (Bit(15)) CategoryHash = br.ReadUInt32(); + if (Bit(16)) Unk14 = br.ReadUInt16(); + if (Bit(17)) Unk15 = br.ReadUInt16(); + if (Bit(18)) Unk16 = br.ReadUInt16(); + if (Bit(19)) Unk17 = br.ReadUInt16(); + if (Bit(20)) UnkHash3 = br.ReadUInt32(); + if (Bit(21)) Unk18 = br.ReadUInt16(); + if (Bit(22)) Unk19 = br.ReadByte(); + if (Bit(23)) Unk20 = br.ReadByte(); + if (Bit(24)) Unk21 = br.ReadByte(); + if (Bit(25)) UnkHash4 = br.ReadUInt32(); + if (Bit(26)) UnkHash5 = br.ReadUInt32(); + if (Bit(27)) Unk22 = br.ReadUInt16(); + if (Bit(28)) Unk23 = br.ReadUInt16(); + if (Bit(29)) Unk24 = br.ReadUInt16(); + } + } + + private bool Bit(int b) + { + return ((Flags & (1u << b)) != 0); + } + + public override string ToString() + { + return string.Format("{0}: {1}, {2}, {3}, {4}, {5}, {6}, {7}", Flags, UnkFlags.Hex, CategoryHash, UnkHash1, UnkHash2, UnkHash3, UnkHash4, UnkHash5); + } + } + + [TC(typeof(EXP))] public class RelSound : RelData + { + public RelSoundHeader Header { get; set; } + public byte AudioTracksCount { get; set; } + public MetaHash[] AudioTracks { get; set; } + public MetaHash[] AudioContainers { get; set; } + + public RelSound(RelData d, BinaryReader br) : base(d) + { + RelSoundHeader h = new RelSoundHeader(); + h.Read(br); + Header = h; + } + + public void ReadAudioTracks(BinaryReader br) + { + AudioTracksCount = br.ReadByte(); + AudioTracks = new MetaHash[AudioTracksCount]; + for (int i = 0; i < AudioTracksCount; i++) + { + AudioTracks[i] = br.ReadUInt32(); + } + } + } + + + + public enum Dat54SoundType : byte + { + LoopingSound = 1, + EnvelopeSound = 2, + TwinLoopSound = 3, + SpeechSound = 4, + OnStopSound = 5, + WrapperSound = 6, + SequentialSound = 7, + StreamingSound = 8, + RetriggeredOverlappedSound = 9, + CrossfadeSound = 10, + CollapsingStereoSound = 11, + SimpleSound = 12, + MultitrackSound = 13, + RandomizedSound = 14, + EnvironmentSound = 15, + DynamicEntitySound = 16, + SequentialOverlapSound = 17, + ModularSynthSound = 18, + GranularSound = 19, + DirectionalSound = 20, + KineticSound = 21, + SwitchSound = 22, + VariableCurveSound = 23, + VariablePrintValueSound = 24, + VariableBlockSound = 25, + IfSound = 26, + MathOperationSound = 27, + ParameterTransformSound = 28, + FluctuatorSound = 29, + AutomationSound = 30, + ExternalStreamSound = 31, + SoundSet = 32, + Unknown = 33, + Unknown2 = 34, + SoundList = 35 + } + + [TC(typeof(EXP))] public class Dat54Sound : RelSound + { + public Dat54SoundType Type { get; set; } + + public Dat54Sound(RelData d, BinaryReader br) : base(d, br) + { + Type = (Dat54SoundType)TypeID; + } + + public override string ToString() + { + return GetBaseString() + ": " + Type.ToString(); + } + } + + [TC(typeof(EXP))] public class Dat54LoopingSound : Dat54Sound + { + public short UnkShort0 { get; set; } //0x0-0x2 + public short UnkShort1 { get; set; } //0x2-0x4 + public short UnkShort2 { get; set; } //0x4-0x6 + public MetaHash AudioHash { get; set; } //0x6-0xA + public MetaHash ParameterHash { get; set; } //0xA-0xE + + public Dat54LoopingSound(RelData d, BinaryReader br) : base(d, br) + { + UnkShort0 = br.ReadInt16(); + UnkShort1 = br.ReadInt16(); + UnkShort2 = br.ReadInt16(); + AudioHash = br.ReadUInt32(); + AudioTracks = new[] { AudioHash }; + ParameterHash = br.ReadUInt32(); + } + } + [TC(typeof(EXP))] public class Dat54EnvelopeSound : Dat54Sound + { + public ushort UnkShortA { get; set; } //0x0-0x2 + public ushort UnkShortA1 { get; set; } //0x2-0x4 + public ushort UnkShortB { get; set; } //0x4-0x6 + public ushort UnkShortB1 { get; set; } //0x6-0x8 + public byte UnkByteA { get; set; } //0x8-0x9 + public byte UnkByteA1 { get; set; } //0x9-0xA + public int UnkInt { get; set; } //0xA-0xE + public ushort UnkShortC { get; set; } //0xE-0x10 + public int UnkIntA { get; set; } //0x10-0x14 + public int UnkIntA1 { get; set; } //0x14-0x18 + public MetaHash CurvesUnkHash0 { get; set; } //0x18-0x1C + public MetaHash CurvesUnkHash1 { get; set; } //0x1C-0x20 + public MetaHash CurvesUnkHash2 { get; set; } //0x20-0x24 + public MetaHash ParameterHash0 { get; set; } //0x24-0x28 + public MetaHash ParameterHash1 { get; set; } //0x28-0x2C + public MetaHash ParameterHash2 { get; set; } //0x2C-0x30 + public MetaHash ParameterHash3 { get; set; } //0x30-0x34 + public MetaHash ParameterHash4 { get; set; } //0x34-0x38 + public MetaHash AudioHash { get; set; }// audio track 0x38-0x3C + public int UnkIntC { get; set; } //0x3C-0x40 + public MetaHash ParameterHash5 { get; set; } //0x40-0x44 + public float UnkFloat0 { get; set; } //0x44-0x48 + public float UnkFloat1 { get; set; } //0x48-0x4C + + public Dat54EnvelopeSound(RelData d, BinaryReader br) : base(d, br) + { + UnkShortA = br.ReadUInt16(); //0x0-0x2 + UnkShortA1 = br.ReadUInt16(); //0x2-0x4 + UnkShortB = br.ReadUInt16(); //0x4-0x6 + UnkShortB1 = br.ReadUInt16(); //0x6-0x8 + UnkByteA = br.ReadByte(); //0x8-0x9 + UnkByteA1 = br.ReadByte(); //0x9-0xA + UnkInt = br.ReadInt32(); //0xA-0xE + UnkShortC = br.ReadUInt16(); //0xE-0x10 + UnkIntA = br.ReadInt32(); //0x10-0x14 + UnkIntA1 = br.ReadInt32(); //0x14-0x18 + CurvesUnkHash0 = br.ReadUInt32(); //0x18-0x1C + CurvesUnkHash1 = br.ReadUInt32(); //0x1C-0x20 + CurvesUnkHash2 = br.ReadUInt32(); //0x20-0x24 + ParameterHash0 = br.ReadUInt32(); //0x24-0x28 + ParameterHash1 = br.ReadUInt32(); //0x28-0x2C + ParameterHash2 = br.ReadUInt32(); //0x2C-0x30 + ParameterHash3 = br.ReadUInt32(); //0x30-0x34 + ParameterHash4 = br.ReadUInt32(); //0x34-0x38 + AudioHash = br.ReadUInt32(); //0x38-0x3C + UnkIntC = br.ReadInt32(); //0x3C-0x40 + ParameterHash5 = br.ReadUInt32(); //0x40-0x44 + UnkFloat0 = br.ReadSingle(); //0x44-0x48 + UnkFloat1 = br.ReadSingle(); //0x48-0x4C + + AudioTracks = new[] { AudioHash }; + } + } + [TC(typeof(EXP))] public class Dat54TwinLoopSound : Dat54Sound + { + public ushort UnkShort0 { get; set; } //0x0-0x2 + public ushort UnkShort1 { get; set; } //0x2-0x4 + public ushort UnkShort2 { get; set; } //0x4-0x6 + public ushort UnkShort3 { get; set; } //0x6-0x8 + public MetaHash UnkHash { get; set; } //0x8-0xC + public MetaHash ParameterHash0 { get; set; } //0xC-0x10 + public MetaHash ParameterHash1 { get; set; } //0x10-0x14 + public MetaHash ParameterHash2 { get; set; } //0x14-0x18 + public MetaHash ParameterHash3 { get; set; } //0x18-0x1C + + public Dat54TwinLoopSound(RelData d, BinaryReader br) : base(d, br) + { + UnkShort0 = br.ReadUInt16(); + UnkShort1 = br.ReadUInt16(); + UnkShort2 = br.ReadUInt16(); + UnkShort3 = br.ReadUInt16(); + UnkHash = br.ReadUInt32(); + ParameterHash0 = br.ReadUInt32(); + ParameterHash1 = br.ReadUInt32(); + ParameterHash2 = br.ReadUInt32(); + ParameterHash3 = br.ReadUInt32(); + + ReadAudioTracks(br); + } + } + [TC(typeof(EXP))] public class Dat54SpeechSound : Dat54Sound + { + public int UnkInt0 { get; set; } //maybe file index? + public int UnkInt1 { get; set; } //ox4-0x8 + public MetaHash VoiceDataHash { get; set; } //0x8-0xC + public string SpeechName { get; set; } //0xD-... + + public Dat54SpeechSound(RelData d, BinaryReader br) : base(d, br) + { + UnkInt0 = br.ReadInt32(); + UnkInt1 = br.ReadInt32(); + VoiceDataHash = br.ReadUInt32(); + SpeechName = br.ReadString(); + } + } + [TC(typeof(EXP))] public class Dat54OnStopSound : Dat54Sound + { + public MetaHash AudioHash0 { get; set; } + public MetaHash AudioHash1 { get; set; } + public MetaHash AudioHash2 { get; set; } + + public Dat54OnStopSound(RelData d, BinaryReader br) : base(d, br) + { + AudioHash0 = br.ReadUInt32(); + AudioHash1 = br.ReadUInt32(); + AudioHash2 = br.ReadUInt32(); + AudioTracks = new[] { AudioHash0, AudioHash1, AudioHash2 }; + } + } + [TC(typeof(EXP))] public class Dat54WrapperSound : Dat54Sound + { + public MetaHash AudioHash0 { get; set; } //0x0-0x4 + public int FrameStartTime { get; set; } //0x4-0x8 // maybe start delay? + public MetaHash AudioHash1 { get; set; } //0x8-0xC + public short FrameTimeInterval { get; set; } //0xC-0xE // [camxx:] My guess is that this is related to the time at which a child sound should start playin (or the length of the sound). + public byte ItemCount { get; set; } + public MetaHash[] Variables { get; set; } //0xF + public byte[] UnkByteData { get; set; } // ... + + public Dat54WrapperSound(RelData d, BinaryReader br) : base(d, br) + { + AudioHash0 = br.ReadUInt32(); + FrameStartTime = br.ReadInt32(); + AudioHash1 = br.ReadUInt32(); + FrameTimeInterval = br.ReadInt16(); + ItemCount = br.ReadByte(); + Variables = new MetaHash[ItemCount]; + for (int i = 0; i < ItemCount; i++) + { + Variables[i] = br.ReadUInt32(); + } + UnkByteData = br.ReadBytes(ItemCount); + + AudioTracks = new[] { AudioHash0, AudioHash1 }; + } + } + [TC(typeof(EXP))] public class Dat54SequentialSound : Dat54Sound + { + public Dat54SequentialSound(RelData d, BinaryReader br) : base(d, br) + { + ReadAudioTracks(br); + } + } + [TC(typeof(EXP))] public class Dat54StreamingSound : Dat54Sound + { + int UnkInt { get; set; } //0x0-0x4 + + public Dat54StreamingSound(RelData d, BinaryReader br) : base(d, br) + { + UnkInt = br.ReadInt32(); + + ReadAudioTracks(br); + } + } + [TC(typeof(EXP))] public class Dat54RetriggeredOverlappedSound : Dat54Sound + { + public ushort UnkShort0 { get; set; } //0x0-0x2 + public ushort UnkShort1 { get; set; } //0x2-0x4 + public ushort UnkShort2 { get; set; } //0x4-0x6 + public ushort UnkShort3 { get; set; } // 0x6-0x8 + public MetaHash ParameterHash0 { get; set; } //0x8-0xC + public MetaHash ParameterHash1 { get; set; } //0xC-0x10 + public MetaHash AudioHash0 { get; set; } + public MetaHash AudioHash1 { get; set; } + public MetaHash AudioHash2 { get; set; } + + public Dat54RetriggeredOverlappedSound(RelData d, BinaryReader br) : base(d, br) + { + UnkShort0 = br.ReadUInt16(); + UnkShort1 = br.ReadUInt16(); + UnkShort2 = br.ReadUInt16(); + UnkShort3 = br.ReadUInt16(); + ParameterHash0 = br.ReadUInt32(); + ParameterHash1 = br.ReadUInt32(); + AudioHash0 = br.ReadUInt32(); + AudioHash1 = br.ReadUInt32(); + AudioHash2 = br.ReadUInt32(); + AudioTracks = new[] { AudioHash0, AudioHash1, AudioHash2 }; + } + } + [TC(typeof(EXP))] public class Dat54CrossfadeSound : Dat54Sound + { + public MetaHash AudioHash0 { get; set; } + public MetaHash AudioHash1 { get; set; } + public byte UnkByte { get; set; } //0x8-0x9 + public float UnkFloat0 { get; set; } //0x9-0xD + public float UnkFloat1 { get; set; } //0xD-0x11 + public int UnkInt2 { get; set; } //0xD-0x15 + public MetaHash UnkCurvesHash { get; set; } //0x15-0x19 + public MetaHash ParameterHash0 { get; set; } //0x19-0x1D + public MetaHash ParameterHash1 { get; set; } //0x1D-0x21 + public MetaHash ParameterHash2 { get; set; } //0x21-0x25 + public MetaHash ParameterHash3 { get; set; } //0x25-0x29 + public MetaHash ParameterHash4 { get; set; } //0x29-0x2D + + public Dat54CrossfadeSound(RelData d, BinaryReader br) : base(d, br) + { + AudioHash0 = br.ReadUInt32(); + AudioHash1 = br.ReadUInt32(); + AudioTracks = new[] { AudioHash0, AudioHash1 }; + UnkByte = br.ReadByte(); + UnkFloat0 = br.ReadSingle(); + UnkFloat1 = br.ReadSingle(); + UnkInt2 = br.ReadInt32(); + UnkCurvesHash = br.ReadUInt32(); + ParameterHash0 = br.ReadUInt32(); + ParameterHash1 = br.ReadUInt32(); + ParameterHash2 = br.ReadUInt32(); + ParameterHash3 = br.ReadUInt32(); + ParameterHash4 = br.ReadUInt32(); + } + } + [TC(typeof(EXP))] public class Dat54CollapsingStereoSound : Dat54Sound + { + public MetaHash AudioHash0 { get; set; } + public MetaHash AudioHash1 { get; set; } + public float UnkFloat0 { get; set; } + public float UnkFloat1 { get; set; } + public MetaHash ParameterHash0 { get; set; } //0x10-0x14 + public MetaHash ParameterHash1 { get; set; } //0x14-0x18 + public MetaHash ParameterHash2 { get; set; } //0x18-0x1C + public MetaHash ParameterHash3 { get; set; } //0x1C-0x20 + public MetaHash ParameterHash4 { get; set; } //0x20-0x24 + public MetaHash ParameterHash5 { get; set; } //0x28-0x2C + public int UnkInt { get; set; } //0x24-0x28 + public byte UnkByte { get; set; } //0x2c-0x2D + + public Dat54CollapsingStereoSound(RelData d, BinaryReader br) : base(d, br) + { + AudioHash0 = br.ReadUInt32(); + AudioHash1 = br.ReadUInt32(); + UnkFloat0 = br.ReadSingle(); //0x8 + UnkFloat1 = br.ReadSingle(); //0xC + ParameterHash0 = br.ReadUInt32(); //0x10 + ParameterHash1 = br.ReadUInt32(); //0x14 + ParameterHash2 = br.ReadUInt32(); //0x18 + ParameterHash3 = br.ReadUInt32(); //0x1C + ParameterHash4 = br.ReadUInt32(); //0x20 + UnkInt = br.ReadInt32(); //0x24-0x28 + ParameterHash5 = br.ReadUInt32(); //0x28-0x2C + UnkByte = br.ReadByte(); //0x2C-0x2D + + AudioTracks = new[] { AudioHash0, AudioHash1 }; + } + } + [TC(typeof(EXP))] public class Dat54SimpleSound : Dat54Sound + { + public MetaHash FileName { get; set; } //Name of the .wav file + public MetaHash ContainerName { get; set; } //Relative path to parent wave container (i.e. \"RESIDENT/animals\") + public byte WaveSlotNum { get; set; } //Internal index of wave (.awc) container + + public Dat54SimpleSound(RelData d, BinaryReader br) : base(d, br) + { + ContainerName = br.ReadUInt32(); + FileName = br.ReadUInt32(); + WaveSlotNum = br.ReadByte(); + + AudioContainers = new[] { ContainerName }; + } + } + [TC(typeof(EXP))] public class Dat54MultitrackSound : Dat54Sound + { + public Dat54MultitrackSound(RelData d, BinaryReader br) : base(d, br) + { + ReadAudioTracks(br); + } + } + [TC(typeof(EXP))] public class Dat54RandomizedSound : Dat54Sound + { + public byte UnkByte { get; set; } //0x0-0x1 something count? + public byte UnkBytesCount { get; set; } //0x1-0x2 + public byte[] UnkBytes { get; set; } + public byte ItemCount { get; set; } + public float[] AudioTrackUnkFloats { get; set; } //probability..? + + public Dat54RandomizedSound(RelData d, BinaryReader br) : base(d, br) + { + UnkByte = br.ReadByte(); + UnkBytesCount = br.ReadByte(); + UnkBytes = br.ReadBytes(UnkBytesCount); + ItemCount = br.ReadByte(); + AudioTracks = new MetaHash[ItemCount]; + AudioTrackUnkFloats = new float[ItemCount]; + for (int i = 0; i < ItemCount; i++) + { + AudioTracks[i] = br.ReadUInt32(); + AudioTrackUnkFloats[i] = br.ReadSingle(); + } + } + } + [TC(typeof(EXP))] public class Dat54EnvironmentSound : Dat54Sound + { + public Dat54EnvironmentSound(RelData d, BinaryReader br) : base(d, br) + { + } + } + [TC(typeof(EXP))] public class Dat54DynamicEntitySound : Dat54Sound + { + public byte ItemCount { get; set; } + public MetaHash[] UnkHashes { get; set; } + + public Dat54DynamicEntitySound(RelData d, BinaryReader br) : base(d, br) + { + ItemCount = br.ReadByte(); + UnkHashes = new MetaHash[ItemCount]; + for (int i = 0; i < ItemCount; i++) + { + UnkHashes[i] = br.ReadUInt32(); + } + } + } + [TC(typeof(EXP))] public class Dat54SequentialOverlapSound : Dat54Sound + { + public ushort UnkShort { get; set; } + public MetaHash ParameterHash0 { get; set; } //0x2-0x6 + public MetaHash ParameterHash1 { get; set; } //0x6-0xA + + public Dat54SequentialOverlapSound(RelData d, BinaryReader br) : base(d, br) + { + UnkShort = br.ReadUInt16(); + ParameterHash0 = br.ReadUInt32(); + ParameterHash1 = br.ReadUInt32(); + + ReadAudioTracks(br); + } + } + [TC(typeof(EXP))] public class Dat54ModularSynthSound : Dat54Sound + { + public MetaHash OptAmpUnkHash { get; set; } //0x0-0x4 + public MetaHash UnkHash { get; set; } //0x4-0x8 + public float UnkFloat { get; set; } //0x8-0xC + public int UnkInt { get; set; } //0xC-0x10 + public int TrackCount { get; set; } + public int UnkItemCount { get; set; } + public Dat54ModularSynthSoundData[] UnkItems { get; set; } //0x28-.. + + public Dat54ModularSynthSound(RelData d, BinaryReader br) : base(d, br) + { + OptAmpUnkHash = br.ReadUInt32(); //0x0-0x4 + UnkHash = br.ReadUInt32(); //0x4-0x8 + UnkFloat = br.ReadSingle(); //0x8-0xC + UnkInt = br.ReadInt32(); //0xC-0x10 + TrackCount = br.ReadInt32(); //0x10-0x14 + AudioTracks = new MetaHash[4]; + for (int i = 0; i < 4; i++) + { + AudioTracks[i] = br.ReadUInt32(); + } + UnkItemCount = br.ReadInt32(); + UnkItems = new Dat54ModularSynthSoundData[UnkItemCount]; + for (int i = 0; i < UnkItemCount; i++) + { + UnkItems[i] = new Dat54ModularSynthSoundData(br); + } + } + } + [TC(typeof(EXP))] public class Dat54ModularSynthSoundData + { + public MetaHash UnkHash { get; set; } + public MetaHash ParameterHash { get; set; } + public float Value { get; set; } + + public Dat54ModularSynthSoundData(BinaryReader br) + { + UnkHash = br.ReadUInt32(); + ParameterHash = br.ReadUInt32(); + Value = br.ReadSingle(); + } + + public override string ToString() + { + return UnkHash.ToString() + ": " + ParameterHash.ToString() + ": " + FloatUtil.ToString(Value); + } + } + [TC(typeof(EXP))] public class Dat54GranularSound : Dat54Sound + { + public int WaveSlotIndex { get; set; } //0x0-0x4 + public Dat54GranularSoundFile Wave1 { get; set; } + public Dat54GranularSoundFile Wave2 { get; set; } + public Dat54GranularSoundFile Wave3 { get; set; } + public Dat54GranularSoundFile Wave4 { get; set; } + public Dat54GranularSoundFile Wave5 { get; set; } + public Dat54GranularSoundFile Wave6 { get; set; } + public Dat54GranularSoundData DataItem1 { get; set; } //0x34-0x3C + public Dat54GranularSoundData DataItem2 { get; set; } //0x3C-0x44 + public Dat54GranularSoundData DataItem3 { get; set; } //0x44-0x4C + public Dat54GranularSoundData DataItem4 { get; set; } //0x4C-0x54 + public Dat54GranularSoundData DataItem5 { get; set; } //0x54-0x5C + public Dat54GranularSoundData DataItem6 { get; set; } //0x5C-0x64 + public int UnkInt0 { get; set; } //0x64-0x68 + public int UnkInt1 { get; set; } //0x68-0x6C + public ushort UnkShort0 { get; set; } //0x6C-0x6E + public ushort UnkShort1 { get; set; } //0x6E-0x70 + public ushort UnkShort2 { get; set; } //0x70-0x72 + public ushort UnkShort3 { get; set; } //0x72-0x74 + public ushort UnkShort4 { get; set; } //0x74-0x76 + public ushort UnkShort5 { get; set; } //0x76-0x78 + public MetaHash TrackName { get; set; } //0x78-0x7C + public byte UnkVecCount { get; set; } //0x7C-0x7D + public Vector2[] UnkVecData { get; set; } //0x7D-... + + public Dat54GranularSound(RelData d, BinaryReader br) : base(d, br) + { + WaveSlotIndex = br.ReadInt32(); + + Wave1 = new Dat54GranularSoundFile(br); + Wave2 = new Dat54GranularSoundFile(br); + Wave3 = new Dat54GranularSoundFile(br); + Wave4 = new Dat54GranularSoundFile(br); + Wave5 = new Dat54GranularSoundFile(br); + Wave6 = new Dat54GranularSoundFile(br); + + AudioContainers = new[] { + Wave1.ContainerName, + Wave2.ContainerName, + Wave3.ContainerName, + Wave4.ContainerName, + Wave5.ContainerName, + Wave6.ContainerName + }; + + DataItem1 = new Dat54GranularSoundData(br); + DataItem2 = new Dat54GranularSoundData(br); + DataItem3 = new Dat54GranularSoundData(br); + DataItem4 = new Dat54GranularSoundData(br); + DataItem5 = new Dat54GranularSoundData(br); + DataItem6 = new Dat54GranularSoundData(br); + + UnkInt0 = br.ReadInt32(); + UnkInt1 = br.ReadInt32(); + UnkShort0 = br.ReadUInt16(); + UnkShort1 = br.ReadUInt16(); + UnkShort2 = br.ReadUInt16(); + UnkShort3 = br.ReadUInt16(); + UnkShort4 = br.ReadUInt16(); + UnkShort5 = br.ReadUInt16(); + + TrackName = br.ReadUInt32(); + + AudioTracks = new[] { TrackName }; + + UnkVecCount = br.ReadByte(); + UnkVecData = new Vector2[UnkVecCount]; + for (int i = 0; i < UnkVecCount; i++) + { + UnkVecData[i] = new Vector2(br.ReadSingle(), br.ReadSingle()); + } + } + } + [TC(typeof(EXP))] public class Dat54GranularSoundFile + { + public MetaHash ContainerName { get; set; } //0x0-0x4 + public MetaHash FileName { get; set; } //0x4-0x8 + + public Dat54GranularSoundFile(BinaryReader br) + { + ContainerName = br.ReadUInt32(); + FileName = br.ReadUInt32(); + } + + public override string ToString() + { + return ContainerName.ToString() + ": " + FileName.ToString(); + } + } + [TC(typeof(EXP))] public class Dat54GranularSoundData + { + public byte UnkFlags0 { get; set; } //0x0-0x1 + public byte UnkFlags1 { get; set; } //0x1-0x2 + public byte UnkByte0 { get; set; } //0x2-0x3 + public byte UnkByte1 { get; set; } //0x3-0x4 + public float UnkFloat { get; set; } //0x4-0x8 + + public Dat54GranularSoundData(BinaryReader br) + { + UnkFlags0 = br.ReadByte(); + UnkFlags1 = br.ReadByte(); + UnkByte0 = br.ReadByte(); + UnkByte1 = br.ReadByte(); + UnkFloat = br.ReadSingle(); + } + + public override string ToString() + { + return UnkFlags0.ToString() + ": " + UnkFlags1.ToString() + ": " + UnkByte0.ToString() + ": " + UnkByte1.ToString() + ": " + FloatUtil.ToString(UnkFloat); + } + } + [TC(typeof(EXP))] public class Dat54DirectionalSound : Dat54Sound + { + public MetaHash AudioHash { get; set; } + public float UnkFloat0 { get; set; } //0x4-0x8 + public float UnkFloat1 { get; set; } //0x8-0xC + public float UnkFloat2 { get; set; } //0xC-0x10 + public float UnkFloat3 { get; set; } //0x10-0x14 + public float UnkFloat4 { get; set; } //0x14-0x18 + + public Dat54DirectionalSound(RelData d, BinaryReader br) : base(d, br) + { + AudioHash = br.ReadUInt32(); + AudioTracks = new[] { AudioHash }; + UnkFloat0 = br.ReadSingle(); + UnkFloat1 = br.ReadSingle(); + UnkFloat2 = br.ReadSingle(); + UnkFloat3 = br.ReadSingle(); + UnkFloat4 = br.ReadSingle(); + } + } + [TC(typeof(EXP))] public class Dat54KineticSound : Dat54Sound + { + public MetaHash AudioHash { get; set; } + public float UnkFloat0 { get; set; } //Maybe kinetic force vector? + public float UnkFloat1 { get; set; } + public float UnkFloat2 { get; set; } + + public Dat54KineticSound(RelData d, BinaryReader br) : base(d, br) + { + AudioHash = br.ReadUInt32(); + AudioTracks = new[] { AudioHash }; + UnkFloat0 = br.ReadSingle(); + UnkFloat1 = br.ReadSingle(); + UnkFloat2 = br.ReadSingle(); + } + } + [TC(typeof(EXP))] public class Dat54SwitchSound : Dat54Sound + { + public MetaHash ParameterHash { get; set; } //0x0-0x4 + + public Dat54SwitchSound(RelData d, BinaryReader br) : base(d, br) + { + ParameterHash = br.ReadUInt32(); + + ReadAudioTracks(br); + } + } + [TC(typeof(EXP))] public class Dat54VariableCurveSound : Dat54Sound + { + public MetaHash AudioHash { get; set; } + public MetaHash ParameterHash0 { get; set; } //0x4-0x8 + public MetaHash ParameterHash1 { get; set; } //0x8-0xC + public MetaHash UnkCurvesHash { get; set; } //0xC-0x10 + + public Dat54VariableCurveSound(RelData d, BinaryReader br) : base(d, br) + { + AudioHash = br.ReadUInt32(); + AudioTracks = new[] { AudioHash }; + ParameterHash0 = br.ReadUInt32(); + ParameterHash1 = br.ReadUInt32(); + UnkCurvesHash = br.ReadUInt32(); + } + } + [TC(typeof(EXP))] public class Dat54VariablePrintValueSound : Dat54Sound + { + public MetaHash ParameterHash { get; set; } //0x0-0x4 + public string VariableString { get; set; } + + public Dat54VariablePrintValueSound(RelData d, BinaryReader br) : base(d, br) + { + ParameterHash = br.ReadUInt32(); + VariableString = br.ReadString(); + } + } + [TC(typeof(EXP))] public class Dat54VariableBlockSound : Dat54Sound + { + public MetaHash AudioHash { get; set; } + public byte VariableCount { get; set; } + public Dat54VariableData[] Variables { get; set; } + + public Dat54VariableBlockSound(RelData d, BinaryReader br) : base(d, br) + { + AudioHash = br.ReadUInt32(); + AudioTracks = new[] { AudioHash }; + VariableCount = br.ReadByte(); + Variables = new Dat54VariableData[VariableCount]; + for (int i = 0; i < VariableCount; i++) + { + Variables[i] = new Dat54VariableData(br); + } + } + } + [TC(typeof(EXP))] public class Dat54VariableData + { + public MetaHash Name { get; set; } + public float Value { get; set; } + public float UnkFloat { get; set; } + public byte Flags { get; set; } + + public Dat54VariableData(BinaryReader br) + { + Name = br.ReadUInt32(); + Value = br.ReadSingle(); + UnkFloat = br.ReadSingle(); + Flags = br.ReadByte(); + } + + public override string ToString() + { + return Name + ": " + FloatUtil.ToString(Value) + ": " + FloatUtil.ToString(UnkFloat) + ": " + Flags.ToString(); + } + } + [TC(typeof(EXP))] public class Dat54IfSound : Dat54Sound + { + public MetaHash AudioHash1 { get; set; } + public MetaHash AudioHash2 { get; set; } + public MetaHash ParameterHash1 { get; set; } + public byte UnkByte { get; set; } + public float UnkFloat { get; set; } + public MetaHash ParameterHash2 { get; set; } + + public Dat54IfSound(RelData d, BinaryReader br) : base(d, br) + { + AudioHash1 = br.ReadUInt32(); + AudioHash2 = br.ReadUInt32(); + AudioTracks = new[] { AudioHash1, AudioHash2 }; + ParameterHash1 = br.ReadUInt32(); + UnkByte = br.ReadByte(); + UnkFloat = br.ReadSingle(); + ParameterHash2 = br.ReadUInt32(); + } + } + [TC(typeof(EXP))] public class Dat54MathOperationSound : Dat54Sound + { + public MetaHash AudioHash { get; set; } + public byte UnkDataCount { get; set; } + public Dat54MathOperationSoundData[] UnkData { get; set; } + + public Dat54MathOperationSound(RelData d, BinaryReader br) : base(d, br) + { + AudioHash = br.ReadUInt32(); + AudioTracks = new[] { AudioHash }; + UnkDataCount = br.ReadByte(); + UnkData = new Dat54MathOperationSoundData[UnkDataCount]; + for (int i = 0; i < UnkDataCount; i++) + { + UnkData[i] = new Dat54MathOperationSoundData(br); + } + } + } + [TC(typeof(EXP))] public class Dat54MathOperationSoundData + { + public byte UnkByte { get; set; } //0x0-0x1 + public int UnkInt0 { get; set; } //0x1-0x5 + public int UnkInt1 { get; set; } //0x5-0x9 + public int UnkInt2 { get; set; } //0x9-0xD + public int UnkInt3 { get; set; } //0xD-0x11 + public int UnkInt4 { get; set; } //0x11-0x15 + public MetaHash ParameterHash0 { get; set; } //0x15-0x19 + public MetaHash ParameterHash1 { get; set; } //0x19-0x1D + + public Dat54MathOperationSoundData(BinaryReader br) + { + UnkByte = br.ReadByte(); + UnkInt0 = br.ReadInt32(); + UnkInt1 = br.ReadInt32(); + UnkInt2 = br.ReadInt32(); + UnkInt3 = br.ReadInt32(); + UnkInt4 = br.ReadInt32(); + ParameterHash0 = br.ReadUInt32(); + ParameterHash1 = br.ReadUInt32(); + } + + public override string ToString() + { + return ParameterHash0.ToString() + ", " + ParameterHash1.ToString(); + } + } + [TC(typeof(EXP))] public class Dat54ParameterTransformSound : Dat54Sound + { + public MetaHash AudioHash { get; set; } + public int ItemCount { get; set; } + public Dat54ParameterTransformSoundData[] Items { get; set; } + + public Dat54ParameterTransformSound(RelData d, BinaryReader br) : base(d, br) + { + AudioHash = br.ReadUInt32(); + AudioTracks = new[] { AudioHash }; + ItemCount = br.ReadInt32(); //0x4-0x8 + Items = new Dat54ParameterTransformSoundData[ItemCount]; + for (int i = 0; i < ItemCount; i++) + { + Items[i] = new Dat54ParameterTransformSoundData(br); + } + } + } + [TC(typeof(EXP))] public class Dat54ParameterTransformSoundData + { + public MetaHash ParameterHash { get; set; } //0x0-0x4 + public float UnkFloat0 { get; set; } //0x4-0x8 + public float UnkFloat1 { get; set; } //0x8-0xC + public int NestedDataCount { get; set; } + public Dat54ParameterTransformSoundData2[] NestedData { get; set; } //0x10.. + + public Dat54ParameterTransformSoundData(BinaryReader br) + { + ParameterHash = br.ReadUInt32(); + UnkFloat0 = br.ReadSingle(); + UnkFloat1 = br.ReadSingle(); + NestedDataCount = br.ReadInt32(); + NestedData = new Dat54ParameterTransformSoundData2[NestedDataCount]; + for (int i = 0; i < NestedDataCount; i++) + { + NestedData[i] = new Dat54ParameterTransformSoundData2(br); + } + } + + public override string ToString() + { + return ParameterHash.ToString() + ", " + NestedDataCount.ToString(); + } + } + [TC(typeof(EXP))] public class Dat54ParameterTransformSoundData2 + { + public float UnkFloat0 { get; set; } //0x0-0x4 + public int UnkInt { get; set; } //0x4 + public MetaHash ParameterHash { get; set; } //0x8-0xC + public float UnkFloat1 { get; set; } //0xC + public float UnkFloat2 { get; set; } //0x10-0x14 + public int NestedItemCount { get; set; } + public Vector2[] NestedItems { get; set; } //0x18-... + + public Dat54ParameterTransformSoundData2(BinaryReader br) + { + UnkFloat0 = br.ReadSingle(); + UnkInt = br.ReadInt32(); + ParameterHash = br.ReadUInt32(); + UnkFloat1 = br.ReadSingle(); + UnkFloat2 = br.ReadSingle(); + NestedItemCount = br.ReadInt32(); + NestedItems = new Vector2[NestedItemCount]; + for (int i = 0; i < NestedItemCount; i++) + { + NestedItems[i] = new Vector2(br.ReadSingle(), br.ReadSingle()); + } + } + + public override string ToString() + { + return ParameterHash.ToString() + ", " + NestedItemCount.ToString(); + } + } + [TC(typeof(EXP))] public class Dat54FluctuatorSound : Dat54Sound + { + public MetaHash AudioHash { get; set; } + public int ItemCount { get; set; } + public Dat54FluctuatorSoundData[] Items { get; set; } + + public Dat54FluctuatorSound(RelData d, BinaryReader br) : base(d, br) + { + AudioHash = br.ReadUInt32(); + AudioTracks = new[] { AudioHash }; + ItemCount = br.ReadInt32(); //0x4-0x8 + Items = new Dat54FluctuatorSoundData[ItemCount]; + for (int i = 0; i < ItemCount; i++) + { + Items[i] = new Dat54FluctuatorSoundData(br); + } + } + } + [TC(typeof(EXP))] public class Dat54FluctuatorSoundData + { + public byte UnkByte0 { get; set; } //0x0-0x1 + public byte UnkByte1 { get; set; } //0x1-0x2 + public MetaHash ParameterHash { get; set; } //0x2-0x6 + public float UnkFloat00 { get; set; } //0x6-0xA + public float UnkFloat01 { get; set; } //0xA-0xE + public float UnkFloat02 { get; set; } //0xE-0x12 + public float UnkFloat03 { get; set; } //0x12-0x16 + public float UnkFloat04 { get; set; } //0x16-0x1A + public float UnkFloat05 { get; set; } //0x1A-0x1E + public float UnkFloat06 { get; set; } //0x1E-0x22 + public float UnkFloat07 { get; set; } //0x22-0x26 + public float UnkFloat08 { get; set; } //0x26-0x2A + public float UnkFloat09 { get; set; } //0x2A-0x2E + public float UnkFloat10 { get; set; } //0x2E-0x32 + + public Dat54FluctuatorSoundData(BinaryReader br) + { + UnkByte0 = br.ReadByte(); + UnkByte1 = br.ReadByte(); + ParameterHash = br.ReadUInt32(); + UnkFloat00 = br.ReadSingle(); + UnkFloat01 = br.ReadSingle(); + UnkFloat02 = br.ReadSingle(); + UnkFloat03 = br.ReadSingle(); + UnkFloat04 = br.ReadSingle(); + UnkFloat05 = br.ReadSingle(); + UnkFloat06 = br.ReadSingle(); + UnkFloat07 = br.ReadSingle(); + UnkFloat08 = br.ReadSingle(); + UnkFloat09 = br.ReadSingle(); + UnkFloat10 = br.ReadSingle(); + } + + public override string ToString() + { + return ParameterHash.ToString(); + } + } + [TC(typeof(EXP))] public class Dat54AutomationSound : Dat54Sound + { + public MetaHash AudioHash0 { get; set; } + public float UnkFloat0 { get; set; } //0x4-0x8 + public float UnkFloat1 { get; set; } //0x8-0xC + public MetaHash ParameterHash { get; set; } //0xC-0x10 + public MetaHash AudioHash1 { get; set; } + public int WaveSlotId { get; set; } //0x14-0x18 + public MetaHash UnkHash1 { get; set; } //0x18-0x1C + public int UnkDataCount { get; set; } // array data count 0x1C-0x20 + public Dat54AutomationSoundData[] UnkData { get; set; } //0x20- + + public Dat54AutomationSound(RelData d, BinaryReader br) : base(d, br) + { + AudioHash0 = br.ReadUInt32(); + UnkFloat0 = br.ReadSingle(); + UnkFloat1 = br.ReadSingle(); + ParameterHash = br.ReadUInt32(); + AudioHash1 = br.ReadUInt32(); + AudioTracks = new[] { AudioHash0, AudioHash1 }; + WaveSlotId = br.ReadInt32(); + UnkHash1 = br.ReadUInt32(); + UnkDataCount = br.ReadInt32(); + UnkData = new Dat54AutomationSoundData[UnkDataCount]; + for (int i = 0; i < UnkDataCount; i++) + { + UnkData[i] = new Dat54AutomationSoundData(br); + } + } + } + [TC(typeof(EXP))] public class Dat54AutomationSoundData + { + public int UnkInt { get; set; } //0x0-0x1 + public MetaHash UnkHash { get; set; } //0x2-0x6 + + public Dat54AutomationSoundData(BinaryReader br) + { + UnkInt = br.ReadInt32(); + UnkHash = br.ReadUInt32(); + } + + public override string ToString() + { + return UnkInt.ToString() + ", " + UnkHash.ToString(); + } + } + [TC(typeof(EXP))] public class Dat54ExternalStreamSound : Dat54Sound + { + public Dat54ExternalStreamSound(RelData d, BinaryReader br) : base(d, br) + { + ReadAudioTracks(br); + + //TODO: could be more to read! + if (br.BaseStream.Position != br.BaseStream.Length) + { } //hits here! + } + } + [TC(typeof(EXP))] public class Dat54SoundSet : Dat54Sound + { + public int ItemCount { get; set; } + public Dat54SoundSetItem[] Items { get; set; } + + public Dat54SoundSet(RelData d, BinaryReader br) : base(d, br) + { + ItemCount = br.ReadInt32(); + Items = new Dat54SoundSetItem[ItemCount]; + AudioTracks = new MetaHash[ItemCount]; + for (int i = 0; i < ItemCount; i++) + { + Items[i] = new Dat54SoundSetItem(br); + AudioTracks[i] = Items[i].SoundName; + } + } + } + [TC(typeof(EXP))] public class Dat54SoundSetItem + { + public MetaHash ScriptName { get; set; } + public MetaHash SoundName { get; set; } + + public Dat54SoundSetItem(BinaryReader br) + { + ScriptName = br.ReadUInt32(); + SoundName = br.ReadUInt32(); + } + + public override string ToString() + { + return ScriptName.ToString() + ": " + SoundName.ToString(); + } + } + [TC(typeof(EXP))] public class Dat54UnknownSound : Dat54Sound + { + public byte UnkDataCount { get; set; } + public Dat54UnknownSoundData[] UnkData { get; set; } + + public Dat54UnknownSound(RelData d, BinaryReader br) : base(d, br) + { + UnkDataCount = br.ReadByte(); + UnkData = new Dat54UnknownSoundData[UnkDataCount]; + AudioTracks = new MetaHash[UnkDataCount]; + for (int i = 0; i < UnkDataCount; i++) + { + UnkData[i] = new Dat54UnknownSoundData(br); + AudioTracks[i] = br.ReadUInt32(); + } + } + } + [TC(typeof(EXP))] public class Dat54UnknownSoundData + { + public byte UnkByte0 { get; set; } + public byte UnkByte1 { get; set; } + public byte UnkByte2 { get; set; } + + public Dat54UnknownSoundData(BinaryReader br) + { + UnkByte0 = br.ReadByte(); + UnkByte1 = br.ReadByte(); + UnkByte2 = br.ReadByte(); + } + + public override string ToString() + { + return UnkByte0.ToString() + ": " + UnkByte1.ToString() + ": " + UnkByte2.ToString(); + } + } + [TC(typeof(EXP))] public class Dat54UnknownSound2 : Dat54Sound + { + public uint UnkCount { get; set; } + public MetaHash[] UnkItems { get; set; } + + public Dat54UnknownSound2(RelData d, BinaryReader br) : base(d, br) + { + UnkCount = br.ReadUInt32(); + UnkItems = new MetaHash[UnkCount]; + for (int i = 0; i < UnkCount; i++) + { + UnkItems[i] = br.ReadUInt32(); + } + } + } + [TC(typeof(EXP))] public class Dat54SoundList : Dat54Sound + { + public ushort UnkShort { get; set; } + public uint Count { get; set; } + public MetaHash[] Items { get; set; } + + public Dat54SoundList(RelData d, BinaryReader br) : base(d, br) + { + UnkShort = br.ReadUInt16(); + Count = br.ReadUInt32(); + Items = new MetaHash[Count]; + for (int i = 0; i < Count; i++) + { + Items[i] = br.ReadUInt32(); + } + if (br.BaseStream.Position != br.BaseStream.Length) + { } + } + } + + + + + + public enum Dat151RelType : byte //not sure how correct these are? + { + SpeechParams = 14, + StartTrackAction = 63, + StopTrackAction = 64, + SetMoodAction = 65, + StartOneShotAction = 67, + StopOneShotAction = 68, + AnimalParams = 73, + ShoreLinePool = 90, + ShoreLineLake = 91, + ShoreLineRiver = 92, + ShoreLineOcean = 93, + ShoreLineList = 94, + RadioDjSpeechAction = 98, + FadeOutRadioAction = 102, + FadeInRadioAction = 103, + ForceRadioTrackAction = 104 + } + + [TC(typeof(EXP))] public class Dat151RelData : RelData + { + public Dat151RelType Type { get; set; } + + public Dat151RelData() { } + public Dat151RelData(RelData d, BinaryReader br) : base(d) + { + Type = (Dat151RelType)TypeID; + } + + public override string ToString() + { + return GetBaseString() + ": " + Type.ToString(); + } + } + + + } diff --git a/GameFiles/Resources/RpfManager.cs b/GameFiles/Resources/RpfManager.cs index 7a244d6..cae2584 100644 --- a/GameFiles/Resources/RpfManager.cs +++ b/GameFiles/Resources/RpfManager.cs @@ -355,10 +355,8 @@ namespace CodeWalker.GameFiles { var nlow = entry.NameLower; if (string.IsNullOrEmpty(nlow)) continue; - JenkIndex.Ensure(entry.Name); - JenkIndex.Ensure(nlow); - //JenkIndex.Ensure(entry.Path); - //JenkIndex.Ensure(entry.Path.ToLower()); + //JenkIndex.Ensure(entry.Name); + //JenkIndex.Ensure(nlow); int ind = nlow.LastIndexOf('.'); if (ind > 0) { @@ -371,6 +369,11 @@ namespace CodeWalker.GameFiles // JenkIndex.Ensure(entry.NameLower.Substring(0, ind) + ".#" + entry.NameLower.Substring(ind + 2)); //} } + else + { + JenkIndex.Ensure(entry.Name); + JenkIndex.Ensure(nlow); + } if (nlow.EndsWith(".ydr") || nlow.EndsWith(".yft")) { var sname = nlow.Substring(0, nlow.Length - 4);