Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions src/BizHawk.Emulation.DiscSystem/DiscFormats/MDS_Format.cs
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ public static LoadResults LoadMDSPath(string path)
/// <exception cref="MDSParseException">path reference no longer points to file</exception>
private static Dictionary<int, IBlob> MountBlobs(AFile mdsf, Disc disc)
{
Debug.Assert(disc.DisposableResources.Count is 0, "no other method should be adding to DisposableResources");
var BlobIndex = new Dictionary<int, IBlob>();

var count = 0;
Expand All @@ -646,17 +647,10 @@ private static Dictionary<int, IBlob> MountBlobs(AFile mdsf, Disc disc)
throw new MDSParseException($"Malformed MDS format: nonexistent image file: {file}");

//mount the file
var mdfBlob = new Blob_RawFile { PhysicalPath = file };

var dupe = false;
foreach (var re in disc.DisposableResources)
{
if (re.ToString() == mdfBlob.ToString())
dupe = true;
}

if (!dupe)
if (!disc.DisposableResources.Cast<Blob_RawFile>()
.Select(static re => re.PhysicalPath).Contains(file))
{
Blob_RawFile mdfBlob = new() { PhysicalPath = file };
// wrap in zeropadadapter
disc.DisposableResources.Add(mdfBlob);
BlobIndex[count++] = mdfBlob;
Expand Down
Loading