Use the right archive type to load bsa according to their type

This commit is contained in:
Cédric Mocquillon 2023-03-02 20:47:53 +01:00
parent 974799c011
commit d30deef4b5
4 changed files with 91 additions and 161 deletions

View file

@ -48,12 +48,14 @@ std::unique_ptr<VFS::Archive> makeBsaArchive(const std::filesystem::path& path)
case Bsa::BSAVER_UNKNOWN:
std::cerr << '"' << path << "\" is unknown BSA archive" << std::endl;
return nullptr;
case Bsa::BSAVER_UNCOMPRESSED:
return std::make_unique<VFS::BsaArchive>(path);
case Bsa::BSAVER_COMPRESSED:
return std::make_unique<VFS::ArchiveSelector<Bsa::BSAVER_COMPRESSED>::type>(path);
case Bsa::BSAVER_BA2_GNRL:
return std::make_unique<VFS::ArchiveSelector<Bsa::BSAVER_BA2_GNRL>::type>(path);
case Bsa::BSAVER_BA2_DX10:
return std::make_unique<VFS::CompressedBsaArchive>(path);
return std::make_unique<VFS::ArchiveSelector<Bsa::BSAVER_BA2_DX10>::type>(path);
case Bsa::BSAVER_UNCOMPRESSED:
return std::make_unique<VFS::ArchiveSelector<Bsa::BSAVER_UNCOMPRESSED>::type>(path);
}
std::cerr << '"' << path << "\" is unsupported BSA archive" << std::endl;