Esempio n. 1
0
        public ModeResult Run(string[] args)
        {
            string gameDir = args[1];
            ushort type    = ushort.Parse(args[2], NumberStyles.HexNumber);

            ClientCreateArgs createArgs = new ClientCreateArgs {
                SpeechLanguage = "enUS",
                TextLanguage   = "enUS"
            };

            TankLib.TACT.LoadHelper.PreLoad();
            ClientHandler client = new ClientHandler(gameDir, createArgs);

            _tankHandler = (ProductHandler_Tank)client.ProductHandler;
            TankLib.TACT.LoadHelper.PostLoad(client);

            foreach (var asset in _tankHandler.Assets)
            {
                if (teResourceGUID.Type(asset.Key) != type)
                {
                    continue;
                }
                string filename = teResourceGUID.AsString(asset.Key);
                using (Stream stream = _tankHandler.OpenFile(asset.Key)) {
                    if (stream == null)
                    {
                        continue;
                    }
                    teStructuredData structuredData = new teStructuredData(stream);
                }
            }

            return(ModeResult.Success);
        }
Esempio n. 2
0
 public static void WriteTextCKeys(ProductHandler_Tank tankHandler, string file, IEnumerable <CKey> cKeys)
 {
     using (StreamWriter writer = new StreamWriter(file)) {
         foreach (CKey asset in cKeys)
         {
             writer.WriteLine(asset.ToHexString());
         }
     }
 }
Esempio n. 3
0
 public static void WriteTextGUIDs(ProductHandler_Tank tankHandler, string file, IEnumerable <ulong> guids)
 {
     using (StreamWriter writer = new StreamWriter(file)) {
         foreach (ulong asset in guids)
         {
             writer.WriteLine(asset.ToString("X"));
         }
     }
 }
Esempio n. 4
0
        public static void InitStorage(bool online = true)
        {
            if (Flags.Language != null)
            {
                Logger.Info("CASC", $"Set language to {Flags.Language}");
            }

            if (Flags.SpeechLanguage != null)
            {
                Logger.Info("CASC", $"Set speech language to {Flags.SpeechLanguage}");
            }

            var args = new ClientCreateArgs {
                SpeechLanguage = Flags.SpeechLanguage,
                TextLanguage   = Flags.Language,
                HandlerArgs    = new ClientCreateArgs_Tank {
                    CacheAPM = Flags.UseCache
                },
                Online = online
            };

            LoadHelper.PreLoad();
            Client = new ClientHandler(Flags.OverwatchDirectory, args);
            LoadHelper.PostLoad(Client);

            if (args.TextLanguage != "enUS")
            {
                Logger.Warn("Core", "Reminder! When extracting data in other languages, the names of the heroes/skins/etc must be in the language you have chosen.");
            }

            if (Client.AgentProduct.ProductCode != "pro")
            {
                Logger.Warn("Core", $"The branch \"{Client.AgentProduct.ProductCode}\" is not supported!. This might result in failure to load. Proceed with caution.");
            }

            if (!Client.AgentProduct.Settings.Languages.Select(x => x.Language)
                .Contains(args.TextLanguage))
            {
                Logger.Warn("Core", "Battle.Net Agent reports that language {0} is not installed.", args.TextLanguage);
            }
            else if (!Client.AgentProduct.Settings.Languages.Select(x => x.Language)
                     .Contains(args.SpeechLanguage))
            {
                Logger.Warn("Core", "Battle.Net Agent reports that language {0} is not installed.", args.SpeechLanguage);
            }

            TankHandler = Client.ProductHandler as ProductHandler_Tank;
            if (TankHandler == null)
            {
                Logger.Error("Core", $"Not a valid Overwatch installation (detected product: {Client.Product})");
                return;
            }

            BuildVersion = uint.Parse(Client.InstallationInfo.Values["Version"]
                                      .Split('.')
                                      .Last());
            if (BuildVersion < 39028)
            {
                Logger.Error("Core", "DataTool doesn't support Overwatch versions below 1.14. Please use OverTool.");
            }
            else if (BuildVersion < 56957)
            {
                Logger.Error("Core", "This version of DataTool doesn't support versions of Overwatch below 1.35. Please downgrade DataTool.");
            }

            InitTrackedFiles();
        }
