add DiscMountPolicy to control discrepancies in generation of subQ between different disc interfaces.
This commit is contained in:
parent
910c745b03
commit
017397d91a
|
@ -214,18 +214,30 @@ namespace BizHawk.Client.DiscoHawk
|
|||
|
||||
if (infile == null)
|
||||
return;
|
||||
|
||||
var dmj = new DiscMountJob { IN_DiscInterface = loadDiscInterface, IN_FromPath = infile };
|
||||
dmj.Run();
|
||||
var disc = dmj.OUT_Disc;
|
||||
|
||||
if(hawk) {} //todo - write it out
|
||||
|
||||
|
||||
if (hawk)
|
||||
{
|
||||
//TODO - write it out
|
||||
var dmj = new DiscMountJob { IN_DiscInterface = loadDiscInterface, IN_FromPath = infile };
|
||||
dmj.Run();
|
||||
//var disc = dmj.OUT_Disc;
|
||||
}
|
||||
|
||||
StringWriter sw = new StringWriter();
|
||||
foreach (var cmpif in compareDiscInterfaces)
|
||||
{
|
||||
sw.WriteLine("BEGIN COMPARE: SRC {0} vs DST {1}", loadDiscInterface, cmpif);
|
||||
|
||||
//reload the original disc, with new policies as needed
|
||||
var dmj = new DiscMountJob { IN_DiscInterface = loadDiscInterface, IN_FromPath = infile };
|
||||
if (cmpif == DiscInterface.MednaDisc)
|
||||
{
|
||||
dmj.IN_DiscMountPolicy.CUE_PauseContradictionModeA = false;
|
||||
}
|
||||
dmj.Run();
|
||||
var disc = dmj.OUT_Disc;
|
||||
|
||||
var src_disc = disc;
|
||||
|
||||
var dst_dmj = new DiscMountJob { IN_DiscInterface = cmpif, IN_FromPath = infile };
|
||||
|
|
|
@ -123,6 +123,7 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
|
||||
/// <summary>
|
||||
/// The context used for this compiling job
|
||||
/// TODO - rename something like context
|
||||
/// </summary>
|
||||
public CUE_Format2 IN_CueFormat;
|
||||
|
||||
|
|
|
@ -14,5 +14,10 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
/// The CueFileResolver to be used by this instance
|
||||
/// </summary>
|
||||
public CueFileResolver Resolver;
|
||||
|
||||
/// <summary>
|
||||
/// The DiscMountPolicy to be applied to this context
|
||||
/// </summary>
|
||||
public DiscMountPolicy DiscMountPolicy;
|
||||
}
|
||||
}
|
|
@ -70,7 +70,6 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
void MountBlobs()
|
||||
{
|
||||
IBlob file_blob = null;
|
||||
long file_len = 0;
|
||||
|
||||
BlobInfos = new List<BlobInfo>();
|
||||
foreach (var ccf in IN_CompileJob.OUT_CompiledCueFiles)
|
||||
|
@ -173,6 +172,7 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
{
|
||||
//params
|
||||
var compiled = IN_CompileJob;
|
||||
var context = compiled.IN_CueFormat;
|
||||
OUT_Disc = new Disc();
|
||||
|
||||
//generation state
|
||||
|
@ -282,14 +282,17 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
sq.ap_frame = BCD2.FromDecimal(new Timestamp(LBA).FRAC);
|
||||
int track_relative_msf = curr_blobMSF - cct.Indexes[1].FileMSF.Sector;
|
||||
|
||||
//for index 0, negative MSF required and encoded oppositely.
|
||||
//for index 0, negative MSF required and encoded oppositely. Read more at Policies declaration
|
||||
if (curr_index == 0)
|
||||
{
|
||||
if (track_relative_msf >= 0) throw new InvalidOperationException("Severe error generating cue subQ (positive MSF for pregap)");
|
||||
if (!context.DiscMountPolicy.CUE_PauseContradictionModeA)
|
||||
track_relative_msf += 1;
|
||||
|
||||
if (track_relative_msf > 0) throw new InvalidOperationException("Severe error generating cue subQ (positive relMSF 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)");
|
||||
if (track_relative_msf < 0) throw new InvalidOperationException("Severe error generating cue subQ (negative relMSF for non-pregap)");
|
||||
|
||||
sq.min = BCD2.FromDecimal(new Timestamp(track_relative_msf).MIN);
|
||||
sq.sec = BCD2.FromDecimal(new Timestamp(track_relative_msf).SEC);
|
||||
|
|
|
@ -82,6 +82,12 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
|
||||
public partial class Disc : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// The DiscMountPolicy used to mount the disc. Consider this read-only.
|
||||
/// NOT SURE WE NEED THIS
|
||||
/// </summary>
|
||||
//public DiscMountPolicy DiscMountPolicy;
|
||||
|
||||
/// <summary>
|
||||
/// Free-form optional memos about the disc
|
||||
/// </summary>
|
||||
|
|
|
@ -6,6 +6,30 @@ using System.Collections.Generic;
|
|||
|
||||
namespace BizHawk.Emulation.DiscSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// General disc policies to be logically applied at mounting time. The choices are irreversible once a disc is loaded.
|
||||
/// Maybe these are only for CUEs, but maybe not. Not sure yet.
|
||||
/// </summary>
|
||||
public class DiscMountPolicy
|
||||
{
|
||||
/// <summary>
|
||||
/// "At the beginning of a Pause (i.e. Index = 00) the relative time is
|
||||
/// --A-- set to the duration of the Pause.
|
||||
/// During the Pause this relative time decreases and
|
||||
/// --B-- equals zero in the last Section"
|
||||
/// This is a contradiction.
|
||||
/// By choosing true, mode A is selected, and the final sector of the pause is -1. I like this better. Defaulting until proven otherwise (write test case here)
|
||||
/// By choosing false, mode B is selected, and the final sector of the pause is 0. Mednafen does it this way.
|
||||
/// Discs (including PSX) exist using A, or B, or possibly (reference please) neither.
|
||||
/// </summary>
|
||||
public bool CUE_PauseContradictionModeA = true;
|
||||
|
||||
public void SetForPlaystation()
|
||||
{
|
||||
//probably set CUE_PauseContradictionModeA to follow mednafen, but not proven yet
|
||||
}
|
||||
}
|
||||
|
||||
public partial class DiscMountJob : LoggedJob
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -19,6 +43,11 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
/// </summary>
|
||||
public int IN_SlowLoadAbortThreshold = 10;
|
||||
|
||||
/// <summary>
|
||||
/// Cryptic policies to be used when mounting the disc.
|
||||
/// </summary>
|
||||
public DiscMountPolicy IN_DiscMountPolicy = new DiscMountPolicy();
|
||||
|
||||
/// <summary>
|
||||
/// The interface to be used for loading the disc.
|
||||
/// Usually you'll want DiscInterface.BizHawk, but others can be used for A/B testing
|
||||
|
@ -74,6 +103,7 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
//perhaps the CUE_Format2 (once renamed to something like Context) can handle that
|
||||
var cuePath = IN_FromPath;
|
||||
var cue2 = new CUE_Format2();
|
||||
cue2.DiscMountPolicy = IN_DiscMountPolicy;
|
||||
|
||||
cue2.Resolver = cfr;
|
||||
if (!cfr.IsHardcodedResolve) cfr.SetBaseDirectory(Path.GetDirectoryName(infile));
|
||||
|
@ -90,7 +120,7 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
//compile the cue file:
|
||||
//includes this work: resolve required bin files and find out what it's gonna take to load the cue
|
||||
var compileJob = new CUE_Format2.CompileCueJob();
|
||||
compileJob.IN_CueFormat = new CUE_Format2() { Resolver = cfr };
|
||||
compileJob.IN_CueFormat = cue2;
|
||||
compileJob.IN_CueFile = parseJob.OUT_CueFile;
|
||||
compileJob.Run();
|
||||
if (compileJob.OUT_Log != "") Console.WriteLine(compileJob.OUT_Log);
|
||||
|
@ -111,6 +141,7 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
ConcatenateJobLog(loadJob);
|
||||
|
||||
OUT_Disc = loadJob.OUT_Disc;
|
||||
//OUT_Disc.DiscMountPolicy = IN_DiscMountPolicy; //NOT SURE WE NEED THIS
|
||||
|
||||
//apply SBI if it exists (TODO - for formats other than cue?)
|
||||
var sbiPath = Path.ChangeExtension(IN_FromPath, ".sbi");
|
||||
|
|
Loading…
Reference in New Issue