mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-30 09:35:40 +00:00
commit
8e011a1429
|
@ -25,17 +25,6 @@ private:
|
||||||
CDSubChannelReplacement m_sbi;
|
CDSubChannelReplacement m_sbi;
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::string ReplaceExtension(std::string_view path, std::string_view new_extension)
|
|
||||||
{
|
|
||||||
std::string_view::size_type pos = path.rfind('.');
|
|
||||||
if (pos == std::string::npos)
|
|
||||||
return std::string(path);
|
|
||||||
|
|
||||||
std::string ret(path, 0, pos + 1);
|
|
||||||
ret.append(new_extension);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
CDImageBin::CDImageBin() = default;
|
CDImageBin::CDImageBin() = default;
|
||||||
|
|
||||||
CDImageBin::~CDImageBin()
|
CDImageBin::~CDImageBin()
|
||||||
|
@ -101,7 +90,7 @@ bool CDImageBin::Open(const char* filename)
|
||||||
|
|
||||||
AddLeadOutIndex();
|
AddLeadOutIndex();
|
||||||
|
|
||||||
m_sbi.LoadSBI(ReplaceExtension(filename, "sbi").c_str());
|
m_sbi.LoadSBI(FileSystem::ReplaceExtension(filename, "sbi").c_str());
|
||||||
|
|
||||||
return Seek(1, Position{0, 0, 0});
|
return Seek(1, Position{0, 0, 0});
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,20 +110,7 @@ bool CDImageMemory::CopyImage(CDImage* image, ProgressCallback* progress)
|
||||||
m_filename = image->GetFileName();
|
m_filename = image->GetFileName();
|
||||||
m_lba_count = image->GetLBACount();
|
m_lba_count = image->GetLBACount();
|
||||||
|
|
||||||
if (!image->Seek(0))
|
m_sbi.LoadSBI(FileSystem::ReplaceExtension(m_filename, "sbi").c_str());
|
||||||
{
|
|
||||||
progress->ModalError("Failed to seek to start of image for subq read");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
progress->SetStatusText("Looking for invalid subchannel data...");
|
|
||||||
|
|
||||||
CDImage::SubChannelQ subq;
|
|
||||||
for (LBA lba = 0; lba < m_lba_count; lba++)
|
|
||||||
{
|
|
||||||
if (ReadSubChannelQ(&subq) && !subq.IsCRCValid())
|
|
||||||
m_sbi.AddReplacementSubChannelQ(lba, subq);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Seek(1, Position{0, 0, 0});
|
return Seek(1, Position{0, 0, 0});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue