Beispiel #1
0
        public static void Save(ICLIFlags flags, string path, STUHero hero, STUHeroSkin skin, bool quiet = true)
        {
            STUSkinOverride skinOverride = GetInstance <STUSkinOverride>(skin.SkinOverride);

            LoudLog($"Extracting skin {GetString(hero.Name)} {GetFileName(skin.SkinOverride)}");
            Save(flags, GetFileName(skin.SkinOverride), path, hero, "", skinOverride, null, null, quiet);
        }
Beispiel #2
0
        public static void Save(ICLIFlags flags, string path, STUHero hero, string rarity, STUUnlock_Skin skin, List <ItemInfo> weaponSkins, List <STULoadout> abilities, bool quiet = true)
        {
            if (skin == null)
            {
                return;
            }
            LoudLog($"Extracting skin {GetString(hero.Name)} {GetString(skin.CosmeticName)}");
            if (weaponSkins == null)
            {
                weaponSkins = new List <ItemInfo>();
            }

            STUSkinOverride skinOverride = GetInstance <STUSkinOverride>(skin.SkinResource);

            Save(flags, GetString(skin.CosmeticName).TrimEnd(' '), path, hero, rarity, skinOverride, weaponSkins, abilities, quiet);
        }
Beispiel #3
0
        public static void SaveSkin(ICLIFlags flags, ulong skinResource, string basePath, STUHero hero, string heroFileName, string name, STUVoiceSetComponent baseComponent, Combo.ComboInfo baseInfo)
        {
            STUSkinOverride skin = GetInstance <STUSkinOverride>(skinResource);

            if (skin == null)
            {
                return;
            }

            STUVoiceSetComponent component = default(STUVoiceSetComponent);

            Combo.ComboInfo info = default(Combo.ComboInfo);

            if (SaveSet(flags, basePath, hero.EntityMain, heroFileName, GetValidFilename(name), ref component, ref info, baseComponent, baseInfo, skin.ProperReplacements))
            {
                return;
            }
        }
