Esempio n. 1
0
        private void Write(BinaryWriterEx bhdWriter, BinaryWriterEx bdtWriter)
        {
            BHD.Write(bhdWriter, Files);

            for (int i = 0; i < Files.Count; i++)
            {
                File file = Files[i];
                bdtWriter.Pad(0x10);

                byte[] bytes = file.Bytes;
                if (file.Flags == 0x03 || file.Flags == 0xC0)
                {
                    bytes = DCX.Compress(bytes, DCX.Type.DarkSouls1);
                }

                if (BHD.Format == 0x3E)
                {
                    bhdWriter.FillUInt64($"FileOffset{i}", (ulong)bdtWriter.Position);
                }
                else
                {
                    bhdWriter.FillUInt32($"FileOffset{i}", (uint)bdtWriter.Position);
                }

                bhdWriter.FillInt64($"FileSize{i}", bytes.LongLength);
                bdtWriter.WriteBytes(bytes);
            }
        }