diff --git a/src/BizHawk.Emulation.DiscSystem/DiscFormats/MDS_Format.cs b/src/BizHawk.Emulation.DiscSystem/DiscFormats/MDS_Format.cs index d7f67999aa3..fa22dd3bfdc 100644 --- a/src/BizHawk.Emulation.DiscSystem/DiscFormats/MDS_Format.cs +++ b/src/BizHawk.Emulation.DiscSystem/DiscFormats/MDS_Format.cs @@ -657,6 +657,7 @@ public static LoadResults LoadMDSPath(string path) /// path reference no longer points to file private static Dictionary MountBlobs(AFile mdsf, Disc disc) { + Debug.Assert(disc.DisposableResources.Count is 0, "no other method should be adding to DisposableResources"); var BlobIndex = new Dictionary(); var count = 0; @@ -667,18 +668,11 @@ private static Dictionary MountBlobs(AFile mdsf, Disc disc) if (!File.Exists(file)) 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) + //mount the file + if (!disc.DisposableResources.Cast() + .Select(static re => re.PhysicalPath).Contains(file)) { + Blob_RawFile mdfBlob = new() { PhysicalPath = file }; // wrap in zeropadadapter disc.DisposableResources.Add(mdfBlob); BlobIndex[count++] = mdfBlob;