From 3895f7e4562a02ee07cac6908787802bddf2c092 Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Sun, 22 Sep 2019 21:44:36 -0400 Subject: pfs: Provide accessors for file sizes and offsets --- src/core/file_sys/partition_filesystem.cpp | 11 +++++++++++ src/core/file_sys/partition_filesystem.h | 6 ++++++ 2 files changed, 17 insertions(+) (limited to 'src/core') diff --git a/src/core/file_sys/partition_filesystem.cpp b/src/core/file_sys/partition_filesystem.cpp index a5259a593..932409d79 100644 --- a/src/core/file_sys/partition_filesystem.cpp +++ b/src/core/file_sys/partition_filesystem.cpp @@ -65,6 +65,9 @@ PartitionFilesystem::PartitionFilesystem(std::shared_ptr file) { std::string name( reinterpret_cast(&file_data[strtab_offset + entry.strtab_offset])); + offsets[name] = content_offset + entry.offset; + sizes[name] = entry.size; + pfs_files.emplace_back(std::make_shared( file, entry.size, content_offset + entry.offset, std::move(name))); } @@ -78,6 +81,14 @@ Loader::ResultStatus PartitionFilesystem::GetStatus() const { return status; } +std::map PartitionFilesystem::GetFileOffsets() const { + return offsets; +} + +std::map PartitionFilesystem::GetFileSizes() const { + return sizes; +} + std::vector> PartitionFilesystem::GetFiles() const { return pfs_files; } diff --git a/src/core/file_sys/partition_filesystem.h b/src/core/file_sys/partition_filesystem.h index 248fdfdeb..279193b19 100644 --- a/src/core/file_sys/partition_filesystem.h +++ b/src/core/file_sys/partition_filesystem.h @@ -29,6 +29,9 @@ public: Loader::ResultStatus GetStatus() const; + std::map GetFileOffsets() const; + std::map GetFileSizes() const; + std::vector> GetFiles() const override; std::vector> GetSubdirectories() const override; std::string GetName() const override; @@ -80,6 +83,9 @@ private: bool is_hfs = false; std::size_t content_offset = 0; + std::map offsets; + std::map sizes; + std::vector pfs_files; }; -- cgit v1.2.3