EgoEngineModding / ego.nefsedit

NeFS archive editor for Ego Engine
MIT License
25 stars 9 forks source link

Investigate why .ctf files have additional 8 bytes of data #15

Open victorbush opened 4 years ago

victorbush commented 4 years ago

For car nef files, there is a *.ctf file in the archive. This file does not have any part 4 data (its p4 index is -1). But the extracted size listed in the part 1 entry is always 8 bytes short. This was confirmed by looking at the diffs between an original nefs archive and an archive saved by NeFSEdit. For now, we are just manually adding the 8 bytes in NefsWriter.cs.

            if (item.CompressedSize == item.ExtractedSize
                && item.ExtractedSize != 1
                && item.Part6Unknown0x02 != 3)
            {
                // Add 8 bytes to the size for some reason
                srcSize += 0x8;
            }

The last item in the archives are 1 byte long (and have a -1 part 4 entry) but their size is actually 1 byte, so this doesn't apply to those items.