Esempio n. 5
0
        public static void Main(string[] args)
        {
            string       overwatchDir = args[0];
            string       mode         = args[1];
            const string language     = "enUS";

            // Usage:
            // {overwatch dir} dump  --  Dump hashes
            // {overwatch dir} compare-enc {other ver num}  --  Extract added files from encoding (requires dump from other version)
            // {overwatch dir} compare-idx {other ver num}  --  Extract added files from indices (requires dump from other version)
            // {overwatch dir} allcmf  --  Extract all files from the cmf

            // casc setup

            TankLib.TACT.LoadHelper.PreLoad();

            ClientCreateArgs createArgs = new ClientCreateArgs {
                SpeechLanguage = language,
                TextLanguage   = language
            };

            if (mode != "allcmf" && mode != "dump-guids" && mode != "compare-guids" && mode != "dump-cmf")
            {
                createArgs.HandlerArgs = new ClientCreateArgs_Tank {
                    LoadManifest = false
                };
            }
            Client      = new ClientHandler(overwatchDir, createArgs);
            TankHandler = (ProductHandler_Tank)Client.ProductHandler;

            TankLib.TACT.LoadHelper.PostLoad(Client);

            BuildVersion = uint.Parse(Client.InstallationInfo.Values["Version"].Split('.').Last());

            // c:\\ow\\game\\Overwatch dump
            // "D:\Games\Overwatch Test" compare 44022

            if (mode == "dump")
            {
                Dump(args);
            }
            else if (mode == "compare-enc")
            {
                CompareEnc(args);
            }
            else if (mode == "compare-idx")
            {
                CompareIdx(args);
            }
            else if (mode == "allcmf")
            {
                AllCMF(args);
            }
            else if (mode == "dump-guids")
            {
                DumpGUIDs(args);
            }
            else if (mode == "compare-guids")
            {
                CompareGUIDs(args);
            }
            else if (mode == "dump-cmf")
            {
                DumpCMF(args);
            }
            else
            {
                throw new Exception($"unknown mode: {mode}");
            }
        }
Esempio n. 6
0
        public static void InitStorage(bool online = false)   // turnin offline off again, can cause perf issues with bundle hack
        // Attempt to load language via registry, if they were already provided via flags then this won't do anything
        {
            if (!Flags.NoLanguageRegistry)
            {
                TryFetchLocaleFromRegistry();
            }

            Logger.Info("CASC", $"Text Language: {Flags.Language} | Speech Language: {Flags.SpeechLanguage}");

            var args = new ClientCreateArgs {
                SpeechLanguage = Flags.SpeechLanguage,
                TextLanguage   = Flags.Language,
                HandlerArgs    = new ClientCreateArgs_Tank {
                    CacheAPM = Flags.UseCache, ManifestRegion = Flags.RCN ? ProductHandler_Tank.REGION_CN : ProductHandler_Tank.REGION_DEV
                },
                Online = online
            };

            LoadHelper.PreLoad();
            Client = new ClientHandler(Flags.OverwatchDirectory, args);
            LoadHelper.PostLoad(Client);

            if (args.TextLanguage != "enUS")
            {
                Logger.Warn("Core", "Reminder! When extracting data in other languages, the names of the heroes/skins/etc must be in the language you have chosen.");
            }

            if (Client.AgentProduct.ProductCode != "pro")
            {
                Logger.Warn("Core", $"The branch \"{Client.AgentProduct.ProductCode}\" is not supported!. This might result in failure to load. Proceed with caution.");
            }

            var clientLanguages = Client.AgentProduct.Settings.Languages.Select(x => x.Language).ToArray();

            if (!clientLanguages.Contains(args.TextLanguage))
            {
                Logger.Warn("Core", "Battle.Net Agent reports that text language {0} is not installed.", args.TextLanguage);
            }
            else if (!clientLanguages.Contains(args.SpeechLanguage))
            {
                Logger.Warn("Core", "Battle.Net Agent reports that speech language {0} is not installed.", args.SpeechLanguage);
            }

            TankHandler = Client.ProductHandler as ProductHandler_Tank;
            if (TankHandler == null)
            {
                Logger.Error("Core", $"Not a valid Overwatch installation (detected product: {Client.Product})");
                return;
            }

            BuildVersion = uint.Parse(Client.InstallationInfo.Values["Version"].Split('.').Last());
            if (BuildVersion < 39028)
            {
                Logger.Error("Core", "DataTool doesn't support Overwatch versions below 1.14. Please use OverTool.");
            }
            else if (BuildVersion < ProductHandler_Tank.VERSION_152_PTR)
            {
                Logger.Error("Core", "This version of DataTool doesn't support versions of Overwatch below 1.52. Please downgrade DataTool.");
            }

            InitTrackedFiles();
        }