disc - correctly generate audio->data track transition 3-second pregaps (Street Fighter Collection (USA) (Disc 1))
This commit is contained in:
parent
a8a0d35a97
commit
ed43d773a6
|
@ -281,6 +281,7 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
session.Tracks.Add(toc_track);
|
||||
toc_track.Number = curr_track;
|
||||
toc_track.TrackType = cue_track.TrackType;
|
||||
toc_track.ADR = 1; //safe assumption. CUE can't store this.
|
||||
|
||||
//choose a Control value based on track type and other flags from cue
|
||||
//TODO - this might need to be controlled by cue loading prefs
|
||||
|
|
|
@ -328,16 +328,14 @@ FILE ""xarp.barp.marp.farp"" BINARY
|
|||
|
||||
var se = Sectors[aba];
|
||||
|
||||
EControlQ control = dp.Track.Control;
|
||||
EControlQ control = dp.Control;
|
||||
bool pause = true;
|
||||
if (dp.Num != 0) //TODO - shouldnt this be IndexNum?
|
||||
pause = false;
|
||||
if ((dp.Track.Control & EControlQ.DataUninterrupted)!=0)
|
||||
if ((dp.Control & EControlQ.DataUninterrupted)!=0)
|
||||
pause = false;
|
||||
|
||||
//we always use ADR=1 (mode-1 q block)
|
||||
//this could be more sophisticated but it is almost useless for emulation (only useful for catalog/ISRC numbers)
|
||||
int adr = 1;
|
||||
|
||||
int adr = dp.ADR;
|
||||
|
||||
SubchannelQ sq = new SubchannelQ();
|
||||
sq.q_status = SubchannelQ.ComputeStatus(adr, control);
|
||||
|
|
|
@ -21,6 +21,7 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
/// TODO - this is kind of garbage, but... I was using it for Synthesize_SubcodeFromStructure() :/
|
||||
/// Really, what it is, is a series of points where the tno/index change. Kind of an agenda. And thats how that function uses it.
|
||||
/// Maybe I should rename it something different, or at least comment it
|
||||
/// Or, you could look at this as a kind of compressed disc map
|
||||
/// </summary>
|
||||
public List<TOCPoint> Points;
|
||||
|
||||
|
@ -104,6 +105,9 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
public int ABA, TrackNum, IndexNum;
|
||||
public Track Track;
|
||||
|
||||
public int ADR;
|
||||
public EControlQ Control;
|
||||
|
||||
public int LBA
|
||||
{
|
||||
get { return ABA - 150; }
|
||||
|
@ -116,23 +120,64 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
public void Synthesize_TOCPointsFromSessions()
|
||||
{
|
||||
Points = new List<TOCPoint>();
|
||||
|
||||
|
||||
int num = 0;
|
||||
foreach (var ses in Sessions)
|
||||
{
|
||||
foreach (var track in ses.Tracks)
|
||||
foreach (var index in track.Indexes)
|
||||
for(int t=0;t<ses.Tracks.Count;t++)
|
||||
{
|
||||
int tnum = t + 1;
|
||||
var track = ses.Tracks[t];
|
||||
for(int i=0;i<track.Indexes.Count;i++)
|
||||
{
|
||||
var index = track.Indexes[i];
|
||||
bool repeat = false;
|
||||
int aba = index.aba;
|
||||
REPEAT:
|
||||
var tp = new TOCPoint
|
||||
{
|
||||
Num = num++,
|
||||
ABA = aba,
|
||||
TrackNum = track.Number,
|
||||
IndexNum = index.Number,
|
||||
Track = track,
|
||||
ADR = track.ADR,
|
||||
Control = track.Control
|
||||
};
|
||||
|
||||
//special case!
|
||||
//yellow-book says:
|
||||
//pre-gap for "first part of a digital data track not containing user data and encoded as a pause"
|
||||
//first interval: at least 75 sectors coded as preceding track
|
||||
//second interval: at least 150 sectors coded as user data track.
|
||||
//TODO - add pause flag tracking to TOCPoint
|
||||
//see mednafen's "TODO: Look into how we're supposed to handle subq control field in the four combinations of track types(data/audio)."
|
||||
if (tnum != 1 && i == 0 && track.TrackType != ETrackType.Audio && !repeat)
|
||||
{
|
||||
//NOTE: we dont implement this exactly the same as mednafen, I think my logic is closer to the docs, but who knows, its complicated
|
||||
int distance = track.Indexes[i + 1].aba - track.Indexes[i].aba;
|
||||
//well, how do we know to apply this logic?
|
||||
//we assume the 150 sector pregap is more important. so if thats all there is, theres no 75 sector pregap like the old track
|
||||
//if theres a longer pregap, then we generate weird old track pregap to contain the rest.
|
||||
if (distance > 150)
|
||||
{
|
||||
Num = num++,
|
||||
ABA = index.aba,
|
||||
TrackNum = track.Number,
|
||||
IndexNum = index.Number,
|
||||
Track = track
|
||||
};
|
||||
int weirdPregapSize = distance - 150;
|
||||
|
||||
//need a new point. fix the old one
|
||||
tp.ADR = Points[Points.Count - 1].ADR;
|
||||
tp.Control = Points[Points.Count - 1].Control;
|
||||
Points.Add(tp);
|
||||
|
||||
aba += weirdPregapSize;
|
||||
repeat = true;
|
||||
goto REPEAT;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Points.Add(tp);
|
||||
}
|
||||
}
|
||||
|
||||
var tpLeadout = new TOCPoint();
|
||||
var lastTrack = ses.Tracks[ses.Tracks.Count - 1];
|
||||
|
@ -167,6 +212,9 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
/// </summary>
|
||||
public int Number;
|
||||
|
||||
/// <summary>
|
||||
/// Conceptual track type, not necessarily stored this way anywhere
|
||||
/// </summary>
|
||||
public ETrackType TrackType;
|
||||
|
||||
/// <summary>
|
||||
|
@ -176,6 +224,11 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
/// </summary>
|
||||
public EControlQ Control;
|
||||
|
||||
/// <summary>
|
||||
/// Well, it seems a track can have an ADR property (used to fill the subchannel Q). This is delivered from a CCD file but may have to be guessed from
|
||||
/// </summary>
|
||||
public int ADR = 1;
|
||||
|
||||
/// <summary>
|
||||
/// All the indexes related to the track. These will be 0-Indexed, but they could be non-consecutive.
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue