Use explicit visibility modifiers in DiscSystem
This commit is contained in:
parent
0706b96afe
commit
ae22cd9f1b
|
@ -31,13 +31,13 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
//leave the disc open until this is disposed so we can read sectors from it
|
//leave the disc open until this is disposed so we can read sectors from it
|
||||||
}
|
}
|
||||||
|
|
||||||
IntPtr handle;
|
private IntPtr handle;
|
||||||
|
|
||||||
public MednadiscTOC TOC;
|
public MednadiscTOC TOC;
|
||||||
public MednadiscTOCTrack[] TOCTracks;
|
public MednadiscTOCTrack[] TOCTracks;
|
||||||
|
|
||||||
[ThreadStatic] static byte[] buf2442 = new byte[2448];
|
[ThreadStatic] private static byte[] buf2442 = new byte[2448];
|
||||||
[ThreadStatic] static byte[] buf96 = new byte[96];
|
[ThreadStatic] private static byte[] buf96 = new byte[96];
|
||||||
|
|
||||||
|
|
||||||
public void Read_2442(int LBA, byte[] buffer, int offset)
|
public void Read_2442(int LBA, byte[] buffer, int offset)
|
||||||
|
@ -91,7 +91,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void CheckLibrary()
|
private static void CheckLibrary()
|
||||||
{
|
{
|
||||||
var lib = OSTailoredCode.LinkedLibManager.LoadOrZero("mednadisc.dll");
|
var lib = OSTailoredCode.LinkedLibManager.LoadOrZero("mednadisc.dll");
|
||||||
_IsLibraryAvailable = lib != IntPtr.Zero
|
_IsLibraryAvailable = lib != IntPtr.Zero
|
||||||
|
@ -104,7 +104,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
CheckLibrary();
|
CheckLibrary();
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool _IsLibraryAvailable;
|
private static bool _IsLibraryAvailable;
|
||||||
public static bool IsLibraryAvailable => _IsLibraryAvailable;
|
public static bool IsLibraryAvailable => _IsLibraryAvailable;
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
|
|
||||||
//note: accepts . or : in the stream stream/substream separator in the stream ID format, since that changed at some point in FFMPEG history
|
//note: accepts . or : in the stream stream/substream separator in the stream ID format, since that changed at some point in FFMPEG history
|
||||||
//if someone has a better idea how to make the determination of whether an audio stream is available, I'm all ears
|
//if someone has a better idea how to make the determination of whether an audio stream is available, I'm all ears
|
||||||
static readonly Regex rxHasAudio = new Regex(@"Stream \#(\d*(\.|\:)\d*)\: Audio", RegexOptions.Compiled);
|
private static readonly Regex rxHasAudio = new Regex(@"Stream \#(\d*(\.|\:)\d*)\: Audio", RegexOptions.Compiled);
|
||||||
public AudioQueryResult QueryAudio(string path)
|
public AudioQueryResult QueryAudio(string path)
|
||||||
{
|
{
|
||||||
var ret = new AudioQueryResult();
|
var ret = new AudioQueryResult();
|
||||||
|
@ -106,7 +106,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class AudioDecoder
|
internal class AudioDecoder
|
||||||
{
|
{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class AudioDecoder_Exception : Exception
|
public class AudioDecoder_Exception : Exception
|
||||||
|
@ -121,7 +121,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CheckForAudio(string path)
|
private bool CheckForAudio(string path)
|
||||||
{
|
{
|
||||||
FFMpeg ffmpeg = new FFMpeg();
|
FFMpeg ffmpeg = new FFMpeg();
|
||||||
var qa = ffmpeg.QueryAudio(path);
|
var qa = ffmpeg.QueryAudio(path);
|
||||||
|
@ -132,7 +132,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
/// finds audio at a path similar to the provided path (i.e. finds Track01.mp3 for Track01.wav)
|
/// finds audio at a path similar to the provided path (i.e. finds Track01.mp3 for Track01.wav)
|
||||||
/// TODO - isnt this redundant with CueFileResolver?
|
/// TODO - isnt this redundant with CueFileResolver?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string FindAudio(string audioPath)
|
private string FindAudio(string audioPath)
|
||||||
{
|
{
|
||||||
string basePath = Path.GetFileNameWithoutExtension(audioPath);
|
string basePath = Path.GetFileNameWithoutExtension(audioPath);
|
||||||
//look for potential candidates
|
//look for potential candidates
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
{
|
{
|
||||||
internal class Blob_ECM : IBlob
|
internal class Blob_ECM : IBlob
|
||||||
{
|
{
|
||||||
FileStream stream;
|
private FileStream stream;
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
|
@ -61,7 +61,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// the ECMfile-provided EDC integrity checksum. not being used right now
|
/// the ECMfile-provided EDC integrity checksum. not being used right now
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int EDC;
|
private int EDC;
|
||||||
|
|
||||||
public long Length;
|
public long Length;
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
Length = logOffset;
|
Length = logOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MisformedException()
|
private void MisformedException()
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Mis-formed ECM file");
|
throw new InvalidOperationException("Mis-formed ECM file");
|
||||||
}
|
}
|
||||||
|
@ -166,7 +166,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// finds the IndexEntry for the specified logical offset
|
/// finds the IndexEntry for the specified logical offset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int FindInIndex(long offset, int LastReadIndex)
|
private int FindInIndex(long offset, int LastReadIndex)
|
||||||
{
|
{
|
||||||
//try to avoid searching the index. check the last index we we used.
|
//try to avoid searching the index. check the last index we we used.
|
||||||
for(int i=0;i<2;i++) //try 2 times
|
for(int i=0;i<2;i++) //try 2 times
|
||||||
|
@ -201,7 +201,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
return listIndex;
|
return listIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Reconstruct(byte[] secbuf, int type)
|
private void Reconstruct(byte[] secbuf, int type)
|
||||||
{
|
{
|
||||||
//sync
|
//sync
|
||||||
secbuf[0] = 0;
|
secbuf[0] = 0;
|
||||||
|
@ -250,8 +250,8 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
}
|
}
|
||||||
|
|
||||||
//we don't want to keep churning through this many big byte arrays while reading stuff, so we save a sector cache.
|
//we don't want to keep churning through this many big byte arrays while reading stuff, so we save a sector cache.
|
||||||
readonly byte[] Read_SectorBuf = new byte[2352];
|
private readonly byte[] Read_SectorBuf = new byte[2352];
|
||||||
int Read_LastIndex = 0;
|
private int Read_LastIndex = 0;
|
||||||
|
|
||||||
public int Read(long byte_pos, byte[] buffer, int offset, int _count)
|
public int Read(long byte_pos, byte[] buffer, int offset, int _count)
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,12 +15,13 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
length = new FileInfo(physicalPath).Length;
|
length = new FileInfo(physicalPath).Length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
string physicalPath;
|
|
||||||
long length;
|
private string physicalPath;
|
||||||
|
private long length;
|
||||||
|
|
||||||
public long Offset = 0;
|
public long Offset = 0;
|
||||||
|
|
||||||
BufferedStream fs;
|
private BufferedStream fs;
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
if (fs != null)
|
if (fs != null)
|
||||||
|
|
|
@ -36,12 +36,13 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
length = new FileInfo(physicalPath).Length;
|
length = new FileInfo(physicalPath).Length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
string physicalPath;
|
|
||||||
long length;
|
private string physicalPath;
|
||||||
|
private long length;
|
||||||
|
|
||||||
public long Offset = 0;
|
public long Offset = 0;
|
||||||
|
|
||||||
BufferedStream fs;
|
private BufferedStream fs;
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
if (fs != null)
|
if (fs != null)
|
||||||
|
@ -132,9 +133,9 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
return RiffSource.BaseStream.Read(buffer, offset, count);
|
return RiffSource.BaseStream.Read(buffer, offset, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
RiffMaster RiffSource;
|
private RiffMaster RiffSource;
|
||||||
long waveDataStreamPos;
|
private long waveDataStreamPos;
|
||||||
long mDataLength;
|
private long mDataLength;
|
||||||
public long Length => mDataLength;
|
public long Length => mDataLength;
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
|
|
@ -8,8 +8,8 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
{
|
{
|
||||||
internal sealed class Blob_ZeroPadAdapter : IBlob
|
internal sealed class Blob_ZeroPadAdapter : IBlob
|
||||||
{
|
{
|
||||||
IBlob srcBlob;
|
private IBlob srcBlob;
|
||||||
long srcBlobLength;
|
private long srcBlobLength;
|
||||||
public Blob_ZeroPadAdapter(IBlob srcBlob, long srcBlobLength)
|
public Blob_ZeroPadAdapter(IBlob srcBlob, long srcBlobLength)
|
||||||
{
|
{
|
||||||
this.srcBlob = srcBlob;
|
this.srcBlob = srcBlob;
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
/// Please be sure to test round-tripping when you make any changes. This architecture is a bit tricky to use, but it works if you're careful.
|
/// Please be sure to test round-tripping when you make any changes. This architecture is a bit tricky to use, but it works if you're careful.
|
||||||
/// TODO - clarify stream disposing semantics
|
/// TODO - clarify stream disposing semantics
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class RiffMaster : IDisposable
|
internal class RiffMaster : IDisposable
|
||||||
{
|
{
|
||||||
public RiffMaster() { }
|
public RiffMaster() { }
|
||||||
|
|
||||||
|
@ -152,7 +152,8 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
Flush();
|
Flush();
|
||||||
base.WriteStream(s);
|
base.WriteStream(s);
|
||||||
}
|
}
|
||||||
void Flush()
|
|
||||||
|
private void Flush()
|
||||||
{
|
{
|
||||||
MemoryStream ms = new MemoryStream();
|
MemoryStream ms = new MemoryStream();
|
||||||
BinaryWriter bw = new BinaryWriter(ms);
|
BinaryWriter bw = new BinaryWriter(ms);
|
||||||
|
|
|
@ -158,7 +158,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
public CCDParseException(string message) : base(message) { }
|
public CCDParseException(string message) : base(message) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
class CCDSection : Dictionary<string,int>
|
private class CCDSection : Dictionary<string,int>
|
||||||
{
|
{
|
||||||
public string Name;
|
public string Name;
|
||||||
public int FetchOrDefault(int def, string key)
|
public int FetchOrDefault(int def, string key)
|
||||||
|
@ -176,7 +176,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<CCDSection> ParseSections(Stream stream)
|
private List<CCDSection> ParseSections(Stream stream)
|
||||||
{
|
{
|
||||||
List<CCDSection> sections = new List<CCDSection>();
|
List<CCDSection> sections = new List<CCDSection>();
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
return sections;
|
return sections;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PreParseIntegrityCheck(List<CCDSection> sections)
|
private int PreParseIntegrityCheck(List<CCDSection> sections)
|
||||||
{
|
{
|
||||||
if (sections.Count == 0) throw new CCDParseException("Malformed CCD format: no sections");
|
if (sections.Count == 0) throw new CCDParseException("Malformed CCD format: no sections");
|
||||||
|
|
||||||
|
@ -438,7 +438,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class SS_CCD : ISectorSynthJob2448
|
private class SS_CCD : ISectorSynthJob2448
|
||||||
{
|
{
|
||||||
public void Synth(SectorSynthJob job)
|
public void Synth(SectorSynthJob job)
|
||||||
{
|
{
|
||||||
|
|
|
@ -160,14 +160,14 @@ namespace BizHawk.Emulation.DiscSystem.CUE
|
||||||
|
|
||||||
//-----------------------------------------------------------------
|
//-----------------------------------------------------------------
|
||||||
|
|
||||||
CompiledCDText curr_cdtext;
|
private CompiledCDText curr_cdtext;
|
||||||
int curr_blobIndex = -1;
|
private int curr_blobIndex = -1;
|
||||||
CompiledCueTrack curr_track = null;
|
private CompiledCueTrack curr_track = null;
|
||||||
CompiledCueFile curr_file = null;
|
private CompiledCueFile curr_file = null;
|
||||||
bool discinfo_session1Format_determined = false;
|
private bool discinfo_session1Format_determined = false;
|
||||||
bool curr_fileHasTrack = false;
|
private bool curr_fileHasTrack = false;
|
||||||
|
|
||||||
void UpdateDiscInfo(CUE_File.Command.TRACK trackCommand)
|
private void UpdateDiscInfo(CUE_File.Command.TRACK trackCommand)
|
||||||
{
|
{
|
||||||
if (OUT_CompiledDiscInfo.FirstRecordedTrackNumber == 0)
|
if (OUT_CompiledDiscInfo.FirstRecordedTrackNumber == 0)
|
||||||
OUT_CompiledDiscInfo.FirstRecordedTrackNumber = trackCommand.Number;
|
OUT_CompiledDiscInfo.FirstRecordedTrackNumber = trackCommand.Number;
|
||||||
|
@ -194,7 +194,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CloseFile()
|
private void CloseFile()
|
||||||
{
|
{
|
||||||
if (curr_track != null)
|
if (curr_track != null)
|
||||||
{
|
{
|
||||||
|
@ -205,7 +205,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE
|
||||||
curr_file = null;
|
curr_file = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenFile(CUE_File.Command.FILE f)
|
private void OpenFile(CUE_File.Command.FILE f)
|
||||||
{
|
{
|
||||||
if (curr_file != null)
|
if (curr_file != null)
|
||||||
CloseFile();
|
CloseFile();
|
||||||
|
@ -284,7 +284,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE
|
||||||
//TODO - check for mismatches between track types and file types, or is that best done when interpreting the commands?
|
//TODO - check for mismatches between track types and file types, or is that best done when interpreting the commands?
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateTrack1Pregap()
|
private void CreateTrack1Pregap()
|
||||||
{
|
{
|
||||||
if (OUT_CompiledCueTracks[1].PregapLength.Sector == 0) { }
|
if (OUT_CompiledCueTracks[1].PregapLength.Sector == 0) { }
|
||||||
else if (OUT_CompiledCueTracks[1].PregapLength.Sector == 150) { }
|
else if (OUT_CompiledCueTracks[1].PregapLength.Sector == 150) { }
|
||||||
|
@ -295,7 +295,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE
|
||||||
OUT_CompiledCueTracks[1].PregapLength = new Timestamp(150);
|
OUT_CompiledCueTracks[1].PregapLength = new Timestamp(150);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FinalAnalysis()
|
private void FinalAnalysis()
|
||||||
{
|
{
|
||||||
//some quick checks:
|
//some quick checks:
|
||||||
if (OUT_CompiledCueFiles.Count == 0)
|
if (OUT_CompiledCueFiles.Count == 0)
|
||||||
|
@ -334,7 +334,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CloseTrack()
|
private void CloseTrack()
|
||||||
{
|
{
|
||||||
if (curr_track == null)
|
if (curr_track == null)
|
||||||
return;
|
return;
|
||||||
|
@ -360,7 +360,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE
|
||||||
curr_track = null;
|
curr_track = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenTrack(CUE_File.Command.TRACK trackCommand)
|
private void OpenTrack(CUE_File.Command.TRACK trackCommand)
|
||||||
{
|
{
|
||||||
//assert that a file is open
|
//assert that a file is open
|
||||||
if(curr_file == null)
|
if(curr_file == null)
|
||||||
|
@ -390,7 +390,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE
|
||||||
UpdateDiscInfo(trackCommand);
|
UpdateDiscInfo(trackCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddIndex(CUE_File.Command.INDEX indexCommand)
|
private void AddIndex(CUE_File.Command.INDEX indexCommand)
|
||||||
{
|
{
|
||||||
curr_track.Indexes.Add(new CompiledCueIndex
|
curr_track.Indexes.Add(new CompiledCueIndex
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,7 +5,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents the contents of a cue file
|
/// Represents the contents of a cue file
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class CUE_File
|
internal class CUE_File
|
||||||
{
|
{
|
||||||
// (here are all the commands we can encounter)
|
// (here are all the commands we can encounter)
|
||||||
public static class Command
|
public static class Command
|
||||||
|
|
|
@ -45,25 +45,25 @@ namespace BizHawk.Emulation.DiscSystem.CUE
|
||||||
Normal, Pregap, Postgap
|
Normal, Pregap, Postgap
|
||||||
}
|
}
|
||||||
|
|
||||||
class BlobInfo
|
private class BlobInfo
|
||||||
{
|
{
|
||||||
public IBlob Blob;
|
public IBlob Blob;
|
||||||
public long Length;
|
public long Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
//not sure if we need this...
|
//not sure if we need this...
|
||||||
class TrackInfo
|
private class TrackInfo
|
||||||
{
|
{
|
||||||
public int Length;
|
public int Length;
|
||||||
|
|
||||||
public CompiledCueTrack CompiledCueTrack;
|
public CompiledCueTrack CompiledCueTrack;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<BlobInfo> BlobInfos;
|
private List<BlobInfo> BlobInfos;
|
||||||
List<TrackInfo> TrackInfos = new List<TrackInfo>();
|
private List<TrackInfo> TrackInfos = new List<TrackInfo>();
|
||||||
|
|
||||||
|
|
||||||
void MountBlobs()
|
private void MountBlobs()
|
||||||
{
|
{
|
||||||
IBlob file_blob = null;
|
IBlob file_blob = null;
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AnalyzeTracks()
|
private void AnalyzeTracks()
|
||||||
{
|
{
|
||||||
var compiledTracks = IN_CompileJob.OUT_CompiledCueTracks;
|
var compiledTracks = IN_CompileJob.OUT_CompiledCueTracks;
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmitRawTOCEntry(CompiledCueTrack cct)
|
private void EmitRawTOCEntry(CompiledCueTrack cct)
|
||||||
{
|
{
|
||||||
SubchannelQ toc_sq = new SubchannelQ();
|
SubchannelQ toc_sq = new SubchannelQ();
|
||||||
//absent some kind of policy for how to set it, this is a safe assumption:
|
//absent some kind of policy for how to set it, this is a safe assumption:
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Performs minimum parse processing on a cue file
|
/// Performs minimum parse processing on a cue file
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class ParseCueJob : DiscJob
|
internal class ParseCueJob : DiscJob
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// input: the cue string to parse
|
/// input: the cue string to parse
|
||||||
|
@ -30,10 +30,10 @@ namespace BizHawk.Emulation.DiscSystem.CUE
|
||||||
public bool IN_Strict { private get; set; } = false;
|
public bool IN_Strict { private get; set; } = false;
|
||||||
|
|
||||||
|
|
||||||
class CueLineParser
|
private class CueLineParser
|
||||||
{
|
{
|
||||||
int index;
|
private int index;
|
||||||
string str;
|
private string str;
|
||||||
public bool EOF;
|
public bool EOF;
|
||||||
public CueLineParser(string line)
|
public CueLineParser(string line)
|
||||||
{
|
{
|
||||||
|
@ -51,12 +51,12 @@ namespace BizHawk.Emulation.DiscSystem.CUE
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Mode
|
private enum Mode
|
||||||
{
|
{
|
||||||
Normal, Quotable
|
Normal, Quotable
|
||||||
}
|
}
|
||||||
|
|
||||||
string ReadToken(Mode mode)
|
private string ReadToken(Mode mode)
|
||||||
{
|
{
|
||||||
if (EOF) return null;
|
if (EOF) return null;
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadFromString(ParseCueJob job)
|
private void LoadFromString(ParseCueJob job)
|
||||||
{
|
{
|
||||||
string cueString = job.IN_CueString;
|
string cueString = job.IN_CueString;
|
||||||
TextReader tr = new StringReader(cueString);
|
TextReader tr = new StringReader(cueString);
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a Mode1 2048-byte sector
|
/// Represents a Mode1 2048-byte sector
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class SS_Mode1_2048 : SS_Base
|
internal class SS_Mode1_2048 : SS_Base
|
||||||
{
|
{
|
||||||
public override void Synth(SectorSynthJob job)
|
public override void Synth(SectorSynthJob job)
|
||||||
{
|
{
|
||||||
|
@ -71,7 +71,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a 2352-byte sector of any sort
|
/// Represents a 2352-byte sector of any sort
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class SS_2352 : SS_Base
|
internal class SS_2352 : SS_Base
|
||||||
{
|
{
|
||||||
public override void Synth(SectorSynthJob job)
|
public override void Synth(SectorSynthJob job)
|
||||||
{
|
{
|
||||||
|
@ -86,7 +86,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Encodes a pre-gap sector
|
/// Encodes a pre-gap sector
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class SS_Gap : SS_Base
|
internal class SS_Gap : SS_Base
|
||||||
{
|
{
|
||||||
public CueTrackType TrackType;
|
public CueTrackType TrackType;
|
||||||
|
|
||||||
|
|
|
@ -10,20 +10,20 @@ namespace BizHawk.Emulation.DiscSystem.CUE
|
||||||
{
|
{
|
||||||
public bool caseSensitive = false;
|
public bool caseSensitive = false;
|
||||||
public bool IsHardcodedResolve { get; private set; }
|
public bool IsHardcodedResolve { get; private set; }
|
||||||
string baseDir;
|
private string baseDir;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieving the FullName from a FileInfo can be slow (and probably other operations), so this will cache all the needed values
|
/// Retrieving the FullName from a FileInfo can be slow (and probably other operations), so this will cache all the needed values
|
||||||
/// TODO - could we treat it like an actual cache and only fill the FullName if it's null?
|
/// TODO - could we treat it like an actual cache and only fill the FullName if it's null?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
struct MyFileInfo
|
private struct MyFileInfo
|
||||||
{
|
{
|
||||||
public string FullName;
|
public string FullName;
|
||||||
public FileInfo FileInfo;
|
public FileInfo FileInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
DirectoryInfo diBasedir;
|
private DirectoryInfo diBasedir;
|
||||||
MyFileInfo[] fisBaseDir;
|
private MyFileInfo[] fisBaseDir;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// sets the base directory and caches the list of files in the directory
|
/// sets the base directory and caches the list of files in the directory
|
||||||
|
@ -50,7 +50,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MyFileInfo[] MyFileInfosFromFileInfos(FileInfo[] fis)
|
private MyFileInfo[] MyFileInfosFromFileInfos(FileInfo[] fis)
|
||||||
{
|
{
|
||||||
var myfis = new MyFileInfo[fis.Length];
|
var myfis = new MyFileInfo[fis.Length];
|
||||||
for (int i = 0; i < fis.Length; i++)
|
for (int i = 0; i < fis.Length; i++)
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
return !ret.Parse(sr) ? null : ret;
|
return !ret.Parse(sr) ? null : ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Parse(StreamReader sr)
|
private bool Parse(StreamReader sr)
|
||||||
{
|
{
|
||||||
bool ext = false;
|
bool ext = false;
|
||||||
int runtime = -1;
|
int runtime = -1;
|
||||||
|
|
|
@ -609,7 +609,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <exception cref="MDSParseException">path reference no longer points to file</exception>
|
/// <exception cref="MDSParseException">path reference no longer points to file</exception>
|
||||||
Dictionary<int, IBlob> MountBlobs(AFile mdsf, Disc disc)
|
private Dictionary<int, IBlob> MountBlobs(AFile mdsf, Disc disc)
|
||||||
{
|
{
|
||||||
Dictionary<int, IBlob> BlobIndex = new Dictionary<int, IBlob>();
|
Dictionary<int, IBlob> BlobIndex = new Dictionary<int, IBlob>();
|
||||||
|
|
||||||
|
@ -651,7 +651,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
return BlobIndex;
|
return BlobIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
RawTOCEntry EmitRawTOCEntry(ATOCEntry entry)
|
private RawTOCEntry EmitRawTOCEntry(ATOCEntry entry)
|
||||||
{
|
{
|
||||||
BCD2 tno, ino;
|
BCD2 tno, ino;
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
this.disc = disc;
|
this.disc = disc;
|
||||||
}
|
}
|
||||||
|
|
||||||
Disc disc;
|
private Disc disc;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// calculates the hash for quick PSX Disc identification
|
/// calculates the hash for quick PSX Disc identification
|
||||||
|
@ -127,7 +127,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint current = 0xFFFFFFFF;
|
private uint current = 0xFFFFFFFF;
|
||||||
|
|
||||||
/// <exception cref="ArgumentOutOfRangeException">
|
/// <exception cref="ArgumentOutOfRangeException">
|
||||||
/// <paramref name="offset"/> is negative, or
|
/// <paramref name="offset"/> is negative, or
|
||||||
|
@ -147,7 +147,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] smallbuf = new byte[8];
|
private byte[] smallbuf = new byte[8];
|
||||||
public void Add(int data)
|
public void Add(int data)
|
||||||
{
|
{
|
||||||
smallbuf[0] = (byte)((data) & 0xFF);
|
smallbuf[0] = (byte)((data) & 0xFF);
|
||||||
|
@ -171,7 +171,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
set => current = value;
|
set => current = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint gf2_matrix_times(uint[] mat, uint vec)
|
private uint gf2_matrix_times(uint[] mat, uint vec)
|
||||||
{
|
{
|
||||||
int matIdx = 0;
|
int matIdx = 0;
|
||||||
uint sum = 0;
|
uint sum = 0;
|
||||||
|
@ -185,7 +185,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gf2_matrix_square(uint[] square, uint[] mat)
|
private void gf2_matrix_square(uint[] square, uint[] mat)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
for (n = 0; n < 32; n++)
|
for (n = 0; n < 32; n++)
|
||||||
|
@ -202,10 +202,10 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
}
|
}
|
||||||
|
|
||||||
//tables used by crc32_combine
|
//tables used by crc32_combine
|
||||||
uint[] even, odd;
|
private uint[] even, odd;
|
||||||
|
|
||||||
//algorithm from zlib's crc32_combine. read http://www.leapsecond.com/tools/crcomb.c for more
|
//algorithm from zlib's crc32_combine. read http://www.leapsecond.com/tools/crcomb.c for more
|
||||||
uint crc32_combine(uint crc1, uint crc2, int len2)
|
private uint crc32_combine(uint crc1, uint crc2, int len2)
|
||||||
{
|
{
|
||||||
if (even == null) even = new uint[32]; // even-power-of-two zeros operator
|
if (even == null) even = new uint[32]; // even-power-of-two zeros operator
|
||||||
if (odd == null) odd = new uint[32]; // odd-power-of-two zeros operator
|
if (odd == null) odd = new uint[32]; // odd-power-of-two zeros operator
|
||||||
|
|
|
@ -227,7 +227,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This is reasonable approach to ID saturn.
|
/// This is reasonable approach to ID saturn.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool DetectSegaSaturn()
|
private bool DetectSegaSaturn()
|
||||||
{
|
{
|
||||||
return StringAt("SEGA SEGASATURN", 0);
|
return StringAt("SEGA SEGASATURN", 0);
|
||||||
}
|
}
|
||||||
|
@ -235,12 +235,12 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// probably wrong
|
/// probably wrong
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool DetectMegaCD()
|
private bool DetectMegaCD()
|
||||||
{
|
{
|
||||||
return StringAt("SEGADISCSYSTEM", 0) || StringAt("SEGADISCSYSTEM", 16);
|
return StringAt("SEGADISCSYSTEM", 0) || StringAt("SEGADISCSYSTEM", 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DetectPSX()
|
private bool DetectPSX()
|
||||||
{
|
{
|
||||||
if (!StringAt(" Licensed by ", 0, 4)) return false;
|
if (!StringAt(" Licensed by ", 0, 4)) return false;
|
||||||
return (StringAt("Sony Computer Entertainment Euro", 32, 4)
|
return (StringAt("Sony Computer Entertainment Euro", 32, 4)
|
||||||
|
@ -250,7 +250,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DetectPCFX()
|
private bool DetectPCFX()
|
||||||
{
|
{
|
||||||
var toc = _disc.TOC;
|
var toc = _disc.TOC;
|
||||||
for (int t = toc.FirstRecordedTrackNumber;
|
for (int t = toc.FirstRecordedTrackNumber;
|
||||||
|
@ -268,7 +268,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
//asni 20171011 - this ONLY works if a valid cuefile/ccd is passed into DiscIdentifier.
|
//asni 20171011 - this ONLY works if a valid cuefile/ccd is passed into DiscIdentifier.
|
||||||
//if an .iso is presented, the internally manufactured cue data does not work - possibly something to do with
|
//if an .iso is presented, the internally manufactured cue data does not work - possibly something to do with
|
||||||
//track 01 being Audio. Not tested, but presumably PCFX has the same issue
|
//track 01 being Audio. Not tested, but presumably PCFX has the same issue
|
||||||
bool DetectTurboCD()
|
private bool DetectTurboCD()
|
||||||
{
|
{
|
||||||
var toc = _disc.TOC;
|
var toc = _disc.TOC;
|
||||||
for (int t = toc.FirstRecordedTrackNumber;
|
for (int t = toc.FirstRecordedTrackNumber;
|
||||||
|
@ -283,7 +283,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Detect3DO()
|
private bool Detect3DO()
|
||||||
{
|
{
|
||||||
var toc = _disc.TOC;
|
var toc = _disc.TOC;
|
||||||
for (int t = toc.FirstRecordedTrackNumber;
|
for (int t = toc.FirstRecordedTrackNumber;
|
||||||
|
@ -298,7 +298,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
}
|
}
|
||||||
|
|
||||||
//asni - slightly longer running than the others due to its brute-force nature. Should run later in the method
|
//asni - slightly longer running than the others due to its brute-force nature. Should run later in the method
|
||||||
bool DetectDreamcast()
|
private bool DetectDreamcast()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 1000; i++)
|
for (int i = 0; i < 1000; i++)
|
||||||
{
|
{
|
||||||
|
@ -309,12 +309,12 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DetectCDi()
|
private bool DetectCDi()
|
||||||
{
|
{
|
||||||
return StringAt("CD-RTOS", 8, 16);
|
return StringAt("CD-RTOS", 8, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DetectGameCube()
|
private bool DetectGameCube()
|
||||||
{
|
{
|
||||||
var data = ReadSectorCached(0);
|
var data = ReadSectorCached(0);
|
||||||
if (data == null) return false;
|
if (data == null) return false;
|
||||||
|
@ -326,7 +326,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
return hexString == "C2339F3D";
|
return hexString == "C2339F3D";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DetectWii()
|
private bool DetectWii()
|
||||||
{
|
{
|
||||||
var data = ReadSectorCached(0);
|
var data = ReadSectorCached(0);
|
||||||
if (data == null) return false;
|
if (data == null) return false;
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class DiscJobAbortException : Exception
|
internal class DiscJobAbortException : Exception
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,7 +2,7 @@
|
||||||
{
|
{
|
||||||
partial class DiscMountJob
|
partial class DiscMountJob
|
||||||
{
|
{
|
||||||
class SS_MednaDisc : ISectorSynthJob2448
|
private class SS_MednaDisc : ISectorSynthJob2448
|
||||||
{
|
{
|
||||||
public void Synth(SectorSynthJob job)
|
public void Synth(SectorSynthJob job)
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunMednaDisc()
|
private void RunMednaDisc()
|
||||||
{
|
{
|
||||||
var disc = new Disc();
|
var disc = new Disc();
|
||||||
OUT_Disc = disc;
|
OUT_Disc = disc;
|
||||||
|
|
|
@ -99,7 +99,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
FinishLog();
|
FinishLog();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunBizHawk()
|
private void RunBizHawk()
|
||||||
{
|
{
|
||||||
string infile = IN_FromPath;
|
string infile = IN_FromPath;
|
||||||
string cue_content = null;
|
string cue_content = null;
|
||||||
|
|
|
@ -58,21 +58,21 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
{
|
{
|
||||||
public DiscSectorReaderPolicy Policy = new DiscSectorReaderPolicy();
|
public DiscSectorReaderPolicy Policy = new DiscSectorReaderPolicy();
|
||||||
|
|
||||||
Disc disc;
|
private Disc disc;
|
||||||
|
|
||||||
public DiscSectorReader(Disc disc)
|
public DiscSectorReader(Disc disc)
|
||||||
{
|
{
|
||||||
this.disc = disc;
|
this.disc = disc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrepareJob(int lba)
|
private void PrepareJob(int lba)
|
||||||
{
|
{
|
||||||
job.LBA = lba;
|
job.LBA = lba;
|
||||||
job.Params = disc.SynthParams;
|
job.Params = disc.SynthParams;
|
||||||
job.Disc = disc;
|
job.Disc = disc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrepareBuffer(byte[] buffer, int offset, int size)
|
private void PrepareBuffer(byte[] buffer, int offset, int size)
|
||||||
{
|
{
|
||||||
if (Policy.DeterministicClearBuffer) Array.Clear(buffer, offset, size);
|
if (Policy.DeterministicClearBuffer) Array.Clear(buffer, offset, size);
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
return 2448;
|
return 2448;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ReadLBA_2048_Mode1(int lba, byte[] buffer, int offset)
|
private int ReadLBA_2048_Mode1(int lba, byte[] buffer, int offset)
|
||||||
{
|
{
|
||||||
//we can read the 2048 bytes directly
|
//we can read the 2048 bytes directly
|
||||||
var sector = disc.SynthProvider.Get(lba);
|
var sector = disc.SynthProvider.Get(lba);
|
||||||
|
@ -145,7 +145,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
return 2048;
|
return 2048;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ReadLBA_2048_Mode2_Form1(int lba, byte[] buffer, int offset)
|
private int ReadLBA_2048_Mode2_Form1(int lba, byte[] buffer, int offset)
|
||||||
{
|
{
|
||||||
//we can read the 2048 bytes directly but we have to get them from the mode 2 data
|
//we can read the 2048 bytes directly but we have to get them from the mode 2 data
|
||||||
var sector = disc.SynthProvider.Get(lba);
|
var sector = disc.SynthProvider.Get(lba);
|
||||||
|
@ -297,8 +297,8 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
}
|
}
|
||||||
|
|
||||||
//lets not try to these as a sector cache. it gets too complicated. its just a temporary variable.
|
//lets not try to these as a sector cache. it gets too complicated. its just a temporary variable.
|
||||||
byte[] buf2442 = new byte[2448];
|
private byte[] buf2442 = new byte[2448];
|
||||||
byte[] buf12 = new byte[12];
|
private byte[] buf12 = new byte[12];
|
||||||
SectorSynthJob job = new SectorSynthJob();
|
private SectorSynthJob job = new SectorSynthJob();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -51,14 +51,14 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DiscStream : System.IO.Stream
|
public class DiscStream : System.IO.Stream
|
||||||
{
|
{
|
||||||
int SectorSize;
|
private int SectorSize;
|
||||||
int NumSectors;
|
private int NumSectors;
|
||||||
Disc Disc;
|
private Disc Disc;
|
||||||
|
|
||||||
long currPosition;
|
private long currPosition;
|
||||||
byte[] cachedSectorBuffer;
|
private byte[] cachedSectorBuffer;
|
||||||
int cachedSector;
|
private int cachedSector;
|
||||||
DiscSectorReader dsr;
|
private DiscSectorReader dsr;
|
||||||
|
|
||||||
/// <exception cref="NotSupportedException"><paramref name="view"/> is not <see cref="DiscSectorReaderPolicy.EUserData2048Mode.AssumeMode1"/> or <see cref="DiscSectorReaderPolicy.EUserData2048Mode.AssumeMode2_Form1"/></exception>
|
/// <exception cref="NotSupportedException"><paramref name="view"/> is not <see cref="DiscSectorReaderPolicy.EUserData2048Mode.AssumeMode1"/> or <see cref="DiscSectorReaderPolicy.EUserData2048Mode.AssumeMode2_Form1"/></exception>
|
||||||
public DiscStream(Disc disc, EDiscStreamView view, int from_lba)
|
public DiscStream(Disc disc, EDiscStreamView view, int from_lba)
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
{
|
{
|
||||||
public static class DiscUtils
|
public static class DiscUtils
|
||||||
{
|
{
|
||||||
static byte IntToBCD(int n)
|
private static byte IntToBCD(int n)
|
||||||
{
|
{
|
||||||
int tens = Math.DivRem(n, 10, out var ones);
|
int tens = Math.DivRem(n, 10, out var ones);
|
||||||
return (byte)((tens << 4) | ones);
|
return (byte)((tens << 4) | ones);
|
||||||
|
|
|
@ -33,14 +33,14 @@ using BizHawk.Common;
|
||||||
|
|
||||||
namespace BizHawk.Emulation.DiscSystem
|
namespace BizHawk.Emulation.DiscSystem
|
||||||
{
|
{
|
||||||
static class ECM
|
internal static class ECM
|
||||||
{
|
{
|
||||||
//EDC (crc) acceleration table
|
//EDC (crc) acceleration table
|
||||||
static readonly uint[] edc_table = new uint[256];
|
private static readonly uint[] edc_table = new uint[256];
|
||||||
|
|
||||||
//math acceleration tables over GF(2^8) with yellowbook specified primitive polynomial 0x11D
|
//math acceleration tables over GF(2^8) with yellowbook specified primitive polynomial 0x11D
|
||||||
static readonly byte[] mul2tab = new byte[256];
|
private static readonly byte[] mul2tab = new byte[256];
|
||||||
static readonly byte[] div3tab = new byte[256];
|
private static readonly byte[] div3tab = new byte[256];
|
||||||
|
|
||||||
static ECM()
|
static ECM()
|
||||||
{
|
{
|
||||||
|
@ -51,7 +51,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// calculate EDC crc tables
|
/// calculate EDC crc tables
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static void Prep_EDC()
|
private static void Prep_EDC()
|
||||||
{
|
{
|
||||||
//14.3 of yellowbook specifies EDC crc as P(x) = (x^16 + x^15 + x^2 + 1) . (x^16 + x^2 + x + 1)
|
//14.3 of yellowbook specifies EDC crc as P(x) = (x^16 + x^15 + x^2 + 1) . (x^16 + x^2 + x + 1)
|
||||||
//confirmation at http://cdmagediscussion.yuku.com/topic/742/EDC-calculation
|
//confirmation at http://cdmagediscussion.yuku.com/topic/742/EDC-calculation
|
||||||
|
@ -88,7 +88,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// calculate math lookup tables for ECC calculations.
|
/// calculate math lookup tables for ECC calculations.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static void Prep_ECC()
|
private static void Prep_ECC()
|
||||||
{
|
{
|
||||||
//create a table implementing f(i) = i*2
|
//create a table implementing f(i) = i*2
|
||||||
for (int i = 0; i < 256; i++)
|
for (int i = 0; i < 256; i++)
|
||||||
|
@ -220,7 +220,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// returns the address from a sector. useful for saving it before zeroing it for ECC calculations
|
/// returns the address from a sector. useful for saving it before zeroing it for ECC calculations
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static uint GetSectorAddress(byte[] sector, int sector_offset)
|
private static uint GetSectorAddress(byte[] sector, int sector_offset)
|
||||||
{
|
{
|
||||||
return (uint)(
|
return (uint)(
|
||||||
(sector[sector_offset + 12 + 0] << 0)
|
(sector[sector_offset + 12 + 0] << 0)
|
||||||
|
@ -233,7 +233,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// sets the address for a sector. useful for restoring it after zeroing it for ECC calculations
|
/// sets the address for a sector. useful for restoring it after zeroing it for ECC calculations
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static void SetSectorAddress(byte[] sector, int sector_offset, uint address)
|
private static void SetSectorAddress(byte[] sector, int sector_offset, uint address)
|
||||||
{
|
{
|
||||||
sector[sector_offset + 12 + 0] = (byte)((address >> 0) & 0xFF);
|
sector[sector_offset + 12 + 0] = (byte)((address >> 0) & 0xFF);
|
||||||
sector[sector_offset + 12 + 1] = (byte)((address >> 8) & 0xFF);
|
sector[sector_offset + 12 + 1] = (byte)((address >> 8) & 0xFF);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// TODO - generate correct Q subchannel CRC
|
// TODO - generate correct Q subchannel CRC
|
||||||
namespace BizHawk.Emulation.DiscSystem
|
namespace BizHawk.Emulation.DiscSystem
|
||||||
{
|
{
|
||||||
class ApplySBIJob
|
internal class ApplySBIJob
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// applies an SBI file to the disc
|
/// applies an SBI file to the disc
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace BizHawk.Emulation.DiscSystem.SBI
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loads SBI files into an internal representation.
|
/// Loads SBI files into an internal representation.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class LoadSBIJob : DiscJob
|
internal class LoadSBIJob : DiscJob
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The file to be loaded
|
/// The file to be loaded
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
/// Synthesizes RawTCOEntry A0 A1 A2 from the provided information.
|
/// 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
|
/// This might be reused by formats other than CUE later, so it isn't directly associated with that
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class Synthesize_A0A1A2_Job
|
internal class Synthesize_A0A1A2_Job
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// "First Recorded Track Number" value for TOC (usually 1)
|
/// "First Recorded Track Number" value for TOC (usually 1)
|
||||||
|
|
|
@ -2,7 +2,7 @@ using System;
|
||||||
|
|
||||||
namespace BizHawk.Emulation.DiscSystem
|
namespace BizHawk.Emulation.DiscSystem
|
||||||
{
|
{
|
||||||
class Synthesize_DiscStructure_From_DiscTOC_Job
|
internal class Synthesize_DiscStructure_From_DiscTOC_Job
|
||||||
{
|
{
|
||||||
public Disc IN_Disc { private get; set; }
|
public Disc IN_Disc { private get; set; }
|
||||||
public DiscTOC TOCRaw;
|
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.
|
/// 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?
|
/// Question: I guess it must ignore q-mode != 1? what else would it do with it?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class Synthesize_DiscTOC_From_RawTOCEntries_Job
|
internal class Synthesize_DiscTOC_From_RawTOCEntries_Job
|
||||||
{
|
{
|
||||||
public IEnumerable<RawTOCEntry> Entries;
|
public IEnumerable<RawTOCEntry> Entries;
|
||||||
public List<string> Log = new List<string>();
|
public List<string> Log = new List<string>();
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
/// generates lead-out sectors according to very crude approximations
|
/// generates lead-out sectors according to very crude approximations
|
||||||
/// TODO - this isn't being used right now
|
/// TODO - this isn't being used right now
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class Synthesize_LeadoutJob
|
internal class Synthesize_LeadoutJob
|
||||||
{
|
{
|
||||||
public int Length;
|
public int Length;
|
||||||
public Disc Disc;
|
public Disc Disc;
|
||||||
|
|
|
@ -9,7 +9,8 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
/// TODO - add a flag indicating whether clearing has happened
|
/// TODO - add a flag indicating whether clearing has happened
|
||||||
/// TODO - add output to the job indicating whether interleaving has happened. let the sector reader be responsible
|
/// TODO - add output to the job indicating whether interleaving has happened. let the sector reader be responsible
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Flags] enum ESectorSynthPart
|
[Flags]
|
||||||
|
internal enum ESectorSynthPart
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The data sector header is required. There's no header for audio tracks/sectors.
|
/// The data sector header is required. There's no header for audio tracks/sectors.
|
||||||
|
@ -100,7 +101,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Basic unit of sector synthesis
|
/// Basic unit of sector synthesis
|
||||||
/// </summary>
|
/// </summary>
|
||||||
interface ISectorSynthJob2448
|
internal interface ISectorSynthJob2448
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Synthesizes a sctor with the given job parameters
|
/// Synthesizes a sctor with the given job parameters
|
||||||
|
@ -111,7 +112,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Not a proper job? maybe with additional flags, it could be
|
/// Not a proper job? maybe with additional flags, it could be
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class SectorSynthJob
|
internal class SectorSynthJob
|
||||||
{
|
{
|
||||||
public int LBA;
|
public int LBA;
|
||||||
public ESectorSynthPart Parts;
|
public ESectorSynthPart Parts;
|
||||||
|
@ -124,7 +125,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// an ISectorSynthProvider that just returns a value from an array of pre-made sectors
|
/// an ISectorSynthProvider that just returns a value from an array of pre-made sectors
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class ArraySectorSynthProvider : ISectorSynthProvider
|
internal class ArraySectorSynthProvider : ISectorSynthProvider
|
||||||
{
|
{
|
||||||
public List<ISectorSynthJob2448> Sectors = new List<ISectorSynthJob2448>();
|
public List<ISectorSynthJob2448> Sectors = new List<ISectorSynthJob2448>();
|
||||||
public int FirstLBA;
|
public int FirstLBA;
|
||||||
|
@ -140,7 +141,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// an ISectorSynthProvider that just returns a fixed synthesizer
|
/// an ISectorSynthProvider that just returns a fixed synthesizer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class SimpleSectorSynthProvider : ISectorSynthProvider
|
internal class SimpleSectorSynthProvider : ISectorSynthProvider
|
||||||
{
|
{
|
||||||
public ISectorSynthJob2448 SS;
|
public ISectorSynthJob2448 SS;
|
||||||
|
|
||||||
|
@ -150,11 +151,11 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns 'Patch' synth if the provided condition is met
|
/// Returns 'Patch' synth if the provided condition is met
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class ConditionalSectorSynthProvider : ISectorSynthProvider
|
internal class ConditionalSectorSynthProvider : ISectorSynthProvider
|
||||||
{
|
{
|
||||||
Func<int,bool> Condition;
|
private Func<int,bool> Condition;
|
||||||
ISectorSynthJob2448 Patch;
|
private ISectorSynthJob2448 Patch;
|
||||||
ISectorSynthProvider Parent;
|
private ISectorSynthProvider Parent;
|
||||||
public void Install(Disc disc, Func<int, bool> condition, ISectorSynthJob2448 patch)
|
public void Install(Disc disc, Func<int, bool> condition, ISectorSynthJob2448 patch)
|
||||||
{
|
{
|
||||||
Parent = disc.SynthProvider;
|
Parent = disc.SynthProvider;
|
||||||
|
@ -171,7 +172,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// When creating a disc, this is set with a callback that can deliver an ISectorSynthJob2448 for the given LBA
|
/// When creating a disc, this is set with a callback that can deliver an ISectorSynthJob2448 for the given LBA
|
||||||
/// </summary>
|
/// </summary>
|
||||||
interface ISectorSynthProvider
|
internal interface ISectorSynthProvider
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieves an ISectorSynthJob2448 for the given LBA
|
/// Retrieves an ISectorSynthJob2448 for the given LBA
|
||||||
|
@ -184,14 +185,14 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
/// To cut down on resource utilization, these can be stored in a disc and are tightly coupled to
|
/// To cut down on resource utilization, these can be stored in a disc and are tightly coupled to
|
||||||
/// the SectorSynths that have been setup for it
|
/// the SectorSynths that have been setup for it
|
||||||
/// </summary>
|
/// </summary>
|
||||||
struct SectorSynthParams
|
internal struct SectorSynthParams
|
||||||
{
|
{
|
||||||
//public long[] BlobOffsets;
|
//public long[] BlobOffsets;
|
||||||
public MednaDisc MednaDisc;
|
public MednaDisc MednaDisc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class SS_PatchQ : ISectorSynthJob2448
|
internal class SS_PatchQ : ISectorSynthJob2448
|
||||||
{
|
{
|
||||||
public ISectorSynthJob2448 Original;
|
public ISectorSynthJob2448 Original;
|
||||||
public byte[] Buffer_SubQ = new byte[12];
|
public byte[] Buffer_SubQ = new byte[12];
|
||||||
|
@ -208,7 +209,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class SS_Leadout : ISectorSynthJob2448
|
internal class SS_Leadout : ISectorSynthJob2448
|
||||||
{
|
{
|
||||||
public int SessionNumber;
|
public int SessionNumber;
|
||||||
public DiscMountPolicy Policy;
|
public DiscMountPolicy Policy;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
namespace BizHawk.Emulation.DiscSystem
|
namespace BizHawk.Emulation.DiscSystem
|
||||||
{
|
{
|
||||||
static class SynthUtils
|
internal static class SynthUtils
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Calculates the checksum of the provided Q subchannel buffer and emplaces it
|
/// Calculates the checksum of the provided Q subchannel buffer and emplaces it
|
||||||
|
|
Loading…
Reference in New Issue