diff --git a/BizHawk.Emulation.DiscSystem/Disc.cs b/BizHawk.Emulation.DiscSystem/Disc.cs
index 1aba433cae..e5673efc4c 100644
--- a/BizHawk.Emulation.DiscSystem/Disc.cs
+++ b/BizHawk.Emulation.DiscSystem/Disc.cs
@@ -213,8 +213,6 @@ namespace BizHawk.Emulation.DiscSystem
TOCRaw.TOCItems[i + 1].LBATimestamp = new Timestamp(track.Indexes[1].LBA); //WHAT?? WE NEED THIS AFTER ALL! ZOUNDS MEANS, THERE WAS JUST SOME OTHER BUG
lastEnd = track.LengthInSectors + track.Indexes[1].LBA;
}
-
- TOCRaw.LeadoutTimestamp = new Timestamp(lastEnd);
}
///
diff --git a/BizHawk.Emulation.DiscSystem/Jobs/DiscMountJob.MednaDisc.cs b/BizHawk.Emulation.DiscSystem/Jobs/DiscMountJob.MednaDisc.cs
index f3ae6d6b50..6864c84356 100644
--- a/BizHawk.Emulation.DiscSystem/Jobs/DiscMountJob.MednaDisc.cs
+++ b/BizHawk.Emulation.DiscSystem/Jobs/DiscMountJob.MednaDisc.cs
@@ -64,6 +64,10 @@ namespace BizHawk.Emulation.DiscSystem
BufferedSubcodeSector bss = new BufferedSubcodeSector(); //TODO - its hacky that we need this..
+ //ADR (q-Mode) is necessarily 0x01 for a RawTOCEntry
+ const int kADR = 1;
+ const int kUnknownControl = 0;
+
//mednafen delivers us what is essentially but not exactly (or completely) a TOCRaw.
//we need to synth RawTOCEntries from this and then turn it into a proper TOCRaw
//when coming from mednafen, there are 101 entries.
@@ -82,7 +86,7 @@ namespace BizHawk.Emulation.DiscSystem
var q = new SubchannelQ
{
- q_status = 0, //unknown with mednadisc
+ q_status = SubchannelQ.ComputeStatus(kADR, (EControlQ)m_te.control),
q_tno = BCD2.FromDecimal(0), //unknown with mednadisc
q_index = BCD2.FromDecimal(i),
min = BCD2.FromDecimal(0), //unknown with mednadisc
@@ -107,7 +111,7 @@ namespace BizHawk.Emulation.DiscSystem
//synth A1 and A2 entries instead of setting FirstRecordedTrackNumber and LastRecordedTrackNumber below
var qA1 = new SubchannelQ
{
- q_status = 0, //unknown with mednadisc
+ q_status = SubchannelQ.ComputeStatus(kADR, kUnknownControl),
q_tno = BCD2.FromDecimal(0), //unknown with mednadisc
q_index = BCD2.FromBCD(0xA0),
min = BCD2.FromDecimal(0), //unknown with mednadisc
@@ -122,7 +126,7 @@ namespace BizHawk.Emulation.DiscSystem
disc.RawTOCEntries.Add(new RawTOCEntry { QData = qA1 });
var qA2 = new SubchannelQ
{
- q_status = 0, //unknown with mednadisc
+ q_status = SubchannelQ.ComputeStatus(kADR, kUnknownControl),
q_tno = BCD2.FromDecimal(0), //unknown with mednadisc
q_index = BCD2.FromBCD(0xA1),
min = BCD2.FromDecimal(0), //unknown with mednadisc
diff --git a/BizHawk.Emulation.DiscSystem/TOC/TOCRaw.cs b/BizHawk.Emulation.DiscSystem/TOC/TOCRaw.cs
index 8618747681..422bd4c111 100644
--- a/BizHawk.Emulation.DiscSystem/TOC/TOCRaw.cs
+++ b/BizHawk.Emulation.DiscSystem/TOC/TOCRaw.cs
@@ -12,9 +12,7 @@ namespace BizHawk.Emulation.DiscSystem
///
/// Synthesizes the TOC from a set of raw entries.
/// When a disc drive firmware reads the lead-in area, it builds this TOC from finding q-mode 1 sectors in the Q subchannel of the lead-in area.
- /// Question: does it ignore q-mode != 1?
- /// Once upon a time, I said: "The disc drive firmware will discover other mode sectors in the lead-in area, and it will register those in separate data structures."
- /// What do I mean by this?
+ /// Question: I guess it must ignore q-mode != 1? what else would it do with it?
///
public class SynthesizeFromRawTOCEntriesJob
{
@@ -27,8 +25,8 @@ namespace BizHawk.Emulation.DiscSystem
SynthesizeFromRawTOCEntriesJob job = this;
DiscTOCRaw ret = new DiscTOCRaw();
- //this is a dummy, for convenience
- ret.TOCItems[0].LBATimestamp = new Timestamp(0);
+ //this is a dummy, for convenience in array indexing, so that track 1 is at array index 1
+ ret.TOCItems[0].LBATimestamp = new Timestamp(0); //arguably could be -150, but let's not just yet
ret.TOCItems[0].Control = 0;
ret.TOCItems[0].Exists = false;
@@ -73,7 +71,9 @@ namespace BizHawk.Emulation.DiscSystem
}
else if (point == 102) //0xA2 bcd
{
- ret.LeadoutTimestamp = q.AP_Timestamp;
+ ret.TOCItems[100].LBATimestamp = new Timestamp(q.AP_Timestamp.Sector - 150); //RawTOCEntries contained an absolute time
+ ret.TOCItems[100].Control = 0; //not clear what this should be
+ ret.TOCItems[100].Exists = true;
}
}
@@ -82,9 +82,10 @@ namespace BizHawk.Emulation.DiscSystem
if (ret.FirstRecordedTrackNumber == -1) { }
if (ret.LastRecordedTrackNumber == -1) { ret.LastRecordedTrackNumber = maxFoundTrack; }
if (ret.Session1Format == SessionFormat.None) ret.Session1Format = SessionFormat.Type00_CDROM_CDDA;
- if (!ret.LeadoutTimestamp.Valid) {
- //we're DOOMED. we cant know the length of the last track without this....
- }
+
+ //if (!ret.LeadoutTimestamp.Valid) {
+ // //we're DOOMED. we cant know the length of the last track without this....
+ //}
job.Result = ret;
}
}
@@ -112,13 +113,25 @@ namespace BizHawk.Emulation.DiscSystem
///
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.
+ /// A CD Reader could conceivably retrieve this.
+ ///
public EControlQ Control;
+
+ ///
+ /// The location of the track (Index 1)
+ ///
public Timestamp LBATimestamp;
///
- /// TODO - this is used for setting ADR to 1 or 0 for mednafen. maybe we need to track ADR separately? (CCD specifies it)
+ /// Whether this entry exists (since the table is 101 entries long always)
///
public bool Exists;
}
@@ -131,8 +144,8 @@ namespace BizHawk.Emulation.DiscSystem
public TOCItem[] TOCItems = new TOCItem[101];
///
- /// POINT=0xA2 specifies this
+ /// The timestamp of the leadout track. In other words, the end of the user area.
///
- public Timestamp LeadoutTimestamp = new Timestamp();
+ public Timestamp LeadoutTimestamp { get { return TOCItems[100].LBATimestamp; } }
}
}
\ No newline at end of file