public void Extract0EE(ICLIFlags toolFlags) { string basePath; if (toolFlags is ExtractFlags flags) { basePath = flags.OutputPath; } else { throw new Exception("no output path"); } const string container = "Debug0EE"; string path = Path.Combine(basePath, container); foreach (ulong key in TrackedFiles[0xEE]) { using (Stream stream = OpenFile(key)) { teStructuredData structuredData = new teStructuredData(stream); STU_E3594B8E inst = structuredData.GetMainInstance <STU_E3594B8E>(); if (inst == null) { continue; //inst = structuredData.GetMainInstance<STU_598579A3>(); } string name = $"{GetString(inst.m_name)}_{teResourceGUID.Index(key):X}"; string description = GetString(inst.m_description); Combo.ComboInfo info = new Combo.ComboInfo(); Combo.Find(info, (ulong)inst.m_21EB3E73); info.SetTextureName((ulong)inst.m_21EB3E73, name); OpenSTUTest(inst.m_7B7CCF55); // ux1 OpenSTUTest(inst.m_E81C5302); // ux2 OpenSTUTest(inst.m_FD9B53F4); // ux3 //{ // teStructuredData uxScreenData = new teStructuredData(); //} SaveLogic.Combo.SaveLooseTextures(flags, path, info); } } }
public void ExtractMapImages(ICLIFlags toolFlags) { string basePath; if (toolFlags is ExtractFlags flags) { basePath = flags.OutputPath; } else { throw new Exception("no output path"); } //flags.ConvertTexturesType = "dds"; const string container = "DebugMapImages"; foreach (ulong key in TrackedFiles[0x2]) { string dir = Path.Combine(basePath, container, GetFileName(key)); Combo.ComboInfo info = new Combo.ComboInfo(); using (Stream stream = OpenFile(key)) { using (Stream file = File.OpenWrite(Path.Combine(dir, "data.002"))) { stream.CopyTo(file); stream.Position = 0; } using (BinaryReader reader = new BinaryReader(stream)) { Map map = reader.Read <Map>(); Combo.Find(info, map.Texture); info.SetTextureName(map.Texture, nameof(Map.Texture)); Combo.Find(info, map.TextureB); info.SetTextureName(map.TextureB, nameof(Map.TextureB)); Combo.Find(info, map.TextureC); info.SetTextureName(map.TextureC, nameof(Map.TextureC)); Combo.Find(info, map.TextureD); info.SetTextureName(map.TextureD, nameof(Map.TextureD)); Combo.Find(info, map.TextureE); info.SetTextureName(map.TextureE, nameof(Map.TextureE)); Combo.Find(info, map.TextureF); info.SetTextureName(map.TextureF, nameof(Map.TextureF)); } SaveLogic.Combo.SaveLooseTextures(flags, dir, info); } } }
public void Parse(ICLIFlags toolFlags) { string basePath; if (toolFlags is ExtractFlags flags) { basePath = flags.OutputPath; } else { throw new Exception("no output path"); } const string container = "GamemodeImages"; string path = Path.Combine(basePath, container); foreach (ulong key in TrackedFiles[0xEE]) { var stuE3594B8E = Helper.STUHelper.GetInstance <STU_E3594B8E>(key); if (stuE3594B8E == null) { continue; } string name = $"{teResourceGUID.Index(key):X3}_{GetString(stuE3594B8E.m_name)}"; Combo.ComboInfo info = new Combo.ComboInfo(); Combo.Find(info, (ulong)stuE3594B8E.m_21EB3E73); info.SetTextureName((ulong)stuE3594B8E.m_21EB3E73, name); var context = new SaveLogic.Combo.SaveContext(info); SaveLogic.Combo.SaveLooseTextures(flags, path, context); context.Wait(); } }
public void SaveUnlocksForHeroes(ICLIFlags flags, IEnumerable <STUHero> heroes, string basePath, bool npc = false) { if (flags.Positionals.Length < 4) { QueryHelp(QueryTypes); return; } Dictionary <string, Dictionary <string, ParsedArg> > parsedTypes = ParseQuery(flags, QueryTypes, QueryNameOverrides); if (parsedTypes == null) { return; } foreach (STUHero hero in heroes) { if (hero == null) { continue; } string heroNameActual = GetString(hero.m_0EDCE350); if (heroNameActual == null) { continue; } Dictionary <string, ParsedArg> config = GetQuery(parsedTypes, heroNameActual.ToLowerInvariant(), "*"); heroNameActual = heroNameActual.TrimEnd(' '); string heroFileName = GetValidFilename(heroNameActual); if (config.Count == 0) { continue; } string heroPath = Path.Combine(basePath, RootDir, heroFileName); VoiceSet voiceSet = new VoiceSet(hero); ProgressionUnlocks progressionUnlocks = new ProgressionUnlocks(hero); if (progressionUnlocks.LevelUnlocks == null && !npc) { continue; } if (progressionUnlocks.LootBoxesUnlocks != null && npc) { continue; } Log($"Processing unlocks for {heroNameActual}"); { Combo.ComboInfo guiInfo = new Combo.ComboInfo(); foreach (STU_1A496D3C tex in hero.m_8203BFE1) { Combo.Find(guiInfo, tex.m_texture); guiInfo.SetTextureName(tex.m_texture, teResourceGUID.AsString(tex.m_id)); } SaveLogic.Combo.SaveLooseTextures(flags, Path.Combine(heroPath, "GUI"), guiInfo); } if (progressionUnlocks.OtherUnlocks != null) // achievements and stuff { Dictionary <string, TagExpectedValue> tags = new Dictionary <string, TagExpectedValue> { { "event", new TagExpectedValue("base") } }; SaveUnlocks(flags, progressionUnlocks.OtherUnlocks, heroPath, "Achievement", config, tags, voiceSet, hero); } if (npc) { foreach (var skin in hero.m_skinThemes) { if (!config.ContainsKey("skin") || !config["skin"].ShouldDo(GetFileName(skin.m_5E9665E3))) { continue; } SkinTheme.Save(flags, Path.Combine(heroPath, Unlock.GetTypeName(typeof(STUUnlock_SkinTheme)), string.Empty, GetFileName(skin.m_5E9665E3)), skin, hero); } continue; } if (progressionUnlocks.LevelUnlocks != null) // default unlocks { Dictionary <string, TagExpectedValue> tags = new Dictionary <string, TagExpectedValue> { { "event", new TagExpectedValue("base") } }; foreach (LevelUnlocks levelUnlocks in progressionUnlocks.LevelUnlocks) { SaveUnlocks(flags, levelUnlocks.Unlocks, heroPath, "Default", config, tags, voiceSet, hero); } } if (progressionUnlocks.LootBoxesUnlocks != null) { foreach (LootBoxUnlocks lootBoxUnlocks in progressionUnlocks.LootBoxesUnlocks) { if (lootBoxUnlocks.Unlocks == null) { continue; } string lootboxName = LootBox.GetName(lootBoxUnlocks.LootBoxType); var tags = new Dictionary <string, TagExpectedValue> { { "event", new TagExpectedValue(LootBox.GetBasicName(lootBoxUnlocks.LootBoxType)) } }; SaveUnlocks(flags, lootBoxUnlocks.Unlocks, heroPath, lootboxName, config, tags, voiceSet, hero); } } } }
public void SaveUnlocksForHeroes(ICLIFlags flags, IEnumerable <STUHero> heroes, string basePath, bool npc = false) { if (flags.Positionals.Length < 4) { QueryHelp(QueryTypes); return; } Log("Initializing..."); Dictionary <string, Dictionary <string, ParsedArg> > parsedTypes = ParseQuery(flags, QueryTypes, QueryNameOverrides); if (parsedTypes == null) { return; } foreach (STUHero hero in heroes) { string heroNameActual = GetString(hero.Name); string heroFileName = GetValidFilename(heroNameActual); if (heroFileName == null) { continue; // heroFileName = "Unknown"; // heroNameActual = "Unknown"; } heroNameActual = heroNameActual.TrimEnd(' '); heroFileName = heroFileName.TrimEnd(' '); Dictionary <string, ParsedArg> config = new Dictionary <string, ParsedArg>(); foreach (string key in new [] { heroNameActual.ToLowerInvariant(), "*" }) { if (!parsedTypes.ContainsKey(key)) { continue; } foreach (KeyValuePair <string, ParsedArg> parsedArg in parsedTypes[key]) { if (config.ContainsKey(parsedArg.Key)) { config[parsedArg.Key] = config[parsedArg.Key].Combine(parsedArg.Value); } else { config[parsedArg.Key] = parsedArg.Value.Combine(null); // clone for safety } } } if (config.Count == 0) { continue; } var unlocks = GetInstance <STUHeroUnlocks>(hero.LootboxUnlocks); if (unlocks?.Unlocks == null && !npc) { continue; } if (unlocks?.LootboxUnlocks != null && npc) { continue; } Log($"Processing data for {heroNameActual}..."); List <ItemInfo> weaponSkins = ListHeroUnlocks.GetUnlocksForHero(hero.LootboxUnlocks)?.SelectMany(x => x.Value.Where(y => y.Type == "Weapon")).ToList(); // eww? var achievementUnlocks = GatherUnlocks(unlocks?.SystemUnlocks?.Unlocks?.Select(it => (ulong)it)).ToList(); foreach (ItemInfo itemInfo in achievementUnlocks) { if (itemInfo == null) { continue; } Dictionary <string, TagExpectedValue> tags = new Dictionary <string, TagExpectedValue> { { "event", new TagExpectedValue("base") } }; SaveItemInfo(itemInfo, basePath, heroFileName, flags, hero, "Achievement", config, tags, weaponSkins); } if (npc) { foreach (STUHeroSkin skin in hero.Skins) { if (config.ContainsKey("skin") && config["skin"].ShouldDo(GetFileName(skin.SkinOverride))) { Skin.Save(flags, $"{basePath}\\{RootDir}", hero, skin, false); } } continue; } foreach (var defaultUnlocks in unlocks.Unlocks) { var dUnlocks = GatherUnlocks(defaultUnlocks.Unlocks.Select(it => (ulong)it)).ToList(); foreach (ItemInfo itemInfo in dUnlocks) { Dictionary <string, TagExpectedValue> tags = new Dictionary <string, TagExpectedValue> { { "event", new TagExpectedValue("base") } }; SaveItemInfo(itemInfo, basePath, heroFileName, flags, hero, "Standard", config, tags, weaponSkins); } } foreach (var eventUnlocks in unlocks.LootboxUnlocks) { if (eventUnlocks?.Unlocks?.Unlocks == null) { continue; } var eventKey = ItemEvents.GetInstance().EventsNormal[(uint)eventUnlocks.Event]; var eUnlocks = eventUnlocks.Unlocks.Unlocks.Select(it => GatherUnlock(it)).ToList(); foreach (ItemInfo itemInfo in eUnlocks) { if (itemInfo == null) { continue; } Dictionary <string, TagExpectedValue> tags = new Dictionary <string, TagExpectedValue> { { "event", new TagExpectedValue(eventUnlocks.Event.ToString().ToLowerInvariant()) } }; SaveItemInfo(itemInfo, basePath, heroFileName, flags, hero, eventKey, config, tags, weaponSkins); } } Combo.ComboInfo guiInfo = new Combo.ComboInfo(); Combo.Find(guiInfo, hero.ImageResource1); Combo.Find(guiInfo, hero.ImageResource2); Combo.Find(guiInfo, hero.ImageResource3); Combo.Find(guiInfo, hero.ImageResource4); guiInfo.SetTextureName(hero.ImageResource1, "Icon"); guiInfo.SetTextureName(hero.ImageResource2, "Portrait"); guiInfo.SetTextureName(hero.ImageResource4, "Avatar"); guiInfo.SetTextureName(hero.SpectatorIcon, "SpectatorIcon"); SaveLogic.Combo.SaveLooseTextures(flags, Path.Combine(basePath, RootDir, heroFileName, "GUI"), guiInfo); } }