Exemple #1
0
        public BNDEntry GetEntry(DSBinaryReader bin)
        {
            if (FileOffset < 0 || FileOffset > bin.Length)
            {
                throw new Exception("Invalid BND3 Entry File Offset.");
            }

            bin.StepIn(FileOffset);
            var bytes = bin.ReadBytes(FileSize);

            bin.StepOut();

            string fileName = null;

            if (FileNameOffset > -1)
            {
                bin.StepIn(FileNameOffset);
                {
                    fileName = bin.ReadStringShiftJIS();
                }
                bin.StepOut();
            }

            return(new BNDEntry(FileID, fileName, Unknown1, bytes));
        }
Exemple #2
0
        public TPFEntry ReadNext(DSBinaryReader bin)
        {
            Offset = bin.ReadInt32();
            Size   = bin.ReadInt32();
            FlagsA = bin.ReadUInt32();

            if (TpfFlags == 0x00020300) //Dark Souls
            {
                NameOffset = bin.ReadInt32();
                FlagsB     = bin.ReadUInt32();
            }
            else if (TpfFlags == 0x02010200 || TpfFlags == 0x02010000) //Demon's Souls
            {
                FlagsB     = bin.ReadUInt32();
                NameOffset = bin.ReadInt32();
            }

            var newEntry = new TPFEntry()
            {
                FlagsA = FlagsA,
                FlagsB = FlagsB
            };

            bin.StepIn(NameOffset);
            {
                newEntry.Name = bin.ReadStringShiftJIS();
            }
            bin.StepOut();

            bin.StepIn(Offset);
            {
                newEntry.DDSBytes = bin.ReadBytes(Size);
            }
            bin.StepOut();

            return(newEntry);
        }