Ejemplo n.º 1
0
        public override void Load(Stream fileStream)
        {
            ExtendedBinaryReader reader = new ExtendedBinaryReader(fileStream)
            {
                Offset = 0x20
            };
            long pos = 0;

            NinjaInfo = new NinjaInfo()
            {
                NodeName = new string(reader.ReadChars(4))
            };
            uint NodeLength = reader.ReadUInt32();
            uint NodeCount  = reader.ReadUInt32();
            uint Unknown1   = reader.ReadUInt32(); //Seems to always be 0x20 (at least in XN*s)?
            uint Unknown2   = reader.ReadUInt32(); //Footer Offset Table Start?
            uint Unknown3   = reader.ReadUInt32(); //Footer Offset Table Data Start?
            uint Unknown4   = reader.ReadUInt32(); //Footer Offset Table Length?
            uint Unknown5   = reader.ReadUInt32(); //Seems to always be 1 (at least in XN*s)?

            for (int i = 0; i < NodeCount; i++)
            {
                //Determine type of node to read
                string NextNodeName   = new string(reader.ReadChars(4));
                uint   NextNodeLength = reader.ReadUInt32();
                reader.JumpBehind(8);
                switch (NextNodeName)
                {
                case "NXTL":
                case "NZTL":
                    NinjaTextureList = ReadNinjaTextureList(reader, pos);
                    break;

                case "NXEF":
                    NinjaEffectList = ReadNinjaEffectList(reader, pos);
                    break;

                case "NXNN":
                    NinjaNodeNameList = ReadNinjaNodeNameList(reader, pos);
                    break;

                case "NXOB":
                case "NZOB":
                    NinjaObject = ReadNinjaObject(reader, pos);
                    break;

                default:
                    reader.JumpAhead(8);
                    reader.JumpAhead(NextNodeLength);
                    //Console.WriteLine($"Block {NextNodeName} Not Implemented!");
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        public NinjaTextureList ReadNinjaTextureList(ExtendedBinaryReader reader, long pos)
        {
            NinjaTextureList = new NinjaTextureList()
            {
                NodeName = new string(reader.ReadChars(4))
            };
            uint NodeLength = reader.ReadUInt32();

            pos = reader.BaseStream.Position; //Save Position
            uint NodeOffset = reader.ReadUInt32();

            reader.JumpTo(NodeOffset, false);

            uint TextureCount      = reader.ReadUInt32();
            uint TextureListOffset = reader.ReadUInt32();

            reader.JumpTo(TextureListOffset, false);

            for (int i = 0; i < TextureCount; i++)
            {
                uint Unknown1          = reader.ReadUInt32();        //Seems to always be 0 (at least in XN*s)? (Padding?)
                uint TextureNameOffset = reader.ReadUInt32();
                long currentPos        = reader.BaseStream.Position; //Save Position
                reader.JumpTo(TextureNameOffset, false);
                NinjaTextureFile TextureFile = new NinjaTextureFile()
                {
                    TextureName = reader.ReadNullTerminatedString()
                };
                reader.JumpTo(currentPos, true);
                TextureFile.Filters = reader.ReadUInt32();
                uint Unknown2 = reader.ReadUInt32(); //Seems to always be 0 (at least in XN*s)? (Padding?)
                uint Unknown3 = reader.ReadUInt32(); //Seems to always be 0 (at least in XN*s)? (Padding?)
                NinjaTextureList.TextureFiles.Add(TextureFile);
            }

            reader.JumpTo(pos, true);
            reader.JumpAhead(NodeLength);
            return(NinjaTextureList);
        }