mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-07 12:54:00 +00:00
7c50f823d8
Currently, Open MW's basic file access speed is limited by a peculiar layer of virtualisation in BSAFile's interface. This PR removes such virtualisation by properly separating BSAFile from CompressedBSAFile in low level contexts.
62 lines
1.7 KiB
C++
62 lines
1.7 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;
|
|
|
|
const Bsa::BSAFile::FileStruct* mInfo;
|
|
Bsa::BSAFile* mFile;
|
|
};
|
|
|
|
class CompressedBsaArchiveFile : public BsaArchiveFile
|
|
{
|
|
public:
|
|
CompressedBsaArchiveFile(const Bsa::BSAFile::FileStruct* info, Bsa::CompressedBSAFile* bsa);
|
|
|
|
Files::IStreamPtr open() override;
|
|
Bsa::CompressedBSAFile* mCompressedFile;
|
|
};
|
|
|
|
|
|
class BsaArchive : public Archive
|
|
{
|
|
public:
|
|
BsaArchive(const std::string& 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 BsaArchive
|
|
{
|
|
public:
|
|
CompressedBsaArchive(const std::string& filename);
|
|
void listResources(std::map<std::string, File*>& out, char (*normalize_function) (char)) override;
|
|
virtual ~CompressedBsaArchive() {}
|
|
|
|
private:
|
|
std::unique_ptr<Bsa::CompressedBSAFile> mCompressedFile;
|
|
std::vector<CompressedBsaArchiveFile> mCompressedResources;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|