From ae22cd9f1b6917f42732bcfa25d3a961288cf138 Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Tue, 19 May 2020 17:00:19 +1000 Subject: [PATCH] Use explicit visibility modifiers in DiscSystem --- .../API_MednaDisc.cs | 10 +++---- .../DiscDecoding.cs | 8 +++--- .../DiscFormats/Blobs/Blob_ECM.cs | 14 +++++----- .../DiscFormats/Blobs/Blob_RawFile.cs | 7 +++-- .../DiscFormats/Blobs/Blob_WaveFile.cs | 13 +++++---- .../DiscFormats/Blobs/Blob_ZeroPadAdapter.cs | 4 +-- .../DiscFormats/Blobs/RiffMaster.cs | 5 ++-- .../DiscFormats/CCD_format.cs | 8 +++--- .../DiscFormats/CUE/CUE_Compile.cs | 28 +++++++++---------- .../DiscFormats/CUE/CUE_File.cs | 2 +- .../DiscFormats/CUE/CUE_Load.cs | 14 +++++----- .../DiscFormats/CUE/CUE_Parse.cs | 14 +++++----- .../DiscFormats/CUE/CUE_Synths.cs | 6 ++-- .../DiscFormats/CUE/CueFileResolver.cs | 10 +++---- .../DiscFormats/M3U_file.cs | 2 +- .../DiscFormats/MDS_Format.cs | 4 +-- .../DiscHasher.cs | 14 +++++----- .../DiscIdentifier.cs | 20 ++++++------- src/BizHawk.Emulation.DiscSystem/DiscJob.cs | 2 +- .../DiscMountJob.MednaDisc.cs | 4 +-- .../DiscMountJob.cs | 2 +- .../DiscSectorReader.cs | 16 +++++------ .../DiscStream.cs | 14 +++++----- src/BizHawk.Emulation.DiscSystem/DiscUtils.cs | 2 +- .../Internal/Algorithms/ECM.cs | 16 +++++------ .../Internal/Jobs/ApplySBIJob.cs | 2 +- .../Internal/Jobs/LoadSBIJob.cs | 2 +- .../Internal/Jobs/Synthesize_A0A1A2_Job.cs | 2 +- ...nthesize_DiscStructure_From_DiscTOC_Job.cs | 2 +- ...nthesize_DiscTOC_From_RawTOCEntries_Job.cs | 2 +- .../Internal/Jobs/Synthesize_Leadout_Job.cs | 2 +- .../Internal/SectorSynth.cs | 27 +++++++++--------- .../Internal/SynthUtils.cs | 2 +- 33 files changed, 142 insertions(+), 138 deletions(-) diff --git a/src/BizHawk.Emulation.DiscSystem/API_MednaDisc.cs b/src/BizHawk.Emulation.DiscSystem/API_MednaDisc.cs index e3bf3a98ff..43b6579a0d 100644 --- a/src/BizHawk.Emulation.DiscSystem/API_MednaDisc.cs +++ b/src/BizHawk.Emulation.DiscSystem/API_MednaDisc.cs @@ -31,13 +31,13 @@ namespace BizHawk.Emulation.DiscSystem //leave the disc open until this is disposed so we can read sectors from it } - IntPtr handle; + private IntPtr handle; public MednadiscTOC TOC; public MednadiscTOCTrack[] TOCTracks; - [ThreadStatic] static byte[] buf2442 = new byte[2448]; - [ThreadStatic] static byte[] buf96 = new byte[96]; + [ThreadStatic] private static byte[] buf2442 = new byte[2448]; + [ThreadStatic] private static byte[] buf96 = new byte[96]; public void Read_2442(int LBA, byte[] buffer, int offset) @@ -91,7 +91,7 @@ namespace BizHawk.Emulation.DiscSystem } #endif - static void CheckLibrary() + private static void CheckLibrary() { var lib = OSTailoredCode.LinkedLibManager.LoadOrZero("mednadisc.dll"); _IsLibraryAvailable = lib != IntPtr.Zero @@ -104,7 +104,7 @@ namespace BizHawk.Emulation.DiscSystem CheckLibrary(); } - static bool _IsLibraryAvailable; + private static bool _IsLibraryAvailable; public static bool IsLibraryAvailable => _IsLibraryAvailable; public void Dispose() diff --git a/src/BizHawk.Emulation.DiscSystem/DiscDecoding.cs b/src/BizHawk.Emulation.DiscSystem/DiscDecoding.cs index b983a4a0be..84ead9a768 100644 --- a/src/BizHawk.Emulation.DiscSystem/DiscDecoding.cs +++ b/src/BizHawk.Emulation.DiscSystem/DiscDecoding.cs @@ -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 //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) { var ret = new AudioQueryResult(); @@ -106,7 +106,7 @@ namespace BizHawk.Emulation.DiscSystem } } - class AudioDecoder + internal class AudioDecoder { [Serializable] 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(); 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) /// TODO - isnt this redundant with CueFileResolver? /// - string FindAudio(string audioPath) + private string FindAudio(string audioPath) { string basePath = Path.GetFileNameWithoutExtension(audioPath); //look for potential candidates diff --git a/src/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/Blob_ECM.cs b/src/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/Blob_ECM.cs index 7f6a812710..4dc18f0f9d 100644 --- a/src/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/Blob_ECM.cs +++ b/src/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/Blob_ECM.cs @@ -36,7 +36,7 @@ namespace BizHawk.Emulation.DiscSystem { internal class Blob_ECM : IBlob { - FileStream stream; + private FileStream stream; public void Dispose() { @@ -61,7 +61,7 @@ namespace BizHawk.Emulation.DiscSystem /// /// the ECMfile-provided EDC integrity checksum. not being used right now /// - int EDC; + private int EDC; public long Length; @@ -143,7 +143,7 @@ namespace BizHawk.Emulation.DiscSystem Length = logOffset; } - void MisformedException() + private void MisformedException() { throw new InvalidOperationException("Mis-formed ECM file"); } @@ -166,7 +166,7 @@ namespace BizHawk.Emulation.DiscSystem /// /// finds the IndexEntry for the specified logical offset /// - 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. for(int i=0;i<2;i++) //try 2 times @@ -201,7 +201,7 @@ namespace BizHawk.Emulation.DiscSystem return listIndex; } - void Reconstruct(byte[] secbuf, int type) + private void Reconstruct(byte[] secbuf, int type) { //sync 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. - readonly byte[] Read_SectorBuf = new byte[2352]; - int Read_LastIndex = 0; + private readonly byte[] Read_SectorBuf = new byte[2352]; + private int Read_LastIndex = 0; public int Read(long byte_pos, byte[] buffer, int offset, int _count) { diff --git a/src/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/Blob_RawFile.cs b/src/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/Blob_RawFile.cs index 41a9be2506..9aa7c2088a 100644 --- a/src/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/Blob_RawFile.cs +++ b/src/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/Blob_RawFile.cs @@ -15,12 +15,13 @@ namespace BizHawk.Emulation.DiscSystem length = new FileInfo(physicalPath).Length; } } - string physicalPath; - long length; + + private string physicalPath; + private long length; public long Offset = 0; - BufferedStream fs; + private BufferedStream fs; public void Dispose() { if (fs != null) diff --git a/src/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/Blob_WaveFile.cs b/src/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/Blob_WaveFile.cs index 4cae65e93b..02c4360966 100644 --- a/src/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/Blob_WaveFile.cs +++ b/src/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/Blob_WaveFile.cs @@ -36,12 +36,13 @@ namespace BizHawk.Emulation.DiscSystem length = new FileInfo(physicalPath).Length; } } - string physicalPath; - long length; + + private string physicalPath; + private long length; public long Offset = 0; - BufferedStream fs; + private BufferedStream fs; public void Dispose() { if (fs != null) @@ -132,9 +133,9 @@ namespace BizHawk.Emulation.DiscSystem return RiffSource.BaseStream.Read(buffer, offset, count); } - RiffMaster RiffSource; - long waveDataStreamPos; - long mDataLength; + private RiffMaster RiffSource; + private long waveDataStreamPos; + private long mDataLength; public long Length => mDataLength; public void Dispose() diff --git a/src/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/Blob_ZeroPadAdapter.cs b/src/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/Blob_ZeroPadAdapter.cs index 6f1d9d63f5..39b195c2d9 100644 --- a/src/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/Blob_ZeroPadAdapter.cs +++ b/src/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/Blob_ZeroPadAdapter.cs @@ -8,8 +8,8 @@ namespace BizHawk.Emulation.DiscSystem { internal sealed class Blob_ZeroPadAdapter : IBlob { - IBlob srcBlob; - long srcBlobLength; + private IBlob srcBlob; + private long srcBlobLength; public Blob_ZeroPadAdapter(IBlob srcBlob, long srcBlobLength) { this.srcBlob = srcBlob; diff --git a/src/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/RiffMaster.cs b/src/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/RiffMaster.cs index 391893ee4e..2aac2497ee 100644 --- a/src/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/RiffMaster.cs +++ b/src/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/RiffMaster.cs @@ -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. /// TODO - clarify stream disposing semantics /// - class RiffMaster : IDisposable + internal class RiffMaster : IDisposable { public RiffMaster() { } @@ -152,7 +152,8 @@ namespace BizHawk.Emulation.DiscSystem Flush(); base.WriteStream(s); } - void Flush() + + private void Flush() { MemoryStream ms = new MemoryStream(); BinaryWriter bw = new BinaryWriter(ms); diff --git a/src/BizHawk.Emulation.DiscSystem/DiscFormats/CCD_format.cs b/src/BizHawk.Emulation.DiscSystem/DiscFormats/CCD_format.cs index 4600837339..bf66dfd6e8 100644 --- a/src/BizHawk.Emulation.DiscSystem/DiscFormats/CCD_format.cs +++ b/src/BizHawk.Emulation.DiscSystem/DiscFormats/CCD_format.cs @@ -158,7 +158,7 @@ namespace BizHawk.Emulation.DiscSystem public CCDParseException(string message) : base(message) { } } - class CCDSection : Dictionary + private class CCDSection : Dictionary { public string Name; public int FetchOrDefault(int def, string key) @@ -176,7 +176,7 @@ namespace BizHawk.Emulation.DiscSystem } } - List ParseSections(Stream stream) + private List ParseSections(Stream stream) { List sections = new List(); @@ -214,7 +214,7 @@ namespace BizHawk.Emulation.DiscSystem return sections; } - int PreParseIntegrityCheck(List sections) + private int PreParseIntegrityCheck(List 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) { diff --git a/src/BizHawk.Emulation.DiscSystem/DiscFormats/CUE/CUE_Compile.cs b/src/BizHawk.Emulation.DiscSystem/DiscFormats/CUE/CUE_Compile.cs index 13ba400c38..b2b33febff 100644 --- a/src/BizHawk.Emulation.DiscSystem/DiscFormats/CUE/CUE_Compile.cs +++ b/src/BizHawk.Emulation.DiscSystem/DiscFormats/CUE/CUE_Compile.cs @@ -160,14 +160,14 @@ namespace BizHawk.Emulation.DiscSystem.CUE //----------------------------------------------------------------- - CompiledCDText curr_cdtext; - int curr_blobIndex = -1; - CompiledCueTrack curr_track = null; - CompiledCueFile curr_file = null; - bool discinfo_session1Format_determined = false; - bool curr_fileHasTrack = false; + private CompiledCDText curr_cdtext; + private int curr_blobIndex = -1; + private CompiledCueTrack curr_track = null; + private CompiledCueFile curr_file = null; + private bool discinfo_session1Format_determined = 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) OUT_CompiledDiscInfo.FirstRecordedTrackNumber = trackCommand.Number; @@ -194,7 +194,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE } } - void CloseFile() + private void CloseFile() { if (curr_track != null) { @@ -205,7 +205,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE curr_file = null; } - void OpenFile(CUE_File.Command.FILE f) + private void OpenFile(CUE_File.Command.FILE f) { if (curr_file != null) 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? } - void CreateTrack1Pregap() + private void CreateTrack1Pregap() { if (OUT_CompiledCueTracks[1].PregapLength.Sector == 0) { } else if (OUT_CompiledCueTracks[1].PregapLength.Sector == 150) { } @@ -295,7 +295,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE OUT_CompiledCueTracks[1].PregapLength = new Timestamp(150); } - void FinalAnalysis() + private void FinalAnalysis() { //some quick checks: if (OUT_CompiledCueFiles.Count == 0) @@ -334,7 +334,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE } - void CloseTrack() + private void CloseTrack() { if (curr_track == null) return; @@ -360,7 +360,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE curr_track = null; } - void OpenTrack(CUE_File.Command.TRACK trackCommand) + private void OpenTrack(CUE_File.Command.TRACK trackCommand) { //assert that a file is open if(curr_file == null) @@ -390,7 +390,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE UpdateDiscInfo(trackCommand); } - void AddIndex(CUE_File.Command.INDEX indexCommand) + private void AddIndex(CUE_File.Command.INDEX indexCommand) { curr_track.Indexes.Add(new CompiledCueIndex { diff --git a/src/BizHawk.Emulation.DiscSystem/DiscFormats/CUE/CUE_File.cs b/src/BizHawk.Emulation.DiscSystem/DiscFormats/CUE/CUE_File.cs index 5f3e1eb0f3..8d0154ff56 100644 --- a/src/BizHawk.Emulation.DiscSystem/DiscFormats/CUE/CUE_File.cs +++ b/src/BizHawk.Emulation.DiscSystem/DiscFormats/CUE/CUE_File.cs @@ -5,7 +5,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE /// /// Represents the contents of a cue file /// - class CUE_File + internal class CUE_File { // (here are all the commands we can encounter) public static class Command diff --git a/src/BizHawk.Emulation.DiscSystem/DiscFormats/CUE/CUE_Load.cs b/src/BizHawk.Emulation.DiscSystem/DiscFormats/CUE/CUE_Load.cs index ae30150550..0c7231ac00 100644 --- a/src/BizHawk.Emulation.DiscSystem/DiscFormats/CUE/CUE_Load.cs +++ b/src/BizHawk.Emulation.DiscSystem/DiscFormats/CUE/CUE_Load.cs @@ -45,25 +45,25 @@ namespace BizHawk.Emulation.DiscSystem.CUE Normal, Pregap, Postgap } - class BlobInfo + private class BlobInfo { public IBlob Blob; public long Length; } //not sure if we need this... - class TrackInfo + private class TrackInfo { public int Length; public CompiledCueTrack CompiledCueTrack; } - List BlobInfos; - List TrackInfos = new List(); + private List BlobInfos; + private List TrackInfos = new List(); - void MountBlobs() + private void MountBlobs() { IBlob file_blob = null; @@ -125,7 +125,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE } - void AnalyzeTracks() + private void AnalyzeTracks() { 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(); //absent some kind of policy for how to set it, this is a safe assumption: diff --git a/src/BizHawk.Emulation.DiscSystem/DiscFormats/CUE/CUE_Parse.cs b/src/BizHawk.Emulation.DiscSystem/DiscFormats/CUE/CUE_Parse.cs index 4f157bdc62..04564603c5 100644 --- a/src/BizHawk.Emulation.DiscSystem/DiscFormats/CUE/CUE_Parse.cs +++ b/src/BizHawk.Emulation.DiscSystem/DiscFormats/CUE/CUE_Parse.cs @@ -12,7 +12,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE /// /// Performs minimum parse processing on a cue file /// - class ParseCueJob : DiscJob + internal class ParseCueJob : DiscJob { /// /// input: the cue string to parse @@ -30,10 +30,10 @@ namespace BizHawk.Emulation.DiscSystem.CUE public bool IN_Strict { private get; set; } = false; - class CueLineParser + private class CueLineParser { - int index; - string str; + private int index; + private string str; public bool EOF; public CueLineParser(string line) { @@ -51,12 +51,12 @@ namespace BizHawk.Emulation.DiscSystem.CUE return ret; } - enum Mode + private enum Mode { Normal, Quotable } - string ReadToken(Mode mode) + private string ReadToken(Mode mode) { 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; TextReader tr = new StringReader(cueString); diff --git a/src/BizHawk.Emulation.DiscSystem/DiscFormats/CUE/CUE_Synths.cs b/src/BizHawk.Emulation.DiscSystem/DiscFormats/CUE/CUE_Synths.cs index a32e1c6900..159909e2f9 100644 --- a/src/BizHawk.Emulation.DiscSystem/DiscFormats/CUE/CUE_Synths.cs +++ b/src/BizHawk.Emulation.DiscSystem/DiscFormats/CUE/CUE_Synths.cs @@ -50,7 +50,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE /// /// Represents a Mode1 2048-byte sector /// - class SS_Mode1_2048 : SS_Base + internal class SS_Mode1_2048 : SS_Base { public override void Synth(SectorSynthJob job) { @@ -71,7 +71,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE /// /// Represents a 2352-byte sector of any sort /// - class SS_2352 : SS_Base + internal class SS_2352 : SS_Base { public override void Synth(SectorSynthJob job) { @@ -86,7 +86,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE /// /// Encodes a pre-gap sector /// - class SS_Gap : SS_Base + internal class SS_Gap : SS_Base { public CueTrackType TrackType; diff --git a/src/BizHawk.Emulation.DiscSystem/DiscFormats/CUE/CueFileResolver.cs b/src/BizHawk.Emulation.DiscSystem/DiscFormats/CUE/CueFileResolver.cs index 474833cc33..21e9c8fe86 100644 --- a/src/BizHawk.Emulation.DiscSystem/DiscFormats/CUE/CueFileResolver.cs +++ b/src/BizHawk.Emulation.DiscSystem/DiscFormats/CUE/CueFileResolver.cs @@ -10,20 +10,20 @@ namespace BizHawk.Emulation.DiscSystem.CUE { public bool caseSensitive = false; public bool IsHardcodedResolve { get; private set; } - string baseDir; + private string baseDir; /// /// 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? /// - struct MyFileInfo + private struct MyFileInfo { public string FullName; public FileInfo FileInfo; } - DirectoryInfo diBasedir; - MyFileInfo[] fisBaseDir; + private DirectoryInfo diBasedir; + private MyFileInfo[] fisBaseDir; /// /// 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]; for (int i = 0; i < fis.Length; i++) diff --git a/src/BizHawk.Emulation.DiscSystem/DiscFormats/M3U_file.cs b/src/BizHawk.Emulation.DiscSystem/DiscFormats/M3U_file.cs index 5f4f79f307..1632415f35 100644 --- a/src/BizHawk.Emulation.DiscSystem/DiscFormats/M3U_file.cs +++ b/src/BizHawk.Emulation.DiscSystem/DiscFormats/M3U_file.cs @@ -11,7 +11,7 @@ namespace BizHawk.Emulation.DiscSystem return !ret.Parse(sr) ? null : ret; } - bool Parse(StreamReader sr) + private bool Parse(StreamReader sr) { bool ext = false; int runtime = -1; diff --git a/src/BizHawk.Emulation.DiscSystem/DiscFormats/MDS_Format.cs b/src/BizHawk.Emulation.DiscSystem/DiscFormats/MDS_Format.cs index e9b515157a..d025ba98bd 100644 --- a/src/BizHawk.Emulation.DiscSystem/DiscFormats/MDS_Format.cs +++ b/src/BizHawk.Emulation.DiscSystem/DiscFormats/MDS_Format.cs @@ -609,7 +609,7 @@ namespace BizHawk.Emulation.DiscSystem } /// path reference no longer points to file - Dictionary MountBlobs(AFile mdsf, Disc disc) + private Dictionary MountBlobs(AFile mdsf, Disc disc) { Dictionary BlobIndex = new Dictionary(); @@ -651,7 +651,7 @@ namespace BizHawk.Emulation.DiscSystem return BlobIndex; } - RawTOCEntry EmitRawTOCEntry(ATOCEntry entry) + private RawTOCEntry EmitRawTOCEntry(ATOCEntry entry) { BCD2 tno, ino; diff --git a/src/BizHawk.Emulation.DiscSystem/DiscHasher.cs b/src/BizHawk.Emulation.DiscSystem/DiscHasher.cs index 65a75bd869..83bae205b1 100644 --- a/src/BizHawk.Emulation.DiscSystem/DiscHasher.cs +++ b/src/BizHawk.Emulation.DiscSystem/DiscHasher.cs @@ -11,7 +11,7 @@ namespace BizHawk.Emulation.DiscSystem this.disc = disc; } - Disc disc; + private Disc disc; /// /// calculates the hash for quick PSX Disc identification @@ -127,7 +127,7 @@ namespace BizHawk.Emulation.DiscSystem } } - uint current = 0xFFFFFFFF; + private uint current = 0xFFFFFFFF; /// /// 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) { smallbuf[0] = (byte)((data) & 0xFF); @@ -171,7 +171,7 @@ namespace BizHawk.Emulation.DiscSystem set => current = value; } - uint gf2_matrix_times(uint[] mat, uint vec) + private uint gf2_matrix_times(uint[] mat, uint vec) { int matIdx = 0; uint sum = 0; @@ -185,7 +185,7 @@ namespace BizHawk.Emulation.DiscSystem return sum; } - void gf2_matrix_square(uint[] square, uint[] mat) + private void gf2_matrix_square(uint[] square, uint[] mat) { int n; for (n = 0; n < 32; n++) @@ -202,10 +202,10 @@ namespace BizHawk.Emulation.DiscSystem } //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 - 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 (odd == null) odd = new uint[32]; // odd-power-of-two zeros operator diff --git a/src/BizHawk.Emulation.DiscSystem/DiscIdentifier.cs b/src/BizHawk.Emulation.DiscSystem/DiscIdentifier.cs index 3c6098ce31..8644e61dc3 100644 --- a/src/BizHawk.Emulation.DiscSystem/DiscIdentifier.cs +++ b/src/BizHawk.Emulation.DiscSystem/DiscIdentifier.cs @@ -227,7 +227,7 @@ namespace BizHawk.Emulation.DiscSystem /// /// This is reasonable approach to ID saturn. /// - bool DetectSegaSaturn() + private bool DetectSegaSaturn() { return StringAt("SEGA SEGASATURN", 0); } @@ -235,12 +235,12 @@ namespace BizHawk.Emulation.DiscSystem /// /// probably wrong /// - bool DetectMegaCD() + private bool DetectMegaCD() { return StringAt("SEGADISCSYSTEM", 0) || StringAt("SEGADISCSYSTEM", 16); } - bool DetectPSX() + private bool DetectPSX() { if (!StringAt(" Licensed by ", 0, 4)) return false; 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; 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. //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 - bool DetectTurboCD() + private bool DetectTurboCD() { var toc = _disc.TOC; for (int t = toc.FirstRecordedTrackNumber; @@ -283,7 +283,7 @@ namespace BizHawk.Emulation.DiscSystem return false; } - bool Detect3DO() + private bool Detect3DO() { var toc = _disc.TOC; 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 - bool DetectDreamcast() + private bool DetectDreamcast() { for (int i = 0; i < 1000; i++) { @@ -309,12 +309,12 @@ namespace BizHawk.Emulation.DiscSystem return false; } - bool DetectCDi() + private bool DetectCDi() { return StringAt("CD-RTOS", 8, 16); } - bool DetectGameCube() + private bool DetectGameCube() { var data = ReadSectorCached(0); if (data == null) return false; @@ -326,7 +326,7 @@ namespace BizHawk.Emulation.DiscSystem return hexString == "C2339F3D"; } - bool DetectWii() + private bool DetectWii() { var data = ReadSectorCached(0); if (data == null) return false; diff --git a/src/BizHawk.Emulation.DiscSystem/DiscJob.cs b/src/BizHawk.Emulation.DiscSystem/DiscJob.cs index e15e5e8949..b619707133 100644 --- a/src/BizHawk.Emulation.DiscSystem/DiscJob.cs +++ b/src/BizHawk.Emulation.DiscSystem/DiscJob.cs @@ -53,7 +53,7 @@ namespace BizHawk.Emulation.DiscSystem } } - class DiscJobAbortException : Exception + internal class DiscJobAbortException : Exception { } } \ No newline at end of file diff --git a/src/BizHawk.Emulation.DiscSystem/DiscMountJob.MednaDisc.cs b/src/BizHawk.Emulation.DiscSystem/DiscMountJob.MednaDisc.cs index a0219ebfbe..881b160ade 100644 --- a/src/BizHawk.Emulation.DiscSystem/DiscMountJob.MednaDisc.cs +++ b/src/BizHawk.Emulation.DiscSystem/DiscMountJob.MednaDisc.cs @@ -2,7 +2,7 @@ { partial class DiscMountJob { - class SS_MednaDisc : ISectorSynthJob2448 + private class SS_MednaDisc : ISectorSynthJob2448 { public void Synth(SectorSynthJob job) { @@ -17,7 +17,7 @@ } } - void RunMednaDisc() + private void RunMednaDisc() { var disc = new Disc(); OUT_Disc = disc; diff --git a/src/BizHawk.Emulation.DiscSystem/DiscMountJob.cs b/src/BizHawk.Emulation.DiscSystem/DiscMountJob.cs index 94e6dd53a0..96c8306135 100644 --- a/src/BizHawk.Emulation.DiscSystem/DiscMountJob.cs +++ b/src/BizHawk.Emulation.DiscSystem/DiscMountJob.cs @@ -99,7 +99,7 @@ namespace BizHawk.Emulation.DiscSystem FinishLog(); } - void RunBizHawk() + private void RunBizHawk() { string infile = IN_FromPath; string cue_content = null; diff --git a/src/BizHawk.Emulation.DiscSystem/DiscSectorReader.cs b/src/BizHawk.Emulation.DiscSystem/DiscSectorReader.cs index ca871c0d41..0b3db177ac 100644 --- a/src/BizHawk.Emulation.DiscSystem/DiscSectorReader.cs +++ b/src/BizHawk.Emulation.DiscSystem/DiscSectorReader.cs @@ -58,21 +58,21 @@ namespace BizHawk.Emulation.DiscSystem { public DiscSectorReaderPolicy Policy = new DiscSectorReaderPolicy(); - Disc disc; + private Disc disc; public DiscSectorReader(Disc disc) { this.disc = disc; } - void PrepareJob(int lba) + private void PrepareJob(int lba) { job.LBA = lba; job.Params = disc.SynthParams; 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); } @@ -126,7 +126,7 @@ namespace BizHawk.Emulation.DiscSystem 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 var sector = disc.SynthProvider.Get(lba); @@ -145,7 +145,7 @@ namespace BizHawk.Emulation.DiscSystem 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 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. - byte[] buf2442 = new byte[2448]; - byte[] buf12 = new byte[12]; - SectorSynthJob job = new SectorSynthJob(); + private byte[] buf2442 = new byte[2448]; + private byte[] buf12 = new byte[12]; + private SectorSynthJob job = new SectorSynthJob(); } } \ No newline at end of file diff --git a/src/BizHawk.Emulation.DiscSystem/DiscStream.cs b/src/BizHawk.Emulation.DiscSystem/DiscStream.cs index b6fb1c6ac0..467eb9e478 100644 --- a/src/BizHawk.Emulation.DiscSystem/DiscStream.cs +++ b/src/BizHawk.Emulation.DiscSystem/DiscStream.cs @@ -51,14 +51,14 @@ namespace BizHawk.Emulation.DiscSystem /// public class DiscStream : System.IO.Stream { - int SectorSize; - int NumSectors; - Disc Disc; + private int SectorSize; + private int NumSectors; + private Disc Disc; - long currPosition; - byte[] cachedSectorBuffer; - int cachedSector; - DiscSectorReader dsr; + private long currPosition; + private byte[] cachedSectorBuffer; + private int cachedSector; + private DiscSectorReader dsr; /// is not or public DiscStream(Disc disc, EDiscStreamView view, int from_lba) diff --git a/src/BizHawk.Emulation.DiscSystem/DiscUtils.cs b/src/BizHawk.Emulation.DiscSystem/DiscUtils.cs index eb67dbcc6f..2997216958 100644 --- a/src/BizHawk.Emulation.DiscSystem/DiscUtils.cs +++ b/src/BizHawk.Emulation.DiscSystem/DiscUtils.cs @@ -4,7 +4,7 @@ namespace BizHawk.Emulation.DiscSystem { public static class DiscUtils { - static byte IntToBCD(int n) + private static byte IntToBCD(int n) { int tens = Math.DivRem(n, 10, out var ones); return (byte)((tens << 4) | ones); diff --git a/src/BizHawk.Emulation.DiscSystem/Internal/Algorithms/ECM.cs b/src/BizHawk.Emulation.DiscSystem/Internal/Algorithms/ECM.cs index 9645225214..4bbbb15f7b 100644 --- a/src/BizHawk.Emulation.DiscSystem/Internal/Algorithms/ECM.cs +++ b/src/BizHawk.Emulation.DiscSystem/Internal/Algorithms/ECM.cs @@ -33,14 +33,14 @@ using BizHawk.Common; namespace BizHawk.Emulation.DiscSystem { - static class ECM + internal static class ECM { //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 - static readonly byte[] mul2tab = new byte[256]; - static readonly byte[] div3tab = new byte[256]; + private static readonly byte[] mul2tab = new byte[256]; + private static readonly byte[] div3tab = new byte[256]; static ECM() { @@ -51,7 +51,7 @@ namespace BizHawk.Emulation.DiscSystem /// /// calculate EDC crc tables /// - 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) //confirmation at http://cdmagediscussion.yuku.com/topic/742/EDC-calculation @@ -88,7 +88,7 @@ namespace BizHawk.Emulation.DiscSystem /// /// calculate math lookup tables for ECC calculations. /// - static void Prep_ECC() + private static void Prep_ECC() { //create a table implementing f(i) = i*2 for (int i = 0; i < 256; i++) @@ -220,7 +220,7 @@ namespace BizHawk.Emulation.DiscSystem /// /// returns the address from a sector. useful for saving it before zeroing it for ECC calculations /// - static uint GetSectorAddress(byte[] sector, int sector_offset) + private static uint GetSectorAddress(byte[] sector, int sector_offset) { return (uint)( (sector[sector_offset + 12 + 0] << 0) @@ -233,7 +233,7 @@ namespace BizHawk.Emulation.DiscSystem /// /// sets the address for a sector. useful for restoring it after zeroing it for ECC calculations /// - 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 + 1] = (byte)((address >> 8) & 0xFF); diff --git a/src/BizHawk.Emulation.DiscSystem/Internal/Jobs/ApplySBIJob.cs b/src/BizHawk.Emulation.DiscSystem/Internal/Jobs/ApplySBIJob.cs index 3578ab14f0..94f0740e32 100644 --- a/src/BizHawk.Emulation.DiscSystem/Internal/Jobs/ApplySBIJob.cs +++ b/src/BizHawk.Emulation.DiscSystem/Internal/Jobs/ApplySBIJob.cs @@ -1,7 +1,7 @@ // TODO - generate correct Q subchannel CRC namespace BizHawk.Emulation.DiscSystem { - class ApplySBIJob + internal class ApplySBIJob { /// /// applies an SBI file to the disc diff --git a/src/BizHawk.Emulation.DiscSystem/Internal/Jobs/LoadSBIJob.cs b/src/BizHawk.Emulation.DiscSystem/Internal/Jobs/LoadSBIJob.cs index 82a21c4866..ff0ddaf0dd 100644 --- a/src/BizHawk.Emulation.DiscSystem/Internal/Jobs/LoadSBIJob.cs +++ b/src/BizHawk.Emulation.DiscSystem/Internal/Jobs/LoadSBIJob.cs @@ -8,7 +8,7 @@ namespace BizHawk.Emulation.DiscSystem.SBI /// /// Loads SBI files into an internal representation. /// - class LoadSBIJob : DiscJob + internal class LoadSBIJob : DiscJob { /// /// The file to be loaded diff --git a/src/BizHawk.Emulation.DiscSystem/Internal/Jobs/Synthesize_A0A1A2_Job.cs b/src/BizHawk.Emulation.DiscSystem/Internal/Jobs/Synthesize_A0A1A2_Job.cs index bfe638ebf6..77013e3ad5 100644 --- a/src/BizHawk.Emulation.DiscSystem/Internal/Jobs/Synthesize_A0A1A2_Job.cs +++ b/src/BizHawk.Emulation.DiscSystem/Internal/Jobs/Synthesize_A0A1A2_Job.cs @@ -9,7 +9,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 /// - class Synthesize_A0A1A2_Job + internal class Synthesize_A0A1A2_Job { /// /// "First Recorded Track Number" value for TOC (usually 1) diff --git a/src/BizHawk.Emulation.DiscSystem/Internal/Jobs/Synthesize_DiscStructure_From_DiscTOC_Job.cs b/src/BizHawk.Emulation.DiscSystem/Internal/Jobs/Synthesize_DiscStructure_From_DiscTOC_Job.cs index bdf356b842..698c2c98f6 100644 --- a/src/BizHawk.Emulation.DiscSystem/Internal/Jobs/Synthesize_DiscStructure_From_DiscTOC_Job.cs +++ b/src/BizHawk.Emulation.DiscSystem/Internal/Jobs/Synthesize_DiscStructure_From_DiscTOC_Job.cs @@ -2,7 +2,7 @@ using System; 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 DiscTOC TOCRaw; diff --git a/src/BizHawk.Emulation.DiscSystem/Internal/Jobs/Synthesize_DiscTOC_From_RawTOCEntries_Job.cs b/src/BizHawk.Emulation.DiscSystem/Internal/Jobs/Synthesize_DiscTOC_From_RawTOCEntries_Job.cs index 56f77453bf..e09b4ad5cc 100644 --- a/src/BizHawk.Emulation.DiscSystem/Internal/Jobs/Synthesize_DiscTOC_From_RawTOCEntries_Job.cs +++ b/src/BizHawk.Emulation.DiscSystem/Internal/Jobs/Synthesize_DiscTOC_From_RawTOCEntries_Job.cs @@ -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? /// - class Synthesize_DiscTOC_From_RawTOCEntries_Job + internal class Synthesize_DiscTOC_From_RawTOCEntries_Job { public IEnumerable Entries; public List Log = new List(); diff --git a/src/BizHawk.Emulation.DiscSystem/Internal/Jobs/Synthesize_Leadout_Job.cs b/src/BizHawk.Emulation.DiscSystem/Internal/Jobs/Synthesize_Leadout_Job.cs index 4fe66f332c..1b2a762b7d 100644 --- a/src/BizHawk.Emulation.DiscSystem/Internal/Jobs/Synthesize_Leadout_Job.cs +++ b/src/BizHawk.Emulation.DiscSystem/Internal/Jobs/Synthesize_Leadout_Job.cs @@ -9,7 +9,7 @@ namespace BizHawk.Emulation.DiscSystem /// generates lead-out sectors according to very crude approximations /// TODO - this isn't being used right now /// - class Synthesize_LeadoutJob + internal class Synthesize_LeadoutJob { public int Length; public Disc Disc; diff --git a/src/BizHawk.Emulation.DiscSystem/Internal/SectorSynth.cs b/src/BizHawk.Emulation.DiscSystem/Internal/SectorSynth.cs index 418559a70b..c98ed0ea70 100644 --- a/src/BizHawk.Emulation.DiscSystem/Internal/SectorSynth.cs +++ b/src/BizHawk.Emulation.DiscSystem/Internal/SectorSynth.cs @@ -9,7 +9,8 @@ namespace BizHawk.Emulation.DiscSystem /// 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 /// - [Flags] enum ESectorSynthPart + [Flags] + internal enum ESectorSynthPart { /// /// The data sector header is required. There's no header for audio tracks/sectors. @@ -100,7 +101,7 @@ namespace BizHawk.Emulation.DiscSystem /// /// Basic unit of sector synthesis /// - interface ISectorSynthJob2448 + internal interface ISectorSynthJob2448 { /// /// Synthesizes a sctor with the given job parameters @@ -111,7 +112,7 @@ namespace BizHawk.Emulation.DiscSystem /// /// Not a proper job? maybe with additional flags, it could be /// - class SectorSynthJob + internal class SectorSynthJob { public int LBA; public ESectorSynthPart Parts; @@ -124,7 +125,7 @@ namespace BizHawk.Emulation.DiscSystem /// /// an ISectorSynthProvider that just returns a value from an array of pre-made sectors /// - class ArraySectorSynthProvider : ISectorSynthProvider + internal class ArraySectorSynthProvider : ISectorSynthProvider { public List Sectors = new List(); public int FirstLBA; @@ -140,7 +141,7 @@ namespace BizHawk.Emulation.DiscSystem /// /// an ISectorSynthProvider that just returns a fixed synthesizer /// - class SimpleSectorSynthProvider : ISectorSynthProvider + internal class SimpleSectorSynthProvider : ISectorSynthProvider { public ISectorSynthJob2448 SS; @@ -150,11 +151,11 @@ namespace BizHawk.Emulation.DiscSystem /// /// Returns 'Patch' synth if the provided condition is met /// - class ConditionalSectorSynthProvider : ISectorSynthProvider + internal class ConditionalSectorSynthProvider : ISectorSynthProvider { - Func Condition; - ISectorSynthJob2448 Patch; - ISectorSynthProvider Parent; + private Func Condition; + private ISectorSynthJob2448 Patch; + private ISectorSynthProvider Parent; public void Install(Disc disc, Func condition, ISectorSynthJob2448 patch) { Parent = disc.SynthProvider; @@ -171,7 +172,7 @@ namespace BizHawk.Emulation.DiscSystem /// /// When creating a disc, this is set with a callback that can deliver an ISectorSynthJob2448 for the given LBA /// - interface ISectorSynthProvider + internal interface ISectorSynthProvider { /// /// 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 /// the SectorSynths that have been setup for it /// - struct SectorSynthParams + internal struct SectorSynthParams { //public long[] BlobOffsets; public MednaDisc MednaDisc; } - class SS_PatchQ : ISectorSynthJob2448 + internal class SS_PatchQ : ISectorSynthJob2448 { public ISectorSynthJob2448 Original; 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 DiscMountPolicy Policy; diff --git a/src/BizHawk.Emulation.DiscSystem/Internal/SynthUtils.cs b/src/BizHawk.Emulation.DiscSystem/Internal/SynthUtils.cs index 337607c9cc..1f7fe5a0a8 100644 --- a/src/BizHawk.Emulation.DiscSystem/Internal/SynthUtils.cs +++ b/src/BizHawk.Emulation.DiscSystem/Internal/SynthUtils.cs @@ -1,6 +1,6 @@ namespace BizHawk.Emulation.DiscSystem { - static class SynthUtils + internal static class SynthUtils { /// /// Calculates the checksum of the provided Q subchannel buffer and emplaces it