CDSubChannelReplacement: Clear map on reload

Fixes one PBP disc's SBI from leaking into others.
This commit is contained in:
Stenzek 2024-01-01 14:46:56 +10:00
parent cc84952fdc
commit cf760bbe42
No known key found for this signature in database
2 changed files with 10 additions and 2 deletions

View File

@ -743,12 +743,16 @@ bool CDImagePBP::OpenDisc(u32 index, Error* error)
if (m_disc_offsets.size() > 1)
{
const std::string offset_path = fmt::format("{}_{}.pbp", Path::StripExtension(m_filename), index + 1);
// Gross. Have to use the SBI suffix here, otherwise Android won't resolve content URIs...
// Which means that LSD won't be usable with PBP on Android. Oh well.
const std::string display_name = FileSystem::GetDisplayNameFromPath(m_filename);
const std::string offset_path =
Path::BuildRelativePath(m_filename, fmt::format("{}_{}.sbi", Path::StripExtension(display_name), index + 1));
m_sbi.LoadFromImagePath(offset_path);
}
else
{
m_sbi.LoadFromImagePath(Path::ReplaceExtension(m_filename, "sbi"));
m_sbi.LoadFromImagePath(m_filename);
}
m_current_disc = index;

View File

@ -61,6 +61,8 @@ bool CDSubChannelReplacement::LoadSBI(const std::string& path)
return true;
}
m_replacement_subq.clear();
SBIFileEntry entry;
while (std::fread(&entry, sizeof(entry), 1, fp.get()) == 1)
{
@ -101,6 +103,8 @@ bool CDSubChannelReplacement::LoadLSD(const std::string& path)
if (!fp)
return false;
m_replacement_subq.clear();
LSDFileEntry entry;
while (std::fread(&entry, sizeof(entry), 1, fp.get()) == 1)
{