Beispiel #4
0
        public static void Save(ICLIFlags flags, string skinName, string basePath, STUHero hero, string rarity, STUSkinOverride skinOverride, List <ItemInfo> weaponSkins, List <STULoadout> abilities, bool quiet = true)
        {
            string heroName     = GetString(hero.Name);
            string heroNamePath = GetValidFilename(heroName) ?? "Unknown";

            heroNamePath = heroNamePath.TrimEnd(' ');

            string path = Path.Combine(basePath,
                                       $"{heroNamePath}\\Skins\\{rarity}\\{GetValidFilename(skinName)}");

            Dictionary <uint, ItemInfo> realWeaponSkins = new Dictionary <uint, ItemInfo>();

            if (weaponSkins != null)
            {
                foreach (ItemInfo weaponSkin in weaponSkins)
                {
                    realWeaponSkins[((STUUnlock_Weapon)weaponSkin.Unlock).Index] = weaponSkin;
                }
            }

            Dictionary <ulong, ulong> replacements = skinOverride.ProperReplacements;

            LoudLog("\tFinding");
            FindLogic.Combo.ComboInfo info = new FindLogic.Combo.ComboInfo();
            FindLogic.Combo.Find(info, hero.EntityMain, replacements);
            FindLogic.Combo.Find(info, hero.EntityHeroSelect, replacements);
            FindLogic.Combo.Find(info, hero.EntityHighlightIntro, replacements);
            FindLogic.Combo.Find(info, hero.EntityPlayable, replacements);
            FindLogic.Combo.Find(info, hero.EntityThirdPerson, replacements);

            info.Config.DoExistingEntities = true;

            uint replacementIndex = 0;

            foreach (Common.STUGUID weaponOverrideGUID in skinOverride.Weapons)
            {
                STUHeroWeapon weaponOverride = GetInstance <STUHeroWeapon>(weaponOverrideGUID);
                if (weaponOverride == null)
                {
                    continue;
                }

                string weaponSkinName = null;
                if (realWeaponSkins.ContainsKey(replacementIndex))
                {
                    weaponSkinName = GetValidFilename(GetString(realWeaponSkins[replacementIndex].Unlock.CosmeticName));
                }

                Dictionary <ulong, ulong> weaponReplacements =
                    weaponOverride.ProperReplacements?.ToDictionary(x => x.Key, y => y.Value) ??
                    new Dictionary <ulong, ulong>();

                List <STUHeroWeaponEntity> weaponEntities = new List <STUHeroWeaponEntity>();
                if (hero.WeaponComponents1 != null)
                {
                    weaponEntities.AddRange(hero.WeaponComponents1);
                }
                if (hero.WeaponComponents2 != null)
                {
                    weaponEntities.AddRange(hero.WeaponComponents2);
                }
                foreach (STUHeroWeaponEntity heroWeapon in weaponEntities)
                {
                    FindLogic.Combo.Find(info, heroWeapon.Entity, weaponReplacements);
                    STUModelComponent modelComponent = GetInstance <STUModelComponent>(heroWeapon.Entity);
                    if (modelComponent?.Look == null || weaponSkinName == null)
                    {
                        continue;
                    }
                    ulong modelLook = FindLogic.Combo.GetReplacement(modelComponent.Look, weaponReplacements);
                    if (!info.ModelLooks.ContainsKey(modelLook))
                    {
                        continue;
                    }
                    FindLogic.Combo.ModelLookInfo modelLookInfo = info.ModelLooks[modelLook];
                    modelLookInfo.Name = weaponSkinName;
                }

                replacementIndex++;
            }
            info.Config.DoExistingEntities = false;

            foreach (Common.STUGUID guiImage in new[] { hero.ImageResource1, hero.ImageResource2, hero.ImageResource3,
                                                        hero.ImageResource3, hero.ImageResource4, skinOverride.SkinImage, hero.SpectatorIcon })
            {
                FindLogic.Combo.Find(info, guiImage, replacements);
            }
            Combo.SaveLooseTextures(flags, Path.Combine(path, "GUI"), info);

            info.SetEntityName(hero.EntityHeroSelect, $"{heroName}-HeroSelect");
            info.SetEntityName(hero.EntityPlayable, $"{heroName}-Playable-ThirdPerson");
            info.SetEntityName(hero.EntityThirdPerson, $"{heroName}-ThirdPerson");
            info.SetEntityName(hero.EntityMain, $"{heroName}-Base");
            info.SetEntityName(hero.EntityHighlightIntro, $"{heroName}-HighlightIntro");

            string soundDirectory = Path.Combine(path, "Sound");

            FindLogic.Combo.ComboInfo diffInfoBefore = new FindLogic.Combo.ComboInfo();
            FindLogic.Combo.ComboInfo diffInfoAfter  = new FindLogic.Combo.ComboInfo();

            if (replacements != null)
            {
                foreach (KeyValuePair <ulong, ulong> replacement in replacements)
                {
                    uint diffReplacementType = GUID.Type(replacement.Value);
                    if (diffReplacementType != 0x2C && diffReplacementType != 0x5F && diffReplacementType != 0x3F &&
                        diffReplacementType != 0xB2)
                    {
                        continue;
                    }
                    FindLogic.Combo.Find(diffInfoAfter, replacement.Value);
                    FindLogic.Combo.Find(diffInfoBefore, replacement.Key);
                }

                diffInfoAfter.SaveRuntimeData = new FindLogic.Combo.ComboSaveRuntimeData {
                    Threads = false
                };

                foreach (KeyValuePair <ulong, FindLogic.Combo.SoundFileInfo> soundFile in diffInfoAfter.SoundFiles)
                {
                    if (diffInfoBefore.SoundFiles.ContainsKey(soundFile.Key))
                    {
                        continue;
                    }
                    Combo.SaveSoundFile(flags, soundDirectory, diffInfoAfter, soundFile.Key, false);
                }

                foreach (KeyValuePair <ulong, FindLogic.Combo.SoundFileInfo> soundFile in diffInfoAfter.VoiceSoundFiles)
                {
                    if (diffInfoBefore.VoiceSoundFiles.ContainsKey(soundFile.Key))
                    {
                        continue;
                    }
                    Combo.SaveSoundFile(flags, soundDirectory, diffInfoAfter, soundFile.Key, true);
                }
            }

            LoudLog("\tSaving");
            Combo.Save(flags, path, info);
            LoudLog("\tDone");
        }
