yuzu-emu
/
yuzu
Archived
1
0
Fork 0

pfs: Provide accessors for file sizes and offsets

This commit is contained in:
Zach Hilman 2019-09-22 21:44:36 -04:00
parent 2f5545f8de
commit 3895f7e456
2 changed files with 17 additions and 0 deletions

View File

@ -65,6 +65,9 @@ PartitionFilesystem::PartitionFilesystem(std::shared_ptr<VfsFile> file) {
std::string name( std::string name(
reinterpret_cast<const char*>(&file_data[strtab_offset + entry.strtab_offset])); reinterpret_cast<const char*>(&file_data[strtab_offset + entry.strtab_offset]));
offsets[name] = content_offset + entry.offset;
sizes[name] = entry.size;
pfs_files.emplace_back(std::make_shared<OffsetVfsFile>( pfs_files.emplace_back(std::make_shared<OffsetVfsFile>(
file, entry.size, content_offset + entry.offset, std::move(name))); file, entry.size, content_offset + entry.offset, std::move(name)));
} }
@ -78,6 +81,14 @@ Loader::ResultStatus PartitionFilesystem::GetStatus() const {
return status; return status;
} }
std::map<std::string, u64> PartitionFilesystem::GetFileOffsets() const {
return offsets;
}
std::map<std::string, u64> PartitionFilesystem::GetFileSizes() const {
return sizes;
}
std::vector<std::shared_ptr<VfsFile>> PartitionFilesystem::GetFiles() const { std::vector<std::shared_ptr<VfsFile>> PartitionFilesystem::GetFiles() const {
return pfs_files; return pfs_files;
} }

View File

@ -29,6 +29,9 @@ public:
Loader::ResultStatus GetStatus() const; Loader::ResultStatus GetStatus() const;
std::map<std::string, u64> GetFileOffsets() const;
std::map<std::string, u64> GetFileSizes() const;
std::vector<std::shared_ptr<VfsFile>> GetFiles() const override; std::vector<std::shared_ptr<VfsFile>> GetFiles() const override;
std::vector<std::shared_ptr<VfsDirectory>> GetSubdirectories() const override; std::vector<std::shared_ptr<VfsDirectory>> GetSubdirectories() const override;
std::string GetName() const override; std::string GetName() const override;
@ -80,6 +83,9 @@ private:
bool is_hfs = false; bool is_hfs = false;
std::size_t content_offset = 0; std::size_t content_offset = 0;
std::map<std::string, u64> offsets;
std::map<std::string, u64> sizes;
std::vector<VirtualFile> pfs_files; std::vector<VirtualFile> pfs_files;
}; };