a little bit of cue subP synthesis

This commit is contained in:
zeromus 2015-07-01 03:34:25 -05:00
parent 8d9f8daf61
commit 910c745b03
2 changed files with 27 additions and 9 deletions

View File

@ -205,16 +205,19 @@ namespace BizHawk.Emulation.DiscSystem
int totalPregapLength = specifiedPregapLength + impliedPregapLength; int totalPregapLength = specifiedPregapLength + impliedPregapLength;
for (int s = 0; s < specifiedPregapLength; s++) for (int s = 0; s < specifiedPregapLength; s++)
{ {
//TODO - do a better job synthesizing //TODO - do a better job synthesizing Q
var zero_sector = new Sector_Zero(); var se_pregap = new SectorEntry(null);
var zero_subSector = new ZeroSubcodeSector(); var ss_pregap = new SS_Pregap();
var se_pregap = new SectorEntry(zero_sector);
se_pregap.SubcodeSector = zero_subSector; //pregaps set pause flag
se_pregap.SectorSynth = new SS_Mode1_2048(); //TODO - do a better job synthesizing P
ss_pregap.Pause = true;
se_pregap.SectorSynth = ss_pregap;
OUT_Disc.Sectors.Add(se_pregap); OUT_Disc.Sectors.Add(se_pregap);
} }
//after this, pregap sectors are generated like a normal sector, but the subQ is specified as a pregap instead of a normal track //after this, pregap sectors are generated like a normal sector, but the subQ is specified as a pregap instead of a normal track (actually, TBD)
//--------------------------------- //---------------------------------
@ -278,12 +281,26 @@ namespace BizHawk.Emulation.DiscSystem
sq.ap_sec = BCD2.FromDecimal(new Timestamp(LBA).SEC); sq.ap_sec = BCD2.FromDecimal(new Timestamp(LBA).SEC);
sq.ap_frame = BCD2.FromDecimal(new Timestamp(LBA).FRAC); sq.ap_frame = BCD2.FromDecimal(new Timestamp(LBA).FRAC);
int track_relative_msf = curr_blobMSF - cct.Indexes[1].FileMSF.Sector; int track_relative_msf = curr_blobMSF - cct.Indexes[1].FileMSF.Sector;
//for index 0, negative MSF required and encoded oppositely.
if (curr_index == 0)
{
if (track_relative_msf >= 0) throw new InvalidOperationException("Severe error generating cue subQ (positive MSF for pregap)");
track_relative_msf = -track_relative_msf;
}
else
if (track_relative_msf < 0) throw new InvalidOperationException("Severe error generating cue subQ (negative MSF for non-pregap)");
sq.min = BCD2.FromDecimal(new Timestamp(track_relative_msf).MIN); sq.min = BCD2.FromDecimal(new Timestamp(track_relative_msf).MIN);
sq.sec = BCD2.FromDecimal(new Timestamp(track_relative_msf).SEC); sq.sec = BCD2.FromDecimal(new Timestamp(track_relative_msf).SEC);
sq.frame = BCD2.FromDecimal(new Timestamp(track_relative_msf).FRAC); sq.frame = BCD2.FromDecimal(new Timestamp(track_relative_msf).FRAC);
//finally we're done: synthesize subchannel //finally we're done: synthesize subchannel
subcode.Synthesize_SubchannelQ(ref sq, true); subcode.Synthesize_SubchannelQ(ref sq, true);
//generate subP
if (curr_index == 0)
ss.Pause = true;
//make the SectorEntry (some temporary bullshit here) //make the SectorEntry (some temporary bullshit here)
var se = new SectorEntry(null); var se = new SectorEntry(null);
se.SectorSynth = ss; se.SectorSynth = ss;

View File

@ -11,6 +11,7 @@ namespace BizHawk.Emulation.DiscSystem
public IBlob Blob; public IBlob Blob;
public long BlobOffset; public long BlobOffset;
public SubchannelQ sq; public SubchannelQ sq;
public bool Pause;
public abstract void Synth(SectorSynthJob job); public abstract void Synth(SectorSynthJob job);
} }
@ -43,7 +44,7 @@ namespace BizHawk.Emulation.DiscSystem
{ {
if ((job.Parts & ESectorSynthPart.SubchannelP) != 0) if ((job.Parts & ESectorSynthPart.SubchannelP) != 0)
{ {
SubSynth.P(job.DestBuffer2448, job.DestOffset + 2352, false); //for now.... SubSynth.P(job.DestBuffer2448, job.DestOffset + 2352, Pause);
} }
if ((job.Parts & ESectorSynthPart.SubchannelQ) != 0) if ((job.Parts & ESectorSynthPart.SubchannelQ) != 0)
@ -69,7 +70,7 @@ namespace BizHawk.Emulation.DiscSystem
if ((job.Parts & ESectorSynthPart.SubchannelP) != 0) if ((job.Parts & ESectorSynthPart.SubchannelP) != 0)
{ {
SubSynth.P(job.DestBuffer2448, job.DestOffset + 2352, false); //for now.... SubSynth.P(job.DestBuffer2448, job.DestOffset + 2352, Pause); //for now....
} }
if ((job.Parts & ESectorSynthPart.SubchannelQ) != 0) if ((job.Parts & ESectorSynthPart.SubchannelQ) != 0)