添加虚拟文件系统(VFS)类以支持压缩文件的读取和管理,更新CMake配置以包含libzip子模块

This commit is contained in:
2025-03-03 19:41:17 +08:00
parent 842295b6b1
commit 9eee8ae1d9
11 changed files with 2901 additions and 2 deletions

26
vfs.hpp Normal file
View File

@@ -0,0 +1,26 @@
#include "zip.h"
#include <list>
#include <string>
#include <unordered_map>
#include <Windows.h>
class VFS {
public:
VFS();
~VFS();
bool AddArchive(std::string path);
bool ContainsFile(std::string path);
bool ContainsFile(std::wstring path);
bool ContainsHandle(HANDLE hFile);
HANDLE CreateFileW(std::wstring path);
bool ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead);
void CloseHandle(HANDLE hFile);
DWORD GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh);
DWORD SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod);
std::unordered_map<std::string, zip_uint64_t> files;
std::string GetBasePath();
private:
std::string base_path;
std::list<zip_t*> archives;
std::unordered_map<HANDLE, std::string> handles;
};