private void PathNodeStreetHashTextBox_TextChanged(object sender, EventArgs e) { if (populatingui) { return; } if (CurrentPathNode == null) { return; } uint hash; uint.TryParse(PathNodeStreetHashTextBox.Text, out hash); var streetname = GlobalText.TryGetString(hash); PathNodeStreetNameLabel.Text = "Name: " + ((hash == 0) ? "[None]" : (string.IsNullOrEmpty(streetname) ? "[Not found]" : streetname)); lock (ProjectForm.ProjectSyncRoot) { if (CurrentPathNode.StreetName.Hash != hash) { CurrentPathNode.StreetName = hash; ProjectForm.SetYndHasChanged(true); } } ProjectForm.ProjectExplorer?.UpdatePathNodeTreeNode(CurrentPathNode); }
public void Init(string name, GameFileCache gfc, bool hidef = true) { Name = name; var modelnamel = name.ToLowerInvariant(); MetaHash modelhash = JenkHash.GenHash(modelnamel); MetaHash modelhashhi = JenkHash.GenHash(modelnamel + "_hi"); var yfthash = hidef ? modelhashhi : modelhash; VehicleInitData vid = null; if (gfc.VehiclesInitDict.TryGetValue(modelhash, out vid)) { bool vehiclechange = NameHash != modelhash; ConvRoofDict = null; ConvRoofClip = null; ModelHash = yfthash; NameHash = modelhash; InitData = vid; Yft = gfc.GetYft(ModelHash); while ((Yft != null) && (!Yft.Loaded)) { Thread.Sleep(20);//kinda hacky Yft = gfc.GetYft(ModelHash); } DisplayMake = GlobalText.TryGetString(JenkHash.GenHash(vid.vehicleMakeName.ToLowerInvariant())); DisplayName = GlobalText.TryGetString(JenkHash.GenHash(vid.gameName.ToLowerInvariant())); if (!string.IsNullOrEmpty(vid.animConvRoofDictName) && (vid.animConvRoofDictName.ToLowerInvariant() != "null")) { var ycdhash = JenkHash.GenHash(vid.animConvRoofDictName.ToLowerInvariant()); var cliphash = JenkHash.GenHash(vid.animConvRoofName?.ToLowerInvariant()); ConvRoofDict = gfc.GetYcd(ycdhash); while ((ConvRoofDict != null) && (!ConvRoofDict.Loaded)) { Thread.Sleep(20);//kinda hacky ConvRoofDict = gfc.GetYcd(ycdhash); } ClipMapEntry cme = null; ConvRoofDict?.ClipMap?.TryGetValue(cliphash, out cme); ConvRoofClip = cme; } } else { ModelHash = 0; NameHash = 0; InitData = null; Yft = null; DisplayMake = "-"; DisplayName = "-"; ConvRoofDict = null; ConvRoofClip = null; } UpdateEntity(); }
private void LoadPathNodeTabPage() { CurrentPathLink = null; if (CurrentPathNode == null) { //YndNodePanel.Enabled = false; PathNodeDeleteButton.Enabled = false; PathNodeAddToProjectButton.Enabled = false; PathNodeAreaIDUpDown.Value = 0; PathNodeNodeIDUpDown.Value = 0; PathNodePositionTextBox.Text = string.Empty; PathNodeStreetHashTextBox.Text = string.Empty; PathNodeStreetNameLabel.Text = "Name: [None]"; UpdatePathNodeFlagsUI(true, true); PathNodeLinkCountLabel.Text = "Link Count: 0"; PathNodeLinksListBox.Items.Clear(); } else { populatingui = true; var n = CurrentPathNode.RawData; //YndNodePanel.Enabled = true; PathNodeDeleteButton.Enabled = ProjectForm.YndExistsInProject(CurrentYndFile); PathNodeAddToProjectButton.Enabled = !PathNodeDeleteButton.Enabled; var streetname = GlobalText.TryGetString(n.StreetName.Hash); PathNodeAreaIDUpDown.Value = n.AreaID; PathNodeNodeIDUpDown.Value = n.NodeID; PathNodePositionTextBox.Text = FloatUtil.GetVector3String(CurrentPathNode.Position); PathNodeStreetHashTextBox.Text = n.StreetName.Hash.ToString(); PathNodeStreetNameLabel.Text = "Name: " + ((n.StreetName.Hash == 0) ? "[None]" : (string.IsNullOrEmpty(streetname) ? "[Not found]" : streetname)); UpdatePathNodeFlagsUI(true, true); PathNodeLinkCountLabel.Text = "Link Count: " + CurrentPathNode.LinkCount.ToString(); PathNodeLinksListBox.Items.Clear(); if (CurrentPathNode.Links != null) { foreach (var link in CurrentPathNode.Links) { PathNodeLinksListBox.Items.Add(link); } } populatingui = false; if (ProjectForm.WorldForm != null) { ProjectForm.WorldForm.SelectObject(CurrentPathNode); } } }
public void LoadVehicle() { var modelname = VehicleModelComboBox.Text; var modelnamel = modelname.ToLowerInvariant(); MetaHash modelhash = JenkHash.GenHash(modelnamel); MetaHash modelhashhi = JenkHash.GenHash(modelnamel + "_hi"); bool hidet = VehicleHighDetailCheckBox.Checked; var yfthash = hidet ? modelhashhi : modelhash; VehicleInitData vid = null; if (GameFileCache.VehiclesInitDict.TryGetValue(modelhash, out vid)) { bool vehiclechange = SelectedVehicleHash != modelhash; SelectedModelHash = yfthash; SelectedVehicleHash = modelhash; SelectedVehicleInit = vid; SelectedVehicleYft = GameFileCache.GetYft(SelectedModelHash); while ((SelectedVehicleYft != null) && (!SelectedVehicleYft.Loaded)) { Thread.Sleep(20);//kinda hacky SelectedVehicleYft = GameFileCache.GetYft(SelectedModelHash); } LoadModel(SelectedVehicleYft, vehiclechange); VehicleMakeLabel.Text = GlobalText.TryGetString(JenkHash.GenHash(vid.vehicleMakeName.ToLower())); VehicleNameLabel.Text = GlobalText.TryGetString(JenkHash.GenHash(vid.gameName.ToLower())); } else { SelectedModelHash = 0; SelectedVehicleHash = 0; SelectedVehicleInit = null; SelectedVehicleYft = null; VehicleMakeLabel.Text = "-"; VehicleNameLabel.Text = "-"; } }
private void FindHash() { uint hash = 0; string hashtxt = HashTextBox.Text; MatchTextBox.Text = ""; if (HexRadioButton.Checked) { try { hash = Convert.ToUInt32(hashtxt, 16); } catch { StatusLabel.Text = "Invalid hex value!"; return; } } else if (UnsignedRadioButton.Checked) { try { hash = uint.Parse(hashtxt); } catch { StatusLabel.Text = "Invalid unsigned int value!"; return; } } else if (SignedRadioButton.Checked) { try { hash = (uint)int.Parse(hashtxt); } catch { StatusLabel.Text = "Invalid signed int value!"; return; } } StatusLabel.Text = Convert.ToString(hash, 16).ToUpper().PadLeft(8, '0'); var str = JenkIndex.TryGetString(hash); var txt = GlobalText.TryGetString(hash); var sta = StatsNames.TryGetString(hash); var ext = TryGetExtraString(hash); bool hasstr = !string.IsNullOrEmpty(str); bool hastxt = !string.IsNullOrEmpty(txt); bool hasext = !string.IsNullOrEmpty(ext); bool hassta = !string.IsNullOrEmpty(sta); if (hasstr && hastxt) { MatchTextBox.Text = string.Format("JenkIndex match:\r\n{0}\r\nGlobalText match:\r\n{1}", str, txt); } else if (hasstr) { MatchTextBox.Text = str; } else if (hastxt) { MatchTextBox.Text = "GlobalText match:\r\n" + txt; } else if (hasext) { MatchTextBox.Text = "Extra strings match:\r\n" + ext; } else if (hassta) { MatchTextBox.Text = "Stats match:\r\n" + sta; } else { MatchTextBox.Text = "[No match found]"; } }
private string GetRelDataTitleString(RelData item) { if (item == null) { return(""); } var h = item.NameHash; var str = JenkIndex.TryGetString(h); if (string.IsNullOrEmpty(str)) { str = GlobalText.TryGetString(h); //is this necessary? } if (string.IsNullOrEmpty(str)) { MetaNames.TryGetString(h, out str); } if (string.IsNullOrEmpty(str)) { str = h.Hex; } var typeid = item.TypeID.ToString(); var rel = item.Rel; if (rel != null) { switch (rel.RelType) { case RelDatFileType.Dat54DataEntries: typeid = ((Dat54SoundType)item.TypeID).ToString(); break; case RelDatFileType.Dat149: case RelDatFileType.Dat150: case RelDatFileType.Dat151: typeid = ((Dat151RelType)item.TypeID).ToString(); break; case RelDatFileType.Dat4: if (rel.IsAudioConfig) { typeid = ((Dat4ConfigType)item.TypeID).ToString(); } else { typeid = ((Dat4SpeechType)item.TypeID).ToString(); } break; case RelDatFileType.Dat10ModularSynth: typeid = ((Dat10RelType)item.TypeID).ToString(); break; case RelDatFileType.Dat15DynamicMixer: typeid = ((Dat15RelType)item.TypeID).ToString(); break; case RelDatFileType.Dat16Curves: typeid = ((Dat16RelType)item.TypeID).ToString(); break; case RelDatFileType.Dat22Categories: typeid = ((Dat22RelType)item.TypeID).ToString(); break; default: break; } } return(str + " : " + typeid); }
public void Init(GameFileCache gameFileCache, Action <string> updateStatus) { Inited = false; GameFileCache = gameFileCache; var rpfman = gameFileCache.RpfMan; string filename = "common.rpf\\data\\levels\\gta5\\popzone.ipl"; if (gameFileCache.EnableDlc) { filename = "update\\update.rpf\\common\\data\\levels\\gta5\\popzone.ipl"; } string ipltext = rpfman.GetFileUTF8Text(filename); if (string.IsNullOrEmpty(ipltext)) { ipltext = ""; } Groups.Clear(); var ipllines = ipltext.Split('\n'); bool inzone = false; foreach (var iplline in ipllines) { var linet = iplline.Trim(); if (linet == "zone") { inzone = true; } else if (linet == "end") { inzone = false; } else if (inzone) { PopZoneBox box = new PopZoneBox(); box.Init(linet); PopZone group; if (!Groups.TryGetValue(box.NameLabel, out group)) { group = new PopZone(); group.NameLabel = box.NameLabel; Groups[box.NameLabel] = group; } group.Boxes.Add(box); } } foreach (var group in Groups.Values) { var hash = JenkHash.GenHash(group.NameLabel.ToLowerInvariant()); group.Name = GlobalText.TryGetString(hash); } BuildVertices(); Inited = true; }