using System;
using System.Text;
using System.Collections.Generic;
namespace BizHawk.Emulation.DiscSystem
{
public class DiscTOC
{
///
/// Sessions contained in the disc. Right now support for anything other than 1 session is totally not working
///
public List Sessions = new List();
///
/// this is an unfinished concept of "TOC Points" which is sometimes more convenient way for organizing the disc contents
///
public List Points = new List();
///
/// Todo - comment about what this actually means
/// TODO - this is redundant with Sectors.Count
///
public int length_aba;
///
/// todo - comment about what this actually means
///
public Timestamp FriendlyLength { get { return new Timestamp(length_aba); } }
///
/// todo - comment about what this actually means
///
public long BinarySize
{
get { return length_aba * 2352; }
}
///
/// seeks the point immediately before (or equal to) this LBA
///
public TOCPoint SeekPoint(int lba)
{
int aba = lba + 150;
for(int i=0;i aba)
return Points[i - 1];
}
return Points[Points.Count - 1];
}
///
///
///
public class TOCPoint
{
public int Num;
public int ABA, TrackNum, IndexNum;
public Track Track;
public int LBA
{
get { return ABA - 150; }
}
}
///
/// Generates the Points list from the current TOC
///
public void GeneratePoints()
{
int num = 0;
Points.Clear();
foreach (var ses in Sessions)
{
foreach (var track in ses.Tracks)
foreach (var index in track.Indexes)
{
var tp = new TOCPoint
{
Num = num++,
ABA = index.aba,
TrackNum = track.num,
IndexNum = index.num,
Track = track
};
Points.Add(tp);
}
var tpLeadout = new TOCPoint();
var lastTrack = ses.Tracks[ses.Tracks.Count - 1];
tpLeadout.Num = num++;
tpLeadout.ABA = lastTrack.Indexes[1].aba + lastTrack.length_aba;
tpLeadout.IndexNum = 0;
tpLeadout.TrackNum = 100;
tpLeadout.Track = null; //no leadout track.. now... or ever?
Points.Add(tpLeadout);
}
}
public class Session
{
public int num;
public List