Beispiel #5
0
        public void ExtractOWL(ICLIFlags toolFlags)
        {
            string basePath;

            if (toolFlags is ExtractFlags flags)
            {
                basePath = flags.OutputPath;
            }
            else
            {
                throw new Exception("no output path");
            }

            const string container = "DebugOWL2";
            string       path      = Path.Combine(basePath, container);

            // foreach (ulong key in TrackedFiles[0xB3]) {
            //     string p = Path.Combine(path, "MatDatas");
            //     if (GUID.Index(key) != 0x8EE9) continue;
            //     ImageDefinition def = new ImageDefinition(OpenFile(key));
            //     SaveTextureDef(flags, p, key, def);
            //     // if (def.Layers != null) {
            //     //     foreach (ImageLayer layer in def.Layers) {
            //     //         if (GUID.Index(layer.Key) == 0x120E2) {  // sf shock normal
            //     //             // Debugger.Break();
            //     //             SaveTextureDef(flags, p, key, def);
            //     //             // found 346777171307564171
            //     //         }
            //     //
            //     //         if (GUID.Index(layer.Key) == 0x11C3F) {  // sym normal
            //     //             // Debugger.Break();
            //     //             SaveTextureDef(flags, p, key, def);
            //     //             // found 346777171307564777
            //     //             // found 346777171307565869
            //     //         }
            //     //
            //     //         if (GUID.Index(layer.Key) == 0x11D56) {  // widow sss
            //     //             // Debugger.Break();
            //     //             SaveTextureDef(flags, p, key, def);
            //     //             //346777171307565850 / 00000000931A.0B3
            //     //         }
            //     //     }
            //     // }
            // }

            List <string> added = ExtractDebugNewEntities.GetAddedFiles("D:\\ow\\OverwatchDataManager\\versions\\1.20.0.2.43435\\data.json");

            Combo.ComboInfo imgInfo = new Combo.ComboInfo();
            // Combo.Find(imgInfo, 864691265894168957ul);
            //foreach (ulong key in TrackedFiles[0xA5]) {
            //    string name = GetFileName(key);
            //    if (!added.Contains(name)) continue;
            //    Skin skin = GetInstance<Skin>(key);
            //    if (skin == null) continue;
            //}

            foreach (ulong key in TrackedFiles[0x4])
            {
                string name = GetFileName(key);
                if (name[3] == 'F')
                {
                    continue;                  // :thonk:
                }
                if (!added.Contains(name))
                {
                    continue;
                }
                Combo.Find(imgInfo, key);
            }
            Console.Out.WriteLine("ok i do save");
            SaveLogic.Combo.SaveLooseTextures(flags, Path.Combine(path, "Tex"), imgInfo);

            return;


            foreach (ulong key in TrackedFiles[0xA6])
            {
                STUSkinOverride @override = GetInstance <STUSkinOverride>(key);
                string          name      = GetFileName(key);
                if (!added.Contains(name))
                {
                    continue;
                }

                Combo.ComboInfo info  = new Combo.ComboInfo();
                Combo.ComboInfo info2 = new Combo.ComboInfo();
                foreach (KeyValuePair <ulong, ulong> overrideReplacement in @override.ProperReplacements)
                {
                    Combo.Find(info, overrideReplacement.Key);
                    Combo.Find(info2, overrideReplacement.Value);
                }

                string p = Path.Combine(path, "SkinOverrides", GetFileName(key));

                SaveLogic.Combo.Save(flags, Path.Combine(p, "Before"), info);
                // SaveLogic.Combo.SaveAllMaterials(flags, Path.Combine(p, "Before"), info);
                SaveLogic.Combo.SaveAllModelLooks(flags, Path.Combine(p, "Before"), info);
                SaveLogic.Combo.Save(flags, Path.Combine(p, "After"), info2);
                // SaveLogic.Combo.SaveAllMaterials(flags, Path.Combine(p, "After"), info2);
                SaveLogic.Combo.SaveAllModelLooks(flags, Path.Combine(p, "After"), info2);
            }

            // foreach (ulong key in TrackedFiles[0x8]) {
            //     Material material = new Material(OpenFile(key), 0);
            //     if (GUID.Index(material.Header.ImageDefinition) == 0x931A) {
            //         Debugger.Break();
            //     }
            // }
        }