XML to audio dat.rel conversion progress

This commit is contained in:
dexy 2019-01-19 14:28:45 +11:00
parent 35d10a8e48
commit 6533d842bc
5 changed files with 225 additions and 55 deletions

View File

@ -824,10 +824,14 @@ namespace CodeWalker.GameFiles
{ {
ntlength += (uint)name.Length + 1; ntlength += (uint)name.Length + 1;
} }
if ((NameTableLength != ntlength)&&(NameTableLength!=0))
{ }
NameTableLength = ntlength; NameTableLength = ntlength;
} }
else else
{ {
if ((NameTableLength != 4)&& (NameTableLength != 0))
{ }
NameTableCount = 0; NameTableCount = 0;
NameTableLength = 4; NameTableLength = 4;
} }
@ -848,7 +852,7 @@ namespace CodeWalker.GameFiles
break; break;
case RelDatFileType.Dat4://TODO! case RelDatFileType.Dat4://TODO!
case RelDatFileType.Dat54DataEntries://TODO! case RelDatFileType.Dat54DataEntries://TODO!
default://TODO..? //default://TODO..?
return; return;
} }
@ -867,32 +871,60 @@ namespace CodeWalker.GameFiles
var rd = RelDatasSorted[i]; var rd = RelDatasSorted[i];
switch ((Dat151RelType)rd.TypeID)//must be a better way of doing this! switch (RelType)
{ {
case Dat151RelType.AmbientEmitter: case RelDatFileType.Dat10ModularSynth:
case Dat151RelType.AmbientZone:
case Dat151RelType.Unk101:
case Dat151RelType.Unk35:
while ((ms.Position & 0xF) != 0) bw.Write((byte)0); //align to nearest 16 bytes
break;
case Dat151RelType.Mood:
case Dat151RelType.Unk70:
case Dat151RelType.Unk29:
case Dat151RelType.SpeechParams:
case Dat151RelType.Unk11:
case Dat151RelType.Unk41:
case Dat151RelType.Unk2:
case Dat151RelType.AmbientEmitterList:
case Dat151RelType.Weapon:
case Dat151RelType.Vehicle:
case Dat151RelType.StopTrackAction:
while ((ms.Position & 3) != 0) bw.Write((byte)0); //align these to nearest 4 bytes while ((ms.Position & 3) != 0) bw.Write((byte)0); //align these to nearest 4 bytes
break; break;
case RelDatFileType.Dat15DynamicMixer:
switch (rd.TypeID)
{
case 0:
case 6:
case 5:
case 7:
case 8:
while ((ms.Position & 3) != 0) bw.Write((byte)0); //align these to nearest 4 bytes
break;
default:
break;
}
break;
case RelDatFileType.Dat149:
case RelDatFileType.Dat150:
case RelDatFileType.Dat151:
switch ((Dat151RelType)rd.TypeID)//must be a better way of doing this!
{
case Dat151RelType.AmbientEmitter:
case Dat151RelType.AmbientZone:
case Dat151RelType.Unk101:
case Dat151RelType.Unk35:
while ((ms.Position & 0xF) != 0) bw.Write((byte)0); //align to nearest 16 bytes
break;
case Dat151RelType.Mood:
case Dat151RelType.Unk70:
case Dat151RelType.Unk29:
case Dat151RelType.SpeechParams:
case Dat151RelType.Unk11:
case Dat151RelType.Unk41:
case Dat151RelType.Unk2:
case Dat151RelType.AmbientEmitterList:
case Dat151RelType.Weapon:
case Dat151RelType.Vehicle:
case Dat151RelType.StopTrackAction:
while ((ms.Position & 3) != 0) bw.Write((byte)0); //align these to nearest 4 bytes
break;
}
break;
//case RelDatFileType.Dat4://TODO!
//case RelDatFileType.Dat54DataEntries://TODO!
// //default://TODO..?
// return;
} }
var pos = ms.Position; var pos = ms.Position;
if (ms.Position != rd.DataOffset) if ((ms.Position != rd.DataOffset)&&(rd.DataOffset!=0))
{ } { }
rd.DataOffset = (uint)ms.Position; rd.DataOffset = (uint)ms.Position;
rd.Write(bw); rd.Write(bw);
@ -908,7 +940,7 @@ namespace CodeWalker.GameFiles
ms.Position = 0; ms.Position = 0;
ms.Read(buf, 0, buf.Length); ms.Read(buf, 0, buf.Length);
if ((DataBlock?.Length ?? 0) != buf.Length) if ((DataBlock!=null)&&(DataBlock.Length != buf.Length))
{ } { }
DataBlock = buf; DataBlock = buf;
@ -928,22 +960,37 @@ namespace CodeWalker.GameFiles
break; break;
case RelDatFileType.Dat4://TODO! case RelDatFileType.Dat4://TODO!
case RelDatFileType.Dat54DataEntries://TODO! case RelDatFileType.Dat54DataEntries://TODO!
default://TODO..? //default://TODO..?
return; return;
} }
//for the correct index ordering, needs to be in order of hashes, but with bits rotated right by 8 (why!?) //for the correct index ordering, needs to be in order of hashes, but with bits rotated right by 8 (why!?)
var sorted = RelDatasSorted.ToList(); var sorted = RelDatasSorted.ToList();
//sorted.Sort((a, b) => { return ((uint)a.NameHash).CompareTo((uint)b.NameHash); }); switch (RelType)
sorted.Sort((a, b) =>
{ {
var ah = (uint)a.NameHash; case RelDatFileType.Dat15DynamicMixer:
var bh = (uint)b.NameHash; //don't sort? sort alphabetically?
var av = (ah >> 8) | (ah << 24); //break;
var bv = (bh >> 8) | (bh << 24); case RelDatFileType.Dat149:
return av.CompareTo(bv); case RelDatFileType.Dat150:
}); case RelDatFileType.Dat151:
case RelDatFileType.Dat10ModularSynth:
case RelDatFileType.Dat22Categories:
case RelDatFileType.Dat16Curves:
sorted.Sort((a, b) =>
{
var ah = (uint)a.NameHash;
var bh = (uint)b.NameHash;
var av = (ah >> 8) | (ah << 24);
var bv = (bh >> 8) | (bh << 24);
return av.CompareTo(bv);
});
break;
default:
sorted.Sort((a, b) => { return ((uint)a.NameHash).CompareTo((uint)b.NameHash); });
break;
}
RelDatas = sorted.ToArray(); RelDatas = sorted.ToArray();
@ -4429,7 +4476,9 @@ namespace CodeWalker.GameFiles
public Vector3 InnerVec3 { get; set; } public Vector3 InnerVec3 { get; set; }
public Vector4 UnkVec1 { get; set; } public Vector4 UnkVec1 { get; set; }
public Vector4 UnkVec2 { get; set; } public Vector4 UnkVec2 { get; set; }
public Vector4 UnkVec3 { get; set; } public MetaHash UnkHash0 { get; set; }
public MetaHash UnkHash1 { get; set; }
public Vector2 UnkVec3 { get; set; }
public FlagsUint Flags2 { get; set; } public FlagsUint Flags2 { get; set; }
public byte Unk14 { get; set; } public byte Unk14 { get; set; }
public byte Unk15 { get; set; } public byte Unk15 { get; set; }
@ -4499,7 +4548,9 @@ namespace CodeWalker.GameFiles
InnerVec3 = new Vector3(br.ReadSingle(), br.ReadSingle(), br.ReadSingle()); InnerVec3 = new Vector3(br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
UnkVec1 = new Vector4(br.ReadSingle(), br.ReadSingle(), br.ReadSingle(), br.ReadSingle()); UnkVec1 = new Vector4(br.ReadSingle(), br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
UnkVec2 = new Vector4(br.ReadSingle(), br.ReadSingle(), br.ReadSingle(), br.ReadSingle()); UnkVec2 = new Vector4(br.ReadSingle(), br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
UnkVec3 = new Vector4(br.ReadSingle(), br.ReadSingle(), br.ReadSingle(), br.ReadSingle()); UnkHash0 = br.ReadUInt32();
UnkHash1 = br.ReadUInt32();
UnkVec3 = new Vector2(br.ReadSingle(), br.ReadSingle());
Flags2 = br.ReadUInt32(); Flags2 = br.ReadUInt32();
Unk14 = br.ReadByte(); Unk14 = br.ReadByte();
@ -4562,6 +4613,11 @@ namespace CodeWalker.GameFiles
if (Flags2 != 0) if (Flags2 != 0)
{ }//eg 0xAE64583B, 0x61083310, 0xCAE96294, 0x1C376176 { }//eg 0xAE64583B, 0x61083310, 0xCAE96294, 0x1C376176
if (UnkHash0 != 0)
{ }
if (UnkHash1 != 0)
{ }
#endregion #endregion
} }
@ -4621,10 +4677,14 @@ namespace CodeWalker.GameFiles
bw.Write(UnkVec2.Y); bw.Write(UnkVec2.Y);
bw.Write(UnkVec2.Z); bw.Write(UnkVec2.Z);
bw.Write(UnkVec2.W); bw.Write(UnkVec2.W);
//bw.Write(UnkVec3.X);
//bw.Write(UnkVec3.Y);
//bw.Write(UnkVec3.Z);
//bw.Write(UnkVec3.W);
bw.Write(UnkHash0);
bw.Write(UnkHash1);
bw.Write(UnkVec3.X); bw.Write(UnkVec3.X);
bw.Write(UnkVec3.Y); bw.Write(UnkVec3.Y);
bw.Write(UnkVec3.Z);
bw.Write(UnkVec3.W);
bw.Write(Flags2); bw.Write(Flags2);
bw.Write(Unk14); bw.Write(Unk14);
@ -4666,7 +4726,11 @@ namespace CodeWalker.GameFiles
RelXml.SelfClosingTag(sb, indent, "InnerVec3 " + FloatUtil.GetVector3XmlString(InnerVec3)); RelXml.SelfClosingTag(sb, indent, "InnerVec3 " + FloatUtil.GetVector3XmlString(InnerVec3));
RelXml.SelfClosingTag(sb, indent, "UnkVec1 " + FloatUtil.GetVector4XmlString(UnkVec1)); RelXml.SelfClosingTag(sb, indent, "UnkVec1 " + FloatUtil.GetVector4XmlString(UnkVec1));
RelXml.SelfClosingTag(sb, indent, "UnkVec2 " + FloatUtil.GetVector4XmlString(UnkVec2)); RelXml.SelfClosingTag(sb, indent, "UnkVec2 " + FloatUtil.GetVector4XmlString(UnkVec2));
RelXml.SelfClosingTag(sb, indent, "UnkVec3 " + FloatUtil.GetVector4XmlString(UnkVec3)); //RelXml.SelfClosingTag(sb, indent, "UnkVec3 " + FloatUtil.GetVector4XmlString(UnkVec3));
RelXml.StringTag(sb, indent, "UnkHash0", RelXml.HashString(UnkHash0));
RelXml.StringTag(sb, indent, "UnkHash1", RelXml.HashString(UnkHash1));
RelXml.SelfClosingTag(sb, indent, "UnkVec3 " + FloatUtil.GetVector2XmlString(UnkVec3));
RelXml.ValueTag(sb, indent, "Flags2", "0x" + Flags2.Hex); RelXml.ValueTag(sb, indent, "Flags2", "0x" + Flags2.Hex);
RelXml.ValueTag(sb, indent, "Unk14", Unk14.ToString()); RelXml.ValueTag(sb, indent, "Unk14", Unk14.ToString());
RelXml.ValueTag(sb, indent, "Unk15", Unk15.ToString()); RelXml.ValueTag(sb, indent, "Unk15", Unk15.ToString());
@ -4723,7 +4787,11 @@ namespace CodeWalker.GameFiles
InnerVec3 = Xml.GetChildVector3Attributes(node, "InnerVec3", "x", "y", "z"); InnerVec3 = Xml.GetChildVector3Attributes(node, "InnerVec3", "x", "y", "z");
UnkVec1 = Xml.GetChildVector4Attributes(node, "UnkVec1", "x", "y", "z", "w"); UnkVec1 = Xml.GetChildVector4Attributes(node, "UnkVec1", "x", "y", "z", "w");
UnkVec2 = Xml.GetChildVector4Attributes(node, "UnkVec2", "x", "y", "z", "w"); UnkVec2 = Xml.GetChildVector4Attributes(node, "UnkVec2", "x", "y", "z", "w");
UnkVec3 = Xml.GetChildVector4Attributes(node, "UnkVec3", "x", "y", "z", "w"); //UnkVec3 = Xml.GetChildVector4Attributes(node, "UnkVec3", "x", "y", "z", "w");
UnkHash0 = XmlRel.GetHash(Xml.GetChildInnerText(node, "UnkHash0"));
UnkHash1 = XmlRel.GetHash(Xml.GetChildInnerText(node, "UnkHash1"));
UnkVec3 = Xml.GetChildVector2Attributes(node, "UnkVec3", "x", "y");
Flags2 = Xml.GetChildUIntAttribute(node, "Flags2", "value"); Flags2 = Xml.GetChildUIntAttribute(node, "Flags2", "value");
Unk14 = (byte)Xml.GetChildUIntAttribute(node, "Unk14", "value"); Unk14 = (byte)Xml.GetChildUIntAttribute(node, "Unk14", "value");
Unk15 = (byte)Xml.GetChildUIntAttribute(node, "Unk15", "value"); Unk15 = (byte)Xml.GetChildUIntAttribute(node, "Unk15", "value");
@ -11710,8 +11778,8 @@ namespace CodeWalker.GameFiles
{ {
RelXml.ValueTag(sb, indent, "Unk00", "0x" + Unk00.Hex); RelXml.ValueTag(sb, indent, "Unk00", "0x" + Unk00.Hex);
RelXml.ValueTag(sb, indent, "Unk01", Unk01.ToString()); RelXml.ValueTag(sb, indent, "Unk01", Unk01.ToString());
RelXml.ValueTag(sb, indent, "Unk02", Unk01.ToString()); RelXml.ValueTag(sb, indent, "Unk02", Unk02.ToString());
RelXml.ValueTag(sb, indent, "Unk03", Unk01.ToString()); RelXml.ValueTag(sb, indent, "Unk03", Unk03.ToString());
var cind = indent + 1; var cind = indent + 1;
var cind2 = indent + 2; var cind2 = indent + 2;

View File

@ -114,6 +114,11 @@ namespace CodeWalker
var c = CultureInfo.InvariantCulture; var c = CultureInfo.InvariantCulture;
return v.X.ToString(c) + ", " + v.Y.ToString(c); return v.X.ToString(c) + ", " + v.Y.ToString(c);
} }
public static string GetVector2XmlString(Vector2 v)
{
var c = CultureInfo.InvariantCulture;
return string.Format("x=\"{0}\" y=\"{1}\"", v.X.ToString(c), v.Y.ToString(c));
}
public static string GetVector3String(Vector3 v) public static string GetVector3String(Vector3 v)
{ {
var c = CultureInfo.InvariantCulture; var c = CultureInfo.InvariantCulture;

View File

@ -80,6 +80,10 @@
this.label16 = new System.Windows.Forms.Label(); this.label16 = new System.Windows.Forms.Label();
this.InnerPosTextBox = new System.Windows.Forms.TextBox(); this.InnerPosTextBox = new System.Windows.Forms.TextBox();
this.GoToButton = new System.Windows.Forms.Button(); this.GoToButton = new System.Windows.Forms.Button();
this.label24 = new System.Windows.Forms.Label();
this.Hash0TextBox = new System.Windows.Forms.TextBox();
this.label25 = new System.Windows.Forms.Label();
this.Hash1TextBox = new System.Windows.Forms.TextBox();
this.tabControl1.SuspendLayout(); this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout(); this.tabPage1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
@ -98,6 +102,10 @@
// //
// tabPage1 // tabPage1
// //
this.tabPage1.Controls.Add(this.label25);
this.tabPage1.Controls.Add(this.Hash1TextBox);
this.tabPage1.Controls.Add(this.label24);
this.tabPage1.Controls.Add(this.Hash0TextBox);
this.tabPage1.Controls.Add(this.label22); this.tabPage1.Controls.Add(this.label22);
this.tabPage1.Controls.Add(this.UnkBytesTextBox); this.tabPage1.Controls.Add(this.UnkBytesTextBox);
this.tabPage1.Controls.Add(this.DeleteButton); this.tabPage1.Controls.Add(this.DeleteButton);
@ -179,7 +187,7 @@
this.DeleteButton.Location = new System.Drawing.Point(343, 3); this.DeleteButton.Location = new System.Drawing.Point(343, 3);
this.DeleteButton.Name = "DeleteButton"; this.DeleteButton.Name = "DeleteButton";
this.DeleteButton.Size = new System.Drawing.Size(93, 23); this.DeleteButton.Size = new System.Drawing.Size(93, 23);
this.DeleteButton.TabIndex = 77; this.DeleteButton.TabIndex = 81;
this.DeleteButton.Text = "Delete zone"; this.DeleteButton.Text = "Delete zone";
this.DeleteButton.UseVisualStyleBackColor = true; this.DeleteButton.UseVisualStyleBackColor = true;
this.DeleteButton.Click += new System.EventHandler(this.DeleteButton_Click); this.DeleteButton.Click += new System.EventHandler(this.DeleteButton_Click);
@ -190,7 +198,7 @@
this.AddToProjectButton.Location = new System.Drawing.Point(452, 3); this.AddToProjectButton.Location = new System.Drawing.Point(452, 3);
this.AddToProjectButton.Name = "AddToProjectButton"; this.AddToProjectButton.Name = "AddToProjectButton";
this.AddToProjectButton.Size = new System.Drawing.Size(93, 23); this.AddToProjectButton.Size = new System.Drawing.Size(93, 23);
this.AddToProjectButton.TabIndex = 76; this.AddToProjectButton.TabIndex = 80;
this.AddToProjectButton.Text = "Add to project"; this.AddToProjectButton.Text = "Add to project";
this.AddToProjectButton.UseVisualStyleBackColor = true; this.AddToProjectButton.UseVisualStyleBackColor = true;
this.AddToProjectButton.Click += new System.EventHandler(this.AddToProjectButton_Click); this.AddToProjectButton.Click += new System.EventHandler(this.AddToProjectButton_Click);
@ -218,21 +226,21 @@
// //
this.label20.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.label20.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label20.AutoSize = true; this.label20.AutoSize = true;
this.label20.Location = new System.Drawing.Point(340, 278); this.label20.Location = new System.Drawing.Point(340, 303);
this.label20.Name = "label20"; this.label20.Name = "label20";
this.label20.Size = new System.Drawing.Size(193, 13); this.label20.Size = new System.Drawing.Size(193, 13);
this.label20.TabIndex = 74; this.label20.TabIndex = 78;
this.label20.Text = "Ext params: Name (hash), Value (float)"; this.label20.Text = "Ext params: Name (hash), Value (float)";
// //
// ExtParamsTextBox // ExtParamsTextBox
// //
this.ExtParamsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.ExtParamsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.ExtParamsTextBox.Location = new System.Drawing.Point(335, 295); this.ExtParamsTextBox.Location = new System.Drawing.Point(335, 319);
this.ExtParamsTextBox.Multiline = true; this.ExtParamsTextBox.Multiline = true;
this.ExtParamsTextBox.Name = "ExtParamsTextBox"; this.ExtParamsTextBox.Name = "ExtParamsTextBox";
this.ExtParamsTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both; this.ExtParamsTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.ExtParamsTextBox.Size = new System.Drawing.Size(209, 116); this.ExtParamsTextBox.Size = new System.Drawing.Size(209, 92);
this.ExtParamsTextBox.TabIndex = 75; this.ExtParamsTextBox.TabIndex = 79;
this.ExtParamsTextBox.WordWrap = false; this.ExtParamsTextBox.WordWrap = false;
this.ExtParamsTextBox.TextChanged += new System.EventHandler(this.ExtParamsTextBox_TextChanged); this.ExtParamsTextBox.TextChanged += new System.EventHandler(this.ExtParamsTextBox_TextChanged);
// //
@ -240,10 +248,10 @@
// //
this.label19.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.label19.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label19.AutoSize = true; this.label19.AutoSize = true;
this.label19.Location = new System.Drawing.Point(340, 134); this.label19.Location = new System.Drawing.Point(340, 183);
this.label19.Name = "label19"; this.label19.Name = "label19";
this.label19.Size = new System.Drawing.Size(46, 13); this.label19.Size = new System.Drawing.Size(46, 13);
this.label19.TabIndex = 72; this.label19.TabIndex = 76;
this.label19.Text = "Hashes:"; this.label19.Text = "Hashes:";
// //
// label15 // label15
@ -306,12 +314,12 @@
// HashesTextBox // HashesTextBox
// //
this.HashesTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.HashesTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.HashesTextBox.Location = new System.Drawing.Point(335, 151); this.HashesTextBox.Location = new System.Drawing.Point(335, 199);
this.HashesTextBox.Multiline = true; this.HashesTextBox.Multiline = true;
this.HashesTextBox.Name = "HashesTextBox"; this.HashesTextBox.Name = "HashesTextBox";
this.HashesTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both; this.HashesTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.HashesTextBox.Size = new System.Drawing.Size(209, 116); this.HashesTextBox.Size = new System.Drawing.Size(209, 92);
this.HashesTextBox.TabIndex = 73; this.HashesTextBox.TabIndex = 77;
this.HashesTextBox.WordWrap = false; this.HashesTextBox.WordWrap = false;
this.HashesTextBox.TextChanged += new System.EventHandler(this.HashesTextBox_TextChanged); this.HashesTextBox.TextChanged += new System.EventHandler(this.HashesTextBox_TextChanged);
// //
@ -634,6 +642,44 @@
this.GoToButton.UseVisualStyleBackColor = true; this.GoToButton.UseVisualStyleBackColor = true;
this.GoToButton.Click += new System.EventHandler(this.GoToButton_Click); this.GoToButton.Click += new System.EventHandler(this.GoToButton_Click);
// //
// label24
//
this.label24.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label24.AutoSize = true;
this.label24.Location = new System.Drawing.Point(340, 130);
this.label24.Name = "label24";
this.label24.Size = new System.Drawing.Size(44, 13);
this.label24.TabIndex = 72;
this.label24.Text = "Hash 0:";
//
// Hash0TextBox
//
this.Hash0TextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.Hash0TextBox.Location = new System.Drawing.Point(390, 127);
this.Hash0TextBox.Name = "Hash0TextBox";
this.Hash0TextBox.Size = new System.Drawing.Size(155, 20);
this.Hash0TextBox.TabIndex = 73;
this.Hash0TextBox.TextChanged += new System.EventHandler(this.Hash0TextBox_TextChanged);
//
// label25
//
this.label25.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label25.AutoSize = true;
this.label25.Location = new System.Drawing.Point(340, 154);
this.label25.Name = "label25";
this.label25.Size = new System.Drawing.Size(44, 13);
this.label25.TabIndex = 74;
this.label25.Text = "Hash 1:";
//
// Hash1TextBox
//
this.Hash1TextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.Hash1TextBox.Location = new System.Drawing.Point(390, 151);
this.Hash1TextBox.Name = "Hash1TextBox";
this.Hash1TextBox.Size = new System.Drawing.Size(155, 20);
this.Hash1TextBox.TabIndex = 75;
this.Hash1TextBox.TextChanged += new System.EventHandler(this.Hash1TextBox_TextChanged);
//
// EditAudioZonePanel // EditAudioZonePanel
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -703,5 +749,9 @@
private System.Windows.Forms.Button DeleteButton; private System.Windows.Forms.Button DeleteButton;
private System.Windows.Forms.Label label22; private System.Windows.Forms.Label label22;
private System.Windows.Forms.TextBox UnkBytesTextBox; private System.Windows.Forms.TextBox UnkBytesTextBox;
private System.Windows.Forms.Label label25;
private System.Windows.Forms.TextBox Hash1TextBox;
private System.Windows.Forms.Label label24;
private System.Windows.Forms.TextBox Hash0TextBox;
} }
} }

