Fix typo and cleanup loop

This commit is contained in:
James Groom 2019-02-24 15:39:01 +10:00 committed by GitHub
parent 9f75222284
commit cf23d9db87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 27 additions and 38 deletions

View File

@ -527,44 +527,33 @@ namespace BizHawk.Emulation.DiscSystem
aFile.ParsedSession.Add(session); aFile.ParsedSession.Add(session);
} }
// now build the TOC object // now build the TOC object
foreach (var se in aFile.ParsedSession) foreach (var se in aFile.ParsedSession)
{ foreach (var t in aTracks.Values
// get the first and last tracks .Where(a => se.StartTrack <= a.TrackNo && a.TrackNo <= se.EndTrack)
int sTrack = se.StartTrack; .OrderBy(a => a.TrackNo))
int eTrack = se.EndTrack; {
aFile.TOCEntries.Add(new ATOCEntry(t.Point)
// get list of all tracks from aTracks for this session {
var tracks = (from a in aTracks.Values ADR_Control = t.ADR_Control,
where a.TrackNo >= sTrack || a.TrackNo <= eTrack AFrame = t.AFrame,
orderby a.TrackNo AMin = t.AMin,
select a).ToList(); ASec = t.ASec,
BlobIndex = t.BlobIndex,
// create the TOC entries EntryNum = t.TrackNo,
foreach (var t in tracks) ExtraBlock = t.ExtraBlock,
{ ImageFileNamePaths = t.ImageFileNamePaths,
ATOCEntry toc = new ATOCEntry(t.Point); PFrame = t.PFrame,
toc.ADR_Control = t.ADR_Control; PLBA = Convert.ToInt32(t.PLBA),
toc.AFrame = t.AFrame; PMin = t.PMin,
toc.AMin = t.AMin; Point = t.Point,
toc.ASec = t.ASec; PSec = t.PSec,
toc.EntryNum = t.TrackNo; SectorSize = t.SectorSize,
toc.PFrame = t.PFrame; Session = se.SessionSequence,
toc.PLBA = Convert.ToInt32(t.PLBA); TrackOffset = Convert.ToInt64(t.StartOffset),
toc.PMin = t.PMin; Zero = t.Zero
toc.Point = t.Point; });
toc.PSec = t.PSec; }
toc.SectorSize = t.SectorSize;
toc.Zero = t.Zero;
toc.TrackOffset = Convert.ToInt64(t.StartOffset);
toc.Session = se.SessionSequence;
toc.ImageFileNamePaths = t.ImageFileNamePaths;
toc.ExtraBlock = t.ExtraBlock;
toc.BlobIndex = t.BlobIndex;
aFile.TOCEntries.Add(toc);
}
}
return aFile; return aFile;
} }