using System; using System.Text; using System.Collections.Generic; namespace BizHawk.Emulation.DiscSystem { /// /// Represents our best guess at what a disc drive firmware will receive by reading the TOC from the lead-in track, modeled after CCD contents and mednafen/PSX needs. /// public class DiscTOC { /// /// The TOC specifies the first recorded track number, independently of whatever may actually be recorded /// public int FirstRecordedTrackNumber = -1; /// /// The TOC specifies the last recorded track number, independently of whatever may actually be recorded /// public int LastRecordedTrackNumber = -1; /// /// The TOC specifies the format of the session, so here it is. /// public SessionFormat Session1Format = SessionFormat.None; /// /// Information about a single track in the TOC /// public struct TOCItem { /// /// [IEC10149] "the control field used in the information track" /// the raw TOC entries do have a control field which is supposed to match what's found in the track. /// Determining whether a track contains audio or data is very important. /// A track mode can't be safely determined from reading sectors from the actual track if it's an audio track (there's no sector header with a mode byte) /// public EControlQ Control; /// /// Whether the Control indicates that this is data /// public bool IsData { get { return (Control & EControlQ.DATA) != 0; } } /// /// The location of the track (Index 1) /// public int LBA; /// /// Whether this entry exists (since the table is 101 entries long always) /// public bool Exists; } /// /// This is a convenient format for storing the TOC (taken from mednafen) /// Element 0 is the Lead-in track /// Element 100 is the Lead-out track /// public TOCItem[] TOCItems = new TOCItem[101]; /// /// The timestamp of the leadout track. In other words, the end of the user area. /// public int LeadoutLBA { get { return TOCItems[100].LBA; } } } }