예제 #1
0
        public void Synth(SectorSynthJob job)
        {
            //be lazy, just generate the whole sector unconditionally
            //this is mostly based on mednafen's approach, which was probably finely tailored for PSX
            //heres the comments on the subject:
            //  I'm not trusting that the "control" field for the TOC leadout entry will always be set properly, so | the control fields for the last track entry
            //  and the leadout entry together before extracting the D2 bit.  Audio track->data leadout is fairly benign though maybe noisy(especially if we ever implement
            //  data scrambling properly), but data track->audio leadout could break things in an insidious manner for the more accurate drive emulation code).

            var ses          = job.Disc.Structure.Sessions[SessionNumber];
            int lba_relative = job.LBA - ses.LeadoutTrack.LBA;

            //data is zero

            int ts  = lba_relative;
            int ats = job.LBA;

            const int ADR     = 0x1;         // Q channel data encodes position
            EControlQ control = ses.LeadoutTrack.Control;

            //ehhh? CDI?
            //if(toc.tracks[toc.last_track].valid)
            // control |= toc.tracks[toc.last_track].control & 0x4;
            //else if(toc.disc_type == DISC_TYPE_CD_I)
            // control |= 0x4;
            control |= (EControlQ)(((int)ses.LastInformationTrack.Control) & 4);

            SubchannelQ sq = new SubchannelQ();

            sq.SetStatus(ADR, control);
            sq.q_tno.BCDValue   = 0xAA;
            sq.q_index.BCDValue = 0x01;
            sq.Timestamp        = ts;
            sq.AP_Timestamp     = ats;
            sq.zero             = 0;

            //finally, rely on a gap sector to do the heavy lifting to synthesize this
            CUE.CueTrackType TrackType = CUE.CueTrackType.Audio;
            if (ses.LeadoutTrack.IsData)
            {
                if (job.Disc.TOC.Session1Format == SessionFormat.Type20_CDXA || job.Disc.TOC.Session1Format == SessionFormat.Type10_CDI)
                {
                    TrackType = CUE.CueTrackType.Mode2_2352;
                }
                else
                {
                    TrackType = CUE.CueTrackType.Mode1_2352;
                }
            }

            CUE.SS_Gap ss_gap = new CUE.SS_Gap()
            {
                Policy    = Policy,
                sq        = sq,
                TrackType = TrackType,
                Pause     = true             //?
            };

            ss_gap.Synth(job);
        }
예제 #2
0
            public void Synth(SectorSynthJob job)
            {
                //CCD is always containing everything we'd need (unless a .sub is missing?) so don't worry about flags
                var imgBlob = job.Disc.DisposableResources[0] as IBlob;
                var subBlob = job.Disc.DisposableResources[1] as IBlob;

                //Read_2442(job.LBA, job.DestBuffer2448, job.DestOffset);

                //read the IMG data if needed
                if ((job.Parts & ESectorSynthPart.UserAny) != 0)
                {
                    long ofs = job.LBA * 2352;
                    imgBlob.Read(ofs, job.DestBuffer2448, 0, 2352);
                }

                //if subcode is needed, read it
                if ((job.Parts & (ESectorSynthPart.SubcodeAny)) != 0)
                {
                    long ofs = job.LBA * 96;
                    subBlob.Read(ofs, job.DestBuffer2448, 2352, 96);

                    //subcode comes to us deinterleved; we may still need to interleave it
                    if ((job.Parts & (ESectorSynthPart.SubcodeDeinterleave)) == 0)
                    {
                        SynthUtils.InterleaveSubcodeInplace(job.DestBuffer2448, job.DestOffset + 2352);
                    }
                }
            }