View File

@ -72,6 +72,8 @@ namespace CodeWalker.Project.Panels
Flags0TextBox.Text = string.Empty; Flags0TextBox.Text = string.Empty;
Flags1TextBox.Text = string.Empty; Flags1TextBox.Text = string.Empty;
Flags2TextBox.Text = string.Empty; Flags2TextBox.Text = string.Empty;
Hash0TextBox.Text = string.Empty;
Hash1TextBox.Text = string.Empty;
HashesTextBox.Text = string.Empty; HashesTextBox.Text = string.Empty;
ExtParamsTextBox.Text = string.Empty; ExtParamsTextBox.Text = string.Empty;
populatingui = false; populatingui = false;
@ -99,11 +101,13 @@ namespace CodeWalker.Project.Panels
OuterVec3TextBox.Text = FloatUtil.GetVector3String(z.OuterVec3); OuterVec3TextBox.Text = FloatUtil.GetVector3String(z.OuterVec3);
UnkVec1TextBox.Text = FloatUtil.GetVector4String(z.UnkVec1); UnkVec1TextBox.Text = FloatUtil.GetVector4String(z.UnkVec1);
UnkVec2TextBox.Text = FloatUtil.GetVector4String(z.UnkVec2); UnkVec2TextBox.Text = FloatUtil.GetVector4String(z.UnkVec2);
UnkVec3TextBox.Text = FloatUtil.GetVector4String(z.UnkVec3); UnkVec3TextBox.Text = FloatUtil.GetVector2String(z.UnkVec3);
UnkBytesTextBox.Text = string.Format("{0}, {1}, {2}", z.Unk14, z.Unk15, z.Unk16); UnkBytesTextBox.Text = string.Format("{0}, {1}, {2}", z.Unk14, z.Unk15, z.Unk16);
Flags0TextBox.Text = z.Flags0.Hex; Flags0TextBox.Text = z.Flags0.Hex;
Flags1TextBox.Text = z.Flags1.Hex; Flags1TextBox.Text = z.Flags1.Hex;
Flags2TextBox.Text = z.Flags2.Hex; Flags2TextBox.Text = z.Flags2.Hex;
Hash0TextBox.Text = z.UnkHash0.ToString();
Hash1TextBox.Text = z.UnkHash1.ToString();
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
if (z.Hashes != null) if (z.Hashes != null)
@ -410,7 +414,7 @@ namespace CodeWalker.Project.Panels
if (populatingui) return; if (populatingui) return;
if (CurrentZone?.AudioZone == null) return; if (CurrentZone?.AudioZone == null) return;
var vec = FloatUtil.ParseVector4String(UnkVec3TextBox.Text); var vec = FloatUtil.ParseVector2String(UnkVec3TextBox.Text);
if (CurrentZone.AudioZone.UnkVec3 != vec) if (CurrentZone.AudioZone.UnkVec3 != vec)
{ {
CurrentZone.AudioZone.UnkVec3 = vec; CurrentZone.AudioZone.UnkVec3 = vec;
@ -489,6 +493,48 @@ namespace CodeWalker.Project.Panels
} }
} }
private void Hash0TextBox_TextChanged(object sender, EventArgs e)
{
if (populatingui) return;
if (CurrentZone?.AudioZone == null) return;
var hashstr = Hash0TextBox.Text;
uint hash = 0;
if (!uint.TryParse(hashstr, out hash))//don't re-hash hashes
{
hash = JenkHash.GenHash(hashstr);
JenkIndex.Ensure(hashstr);
}
if (CurrentZone.AudioZone.UnkHash0 != hash)
{
CurrentZone.AudioZone.UnkHash0 = hash;
ProjectItemChanged();
}
}
private void Hash1TextBox_TextChanged(object sender, EventArgs e)
{
if (populatingui) return;
if (CurrentZone?.AudioZone == null) return;
var hashstr = Hash1TextBox.Text;
uint hash = 0;
if (!uint.TryParse(hashstr, out hash))//don't re-hash hashes
{
hash = JenkHash.GenHash(hashstr);
JenkIndex.Ensure(hashstr);
}
if (CurrentZone.AudioZone.UnkHash1 != hash)
{
CurrentZone.AudioZone.UnkHash1 = hash;
ProjectItemChanged();
}
}
private void HashesTextBox_TextChanged(object sender, EventArgs e) private void HashesTextBox_TextChanged(object sender, EventArgs e)
{ {
if (populatingui) return; if (populatingui) return;
@ -570,6 +616,5 @@ namespace CodeWalker.Project.Panels
ProjectForm.SetProjectItem(CurrentZone); ProjectForm.SetProjectItem(CurrentZone);
ProjectForm.DeleteAudioZone(); ProjectForm.DeleteAudioZone();
} }
} }
} }

