XML to audio dat.rel conversion progress

This commit is contained in:
dexy
2019-01-19 14:28:45 +11:00
Unverified
parent 35d10a8e48
commit 6533d842bc
5 changed files with 225 additions and 55 deletions
+62 -12
View File
@@ -80,6 +80,10 @@
this.label16 = new System.Windows.Forms.Label();
this.InnerPosTextBox = new System.Windows.Forms.TextBox();
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.tabPage1.SuspendLayout();
this.SuspendLayout();
@@ -98,6 +102,10 @@
//
// 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.UnkBytesTextBox);
this.tabPage1.Controls.Add(this.DeleteButton);
@@ -179,7 +187,7 @@
this.DeleteButton.Location = new System.Drawing.Point(343, 3);
this.DeleteButton.Name = "DeleteButton";
this.DeleteButton.Size = new System.Drawing.Size(93, 23);
this.DeleteButton.TabIndex = 77;
this.DeleteButton.TabIndex = 81;
this.DeleteButton.Text = "Delete zone";
this.DeleteButton.UseVisualStyleBackColor = true;
this.DeleteButton.Click += new System.EventHandler(this.DeleteButton_Click);
@@ -190,7 +198,7 @@
this.AddToProjectButton.Location = new System.Drawing.Point(452, 3);
this.AddToProjectButton.Name = "AddToProjectButton";
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.UseVisualStyleBackColor = true;
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.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.Size = new System.Drawing.Size(193, 13);
this.label20.TabIndex = 74;
this.label20.TabIndex = 78;
this.label20.Text = "Ext params: Name (hash), Value (float)";
//
// ExtParamsTextBox
//
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.Name = "ExtParamsTextBox";
this.ExtParamsTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.ExtParamsTextBox.Size = new System.Drawing.Size(209, 116);
this.ExtParamsTextBox.TabIndex = 75;
this.ExtParamsTextBox.Size = new System.Drawing.Size(209, 92);
this.ExtParamsTextBox.TabIndex = 79;
this.ExtParamsTextBox.WordWrap = false;
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.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.Size = new System.Drawing.Size(46, 13);
this.label19.TabIndex = 72;
this.label19.TabIndex = 76;
this.label19.Text = "Hashes:";
//
// label15
@@ -306,12 +314,12 @@
// HashesTextBox
//
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.Name = "HashesTextBox";
this.HashesTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.HashesTextBox.Size = new System.Drawing.Size(209, 116);
this.HashesTextBox.TabIndex = 73;
this.HashesTextBox.Size = new System.Drawing.Size(209, 92);
this.HashesTextBox.TabIndex = 77;
this.HashesTextBox.WordWrap = false;
this.HashesTextBox.TextChanged += new System.EventHandler(this.HashesTextBox_TextChanged);
//
@@ -634,6 +642,44 @@
this.GoToButton.UseVisualStyleBackColor = true;
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
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -703,5 +749,9 @@
private System.Windows.Forms.Button DeleteButton;
private System.Windows.Forms.Label label22;
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;
}
}
+48 -3
View File
@@ -72,6 +72,8 @@ namespace CodeWalker.Project.Panels
Flags0TextBox.Text = string.Empty;
Flags1TextBox.Text = string.Empty;
Flags2TextBox.Text = string.Empty;
Hash0TextBox.Text = string.Empty;
Hash1TextBox.Text = string.Empty;
HashesTextBox.Text = string.Empty;
ExtParamsTextBox.Text = string.Empty;
populatingui = false;
@@ -99,11 +101,13 @@ namespace CodeWalker.Project.Panels
OuterVec3TextBox.Text = FloatUtil.GetVector3String(z.OuterVec3);
UnkVec1TextBox.Text = FloatUtil.GetVector4String(z.UnkVec1);
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);
Flags0TextBox.Text = z.Flags0.Hex;
Flags1TextBox.Text = z.Flags1.Hex;
Flags2TextBox.Text = z.Flags2.Hex;
Hash0TextBox.Text = z.UnkHash0.ToString();
Hash1TextBox.Text = z.UnkHash1.ToString();
StringBuilder sb = new StringBuilder();
if (z.Hashes != null)
@@ -410,7 +414,7 @@ namespace CodeWalker.Project.Panels
if (populatingui) return;
if (CurrentZone?.AudioZone == null) return;
var vec = FloatUtil.ParseVector4String(UnkVec3TextBox.Text);
var vec = FloatUtil.ParseVector2String(UnkVec3TextBox.Text);
if (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)
{
if (populatingui) return;
@@ -570,6 +616,5 @@ namespace CodeWalker.Project.Panels
ProjectForm.SetProjectItem(CurrentZone);
ProjectForm.DeleteAudioZone();
}
}
}