diff --git a/BizHawk.Emulation.DiscSystem/DiscMountJob.MednaDisc.cs b/BizHawk.Emulation.DiscSystem/DiscMountJob.MednaDisc.cs index 1a9c3ce9c7..e055b262d3 100644 --- a/BizHawk.Emulation.DiscSystem/DiscMountJob.MednaDisc.cs +++ b/BizHawk.Emulation.DiscSystem/DiscMountJob.MednaDisc.cs @@ -41,19 +41,7 @@ namespace BizHawk.Emulation.DiscSystem //this is the sole sector synthesizer we'll need var synth = new SS_MednaDisc(); - - //make sector interfaces: - //1. mandatory track 1 pregap - for (int i = 0; i < 150; i++) - { - disc._Sectors.Add(synth); - } - - //2. actual sectors - for (int i = 0; i < nSectors; i++) - { - disc._Sectors.Add(synth); - } + OUT_Disc.SynthProvider = new SimpleSectorSynthProvider() { SS = synth }; //ADR (q-Mode) is necessarily 0x01 for a RawTOCEntry const int kADR = 1; diff --git a/BizHawk.Emulation.DiscSystem/DiscMountJob.cs b/BizHawk.Emulation.DiscSystem/DiscMountJob.cs index 556f5857ee..3d9bf0271e 100644 --- a/BizHawk.Emulation.DiscSystem/DiscMountJob.cs +++ b/BizHawk.Emulation.DiscSystem/DiscMountJob.cs @@ -65,14 +65,6 @@ namespace BizHawk.Emulation.DiscSystem { OUT_Disc.Name = Path.GetFileName(IN_FromPath); - //setup the lowest level synth provider - var sssp = new SimpleSectorSynthProvider() - { - Sectors = OUT_Disc._Sectors, - FirstLBA = -150 - }; - OUT_Disc.SynthProvider = sssp; - //generate toc and structure: //1. TOCRaw from RawTOCEntries var tocSynth = new Synthesize_DiscTOC_From_RawTOCEntries_Job() { Entries = OUT_Disc.RawTOCEntries }; @@ -84,13 +76,17 @@ namespace BizHawk.Emulation.DiscSystem OUT_Disc.Structure = structureSynth.Result; //insert a synth provider to take care of the leadout track - var ss_leadout = new SS_Leadout() + //currently, we let mednafen take care of its own leadout track (we'll make that controllable later) + if (IN_DiscInterface != DiscInterface.MednaDisc) { - SessionNumber = 1, - Policy = IN_DiscMountPolicy - }; - Func condition = (int lba) => lba >= OUT_Disc.Session1.LeadoutLBA; - new ConditionalSectorSynthProvider().Install(OUT_Disc, condition, ss_leadout); + var ss_leadout = new SS_Leadout() + { + SessionNumber = 1, + Policy = IN_DiscMountPolicy + }; + Func condition = (int lba) => lba >= OUT_Disc.Session1.LeadoutLBA; + new ConditionalSectorSynthProvider().Install(OUT_Disc, condition, ss_leadout); + } } FinishLog(); @@ -185,6 +181,14 @@ namespace BizHawk.Emulation.DiscSystem } DONE: ; + + //setup the lowest level synth provider + var sssp = new ArraySectorSynthProvider() + { + Sectors = OUT_Disc._Sectors, + FirstLBA = -150 + }; + OUT_Disc.SynthProvider = sssp; } } diff --git a/BizHawk.Emulation.DiscSystem/Internal/SectorSynth.cs b/BizHawk.Emulation.DiscSystem/Internal/SectorSynth.cs index 95e00c8c15..257bbe0275 100644 --- a/BizHawk.Emulation.DiscSystem/Internal/SectorSynth.cs +++ b/BizHawk.Emulation.DiscSystem/Internal/SectorSynth.cs @@ -125,7 +125,7 @@ namespace BizHawk.Emulation.DiscSystem /// /// an ISectorSynthProvider that just returns a value from an array of pre-made sectors /// - class SimpleSectorSynthProvider : ISectorSynthProvider + class ArraySectorSynthProvider : ISectorSynthProvider { public List Sectors = new List(); public int FirstLBA; @@ -137,6 +137,16 @@ namespace BizHawk.Emulation.DiscSystem } } + /// + /// an ISectorSynthProvider that just returns a fixed synthesizer + /// + class SimpleSectorSynthProvider : ISectorSynthProvider + { + public ISectorSynthJob2448 SS; + + public ISectorSynthJob2448 Get(int lba) { return SS; } + } + /// /// Returns 'Patch' synth if the provided condition is met ///