Ryan-rsm-McKenzie / bsa

C++ library for working with the Bethesda archive file format
MIT License
41 stars 6 forks source link

Duplicated file when iterating archive #7

Closed Guekka closed 2 years ago

Guekka commented 2 years ago

When iterating this archive (from WACCF) the file "textures\\weapons\\orcish\\orcisharrow.dds" is listed twice.

This causes issues in multithreading with two threads trying to open the same file

Ryan-rsm-McKenzie commented 2 years ago

You will notice that these two files are different if you check their hashes, so you are not enumerating the same file twice. What is happening is the archive has been "optimized" to use binary sharing, except whoever wrote the binary sharing algorithm never thought to themselves what would happen if the "embedded file names" flag is enabled as well. So not only are these two files sharing their binary data, they're also sharing their file names, which is why you're seeing the "same file" twice.

Guekka commented 2 years ago

Thanks. I expected it to be related to binary sharing