mirror of https://github.com/OpenMW/openmw.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
2.0 KiB
C++
69 lines
2.0 KiB
C++
#ifndef VFS_BSAARCHIVE_HPP_
|
|
#define VFS_BSAARCHIVE_HPP_
|
|
|
|
#include "archive.hpp"
|
|
|
|
#include <components/bsa/bsa_file.hpp>
|
|
#include <components/bsa/compressedbsafile.hpp>
|
|
|
|
namespace VFS
|
|
{
|
|
class BsaArchiveFile : public File
|
|
{
|
|
public:
|
|
BsaArchiveFile(const Bsa::BSAFile::FileStruct* info, Bsa::BSAFile* bsa);
|
|
|
|
Files::IStreamPtr open() override;
|
|
|
|
std::filesystem::path getPath() override { return mInfo->name(); }
|
|
|
|
const Bsa::BSAFile::FileStruct* mInfo;
|
|
Bsa::BSAFile* mFile;
|
|
};
|
|
|
|
class CompressedBsaArchiveFile : public File
|
|
{
|
|
public:
|
|
CompressedBsaArchiveFile(const Bsa::BSAFile::FileStruct* info, Bsa::CompressedBSAFile* bsa);
|
|
|
|
Files::IStreamPtr open() override;
|
|
|
|
std::filesystem::path getPath() override { return mInfo->name(); }
|
|
|
|
const Bsa::BSAFile::FileStruct* mInfo;
|
|
Bsa::CompressedBSAFile* mCompressedFile;
|
|
};
|
|
|
|
class BsaArchive : public Archive
|
|
{
|
|
public:
|
|
BsaArchive(const std::filesystem::path& filename);
|
|
BsaArchive();
|
|
virtual ~BsaArchive();
|
|
void listResources(std::map<std::string, File*>& out, char (*normalize_function)(char)) override;
|
|
bool contains(const std::string& file, char (*normalize_function)(char)) const override;
|
|
std::string getDescription() const override;
|
|
|
|
protected:
|
|
std::unique_ptr<Bsa::BSAFile> mFile;
|
|
std::vector<BsaArchiveFile> mResources;
|
|
};
|
|
|
|
class CompressedBsaArchive : public Archive
|
|
{
|
|
public:
|
|
CompressedBsaArchive(const std::filesystem::path& filename);
|
|
virtual ~CompressedBsaArchive() {}
|
|
void listResources(std::map<std::string, File*>& out, char (*normalize_function)(char)) override;
|
|
bool contains(const std::string& file, char (*normalize_function)(char)) const override;
|
|
std::string getDescription() const override;
|
|
|
|
private:
|
|
std::unique_ptr<Bsa::CompressedBSAFile> mCompressedFile;
|
|
std::vector<CompressedBsaArchiveFile> mCompressedResources;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|