private void UpdateDisplay() { Title = "Edit Entry: " + _entry.Index.ToString("d3"); if (ForceHex) { ImageVisible = false; } else if (_entry.Type == EntryType.Texture) { if (_entry.Console) { Image = GameImage.GetImagePS3(_entry.EntryBlocks[0].Data, _entry.EntryBlocks[1].Data); } else { Image = GameImage.GetImage(_entry.EntryBlocks[0].Data, _entry.EntryBlocks[1].Data); } ImageVisible = Image != null; } TabsVisible = !ImageVisible; //} ImageMenuVisible = ImageVisible; BinaryMenuVisible = TabsVisible; //ModelMenuVisible = _entry.Type == EntryType.RwRenderableResourceType; if (TabsVisible) { DataHex = _entry.EntryBlocks[0].Data; //.AsString(); ExtraDataHex = _entry.EntryBlocks[1].Data; //.AsString(); } MenuVisible = true; /*try * { * if (_entry.HasBody && !TabList.TabPages.Contains(TabBody)) * TabList.TabPages.Add(TabBody); * else if (!_entry.HasBody && TabList.TabPages.Contains(TabBody)) * TabList.TabPages.Remove(TabBody); * } * catch (Exception ex) * { * MessageBox.Show(ex.Message + "\n\n" + ex.StackTrace); * }*/ InfoText = GetInfo(); }
private Image GetGameMap(BundleArchive archive) { ulong id = 0x9F55039D; BundleEntry descEntry1 = archive.GetEntryByID(id); if (descEntry1 == null) { string file = BundleCache.GetFileByEntryID(id); if (!string.IsNullOrEmpty(file)) { BundleArchive archive2 = BundleArchive.Read(file); if (archive2 != null) { descEntry1 = archive2.GetEntryByID(id); } } } if (descEntry1 == null) { string path = Path.GetDirectoryName(archive.Path) + Path.DirectorySeparatorChar + "GUITEXTURES.BIN"; BundleArchive archive2 = BundleArchive.Read(path); if (archive2 != null) { descEntry1 = archive2.GetEntryByID(id); } } Image image = null; if (descEntry1 != null && descEntry1.Type == EntryType.Texture) { if (archive.Console) { image = GameImage.GetImagePS3(descEntry1.EntryBlocks[0].Data, descEntry1.EntryBlocks[1].Data); } else { image = GameImage.GetImage(descEntry1.EntryBlocks[0].Data, descEntry1.EntryBlocks[1].Data); } if (image != null) { TextureCache.AddToCache(id, image); } } return(image); }
public static TextureState Read(BundleEntry entry) { TextureState result = new TextureState(); List <BundleDependency> dependencies = entry.GetDependencies(); foreach (BundleDependency dependency in dependencies) { ulong id = dependency.EntryID; if (TextureCache.Contains(id)) { result.Texture = TextureCache.GetTexture(id); } else { BundleEntry descEntry1 = entry.Archive.GetEntryByID(id); if (descEntry1 == null) { string file = BundleCache.GetFileByEntryID(id); if (!string.IsNullOrEmpty(file)) { BundleArchive archive = BundleArchive.Read(file); if (archive != null) { descEntry1 = archive.GetEntryByID(id); } } } if (descEntry1 != null && descEntry1.Type == EntryType.Texture) { if (entry.Console) { result.Texture = GameImage.GetImagePS3(descEntry1.EntryBlocks[0].Data, descEntry1.EntryBlocks[1].Data); } else { result.Texture = GameImage.GetImage(descEntry1.EntryBlocks[0].Data, descEntry1.EntryBlocks[1].Data); } if (result.Texture != null) { TextureCache.AddToCache(id, result.Texture); } break; } } } MemoryStream ms = entry.MakeStream(); BinaryReader2 br = new BinaryReader2(ms); br.BigEndian = entry.Console; // TODO: Read Texture State br.Close(); ms.Close(); return(result); }