mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-11-26 00:43:00 +08:00
Audio explorer progress
This commit is contained in:
parent
75c3a0690b
commit
64f007d611
File diff suppressed because it is too large
Load Diff
26
CodeWalker/Tools/AudioExplorerForm.Designer.cs
generated
26
CodeWalker/Tools/AudioExplorerForm.Designer.cs
generated
@ -39,6 +39,7 @@ namespace CodeWalker.Tools
|
|||||||
this.XmlTabPage = new System.Windows.Forms.TabPage();
|
this.XmlTabPage = new System.Windows.Forms.TabPage();
|
||||||
this.XmlTextBox = new FastColoredTextBoxNS.FastColoredTextBox();
|
this.XmlTextBox = new FastColoredTextBoxNS.FastColoredTextBox();
|
||||||
this.NameComboBox = new System.Windows.Forms.ComboBox();
|
this.NameComboBox = new System.Windows.Forms.ComboBox();
|
||||||
|
this.TypeComboBox = new System.Windows.Forms.ComboBox();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.MainSplitContainer)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.MainSplitContainer)).BeginInit();
|
||||||
this.MainSplitContainer.Panel1.SuspendLayout();
|
this.MainSplitContainer.Panel1.SuspendLayout();
|
||||||
this.MainSplitContainer.Panel2.SuspendLayout();
|
this.MainSplitContainer.Panel2.SuspendLayout();
|
||||||
@ -82,8 +83,8 @@ namespace CodeWalker.Tools
|
|||||||
//
|
//
|
||||||
// PropertiesTabControl
|
// PropertiesTabControl
|
||||||
//
|
//
|
||||||
this.PropertiesTabControl.Controls.Add(this.DetailsTabPage);
|
|
||||||
this.PropertiesTabControl.Controls.Add(this.XmlTabPage);
|
this.PropertiesTabControl.Controls.Add(this.XmlTabPage);
|
||||||
|
this.PropertiesTabControl.Controls.Add(this.DetailsTabPage);
|
||||||
this.PropertiesTabControl.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.PropertiesTabControl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.PropertiesTabControl.Location = new System.Drawing.Point(0, 0);
|
this.PropertiesTabControl.Location = new System.Drawing.Point(0, 0);
|
||||||
this.PropertiesTabControl.Name = "PropertiesTabControl";
|
this.PropertiesTabControl.Name = "PropertiesTabControl";
|
||||||
@ -117,7 +118,7 @@ namespace CodeWalker.Tools
|
|||||||
this.XmlTabPage.Controls.Add(this.XmlTextBox);
|
this.XmlTabPage.Controls.Add(this.XmlTextBox);
|
||||||
this.XmlTabPage.Location = new System.Drawing.Point(4, 22);
|
this.XmlTabPage.Location = new System.Drawing.Point(4, 22);
|
||||||
this.XmlTabPage.Name = "XmlTabPage";
|
this.XmlTabPage.Name = "XmlTabPage";
|
||||||
this.XmlTabPage.Size = new System.Drawing.Size(537, 501);
|
this.XmlTabPage.Size = new System.Drawing.Size(445, 501);
|
||||||
this.XmlTabPage.TabIndex = 1;
|
this.XmlTabPage.TabIndex = 1;
|
||||||
this.XmlTabPage.Text = "XML";
|
this.XmlTabPage.Text = "XML";
|
||||||
this.XmlTabPage.UseVisualStyleBackColor = true;
|
this.XmlTabPage.UseVisualStyleBackColor = true;
|
||||||
@ -138,7 +139,7 @@ namespace CodeWalker.Tools
|
|||||||
this.XmlTextBox.AutoIndentChars = false;
|
this.XmlTextBox.AutoIndentChars = false;
|
||||||
this.XmlTextBox.AutoIndentCharsPatterns = "";
|
this.XmlTextBox.AutoIndentCharsPatterns = "";
|
||||||
this.XmlTextBox.AutoIndentExistingLines = false;
|
this.XmlTextBox.AutoIndentExistingLines = false;
|
||||||
this.XmlTextBox.AutoScrollMinSize = new System.Drawing.Size(2, 14);
|
this.XmlTextBox.AutoScrollMinSize = new System.Drawing.Size(27, 14);
|
||||||
this.XmlTextBox.BackBrush = null;
|
this.XmlTextBox.BackBrush = null;
|
||||||
this.XmlTextBox.CharHeight = 14;
|
this.XmlTextBox.CharHeight = 14;
|
||||||
this.XmlTextBox.CharWidth = 8;
|
this.XmlTextBox.CharWidth = 8;
|
||||||
@ -147,7 +148,6 @@ namespace CodeWalker.Tools
|
|||||||
this.XmlTextBox.DelayedEventsInterval = 1;
|
this.XmlTextBox.DelayedEventsInterval = 1;
|
||||||
this.XmlTextBox.DisabledColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(180)))), ((int)(((byte)(180)))), ((int)(((byte)(180)))));
|
this.XmlTextBox.DisabledColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(180)))), ((int)(((byte)(180)))), ((int)(((byte)(180)))));
|
||||||
this.XmlTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.XmlTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.XmlTextBox.Font = new System.Drawing.Font("Courier New", 9.75F);
|
|
||||||
this.XmlTextBox.IsReplaceMode = false;
|
this.XmlTextBox.IsReplaceMode = false;
|
||||||
this.XmlTextBox.Language = FastColoredTextBoxNS.Language.XML;
|
this.XmlTextBox.Language = FastColoredTextBoxNS.Language.XML;
|
||||||
this.XmlTextBox.LeftBracket = '<';
|
this.XmlTextBox.LeftBracket = '<';
|
||||||
@ -159,7 +159,7 @@ namespace CodeWalker.Tools
|
|||||||
this.XmlTextBox.RightBracket2 = ')';
|
this.XmlTextBox.RightBracket2 = ')';
|
||||||
this.XmlTextBox.SelectionColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(255)))));
|
this.XmlTextBox.SelectionColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(255)))));
|
||||||
this.XmlTextBox.ServiceColors = ((FastColoredTextBoxNS.ServiceColors)(resources.GetObject("XmlTextBox.ServiceColors")));
|
this.XmlTextBox.ServiceColors = ((FastColoredTextBoxNS.ServiceColors)(resources.GetObject("XmlTextBox.ServiceColors")));
|
||||||
this.XmlTextBox.Size = new System.Drawing.Size(537, 501);
|
this.XmlTextBox.Size = new System.Drawing.Size(445, 501);
|
||||||
this.XmlTextBox.TabIndex = 1;
|
this.XmlTextBox.TabIndex = 1;
|
||||||
this.XmlTextBox.Zoom = 100;
|
this.XmlTextBox.Zoom = 100;
|
||||||
//
|
//
|
||||||
@ -172,15 +172,28 @@ namespace CodeWalker.Tools
|
|||||||
this.NameComboBox.FormattingEnabled = true;
|
this.NameComboBox.FormattingEnabled = true;
|
||||||
this.NameComboBox.Location = new System.Drawing.Point(12, 8);
|
this.NameComboBox.Location = new System.Drawing.Point(12, 8);
|
||||||
this.NameComboBox.Name = "NameComboBox";
|
this.NameComboBox.Name = "NameComboBox";
|
||||||
this.NameComboBox.Size = new System.Drawing.Size(453, 21);
|
this.NameComboBox.Size = new System.Drawing.Size(416, 21);
|
||||||
this.NameComboBox.TabIndex = 1;
|
this.NameComboBox.TabIndex = 1;
|
||||||
this.NameComboBox.TextChanged += new System.EventHandler(this.NameComboBox_TextChanged);
|
this.NameComboBox.TextChanged += new System.EventHandler(this.NameComboBox_TextChanged);
|
||||||
//
|
//
|
||||||
|
// TypeComboBox
|
||||||
|
//
|
||||||
|
this.TypeComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.TypeComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
|
||||||
|
this.TypeComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
|
||||||
|
this.TypeComboBox.FormattingEnabled = true;
|
||||||
|
this.TypeComboBox.Location = new System.Drawing.Point(448, 8);
|
||||||
|
this.TypeComboBox.Name = "TypeComboBox";
|
||||||
|
this.TypeComboBox.Size = new System.Drawing.Size(205, 21);
|
||||||
|
this.TypeComboBox.TabIndex = 2;
|
||||||
|
this.TypeComboBox.TextChanged += new System.EventHandler(this.TypeComboBox_TextChanged);
|
||||||
|
//
|
||||||
// AudioExplorerForm
|
// AudioExplorerForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(823, 564);
|
this.ClientSize = new System.Drawing.Size(823, 564);
|
||||||
|
this.Controls.Add(this.TypeComboBox);
|
||||||
this.Controls.Add(this.NameComboBox);
|
this.Controls.Add(this.NameComboBox);
|
||||||
this.Controls.Add(this.MainSplitContainer);
|
this.Controls.Add(this.MainSplitContainer);
|
||||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||||
@ -208,5 +221,6 @@ namespace CodeWalker.Tools
|
|||||||
private WinForms.PropertyGridFix DetailsPropertyGrid;
|
private WinForms.PropertyGridFix DetailsPropertyGrid;
|
||||||
private System.Windows.Forms.TabPage XmlTabPage;
|
private System.Windows.Forms.TabPage XmlTabPage;
|
||||||
private FastColoredTextBoxNS.FastColoredTextBox XmlTextBox;
|
private FastColoredTextBoxNS.FastColoredTextBox XmlTextBox;
|
||||||
|
private System.Windows.Forms.ComboBox TypeComboBox;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -15,8 +15,10 @@ namespace CodeWalker.Tools
|
|||||||
{
|
{
|
||||||
private GameFileCache GameFileCache { get; set; }
|
private GameFileCache GameFileCache { get; set; }
|
||||||
|
|
||||||
|
private List<string> NameComboItems = new List<string>();
|
||||||
private Dictionary<string, RelData> NameComboLookup = new Dictionary<string, RelData>();
|
private Dictionary<string, RelData> NameComboLookup = new Dictionary<string, RelData>();
|
||||||
|
|
||||||
|
|
||||||
public AudioExplorerForm(GameFileCache gfc)
|
public AudioExplorerForm(GameFileCache gfc)
|
||||||
{
|
{
|
||||||
GameFileCache = gfc;
|
GameFileCache = gfc;
|
||||||
@ -32,30 +34,95 @@ namespace CodeWalker.Tools
|
|||||||
NameComboLookup.Clear();
|
NameComboLookup.Clear();
|
||||||
NameComboBox.Items.Clear();
|
NameComboBox.Items.Clear();
|
||||||
NameComboBox.AutoCompleteCustomSource.Clear();
|
NameComboBox.AutoCompleteCustomSource.Clear();
|
||||||
List<string> namelist = new List<string>();
|
NameComboItems = new List<string>();
|
||||||
void addItem(RelData item)
|
void addNameItem(RelData item, bool addToCombo = true)
|
||||||
{
|
{
|
||||||
if (item == null) return;
|
if (item == null) return;
|
||||||
var str = GetRelDataTitleString(item);
|
var str = GetRelDataTitleString(item);
|
||||||
namelist.Add(str);
|
|
||||||
NameComboLookup.Add(str, item);
|
NameComboLookup.Add(str, item);
|
||||||
|
if (addToCombo) NameComboItems.Add(str);
|
||||||
}
|
}
|
||||||
if (GameFileCache.AudioSoundsDict != null)
|
if (GameFileCache.AudioSoundsDict != null)
|
||||||
{
|
{
|
||||||
//foreach (var kvp in GameFileCache.AudioConfigDict) addItem(kvp.Value);
|
foreach (var kvp in GameFileCache.AudioConfigDict) addNameItem(kvp.Value, false);
|
||||||
//foreach (var kvp in GameFileCache.AudioSpeechDict) addItem(kvp.Value);
|
foreach (var kvp in GameFileCache.AudioSpeechDict) addNameItem(kvp.Value, false);
|
||||||
foreach (var kvp in GameFileCache.AudioSynthsDict) addItem(kvp.Value);
|
foreach (var kvp in GameFileCache.AudioSynthsDict) addNameItem(kvp.Value);
|
||||||
foreach (var kvp in GameFileCache.AudioMixersDict) addItem(kvp.Value);
|
foreach (var kvp in GameFileCache.AudioMixersDict) addNameItem(kvp.Value);
|
||||||
foreach (var kvp in GameFileCache.AudioCurvesDict) addItem(kvp.Value);
|
foreach (var kvp in GameFileCache.AudioCurvesDict) addNameItem(kvp.Value);
|
||||||
foreach (var kvp in GameFileCache.AudioCategsDict) addItem(kvp.Value);
|
foreach (var kvp in GameFileCache.AudioCategsDict) addNameItem(kvp.Value);
|
||||||
foreach (var kvp in GameFileCache.AudioSoundsDict) addItem(kvp.Value);
|
foreach (var kvp in GameFileCache.AudioSoundsDict) addNameItem(kvp.Value);
|
||||||
foreach (var kvp in GameFileCache.AudioGameDict) addItem(kvp.Value);
|
foreach (var kvp in GameFileCache.AudioGameDict) addNameItem(kvp.Value);
|
||||||
}
|
}
|
||||||
NameComboBox.AutoCompleteCustomSource.AddRange(namelist.ToArray());
|
NameComboBox.AutoCompleteCustomSource.AddRange(NameComboItems.ToArray());
|
||||||
NameComboBox.Text = "(Start typing to search...)";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TypeComboBox.Items.Clear();
|
||||||
|
TypeComboBox.Items.Add("(All types)");
|
||||||
|
void addTypeItem(string filetype, object item)
|
||||||
|
{
|
||||||
|
var str = filetype + " : " + item.ToString();
|
||||||
|
TypeComboBox.Items.Add(str);
|
||||||
|
}
|
||||||
|
foreach (var e in Enum.GetValues(typeof(Dat4ConfigType))) addTypeItem("Config", e);
|
||||||
|
foreach (var e in Enum.GetValues(typeof(Dat4SpeechType))) addTypeItem("Speech", e);
|
||||||
|
foreach (var e in Enum.GetValues(typeof(Dat10RelType))) addTypeItem("Synths", e);
|
||||||
|
foreach (var e in Enum.GetValues(typeof(Dat15RelType))) addTypeItem("Mixers", e);
|
||||||
|
foreach (var e in Enum.GetValues(typeof(Dat16RelType))) addTypeItem("Curves", e);
|
||||||
|
foreach (var e in Enum.GetValues(typeof(Dat22RelType))) addTypeItem("Categories", e);
|
||||||
|
foreach (var e in Enum.GetValues(typeof(Dat54SoundType))) addTypeItem("Sounds", e);
|
||||||
|
foreach (var e in Enum.GetValues(typeof(Dat151RelType))) addTypeItem("Game", e);
|
||||||
|
TypeComboBox.SelectedIndex = 0;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SelectType()
|
||||||
|
{
|
||||||
|
var typestr = TypeComboBox.Text;
|
||||||
|
var typespl = typestr.Split(new[] { " : " }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
Dictionary<MetaHash, RelData> dict = null;
|
||||||
|
byte typeid = 255;
|
||||||
|
if (typespl.Length == 2)
|
||||||
|
{
|
||||||
|
switch (typespl[0])
|
||||||
|
{
|
||||||
|
case "Config": { dict = GameFileCache.AudioConfigDict; if (Enum.TryParse(typespl[1], out Dat4ConfigType t)) typeid = (byte)t; break; }
|
||||||
|
case "Speech": { dict = GameFileCache.AudioSpeechDict; if (Enum.TryParse(typespl[1], out Dat4SpeechType t)) typeid = (byte)t; break; }
|
||||||
|
case "Synths": { dict = GameFileCache.AudioSynthsDict; if (Enum.TryParse(typespl[1], out Dat10RelType t)) typeid = (byte)t; break; }
|
||||||
|
case "Mixers": { dict = GameFileCache.AudioMixersDict; if (Enum.TryParse(typespl[1], out Dat15RelType t)) typeid = (byte)t; break; }
|
||||||
|
case "Curves": { dict = GameFileCache.AudioCurvesDict; if (Enum.TryParse(typespl[1], out Dat16RelType t)) typeid = (byte)t; break; }
|
||||||
|
case "Categories": { dict = GameFileCache.AudioCategsDict; if (Enum.TryParse(typespl[1], out Dat22RelType t)) typeid = (byte)t; break; }
|
||||||
|
case "Sounds": { dict = GameFileCache.AudioSoundsDict; if (Enum.TryParse(typespl[1], out Dat54SoundType t)) typeid = (byte)t; break; }
|
||||||
|
case "Game": { dict = GameFileCache.AudioGameDict; if (Enum.TryParse(typespl[1], out Dat151RelType t)) typeid = (byte)t; break; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((dict != null) && (typeid != 255))
|
||||||
|
{
|
||||||
|
NameComboBox.AutoCompleteSource = AutoCompleteSource.ListItems;
|
||||||
|
NameComboBox.Text = "(Select item...)";
|
||||||
|
NameComboBox.Items.Clear();
|
||||||
|
var list = new List<string>();
|
||||||
|
foreach (var kvp in dict)
|
||||||
|
{
|
||||||
|
var item = kvp.Value;
|
||||||
|
if (item.TypeID == typeid)
|
||||||
|
{
|
||||||
|
var str = GetRelDataTitleString(item);
|
||||||
|
list.Add(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list.Sort();
|
||||||
|
NameComboBox.Items.AddRange(list.ToArray());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NameComboBox.AutoCompleteSource = AutoCompleteSource.CustomSource;
|
||||||
|
NameComboBox.Text = "(Start typing to search...)";
|
||||||
|
NameComboBox.Items.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetRelDataTitleString(RelData item)
|
private string GetRelDataTitleString(RelData item)
|
||||||
@ -126,6 +193,7 @@ namespace CodeWalker.Tools
|
|||||||
|
|
||||||
node.Tag = item;
|
node.Tag = item;
|
||||||
|
|
||||||
|
var speech = GetUniqueHashes(item.GetSpeechHashes(), item);
|
||||||
var synths = GetUniqueHashes(item.GetSynthHashes(), item);
|
var synths = GetUniqueHashes(item.GetSynthHashes(), item);
|
||||||
var mixers = GetUniqueHashes(item.GetMixerHashes(), item);
|
var mixers = GetUniqueHashes(item.GetMixerHashes(), item);
|
||||||
var curves = GetUniqueHashes(item.GetCurveHashes(), item);
|
var curves = GetUniqueHashes(item.GetCurveHashes(), item);
|
||||||
@ -134,6 +202,13 @@ namespace CodeWalker.Tools
|
|||||||
var games = GetUniqueHashes(item.GetGameHashes(), item);
|
var games = GetUniqueHashes(item.GetGameHashes(), item);
|
||||||
|
|
||||||
|
|
||||||
|
if (speech != null)
|
||||||
|
{
|
||||||
|
foreach (var h in speech)
|
||||||
|
{
|
||||||
|
if (GameFileCache.AudioSpeechDict.TryGetValue(h, out RelData child)) LoadItemHierarchy(child, node);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (synths != null)
|
if (synths != null)
|
||||||
{
|
{
|
||||||
foreach (var h in synths)
|
foreach (var h in synths)
|
||||||
@ -205,6 +280,11 @@ namespace CodeWalker.Tools
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void TypeComboBox_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SelectType();
|
||||||
|
}
|
||||||
|
|
||||||
private void HierarchyTreeView_AfterSelect(object sender, TreeViewEventArgs e)
|
private void HierarchyTreeView_AfterSelect(object sender, TreeViewEventArgs e)
|
||||||
{
|
{
|
||||||
var item = HierarchyTreeView.SelectedNode?.Tag as RelData;
|
var item = HierarchyTreeView.SelectedNode?.Tag as RelData;
|
||||||
|
Loading…
Reference in New Issue
Block a user