예제 #1
0
            /// <summary>
            /// Load the valid XAssets for the TTF XAsset Pool.
            /// </summary>
            /// <param name="instance"></param>
            /// <returns>List of TTF XAsset objects.</returns>
            public override List <GameXAsset> Load(JekyllInstance instance)
            {
                List <GameXAsset> results = new List <GameXAsset>();

                Entries  = instance.Reader.ReadStruct <long>(instance.Game.DBAssetPools + (Marshal.SizeOf <DBAssetPool>() * Index));
                PoolSize = instance.Reader.ReadStruct <int>(instance.Game.DBAssetPoolSizes + (Marshal.SizeOf <DBAssetPoolSize>() * Index));

                for (int i = 0; i < PoolSize; i++)
                {
                    TTFDef header = instance.Reader.ReadStruct <TTFDef>(Entries + Marshal.SizeOf <DBAssetPool>() + (i * Marshal.SizeOf <TTFDef>()));

                    if (IsNullXAsset(header.Name))
                    {
                        continue;
                    }
                    else if (instance.Reader.ReadNullTerminatedString(header.Name).EndsWith(".ttf") is false)
                    {
                        continue;
                    }

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

                return(results);
            }
예제 #2
0
            /// <summary>
            /// Load the valid XAssets for the TTF XAsset Pool.
            /// </summary>
            /// <param name="instance"></param>
            /// <returns>List of TTF XAsset objects.</returns>
            public override List <GameXAsset> Load(JekyllInstance instance)
            {
                List <GameXAsset> results = new List <GameXAsset>();

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

                Entries     = pool.Entries;
                ElementSize = pool.ElementSize;
                PoolSize    = pool.PoolSize;

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

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

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

                return(results);
            }
예제 #3
0
            /// <summary>
            /// Exports the specified TTF XAsset.
            /// </summary>
            /// <param name="xasset"></param>
            /// <param name="instance"></param>
            /// <returns>Status of the export operation.</returns>
            public override JekyllStatus Export(GameXAsset xasset, JekyllInstance instance)
            {
                TTFDef header = instance.Reader.ReadStruct <TTFDef>(xasset.HeaderAddress);

                if (xasset.Name != instance.Reader.ReadNullTerminatedString(header.Name))
                {
                    return(JekyllStatus.MemoryChanged);
                }

                string path = Path.Combine(instance.ExportPath, xasset.Name);

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

                byte[] buffer = instance.Reader.ReadBytes(header.File, header.FileLen);
                File.WriteAllBytes(path, buffer);

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

                return(JekyllStatus.Success);
            }
예제 #4
0
            /// <summary>
            /// Load the valid XAssets for the TTF XAsset Pool.
            /// </summary>
            /// <param name="instance"></param>
            /// <returns>List of TTF 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 <TTFDef>()) == false)
                {
                    return(results);
                }

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

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

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

                return(results);
            }