Exemplo n.º 1
0
        /// <summary>
        /// Gets the first entry in the XModel XAsset Pool of Black Ops III.
        /// </summary>
        /// <param name="instance"></param>
        /// <returns>Name of the XModel.</returns>
        public string GetFirstXModel(JekyllInstance instance)
        {
            long       address = DBAssetPools + (Marshal.SizeOf <XAssetPool>() * (int)XAssetType.ASSET_TYPE_XMODEL);
            XAssetPool pool    = instance.Reader.ReadStruct <XAssetPool>(address);
            long       name    = instance.Reader.ReadInt64(pool.Pool);

            return(instance.Reader.ReadNullTerminatedString(name));
        }
Exemplo n.º 2
0
            /// <summary>
            /// Load the valid XAssets for the Localize XAsset Pool.
            /// </summary>
            /// <param name="instance"></param>
            /// <returns>List of Localize XAsset objects.</returns>
            public override List <GameXAsset> Load(JekyllInstance instance)
            {
                List <GameXAsset> results = new List <GameXAsset>();

                XAssetPool pool = instance.Reader.ReadStruct <XAssetPool>(instance.Game.DBAssetPools + (Index * Marshal.SizeOf <XAssetPool>()));

                Entries     = pool.Pool;
                ElementSize = pool.ItemSize;
                PoolSize    = (uint)pool.ItemCount;

                if (IsValidPool(Name, ElementSize, Marshal.SizeOf <LocalizeEntry>()) == false)
                {
                    return(results);
                }

                Dictionary <string, string> entries = new Dictionary <string, string>();

                for (int i = 0; i < PoolSize; i++)
                {
                    LocalizeEntry header = instance.Reader.ReadStruct <LocalizeEntry>(Entries + (i * ElementSize));

                    if (IsNullXAsset(header.Name))
                    {
                        continue;
                    }

                    string key = instance.Reader.ReadNullTerminatedString(header.Name).ToUpper();

                    if (entries.TryGetValue(key, out string _))
                    {
                        continue;
                    }

                    string value = instance.Reader.ReadNullTerminatedString(header.Value, nullCheck: true);
                    entries.Add(key, value);

                    Console.WriteLine($"Exported {Name} {key}");
                }

                string path = Path.Combine(instance.ExportPath, "localize.json");

                Directory.CreateDirectory(Path.GetDirectoryName(path));

                using (StreamWriter file = File.CreateText(path))
                {
                    file.Write(JsonConvert.SerializeObject(entries, Formatting.Indented));
                }

                return(results);
            }
Exemplo n.º 3
0
            /// <summary>
            /// Load the valid XAssets for the RawFile XAsset Pool.
            /// </summary>
            /// <param name="instance"></param>
            /// <returns>List of RawFile XAsset objects.</returns>
            public override List <GameXAsset> Load(JekyllInstance instance)
            {
                List <GameXAsset> results = new List <GameXAsset>();

                XAssetPool pool = instance.Reader.ReadStruct <XAssetPool>(instance.Game.DBAssetPools + (Index * Marshal.SizeOf <XAssetPool>()));

                Entries     = pool.Pool;
                ElementSize = pool.ItemSize;
                PoolSize    = (uint)pool.ItemCount;

                if (IsValidPool(Name, ElementSize, Marshal.SizeOf <RawFileXAsset>()) == false)
                {
                    return(results);
                }

                for (int i = 0; i < PoolSize; i++)
                {
                    RawFileXAsset header = instance.Reader.ReadStruct <RawFileXAsset>(Entries + (i * ElementSize));

                    if (IsNullXAsset(header.Name))
                    {
                        continue;
                    }
                    else if (header.Len == 0)
                    {
                        continue;
                    }

                    results.Add(new GameXAsset()
                    {
                        Name          = instance.Reader.ReadNullTerminatedString(header.Name),
                        Type          = Name,
                        Size          = ElementSize,
                        XAssetPool    = this,
                        HeaderAddress = Entries + (i * ElementSize),
                    });
                }

                return(results);
            }