GameList: Add "File Size" field

This commit is contained in:
Stenzek
2023-12-20 23:40:24 +10:00
parent fd341f6a9d
commit 36643fe78b
15 changed files with 128 additions and 26 deletions

View File

@ -33,6 +33,7 @@ public:
bool ReadSubChannelQ(SubChannelQ* subq, const Index& index, LBA lba_in_index) override;
bool HasNonStandardSubchannel() const override;
s64 GetSizeOnDisk() const override;
std::string GetMetadata(const std::string_view& type) const override;
std::string GetSubImageMetadata(u32 index, const std::string_view& type) const override;
@ -53,6 +54,7 @@ private:
std::unique_ptr<CDImage> m_parent_image;
std::vector<u8> m_replacement_data;
std::unordered_map<u32, u32> m_replacement_map;
s64 m_patch_size = 0;
u32 m_replacement_offset = 0;
};
@ -71,6 +73,8 @@ bool CDImagePPF::Open(const char* filename, std::unique_ptr<CDImage> parent_imag
return false;
}
m_patch_size = FileSystem::FSize64(fp.get());
u32 magic;
if (std::fread(&magic, sizeof(magic), 1, fp.get()) != 1)
{
@ -445,6 +449,11 @@ bool CDImagePPF::ReadSectorFromIndex(void* buffer, const Index& index, LBA lba_i
return true;
}
s64 CDImagePPF::GetSizeOnDisk() const
{
return m_patch_size + m_parent_image->GetSizeOnDisk();
}
std::unique_ptr<CDImage>
CDImage::OverlayPPFPatch(const char* filename, std::unique_ptr<CDImage> parent_image,
ProgressCallback* progress /* = ProgressCallback::NullProgressCallback */)