View File

@ -4591,7 +4591,9 @@ namespace CodeWalker.Project
zone.OuterVec3 = cp ? copy.AudioZone.OuterVec3 : Vector3.Zero; zone.OuterVec3 = cp ? copy.AudioZone.OuterVec3 : Vector3.Zero;
zone.UnkVec1 = cp ? copy.AudioZone.UnkVec1 : new Vector4(0, 0, 1, 0); zone.UnkVec1 = cp ? copy.AudioZone.UnkVec1 : new Vector4(0, 0, 1, 0);
zone.UnkVec2 = cp ? copy.AudioZone.UnkVec2 : new Vector4(1, -1, -1, 0); zone.UnkVec2 = cp ? copy.AudioZone.UnkVec2 : new Vector4(1, -1, -1, 0);
zone.UnkVec3 = cp ? copy.AudioZone.UnkVec3 : new Vector4(0, 0, -1, 0); zone.UnkHash0 = cp ? copy.AudioZone.UnkHash0 : 0;
zone.UnkHash1 = cp ? copy.AudioZone.UnkHash1 : 0;
zone.UnkVec3 = cp ? copy.AudioZone.UnkVec3 : new Vector2(-1, 0);
zone.Unk14 = cp ? copy.AudioZone.Unk14 : (byte)4; zone.Unk14 = cp ? copy.AudioZone.Unk14 : (byte)4;
zone.Unk15 = cp ? copy.AudioZone.Unk15 : (byte)1; zone.Unk15 = cp ? copy.AudioZone.Unk15 : (byte)1;
zone.Unk16 = cp ? copy.AudioZone.Unk16 : (byte)0; zone.Unk16 = cp ? copy.AudioZone.Unk16 : (byte)0;