CDROM: Add PVD/directory entries to file map

This commit is contained in:
Stenzek 2023-11-30 14:38:38 +10:00
parent 8cfa4637a2
commit df91c63b31
No known key found for this signature in database
3 changed files with 8 additions and 0 deletions

View File

@ -3292,6 +3292,7 @@ void CDROM::CreateFileMap()
}
Log_DevFmt("Creating file map for {}...", media->GetFileName());
s_file_map.emplace(iso.GetPVDLBA(), std::make_pair(iso.GetPVDLBA(), std::string("PVD")));
CreateFileMap(iso, std::string_view());
Log_DevFmt("Found {} files", s_file_map.size());
}
@ -3302,6 +3303,10 @@ void CDROM::CreateFileMap(IsoReader& iso, const std::string_view& dir)
{
if (entry.IsDirectory())
{
Log_DevFmt("{}-{} = {}", entry.location_le, entry.location_le + entry.GetSizeInSectors() - 1, path);
s_file_map.emplace(entry.location_le, std::make_pair(entry.location_le + entry.GetSizeInSectors() - 1,
fmt::format("<DIR> {}", path)));
CreateFileMap(iso, path);
continue;
}

View File

@ -72,6 +72,7 @@ bool IsoReader::ReadPVD(Error* error)
else if (header->type_code == 255)
break;
m_pvd_lba = START_SECTOR + i;
std::memcpy(&m_pvd, buffer, sizeof(ISOPrimaryVolumeDescriptor));
Log_DevFmt("ISOReader: PVD found at index {}", i);
return true;

View File

@ -145,6 +145,7 @@ public:
ALWAYS_INLINE const CDImage* GetImage() const { return m_image; }
ALWAYS_INLINE u32 GetTrackNumber() const { return m_track_number; }
ALWAYS_INLINE u32 GetPVDLBA() const { return m_pvd_lba; }
ALWAYS_INLINE const ISOPrimaryVolumeDescriptor& GetPVD() const { return m_pvd; }
bool Open(CDImage* image, u32 track_number, Error* error = nullptr);
@ -173,4 +174,5 @@ private:
u32 m_track_number;
ISOPrimaryVolumeDescriptor m_pvd = {};
u32 m_pvd_lba = 0;
};