From cad572262af677002dd90700336be880cf45b5a8 Mon Sep 17 00:00:00 2001 From: zeromus Date: Sun, 21 Dec 2014 23:32:39 +0000 Subject: [PATCH] disc - fix some disc loading bugs --- BizHawk.Emulation.DiscSystem/Disc.cs | 17 +++++++++++++---- BizHawk.Emulation.DiscSystem/Subcode.cs | 2 ++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/BizHawk.Emulation.DiscSystem/Disc.cs b/BizHawk.Emulation.DiscSystem/Disc.cs index acd7ec8f73..371f6d557d 100644 --- a/BizHawk.Emulation.DiscSystem/Disc.cs +++ b/BizHawk.Emulation.DiscSystem/Disc.cs @@ -261,6 +261,10 @@ FILE ""xarp.barp.marp.farp"" BINARY int aba = 0; int dpIndex = 0; + //TODO - from mednafen (on PC-FX chip chan kick) + //If we're more than 2 seconds(150 sectors) from the real "start" of the track/INDEX 01, and the track is a data track, + //and the preceding track is an audio track, encode it as audio(by taking the SubQ control field from the preceding + //NOTE: discs may have subcode which is nonsense or possibly not recoverable from a sensible disc structure. //but this function does what it says. @@ -272,18 +276,23 @@ FILE ""xarp.barp.marp.farp"" BINARY { if (dpIndex < Structure.Points.Count - 1) { - if (aba >= Structure.Points[dpIndex + 1].ABA) + while (aba >= Structure.Points[dpIndex + 1].ABA) { dpIndex++; } } var dp = Structure.Points[dpIndex]; + if (aba == 4903 + 150) + { + int zzz = 9; + } + var se = Sectors[aba]; EControlQ control = dp.Track.Control; bool pause = true; - if (dp.Num != 0) + if (dp.Num != 0) //TODO - shouldnt this be IndexNum? pause = false; if ((dp.Track.Control & EControlQ.DataUninterrupted)!=0) pause = false; @@ -294,8 +303,8 @@ FILE ""xarp.barp.marp.farp"" BINARY SubchannelQ sq = new SubchannelQ(); sq.q_status = SubchannelQ.ComputeStatus(adr, control); - sq.q_tno = (byte)dp.TrackNum; - sq.q_index = (byte)dp.IndexNum; + sq.q_tno = BCD2.FromDecimal(dp.TrackNum).BCDValue; + sq.q_index = BCD2.FromDecimal(dp.IndexNum).BCDValue; int track_relative_aba = aba - dp.Track.Indexes[1].aba; track_relative_aba = Math.Abs(track_relative_aba); diff --git a/BizHawk.Emulation.DiscSystem/Subcode.cs b/BizHawk.Emulation.DiscSystem/Subcode.cs index f7fc797fdb..5738902f54 100644 --- a/BizHawk.Emulation.DiscSystem/Subcode.cs +++ b/BizHawk.Emulation.DiscSystem/Subcode.cs @@ -134,12 +134,14 @@ namespace BizHawk.Emulation.DiscSystem { /// /// ADR and CONTROL + /// TODO - make BCD2? /// public byte q_status; /// /// normal track: BCD indications of the current track number /// leadin track: should be 0 + /// TODO - make BCD2? /// public byte q_tno;