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

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