mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-18 22:35:39 +00:00
CDImage: Add helper for checking for SBI
This commit is contained in:
parent
4232ef7bf3
commit
627008f34c
|
@ -255,6 +255,11 @@ bool CDImage::ReadSubChannelQ(SubChannelQ* subq)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CDImage::HasNonStandardSubchannel() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const CDImage::Index* CDImage::GetIndexForDiscPosition(LBA pos)
|
const CDImage::Index* CDImage::GetIndexForDiscPosition(LBA pos)
|
||||||
{
|
{
|
||||||
for (const Index& index : m_indices)
|
for (const Index& index : m_indices)
|
||||||
|
|
|
@ -242,6 +242,9 @@ public:
|
||||||
// Reads sub-channel Q for the current LBA.
|
// Reads sub-channel Q for the current LBA.
|
||||||
virtual bool ReadSubChannelQ(SubChannelQ* subq);
|
virtual bool ReadSubChannelQ(SubChannelQ* subq);
|
||||||
|
|
||||||
|
// Returns true if the image has replacement subchannel data.
|
||||||
|
virtual bool HasNonStandardSubchannel() const;
|
||||||
|
|
||||||
// Reads a single sector from an index.
|
// Reads a single sector from an index.
|
||||||
virtual bool ReadSectorFromIndex(void* buffer, const Index& index, LBA lba_in_index) = 0;
|
virtual bool ReadSectorFromIndex(void* buffer, const Index& index, LBA lba_in_index) = 0;
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ public:
|
||||||
bool Open(const char* filename);
|
bool Open(const char* filename);
|
||||||
|
|
||||||
bool ReadSubChannelQ(SubChannelQ* subq) override;
|
bool ReadSubChannelQ(SubChannelQ* subq) override;
|
||||||
|
bool HasNonStandardSubchannel() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool ReadSectorFromIndex(void* buffer, const Index& index, LBA lba_in_index) override;
|
bool ReadSectorFromIndex(void* buffer, const Index& index, LBA lba_in_index) override;
|
||||||
|
@ -103,6 +104,11 @@ bool CDImageBin::ReadSubChannelQ(SubChannelQ* subq)
|
||||||
return CDImage::ReadSubChannelQ(subq);
|
return CDImage::ReadSubChannelQ(subq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CDImageBin::HasNonStandardSubchannel() const
|
||||||
|
{
|
||||||
|
return (m_sbi.GetReplacementSectorCount() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
bool CDImageBin::ReadSectorFromIndex(void* buffer, const Index& index, LBA lba_in_index)
|
bool CDImageBin::ReadSectorFromIndex(void* buffer, const Index& index, LBA lba_in_index)
|
||||||
{
|
{
|
||||||
const u64 file_position = index.file_offset + (static_cast<u64>(lba_in_index) * index.file_sector_size);
|
const u64 file_position = index.file_offset + (static_cast<u64>(lba_in_index) * index.file_sector_size);
|
||||||
|
|
|
@ -49,6 +49,7 @@ public:
|
||||||
bool Open(const char* filename);
|
bool Open(const char* filename);
|
||||||
|
|
||||||
bool ReadSubChannelQ(SubChannelQ* subq) override;
|
bool ReadSubChannelQ(SubChannelQ* subq) override;
|
||||||
|
bool HasNonStandardSubchannel() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool ReadSectorFromIndex(void* buffer, const Index& index, LBA lba_in_index) override;
|
bool ReadSectorFromIndex(void* buffer, const Index& index, LBA lba_in_index) override;
|
||||||
|
@ -262,6 +263,11 @@ bool CDImageCHD::ReadSubChannelQ(SubChannelQ* subq)
|
||||||
return CDImage::ReadSubChannelQ(subq);
|
return CDImage::ReadSubChannelQ(subq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CDImageCHD::HasNonStandardSubchannel() const
|
||||||
|
{
|
||||||
|
return (m_sbi.GetReplacementSectorCount() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
// There's probably a more efficient way of doing this with vectorization...
|
// There's probably a more efficient way of doing this with vectorization...
|
||||||
ALWAYS_INLINE static void CopyAndSwap(void* dst_ptr, const u8* src_ptr, u32 data_size)
|
ALWAYS_INLINE static void CopyAndSwap(void* dst_ptr, const u8* src_ptr, u32 data_size)
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,6 +18,7 @@ public:
|
||||||
bool OpenAndParse(const char* filename);
|
bool OpenAndParse(const char* filename);
|
||||||
|
|
||||||
bool ReadSubChannelQ(SubChannelQ* subq) override;
|
bool ReadSubChannelQ(SubChannelQ* subq) override;
|
||||||
|
bool HasNonStandardSubchannel() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool ReadSectorFromIndex(void* buffer, const Index& index, LBA lba_in_index) override;
|
bool ReadSectorFromIndex(void* buffer, const Index& index, LBA lba_in_index) override;
|
||||||
|
@ -258,6 +259,11 @@ bool CDImageCueSheet::ReadSubChannelQ(SubChannelQ* subq)
|
||||||
return CDImage::ReadSubChannelQ(subq);
|
return CDImage::ReadSubChannelQ(subq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CDImageCueSheet::HasNonStandardSubchannel() const
|
||||||
|
{
|
||||||
|
return (m_sbi.GetReplacementSectorCount() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
bool CDImageCueSheet::ReadSectorFromIndex(void* buffer, const Index& index, LBA lba_in_index)
|
bool CDImageCueSheet::ReadSectorFromIndex(void* buffer, const Index& index, LBA lba_in_index)
|
||||||
{
|
{
|
||||||
DebugAssert(index.file_index < m_files.size());
|
DebugAssert(index.file_index < m_files.size());
|
||||||
|
|
|
@ -18,6 +18,7 @@ public:
|
||||||
bool CopyImage(CDImage* image, ProgressCallback* progress);
|
bool CopyImage(CDImage* image, ProgressCallback* progress);
|
||||||
|
|
||||||
bool ReadSubChannelQ(SubChannelQ* subq) override;
|
bool ReadSubChannelQ(SubChannelQ* subq) override;
|
||||||
|
bool HasNonStandardSubchannel() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool ReadSectorFromIndex(void* buffer, const Index& index, LBA lba_in_index) override;
|
bool ReadSectorFromIndex(void* buffer, const Index& index, LBA lba_in_index) override;
|
||||||
|
@ -123,6 +124,11 @@ bool CDImageMemory::ReadSubChannelQ(SubChannelQ* subq)
|
||||||
return CDImage::ReadSubChannelQ(subq);
|
return CDImage::ReadSubChannelQ(subq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CDImageMemory::HasNonStandardSubchannel() const
|
||||||
|
{
|
||||||
|
return (m_sbi.GetReplacementSectorCount() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
bool CDImageMemory::ReadSectorFromIndex(void* buffer, const Index& index, LBA lba_in_index)
|
bool CDImageMemory::ReadSectorFromIndex(void* buffer, const Index& index, LBA lba_in_index)
|
||||||
{
|
{
|
||||||
DebugAssert(index.file_index == 0);
|
DebugAssert(index.file_index == 0);
|
||||||
|
|
Loading…
Reference in a new issue