private void btnCalc_Click(object sender, EventArgs e) { tbFNV32.Text = "0x" + FNV32.GetHash(tbInput.Text).ToString("X8"); tbFNV64.Text = "0x" + FNV64.GetHash(tbInput.Text).ToString("X16"); tbCLIPIID.Text = "0x" + FNV64CLIP.GetHash(tbInput.Text).ToString("X16"); tbFVV24.Text = "0x" + FNV24.GetHash(tbInput.Text).ToString("X6"); }
public void UnParse(BinaryWriter w) { myPosition = (uint)w.BaseStream.Position; if (this.name == null) { this.name = ""; } this.nameHash = FNV32.GetHash(this.name); if (this.fieldList == null) { this.fieldList = new FieldList(this.handler); } if (this.fieldList.Count == 0) { this.fieldTablePosition = Util.NullOffset; } w.Write(Util.Zero32); // Name Offset w.Write(this.nameHash); w.Write(this.unknown08); w.Write(this.size); w.Write(Util.Zero32); // Field Table Offset w.Write(this.fieldList.Count); }
private static void GetInfo(BoneManager manager, RigResource.RigResource.Bone bone, StringBuilder sb) { Matrix t = GetAbsoluteTransform(manager, bone); Matrix ti = t.GetInverse(); sb.AppendLine("============================"); sb.AppendFormat("Name:\t{0}\r\n", bone.Name); sb.AppendFormat("Hashed:\t0x{0:X8}\r\n", FNV32.GetHash(bone.Name)); sb.AppendLine("Absolute Transform (RSLT):"); sb.AppendLine(t.TransposedString()); sb.AppendLine("Absolute Transform Inverse (SKIN):"); sb.AppendLine(ti.ToString()); }
public void UnParse(BinaryWriter w) { myPosition = (uint)w.BaseStream.Position; if (this.name == null) { this.name = ""; } this.nameHash = FNV32.GetHash(this.name); w.Write(Util.Zero32); // Name Offset w.Write(this.nameHash); w.Write(this.type); w.Write(this.dataOffset); w.Write(Util.Zero32); // Unknown 10 Offset }
public void UnParse(BinaryWriter w) { myPosition = (uint)w.BaseStream.Position; if (this.name == null) { this.name = ""; } this.nameHash = FNV32.GetHash(this.name); w.Write(Util.Zero32); // Name Offset w.Write(this.nameHash); w.Write(Util.Zero32); // Structure Offset w.Write(this.unknown0C); w.Write(this.unknown10); w.Write(Util.Zero32); // Field Offset w.Write(this.fieldCount); }
private static Dictionary <uint, string> LoadDictionary(string name) { var dict = new Dictionary <uint, string>(); string geostatePath = Path.Combine(Path.GetDirectoryName(typeof(App).Assembly.Location), name + ".txt"); if (File.Exists(geostatePath)) { using (var sr = new StreamReader(File.OpenRead(geostatePath))) { String line; while ((line = sr.ReadLine()) != null) { if (!line.Contains("#")) { dict[FNV32.GetHash(line)] = line; } } } } return(dict); }
private static void ExecuteAddBone(BoneViewModel target) { target.Manager.AddBone(new RigResource.RigResource.Bone(0, null, new Vertex(0, null), new s3pi.Interfaces.Quaternion(0, null, 0f, 0f, 0f, 1f), new Vertex(0, null), NEW_BONE_NAME, target.Manager.Bones.Count, -1, FNV32.GetHash(NEW_BONE_NAME), 0x23), target.Bone); }
private void ChangePropertyFromString(object result, IList <string> filedNames, string hashsalt, bool setHighBit = true) { foreach (var fieldName in filedNames) { var prop = result.GetType().GetProperty(fieldName); if (prop == null) { continue; } var value = prop.GetValue(result, null); if (value == null) { continue; } if (value.GetType() == typeof(int) || value.GetType() == typeof(Int32)) { int v = (int)value; int newValue = v ^ (int)FNV32.GetHash(hashsalt); SetProperty(result, fieldName, newValue); } else if (value.GetType() == typeof(uint) || value.GetType() == typeof(UInt32)) { uint v = (uint)value; uint newValue = v ^ FNV32.GetHash(hashsalt); SetProperty(result, fieldName, newValue); } else if (value.GetType() == typeof(short) || value.GetType() == typeof(Int16)) { short v = (short)value; short newValue = Convert.ToInt16((uint)v ^ FNV32.GetHash(hashsalt)); SetProperty(result, fieldName, newValue); } else if (value.GetType() == typeof(ushort) || value.GetType() == typeof(UInt16)) { ushort v = (ushort)value; ushort newValue = Convert.ToUInt16((uint)v ^ FNV32.GetHash(hashsalt)); SetProperty(result, fieldName, newValue); } else if (value.GetType() == typeof(byte) || value.GetType() == typeof(Byte)) { byte v = (byte)value; byte newValue = Convert.ToByte((uint)v ^ FNV32.GetHash(hashsalt)); SetProperty(result, fieldName, newValue); } else if (value.GetType() == typeof(TGIBlock)) { TGIBlock v = value as TGIBlock; if (v != null) { v.Instance ^= FNV64.GetHash(hashsalt); if (setHighBit) { v.Instance |= (ulong)1 << 63; v.ResourceGroup |= (uint)1 << 31; } } SetProperty(result, fieldName, v); } else if (value.GetType() == typeof(TGIBlock[])) { TGIBlock[] v = value as TGIBlock[]; if (v != null) { foreach (var tgi in v) { tgi.Instance ^= FNV64.GetHash(hashsalt); if (setHighBit) { tgi.Instance |= (ulong)1 << 63; tgi.ResourceGroup |= (uint)1 << 31; } } } SetProperty(result, fieldName, v); } } }
private void btnFNV32_Click(object sender, EventArgs e) { tbInstance.Text = "0x" + FNV32.GetHash(tbName.Text).ToString("X16"); }
private void btnOk_Click(object sender, EventArgs e) { try { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; RigResource.RigResource grd = mRig; saveFileDialog1.FileName = "rigfile.txt"; saveFileDialog1.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*"; DialogResult result = saveFileDialog1.ShowDialog(); if (result == DialogResult.OK) { var sb = new StringBuilder(); for (int i = 0; i < clbBones.Items.Count; i++) { if (clbBones.GetItemChecked(i)) { RigResource.RigResource.Bone bone = ((BoneListItem)clbBones.Items[i]).Bone; bool flip = bone.ParentBoneIndex == -1; sb.AppendFormat("\"{0}\" \"{1}\" {2} {3:F10} {4:F10} {5:F10}\r\n", cbHashBones.Checked ? String.Format("0x{0:X8}", FNV32.GetHash(bone.Name)) : bone.Name, bone.ParentBoneIndex == -1 ? "unparented" : cbHashBones.Checked ? String.Format("0x{0:X8}", FNV32.GetHash(grd.Bones[bone.ParentBoneIndex].Name)) : grd.Bones[bone.ParentBoneIndex].Name, bone.Position.X, bone.Position.Y, bone.Position.Z, ToEuler(bone.Orientation, flip)); } } using (var s = new StreamWriter(File.Create(saveFileDialog1.FileName))) s.Write(sb.ToString()); } } finally { Close(); } }