2023-04-14 03:55:11 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
2023-04-16 13:07:43 +00:00
|
|
|
|
namespace GameBuilder.Cue
|
2023-04-14 03:55:11 +00:00
|
|
|
|
{
|
|
|
|
|
public class CueTrack
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public const int MODE2_SECTOR_SZ = 2352;
|
|
|
|
|
public const int CDDA_SECTOR_SZ = 2352;
|
|
|
|
|
|
|
|
|
|
public TrackType TrackType;
|
|
|
|
|
public byte TrackNo;
|
2023-04-30 09:08:57 +00:00
|
|
|
|
public DiscIndex[] TrackIndex;
|
2023-04-14 03:55:11 +00:00
|
|
|
|
|
|
|
|
|
public int TrackLength;
|
|
|
|
|
public int SectorSz
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (TrackType == TrackType.TRACK_CDDA) return CDDA_SECTOR_SZ;
|
|
|
|
|
else return MODE2_SECTOR_SZ;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
internal long binFileSz;
|
|
|
|
|
internal string binFileName;
|
|
|
|
|
|
|
|
|
|
internal CueTrack(string binFile)
|
|
|
|
|
{
|
2023-04-30 09:08:57 +00:00
|
|
|
|
TrackIndex = new DiscIndex[2];
|
2023-04-14 03:55:11 +00:00
|
|
|
|
for (int i = 0; i < TrackIndex.Length; i++)
|
2023-04-30 09:08:57 +00:00
|
|
|
|
TrackIndex[i] = new DiscIndex(Convert.ToByte(i));
|
2023-04-14 03:55:11 +00:00
|
|
|
|
|
|
|
|
|
binFileName = binFile;
|
|
|
|
|
binFileSz = new FileInfo(binFileName).Length;
|
|
|
|
|
|
|
|
|
|
TrackType = TrackType.TRACK_MODE2_2352;
|
|
|
|
|
TrackNo = 0xFF;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public byte[] ToTocEntry()
|
|
|
|
|
{
|
|
|
|
|
byte[] tocEntry = new byte[10];
|
|
|
|
|
|
|
|
|
|
tocEntry[0] = Convert.ToByte(this.TrackType);
|
|
|
|
|
tocEntry[1] = 0;
|
2023-04-30 09:08:57 +00:00
|
|
|
|
tocEntry[2] = CueReader.DecimalToBinaryDecimal(this.TrackNo);
|
2023-04-14 03:55:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tocEntry[3] = this.TrackIndex[0].M;
|
|
|
|
|
tocEntry[4] = this.TrackIndex[0].S;
|
|
|
|
|
tocEntry[5] = this.TrackIndex[0].F;
|
|
|
|
|
tocEntry[6] = 0;
|
|
|
|
|
tocEntry[7] = this.TrackIndex[1].M;
|
|
|
|
|
tocEntry[8] = this.TrackIndex[1].S;
|
|
|
|
|
tocEntry[9] = this.TrackIndex[1].F;
|
|
|
|
|
|
|
|
|
|
return tocEntry;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|