diff --git a/File_Format_Library/FileFormats/MKAGPDX/MKAGPDX_Model.cs b/File_Format_Library/FileFormats/MKAGPDX/MKAGPDX_Model.cs index 45ff33d2..e63b4a39 100644 --- a/File_Format_Library/FileFormats/MKAGPDX/MKAGPDX_Model.cs +++ b/File_Format_Library/FileFormats/MKAGPDX/MKAGPDX_Model.cs @@ -522,7 +522,7 @@ namespace FirstPlugin subMeshNode.lodMeshes = new List(); var submsh = new GenericRenderedObject.LOD_Mesh(); - submsh.PrimitiveType = STPolygonType.Triangle; + submsh.PrimativeType = STPrimativeType.Triangles; submsh.FirstVertex = 0; submsh.faces = subMesh.Faces; subMeshNode.lodMeshes.Add(submsh); @@ -717,7 +717,7 @@ namespace FirstPlugin public bool IsBone { - get { return Name.Contains("jnt") || Name.Contains("center"); } + get { return SubMeshes.Count == 0; } } public bool IsMesh @@ -748,77 +748,41 @@ namespace FirstPlugin if (SubMeshArrayOffsetPtr != 0) { - //4 possible sub meshes - reader.SeekBegin(SubMeshArrayOffsetPtr); - uint SubMeshArrayOffset1 = reader.ReadUInt32(); - uint SubMeshArrayOffset2 = reader.ReadUInt32(); - uint SubMeshArrayOffset3 = reader.ReadUInt32(); - uint SubMeshArrayOffset4 = reader.ReadUInt32(); - if (SubMeshArrayOffset1 != 0) + int i = 0; + while (true) { - reader.SeekBegin(SubMeshArrayOffset1); - SubMesh subMesh = new SubMesh(this); - subMesh.Read(reader); - SubMeshes.Add(subMesh); - } - if (SubMeshArrayOffset2 != 0) - { - reader.SeekBegin(SubMeshArrayOffset2); - SubMesh subMesh = new SubMesh(this); - subMesh.Read(reader); - SubMeshes.Add(subMesh); - } - if (SubMeshArrayOffset3 != 0) - { - reader.SeekBegin(SubMeshArrayOffset3); - SubMesh subMesh = new SubMesh(this); - subMesh.Read(reader); - SubMeshes.Add(subMesh); - } - if (SubMeshArrayOffset4 != 0) - { - reader.SeekBegin(SubMeshArrayOffset4); - SubMesh subMesh = new SubMesh(this); - subMesh.Read(reader); - SubMeshes.Add(subMesh); + reader.SeekBegin((int)SubMeshArrayOffsetPtr + i * 4); + + uint SubMeshArrayOffset1 = reader.ReadUInt32(); + if (SubMeshArrayOffset1 == 0) break; + + if (SubMeshArrayOffset1 != 0) + { + reader.SeekBegin(SubMeshArrayOffset1); + SubMesh subMesh = new SubMesh(this); + subMesh.Read(reader); + SubMeshes.Add(subMesh); + } + + i++; } } if (ChildNodeOffsetPtr != 0) { - //4 possible children - reader.SeekBegin(ChildNodeOffsetPtr); - uint ChildNodeOffset1 = reader.ReadUInt32(); - uint ChildNodeOffset2 = reader.ReadUInt32(); - uint ChildNodeOffset3 = reader.ReadUInt32(); - uint ChildNodeOffset4 = reader.ReadUInt32(); - if (ChildNodeOffset1 != 0) + //4 possible sub meshes + for (int i = 0; i < 4; i++) { - reader.SeekBegin(ChildNodeOffset1); - Node ChildNode = new Node(); - ChildNode.Read(reader); - Children.Add(ChildNode); - } - if (ChildNodeOffset2 != 0) - { - reader.SeekBegin(ChildNodeOffset2); - Node ChildNode = new Node(); - ChildNode.Read(reader); - Children.Add(ChildNode); - } - if (ChildNodeOffset3 != 0) - { - reader.SeekBegin(ChildNodeOffset3); - Node ChildNode = new Node(); - ChildNode.Read(reader); - Children.Add(ChildNode); - } - if (ChildNodeOffset4 != 0) - { - reader.SeekBegin(ChildNodeOffset4); - Node ChildNode = new Node(); - ChildNode.Read(reader); - Children.Add(ChildNode); + reader.SeekBegin((int)ChildNodeOffsetPtr + i * 4); + + uint ChildNodeOffset1 = reader.ReadUInt32(); + if (ChildNodeOffset1 != 0) + { + reader.SeekBegin(ChildNodeOffset1); + Node ChildNode = new Node(); + ChildNode.Read(reader); + Children.Add(ChildNode); + } } } diff --git a/Toolbox/GUI/HashCalculatorForm.Designer.cs b/Toolbox/GUI/HashCalculatorForm.Designer.cs index c155c01c..9e478d0a 100644 --- a/Toolbox/GUI/HashCalculatorForm.Designer.cs +++ b/Toolbox/GUI/HashCalculatorForm.Designer.cs @@ -36,6 +36,9 @@ this.stLabel3 = new Toolbox.Library.Forms.STLabel(); this.chkUseHex = new Toolbox.Library.Forms.STCheckBox(); this.stPanel1 = new Toolbox.Library.Forms.STPanel(); + this.chkSearchNumbered = new Toolbox.Library.Forms.STCheckBox(); + this.characterStartTB = new Toolbox.Library.Forms.STTextBox(); + this.stLabel8 = new Toolbox.Library.Forms.STLabel(); this.maxLengthUD = new Toolbox.Library.Forms.NumericUpDownUint(); this.stLabel7 = new Toolbox.Library.Forms.STLabel(); this.searchUppercase = new Toolbox.Library.Forms.STCheckBox(); @@ -45,8 +48,6 @@ this.bruteForceHashTB = new Toolbox.Library.Forms.STTextBox(); this.stLabel5 = new Toolbox.Library.Forms.STLabel(); this.stLabel4 = new Toolbox.Library.Forms.STLabel(); - this.characterStartTB = new Toolbox.Library.Forms.STTextBox(); - this.stLabel8 = new Toolbox.Library.Forms.STLabel(); this.contentContainer.SuspendLayout(); this.stPanel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.maxLengthUD)).BeginInit(); @@ -63,7 +64,7 @@ this.contentContainer.Controls.Add(this.hashTypeCB); this.contentContainer.Controls.Add(this.resultTB); this.contentContainer.Controls.Add(this.stringTB); - this.contentContainer.Size = new System.Drawing.Size(624, 359); + this.contentContainer.Size = new System.Drawing.Size(704, 362); this.contentContainer.Controls.SetChildIndex(this.stringTB, 0); this.contentContainer.Controls.SetChildIndex(this.resultTB, 0); this.contentContainer.Controls.SetChildIndex(this.hashTypeCB, 0); @@ -143,6 +144,7 @@ // // stPanel1 // + this.stPanel1.Controls.Add(this.chkSearchNumbered); this.stPanel1.Controls.Add(this.characterStartTB); this.stPanel1.Controls.Add(this.stLabel8); this.stPanel1.Controls.Add(this.maxLengthUD); @@ -155,12 +157,40 @@ this.stPanel1.Controls.Add(this.stLabel5); this.stPanel1.Location = new System.Drawing.Point(5, 100); this.stPanel1.Name = "stPanel1"; - this.stPanel1.Size = new System.Drawing.Size(610, 250); + this.stPanel1.Size = new System.Drawing.Size(690, 250); this.stPanel1.TabIndex = 18; // + // chkSearchNumbered + // + this.chkSearchNumbered.AutoSize = true; + this.chkSearchNumbered.Location = new System.Drawing.Point(554, 188); + this.chkSearchNumbered.Name = "chkSearchNumbered"; + this.chkSearchNumbered.Size = new System.Drawing.Size(112, 17); + this.chkSearchNumbered.TabIndex = 30; + this.chkSearchNumbered.Text = "Search Numbered"; + this.chkSearchNumbered.UseVisualStyleBackColor = true; + // + // characterStartTB + // + this.characterStartTB.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.characterStartTB.Location = new System.Drawing.Point(381, 49); + this.characterStartTB.Multiline = true; + this.characterStartTB.Name = "characterStartTB"; + this.characterStartTB.Size = new System.Drawing.Size(159, 156); + this.characterStartTB.TabIndex = 28; + // + // stLabel8 + // + this.stLabel8.AutoSize = true; + this.stLabel8.Location = new System.Drawing.Point(378, 32); + this.stLabel8.Name = "stLabel8"; + this.stLabel8.Size = new System.Drawing.Size(81, 13); + this.stLabel8.TabIndex = 29; + this.stLabel8.Text = "Starting String:s"; + // // maxLengthUD // - this.maxLengthUD.Location = new System.Drawing.Point(381, 97); + this.maxLengthUD.Location = new System.Drawing.Point(549, 133); this.maxLengthUD.Maximum = new decimal(new int[] { 2147483647, 0, @@ -173,7 +203,7 @@ // stLabel7 // this.stLabel7.AutoSize = true; - this.stLabel7.Location = new System.Drawing.Point(378, 81); + this.stLabel7.Location = new System.Drawing.Point(546, 105); this.stLabel7.Name = "stLabel7"; this.stLabel7.Size = new System.Drawing.Size(116, 13); this.stLabel7.TabIndex = 26; @@ -182,7 +212,7 @@ // searchUppercase // this.searchUppercase.AutoSize = true; - this.searchUppercase.Location = new System.Drawing.Point(386, 129); + this.searchUppercase.Location = new System.Drawing.Point(554, 165); this.searchUppercase.Name = "searchUppercase"; this.searchUppercase.Size = new System.Drawing.Size(115, 17); this.searchUppercase.TabIndex = 24; @@ -245,28 +275,11 @@ this.stLabel4.TabIndex = 19; this.stLabel4.Text = "Brute Force:"; // - // characterStartTB - // - this.characterStartTB.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.characterStartTB.Location = new System.Drawing.Point(381, 49); - this.characterStartTB.Name = "characterStartTB"; - this.characterStartTB.Size = new System.Drawing.Size(159, 20); - this.characterStartTB.TabIndex = 28; - // - // stLabel8 - // - this.stLabel8.AutoSize = true; - this.stLabel8.Location = new System.Drawing.Point(378, 32); - this.stLabel8.Name = "stLabel8"; - this.stLabel8.Size = new System.Drawing.Size(76, 13); - this.stLabel8.TabIndex = 29; - this.stLabel8.Text = "Starting String:"; - // // HashCalculatorForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(630, 364); + this.ClientSize = new System.Drawing.Size(710, 367); this.Name = "HashCalculatorForm"; this.Text = "Hash Calculator"; this.contentContainer.ResumeLayout(false); @@ -299,5 +312,6 @@ private Library.Forms.NumericUpDownUint maxLengthUD; private Library.Forms.STTextBox characterStartTB; private Library.Forms.STLabel stLabel8; + private Library.Forms.STCheckBox chkSearchNumbered; } } \ No newline at end of file diff --git a/Toolbox/GUI/HashCalculatorForm.cs b/Toolbox/GUI/HashCalculatorForm.cs index 111ccf12..3eeac9c6 100644 --- a/Toolbox/GUI/HashCalculatorForm.cs +++ b/Toolbox/GUI/HashCalculatorForm.cs @@ -68,6 +68,7 @@ namespace Toolbox private bool CancelOperation = false; private bool UseSpeialcase => true; + private bool UseNumbered => chkSearchNumbered.Checked; private bool UseLowercase => true; private bool UseUppercase => searchUppercase.Checked; @@ -135,10 +136,11 @@ namespace Toolbox while (true && CancelOperation == false && hashes.Count > 0) { String value = Sb.ToString(); + uint calculatedHash = StringToHash($"{characterStartTB.Text}{value}"); if (hashes.Contains(calculatedHash)) { - UpdateTextbox($"[{calculatedHash}] {characterStartTB.Text}{value}"); + UpdateTextbox($"{characterStartTB.Text}{value}"); hashes.Remove(calculatedHash); if (hashes.Count == 0) @@ -153,6 +155,27 @@ namespace Toolbox } } + foreach (var line in characterStartTB.Lines) + { + uint calculatedHash2 = StringToHash($"{line}{value}"); + if (hashes.Contains(calculatedHash2)) + { + UpdateTextbox($"{line}{value}"); + hashes.Remove(calculatedHash2); + + if (hashes.Count == 0) + { + if (progressBar.InvokeRequired) + { + progressBar.Invoke((MethodInvoker)delegate { + progressBar.Close(); + }); + } + return; + } + } + } + if (value.All(item => item == lastChar)) break; @@ -164,6 +187,28 @@ namespace Toolbox break; } else if (Sb[i] == '/') + { + if (UseNumbered) + Sb[i] = '0'; + else + { + if (UseUppercase) + Sb[i] = 'A'; + else + Sb[i] = 'a'; + } + break; + } + else if (Sb[i] == '0') { Sb[i] = '1'; break; } + else if (Sb[i] == '1') { Sb[i] = '2'; break; } + else if (Sb[i] == '2') { Sb[i] = '3'; break; } + else if (Sb[i] == '3') { Sb[i] = '4'; break; } + else if (Sb[i] == '4') { Sb[i] = '5'; break; } + else if (Sb[i] == '5') { Sb[i] = '6'; break; } + else if (Sb[i] == '6') { Sb[i] = '7'; break; } + else if (Sb[i] == '7') { Sb[i] = '8'; break; } + else if (Sb[i] == '8') { Sb[i] = '9'; break; } + else if (Sb[i] == '9') { if (UseUppercase) Sb[i] = 'A'; @@ -208,7 +253,10 @@ namespace Toolbox if (bruteForceStringTB.InvokeRequired) { bruteForceStringTB.Invoke((MethodInvoker)delegate { - bruteForceStringTB.AppendText(text); + if (bruteForceStringTB.Text.Length == 0) + bruteForceStringTB.Text = text; + else + bruteForceStringTB.AppendText("\r\n" + text); }); } else