System: Move overlay checking to common
This commit is contained in:
@ -17,7 +17,7 @@ public:
|
||||
CDImageM3u();
|
||||
~CDImageM3u() override;
|
||||
|
||||
bool Open(const char* path, Common::Error* Error);
|
||||
bool Open(const char* path, bool apply_patches, Common::Error* Error);
|
||||
|
||||
bool ReadSubChannelQ(SubChannelQ* subq, const Index& index, LBA lba_in_index) override;
|
||||
bool HasNonStandardSubchannel() const override;
|
||||
@ -42,13 +42,14 @@ private:
|
||||
std::vector<Entry> m_entries;
|
||||
std::unique_ptr<CDImage> m_current_image;
|
||||
u32 m_current_image_index = UINT32_C(0xFFFFFFFF);
|
||||
bool m_apply_patches = false;
|
||||
};
|
||||
|
||||
CDImageM3u::CDImageM3u() = default;
|
||||
|
||||
CDImageM3u::~CDImageM3u() = default;
|
||||
|
||||
bool CDImageM3u::Open(const char* path, Common::Error* error)
|
||||
bool CDImageM3u::Open(const char* path, bool apply_patches, Common::Error* error)
|
||||
{
|
||||
std::FILE* fp = FileSystem::OpenCFile(path, "rb");
|
||||
if (!fp)
|
||||
@ -65,6 +66,7 @@ bool CDImageM3u::Open(const char* path, Common::Error* error)
|
||||
|
||||
std::istringstream ifs(m3u_file.value());
|
||||
m_filename = path;
|
||||
m_apply_patches = apply_patches;
|
||||
|
||||
std::vector<std::string> entries;
|
||||
std::string line;
|
||||
@ -131,7 +133,7 @@ bool CDImageM3u::SwitchSubImage(u32 index, Common::Error* error)
|
||||
return true;
|
||||
|
||||
const Entry& entry = m_entries[index];
|
||||
std::unique_ptr<CDImage> new_image = CDImage::Open(entry.filename.c_str(), error);
|
||||
std::unique_ptr<CDImage> new_image = CDImage::Open(entry.filename.c_str(), m_apply_patches, error);
|
||||
if (!new_image)
|
||||
{
|
||||
Log_ErrorPrintf("Failed to load subimage %u (%s)", index, entry.filename.c_str());
|
||||
@ -170,10 +172,10 @@ bool CDImageM3u::ReadSubChannelQ(SubChannelQ* subq, const Index& index, LBA lba_
|
||||
return m_current_image->ReadSubChannelQ(subq, index, lba_in_index);
|
||||
}
|
||||
|
||||
std::unique_ptr<CDImage> CDImage::OpenM3uImage(const char* filename, Common::Error* error)
|
||||
std::unique_ptr<CDImage> CDImage::OpenM3uImage(const char* filename, bool apply_patches, Common::Error* error)
|
||||
{
|
||||
std::unique_ptr<CDImageM3u> image = std::make_unique<CDImageM3u>();
|
||||
if (!image->Open(filename, error))
|
||||
if (!image->Open(filename, apply_patches, error))
|
||||
return {};
|
||||
|
||||
return image;
|
||||
|
||||
Reference in New Issue
Block a user