예제 #3
0
			public void Synth(SectorSynthJob job)
			{
				//mednafen is always synthesizing everything, no need to worry about flags.. mostly./
				job.Params.MednaDisc.Read_2442(job.LBA, job.DestBuffer2448, job.DestOffset);
				
				//we may still need to deinterleave it if subcode was requested and it needs deinterleaving
				if ((job.Parts & (ESectorSynthPart.SubcodeDeinterleave | ESectorSynthPart.SubcodeAny)) != 0)
				{
					SynthUtils.DeinterleaveSubcodeInplace(job.DestBuffer2448, 2352);
				}
			}
            public void Synth(SectorSynthJob job)
            {
                //mednafen is always synthesizing everything, no need to worry about flags.. mostly./
                job.Params.MednaDisc.Read_2442(job.LBA, job.DestBuffer2448, job.DestOffset);

                //we may still need to deinterleave it if subcode was requested and it needs deinterleaving
                if ((job.Parts & (ESectorSynthPart.SubcodeDeinterleave | ESectorSynthPart.SubcodeAny)) != 0)
                {
                    SynthUtils.DeinterleaveSubcodeInplace(job.DestBuffer2448, 2352);
                }
            }
        public void Synth(SectorSynthJob job)
        {
            Original.Synth(job);

            if ((job.Parts & ESectorSynthPart.SubchannelQ) == 0)
            {
                return;
            }

            //apply patched subQ
            for (int i = 0; i < 12; i++)
            {
                job.DestBuffer2448[2352 + 12 + i] = Buffer_SubQ[i];
            }
        }
예제 #6
0
        public void Synth(SectorSynthJob job)
        {
            Original.Synth(job);

            if ((job.Parts & ESectorSynthPart.SubchannelQ) == 0)
                return;

            //apply patched subQ
            for (int i = 0; i < 12; i++)
                job.DestBuffer2448[2352 + 12 + i] = Buffer_SubQ[i];
        }
예제 #7
0
        public void Synth(SectorSynthJob job)
        {
            //be lazy, just generate the whole sector unconditionally
            //this is mostly based on mednafen's approach, which was probably finely tailored for PSX
            //heres the comments on the subject:
            //  I'm not trusting that the "control" field for the TOC leadout entry will always be set properly, so | the control fields for the last track entry
            //  and the leadout entry together before extracting the D2 bit.  Audio track->data leadout is fairly benign though maybe noisy(especially if we ever implement
            //  data scrambling properly), but data track->audio leadout could break things in an insidious manner for the more accurate drive emulation code).

            var ses = job.Disc.Structure.Sessions[SessionNumber];
            int lba_relative = job.LBA - ses.LeadoutTrack.LBA;

            //data is zero

            int ts = lba_relative;
            int ats = job.LBA;

            const int ADR = 0x1; // Q channel data encodes position
            EControlQ control = ses.LeadoutTrack.Control;

            //ehhh? CDI?
             //if(toc.tracks[toc.last_track].valid)
             // control |= toc.tracks[toc.last_track].control & 0x4;
             //else if(toc.disc_type == DISC_TYPE_CD_I)
             // control |= 0x4;
            control |= (EControlQ)(((int)ses.LastInformationTrack.Control) & 4);

            SubchannelQ sq = new SubchannelQ();
            sq.SetStatus(ADR, control);
            sq.q_tno.BCDValue = 0xAA;
            sq.q_index.BCDValue = 0x01;
            sq.Timestamp = ts;
            sq.AP_Timestamp = ats;
            sq.zero = 0;

            //finally, rely on a gap sector to do the heavy lifting to synthesize this
            CUE.CueTrackType TrackType = CUE.CueTrackType.Audio;
            if (ses.LeadoutTrack.IsData)
            {
                if (job.Disc.TOC.Session1Format == SessionFormat.Type20_CDXA || job.Disc.TOC.Session1Format == SessionFormat.Type10_CDI)
                    TrackType = CUE.CueTrackType.Mode2_2352;
                else
                    TrackType = CUE.CueTrackType.Mode1_2352;
            }

            CUE.SS_Gap ss_gap = new CUE.SS_Gap()
            {
                Policy = Policy,
                sq = sq,
                TrackType = TrackType,
                Pause = true //?
            };

            ss_gap.Synth(job);
        }