do a bad job supporting header synthesis for different sector modes

This commit is contained in:
zeromus 2015-07-01 06:34:37 -05:00
parent 5713346580
commit c5d7fda22f
2 changed files with 26 additions and 15 deletions

View File

@ -229,10 +229,12 @@ namespace BizHawk.Emulation.DiscSystem
for (; ; )
{
bool trackDone = false;
bool generateGap = false;
if (specifiedPregapLength > 0)
{
//if burning through a specified pregap, count it down
generateGap = true;
specifiedPregapLength--;
}
else
@ -255,20 +257,16 @@ namespace BizHawk.Emulation.DiscSystem
}
}
//generate a sector:
SS_Base ss = null;
//if we're in a pregap, setup subQ and gap type depending on tracktype
EControlQ qFlags = (EControlQ)(int)cct.Flags;
int qRelMSF = relMSF;
bool audioGap = true;
if (curr_index == 0)
{
//generating pregap:
//tweak relMSF due to ambiguity/contradiction in yellowbook docs
if (!context.DiscMountPolicy.CUE_PregapContradictionModeA)
qRelMSF++;
bool audioGap = true;
//normally the gap takes this track's type
if (cct.TrackType != CueFile.TrackType.Audio) audioGap = false;
@ -285,27 +283,39 @@ namespace BizHawk.Emulation.DiscSystem
audioGap = true;
}
}
if(audioGap) ss = new SS_AudioGap(); else ss = new SS_DataGap();
}
SS_Base ss = null;
if (generateGap)
{
if (audioGap) ss = new SS_AudioGap(); else ss = new SS_DataGap();
}
else
{
//generating normal index 1+ sector
switch (cct.TrackType)
{
case CueFile.TrackType.Mode1_2048:
ss = new SS_Mode1_2048() { Blob = curr_blobInfo.Blob, BlobOffset = curr_blobOffset };
curr_blobOffset += 2048;
case CueFile.TrackType.Audio:
ss = new SS_2352() { Blob = curr_blobInfo.Blob, BlobOffset = curr_blobOffset, Mode = 0 };
curr_blobOffset += 2352;
break;
case CueFile.TrackType.CDI_2352:
case CueFile.TrackType.Mode1_2352:
case CueFile.TrackType.Mode2_2352:
case CueFile.TrackType.Audio:
ss = new SS_2352() { Blob = curr_blobInfo.Blob, BlobOffset = curr_blobOffset };
ss = new SS_2352() { Blob = curr_blobInfo.Blob, BlobOffset = curr_blobOffset, Mode = 1 };
curr_blobOffset += 2352;
break;
case CueFile.TrackType.Mode2_2352:
ss = new SS_2352() { Blob = curr_blobInfo.Blob, BlobOffset = curr_blobOffset, Mode = 2 };
curr_blobOffset += 2352;
break;
case CueFile.TrackType.Mode1_2048:
ss = new SS_Mode1_2048() { Blob = curr_blobInfo.Blob, BlobOffset = curr_blobOffset, Mode = 1 };
curr_blobOffset += 2048;
break;
default:
case CueFile.TrackType.Mode2_2336:
throw new InvalidOperationException("Not supported: " + cct.TrackType);

View File

@ -13,6 +13,7 @@ namespace BizHawk.Emulation.DiscSystem
public long BlobOffset;
public SubchannelQ sq;
public bool Pause;
public byte Mode;
public abstract void Synth(SectorSynthJob job);
@ -96,7 +97,7 @@ namespace BizHawk.Emulation.DiscSystem
Blob.Read(BlobOffset, job.DestBuffer2448, job.DestOffset + 16, 2048);
if ((job.Parts & ESectorSynthPart.Header16) != 0)
SynthUtils.SectorHeader(job.DestBuffer2448, job.DestOffset + 0, job.LBA, 1);
SynthUtils.SectorHeader(job.DestBuffer2448, job.DestOffset + 0, job.LBA, Mode);
if ((job.Parts & ESectorSynthPart.ECMAny) != 0)
SynthUtils.ECM_Mode1(job.DestBuffer2448, job.DestOffset + 0, job.LBA);