big discsys reorg.. move all API parts into Disc*-named files in root and hide more private stuff
This commit is contained in:
parent
e84d212cea
commit
41d5875baf
|
@ -50,54 +50,56 @@
|
|||
<Compile Include="..\Version\VersionInfo.cs">
|
||||
<Link>VersionInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="API\DiscExceptions.cs" />
|
||||
<Compile Include="API\DiscHasher.cs" />
|
||||
<Compile Include="API\DiscIdentifier.cs" />
|
||||
<Compile Include="API\DiscSectorReader.cs" />
|
||||
<Compile Include="API\DiscStream.cs" />
|
||||
<Compile Include="API\DiscStructure.cs" />
|
||||
<Compile Include="API\DiscTOC.cs" />
|
||||
<Compile Include="Blobs\Blob_ECM.cs" />
|
||||
<Compile Include="Blobs\Blob_RawFile.cs" />
|
||||
<Compile Include="Blobs\Blob_WaveFile.cs" />
|
||||
<Compile Include="Blobs\Blob_ZeroPadAdapter.cs" />
|
||||
<Compile Include="Blobs\IBlob.cs" />
|
||||
<Compile Include="Blobs\RiffMaster.cs" />
|
||||
<Compile Include="CCD_format.cs" />
|
||||
<Compile Include="cdfs\EndianBitConverter.cs" />
|
||||
<Compile Include="cdfs\ISODirectoryNode.cs" />
|
||||
<Compile Include="cdfs\ISOFile.cs" />
|
||||
<Compile Include="cdfs\ISOFileNode.cs" />
|
||||
<Compile Include="cdfs\ISONode.cs" />
|
||||
<Compile Include="cdfs\ISONodeRecord.cs" />
|
||||
<Compile Include="cdfs\ISOVolumeDescriptor.cs" />
|
||||
<Compile Include="CUE\CueFileResolver.cs" />
|
||||
<Compile Include="CUE\CUE_Compile.cs" />
|
||||
<Compile Include="CUE\CUE_Format.cs" />
|
||||
<Compile Include="CUE\CUE_Load.cs" />
|
||||
<Compile Include="CUE\CUE_Parse.cs" />
|
||||
<Compile Include="CUE\CUE_Synths.cs" />
|
||||
<Compile Include="Decoding.cs" />
|
||||
<Compile Include="API_MednaDisc.cs" />
|
||||
<Compile Include="CDFS\EndianBitConverter.cs" />
|
||||
<Compile Include="CDFS\ISODirectoryNode.cs" />
|
||||
<Compile Include="CDFS\ISOFile.cs" />
|
||||
<Compile Include="CDFS\ISOFileNode.cs" />
|
||||
<Compile Include="CDFS\ISONode.cs" />
|
||||
<Compile Include="CDFS\ISONodeRecord.cs" />
|
||||
<Compile Include="CDFS\ISOVolumeDescriptor.cs" />
|
||||
<Compile Include="Disc.cs" />
|
||||
<Compile Include="DiscDecoding.cs" />
|
||||
<Compile Include="DiscExceptions.cs" />
|
||||
<Compile Include="DiscFormats\Blobs\Blob_ECM.cs" />
|
||||
<Compile Include="DiscFormats\Blobs\Blob_RawFile.cs" />
|
||||
<Compile Include="DiscFormats\Blobs\Blob_WaveFile.cs" />
|
||||
<Compile Include="DiscFormats\Blobs\Blob_ZeroPadAdapter.cs" />
|
||||
<Compile Include="DiscFormats\Blobs\IBlob.cs" />
|
||||
<Compile Include="DiscFormats\Blobs\RiffMaster.cs" />
|
||||
<Compile Include="DiscFormats\CCD_format.cs" />
|
||||
<Compile Include="DiscFormats\CUE\CueFileResolver.cs" />
|
||||
<Compile Include="DiscFormats\CUE\CUE_Compile.cs" />
|
||||
<Compile Include="DiscFormats\CUE\CUE_Context.cs" />
|
||||
<Compile Include="DiscFormats\CUE\CUE_Load.cs" />
|
||||
<Compile Include="DiscFormats\CUE\CUE_Parse.cs" />
|
||||
<Compile Include="DiscFormats\CUE\CUE_Synths.cs" />
|
||||
<Compile Include="DiscFormats\M3U_file.cs" />
|
||||
<Compile Include="DiscFormats\SBI_format.cs" />
|
||||
<Compile Include="DiscFormats\TOC_format.cs" />
|
||||
<Compile Include="DiscHasher.cs" />
|
||||
<Compile Include="DiscIdentifier.cs" />
|
||||
<Compile Include="DiscJob.cs" />
|
||||
<Compile Include="DiscMountJob.cs" />
|
||||
<Compile Include="DiscMountJob.MednaDisc.cs" />
|
||||
<Compile Include="DiscMountPolicy.cs" />
|
||||
<Compile Include="DiscSectorReader.cs" />
|
||||
<Compile Include="DiscStream.cs" />
|
||||
<Compile Include="DiscStructure.cs" />
|
||||
<Compile Include="DiscSubQ.cs" />
|
||||
<Compile Include="DiscTOC.cs" />
|
||||
<Compile Include="DiscTypes.cs" />
|
||||
<Compile Include="DiscUtils.cs" />
|
||||
<Compile Include="ECM.cs" />
|
||||
<Compile Include="GPL_ECM.cs" />
|
||||
<Compile Include="Jobs\DiscMountJob.cs" />
|
||||
<Compile Include="Jobs\DiscMountJob.MednaDisc.cs" />
|
||||
<Compile Include="Jobs\LoadSBIJob.cs" />
|
||||
<Compile Include="Jobs\LoggedJob.cs" />
|
||||
<Compile Include="Jobs\Synthesize_A0A1A2_Job.cs" />
|
||||
<Compile Include="Jobs\Synthesize_DiscStructure_From_DiscTOC_Job.cs" />
|
||||
<Compile Include="Jobs\Synthesize_DiscTOC_From_RawTOCEntries_Job.cs" />
|
||||
<Compile Include="Jobs\Synthesize_Leadout_Job.cs" />
|
||||
<Compile Include="M3U_file.cs" />
|
||||
<Compile Include="MednaDiscAPI.cs" />
|
||||
<Compile Include="Internal\Algorithms\ECM.cs" />
|
||||
<Compile Include="Internal\Algorithms\GPL_ECM.cs" />
|
||||
<Compile Include="Internal\Algorithms\SubQ_CRC.cs" />
|
||||
<Compile Include="Internal\Jobs\LoadSBIJob.cs" />
|
||||
<Compile Include="Internal\Jobs\Synthesize_A0A1A2_Job.cs" />
|
||||
<Compile Include="Internal\Jobs\Synthesize_DiscStructure_From_DiscTOC_Job.cs" />
|
||||
<Compile Include="Internal\Jobs\Synthesize_DiscTOC_From_RawTOCEntries_Job.cs" />
|
||||
<Compile Include="Internal\Jobs\Synthesize_Leadout_Job.cs" />
|
||||
<Compile Include="Internal\SectorSynth.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SBI_format.cs" />
|
||||
<Compile Include="SectorInterfaces.cs" />
|
||||
<Compile Include="Subcode.cs" />
|
||||
<Compile Include="TOC_format.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BizHawk.Common\BizHawk.Common.csproj">
|
||||
|
@ -106,6 +108,7 @@
|
|||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="CDFS\origin.txt" />
|
||||
<Content Include="docs\notes.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
|
|
|
@ -120,7 +120,7 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
}
|
||||
}
|
||||
|
||||
internal class CompileCueJob : LoggedJob
|
||||
internal class CompileCueJob : DiscJob
|
||||
{
|
||||
/// <summary>
|
||||
/// input: the CueFile to analyze
|
|
@ -32,7 +32,7 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
/// For this job, virtually all nonsense input is treated as errors, but the process will try to recover as best it can.
|
||||
/// The user should still reject any jobs which generated errors
|
||||
/// </summary>
|
||||
internal class LoadCueJob : LoggedJob
|
||||
internal class LoadCueJob : DiscJob
|
||||
{
|
||||
/// <summary>
|
||||
/// The results of the compile job, a prerequisite for this
|
|
@ -14,7 +14,7 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
{
|
||||
partial class CUE_Context
|
||||
{
|
||||
public class ParseCueJob : LoggedJob
|
||||
public class ParseCueJob : DiscJob
|
||||
{
|
||||
/// <summary>
|
||||
/// input: the cue string to parse
|
|
@ -11,7 +11,7 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
/// Returns WARNINGS for things which will are irregular or erroneous but later jobs might be able to handle, or which can be worked around by configuration assumptions.
|
||||
/// TODO - make IDisposable so I don't have to remember to Finish() it?
|
||||
/// </summary>
|
||||
public class LoggedJob
|
||||
public class DiscJob
|
||||
{
|
||||
internal int CurrentLine = -1;
|
||||
|
||||
|
@ -49,7 +49,7 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
/// <summary>
|
||||
/// Concatenates the log results from the provided job into this log
|
||||
/// </summary>
|
||||
public void ConcatenateJobLog(LoggedJob job)
|
||||
public void ConcatenateJobLog(DiscJob job)
|
||||
{
|
||||
OUT_ErrorLevel |= job.OUT_ErrorLevel;
|
||||
swLog.Write(job.OUT_Log);
|
|
@ -6,47 +6,9 @@ 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.
|
||||
/// Could put caching policies here too (cached ecm calculations, etc.)
|
||||
/// </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_PregapContradictionModeA = true;
|
||||
|
||||
/// <summary>
|
||||
/// Mednafen sets mode2 pregap sectors as XA Form2 sectors.
|
||||
/// This is almost surely not right in every case.
|
||||
/// </summary>
|
||||
public bool CUE_PregapMode2_As_XA_Form2 = true;
|
||||
|
||||
/// <summary>
|
||||
/// Mednafen loads SBI files oddly
|
||||
/// </summary>
|
||||
public bool SBI_As_Mednafen = true;
|
||||
|
||||
public void SetForPSX()
|
||||
{
|
||||
CUE_PregapContradictionModeA = false;
|
||||
CUE_PregapMode2_As_XA_Form2 = true;
|
||||
SBI_As_Mednafen = true;
|
||||
}
|
||||
}
|
||||
|
||||
public partial class DiscMountJob : LoggedJob
|
||||
|
||||
public partial class DiscMountJob : DiscJob
|
||||
{
|
||||
/// <summary>
|
||||
/// The filename to be loaded
|
|
@ -0,0 +1,44 @@
|
|||
|
||||
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.
|
||||
/// Could put caching policies here too (cached ecm calculations, etc.)
|
||||
/// </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_PregapContradictionModeA = true;
|
||||
|
||||
/// <summary>
|
||||
/// Mednafen sets mode2 pregap sectors as XA Form2 sectors.
|
||||
/// This is almost surely not right in every case.
|
||||
/// </summary>
|
||||
public bool CUE_PregapMode2_As_XA_Form2 = true;
|
||||
|
||||
/// <summary>
|
||||
/// Mednafen loads SBI files oddly
|
||||
/// </summary>
|
||||
public bool SBI_As_Mednafen = true;
|
||||
|
||||
public void SetForPSX()
|
||||
{
|
||||
CUE_PregapContradictionModeA = false;
|
||||
CUE_PregapMode2_As_XA_Form2 = true;
|
||||
SBI_As_Mednafen = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -131,44 +131,5 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
/// </summary>
|
||||
public EControlQ CONTROL { get { return (EControlQ)((q_status >> 4) & 0xF); } }
|
||||
}
|
||||
|
||||
|
||||
//this has been checked against mednafen's and seems to match
|
||||
//there are a few dozen different ways to do CRC16-CCITT
|
||||
//this table is backwards or something. at any rate its tailored to the needs of the Q subchannel
|
||||
internal static class CRC16_CCITT
|
||||
{
|
||||
private static readonly ushort[] table = new ushort[256];
|
||||
|
||||
static CRC16_CCITT()
|
||||
{
|
||||
for (ushort i = 0; i < 256; ++i)
|
||||
{
|
||||
ushort value = 0;
|
||||
ushort temp = (ushort)(i << 8);
|
||||
for (byte j = 0; j < 8; ++j)
|
||||
{
|
||||
if (((value ^ temp) & 0x8000) != 0)
|
||||
value = (ushort)((value << 1) ^ 0x1021);
|
||||
else
|
||||
value <<= 1;
|
||||
temp <<= 1;
|
||||
}
|
||||
table[i] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static ushort Calculate(byte[] data, int offset, int length)
|
||||
{
|
||||
ushort Result = 0;
|
||||
for(int i=0;i<length;i++)
|
||||
{
|
||||
byte b = data[offset + i];
|
||||
int index = (b ^ ((Result >> 8) & 0xFF));
|
||||
Result = (ushort)((Result << 8) ^ table[index]);
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
namespace BizHawk.Emulation.DiscSystem
|
||||
{
|
||||
|
||||
//this has been checked against mednafen's and seems to match
|
||||
//there are a few dozen different ways to do CRC16-CCITT
|
||||
//this table is backwards or something. at any rate its tailored to the needs of the Q subchannel
|
||||
internal static class CRC16_CCITT
|
||||
{
|
||||
private static readonly ushort[] table = new ushort[256];
|
||||
|
||||
static CRC16_CCITT()
|
||||
{
|
||||
for (ushort i = 0; i < 256; ++i)
|
||||
{
|
||||
ushort value = 0;
|
||||
ushort temp = (ushort)(i << 8);
|
||||
for (byte j = 0; j < 8; ++j)
|
||||
{
|
||||
if (((value ^ temp) & 0x8000) != 0)
|
||||
value = (ushort)((value << 1) ^ 0x1021);
|
||||
else
|
||||
value <<= 1;
|
||||
temp <<= 1;
|
||||
}
|
||||
table[i] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static ushort Calculate(byte[] data, int offset, int length)
|
||||
{
|
||||
ushort Result = 0;
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
byte b = data[offset + i];
|
||||
int index = (b ^ ((Result >> 8) & 0xFF));
|
||||
Result = (ushort)((Result << 8) ^ table[index]);
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -10,7 +10,7 @@ namespace BizHawk.Emulation.DiscSystem.SBI
|
|||
/// <summary>
|
||||
/// Loads SBI files into an internal representation.
|
||||
/// </summary>
|
||||
public class LoadSBIJob : LoggedJob
|
||||
class LoadSBIJob : DiscJob
|
||||
{
|
||||
/// <summary>
|
||||
/// The file to be loaded
|
|
@ -12,7 +12,7 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
/// Synthesizes RawTCOEntry A0 A1 A2 from the provided information.
|
||||
/// This might be reused by formats other than CUE later, so it isn't directly associated with that
|
||||
/// </summary>
|
||||
public class Synthesize_A0A1A2_Job
|
||||
class Synthesize_A0A1A2_Job
|
||||
{
|
||||
/// <summary>
|
||||
/// "First Recorded Track Number" value for TOC (usually 1)
|
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||
|
||||
namespace BizHawk.Emulation.DiscSystem
|
||||
{
|
||||
public class Synthesize_DiscStructure_From_DiscTOC_Job
|
||||
class Synthesize_DiscStructure_From_DiscTOC_Job
|
||||
{
|
||||
public Disc IN_Disc;
|
||||
public DiscTOC TOCRaw;
|
|
@ -8,7 +8,7 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
/// When a disc drive firmware reads the lead-in area, it builds this TOC from finding q-mode 1 sectors in the Q subchannel of the lead-in area.
|
||||
/// Question: I guess it must ignore q-mode != 1? what else would it do with it?
|
||||
/// </summary>
|
||||
public class Synthesize_DiscTOC_From_RawTOCEntries_Job
|
||||
class Synthesize_DiscTOC_From_RawTOCEntries_Job
|
||||
{
|
||||
public IEnumerable<RawTOCEntry> Entries;
|
||||
public List<string> Log = new List<string>();
|
|
@ -13,7 +13,7 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
/// generates lead-out sectors according to very crude approximations
|
||||
/// TODO - this isnt being used right now
|
||||
/// </summary>
|
||||
public class Synthesize_LeadoutJob
|
||||
class Synthesize_LeadoutJob
|
||||
{
|
||||
public int Length;
|
||||
public Disc Disc;
|
|
@ -2,8 +2,6 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
//TODO - most of these sector interfaces are really only useful for CUEs, I guess. most other disc formats arent nearly as lame.. I think
|
||||
|
||||
namespace BizHawk.Emulation.DiscSystem
|
||||
{
|
||||
/// <summary>
|
Loading…
Reference in New Issue