Exemplo n.º 1
0
        private static void InitStorage(string language)
        {
            Logger.Info("CASC", $"Attempting to load language {language}");
            Client       = null;
            TankHandler  = null;
            TrackedFiles = null;

            var args = new ClientCreateArgs {
                SpeechLanguage = "enUS",
                TextLanguage   = language,
                HandlerArgs    = new ClientCreateArgs_Tank {
                    CacheAPM = Flags.UseCache
                },
                Online = false
            };

            Client      = new ClientHandler(Flags.OverwatchDirectory, args);
            TankHandler = Client.ProductHandler as ProductHandler_Tank;

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

            InitTrackedFiles();
            InitKeys();
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        public ModeResult Run(string[] args)
        {
            if (args.Length < 3)
            {
                Console.Out.WriteLine("Missing required arg: \"overwatch dir\" types...");
                return(ModeResult.Fail);
            }
            string gameDir = args[1];

            ushort[] types = args.Skip(2).Select(x => ushort.Parse(x, NumberStyles.HexNumber)).ToArray();

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

            TankLib.TACT.LoadHelper.PreLoad();
            ClientHandler client  = new ClientHandler(gameDir, createArgs);
            var           handler = (ProductHandler_Tank)client.ProductHandler;

            TankLib.TACT.LoadHelper.PostLoad(client);

            foreach (var asset in handler.m_assets)
            {
                if (!types.Contains(teResourceGUID.Type(asset.Key)))
                {
                    continue;
                }
                string filename = teResourceGUID.AsString(asset.Key);
                using (Stream stream = handler.OpenFile(asset.Key)) {
                    try {
                        if (stream == null)
                        {
                            throw new Exception();
                        }
                        using (var structuredData = new teStructuredData(stream)) {
                            var primary = structuredData.Instances.FirstOrDefault(x => x.Usage == TypeUsage.Root) ?? structuredData.Instances.FirstOrDefault();

                            if (primary == default)
                            {
                                throw new Exception();
                            }

                            Logger.Info(null, $"{filename}: {primary.GetType().Name}");
                        }
                    } catch {
                        Logger.Warn(null, $"Can't find root instance for {filename}");
                    }
                }
            }

            return(ModeResult.Success);
        }
Exemplo 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();
        }
Exemplo 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}");
            }
        }
Exemplo 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();
        }