diff --git a/BizHawk.Emulation.DiscSystem/TOC/DiscStructure.cs b/BizHawk.Emulation.DiscSystem/API/DiscStructure.cs
similarity index 100%
rename from BizHawk.Emulation.DiscSystem/TOC/DiscStructure.cs
rename to BizHawk.Emulation.DiscSystem/API/DiscStructure.cs
diff --git a/BizHawk.Emulation.DiscSystem/TOC/TOCRaw.cs b/BizHawk.Emulation.DiscSystem/API/TOCRaw.cs
similarity index 100%
rename from BizHawk.Emulation.DiscSystem/TOC/TOCRaw.cs
rename to BizHawk.Emulation.DiscSystem/API/TOCRaw.cs
diff --git a/BizHawk.Emulation.DiscSystem/BizHawk.Emulation.DiscSystem.csproj b/BizHawk.Emulation.DiscSystem/BizHawk.Emulation.DiscSystem.csproj
index f120c3ad16..f2f8adf30c 100644
--- a/BizHawk.Emulation.DiscSystem/BizHawk.Emulation.DiscSystem.csproj
+++ b/BizHawk.Emulation.DiscSystem/BizHawk.Emulation.DiscSystem.csproj
@@ -55,6 +55,8 @@
+
+
@@ -92,8 +94,6 @@
-
-
diff --git a/BizHawk.Emulation.DiscSystem/Blobs/Blob_ZeroPadAdapter.cs b/BizHawk.Emulation.DiscSystem/Blobs/Blob_ZeroPadAdapter.cs
index f9dcaa8f8b..f99c56c1c8 100644
--- a/BizHawk.Emulation.DiscSystem/Blobs/Blob_ZeroPadAdapter.cs
+++ b/BizHawk.Emulation.DiscSystem/Blobs/Blob_ZeroPadAdapter.cs
@@ -7,22 +7,6 @@ namespace BizHawk.Emulation.DiscSystem
{
public partial class Disc : IDisposable
{
- ///
- /// A blob that always reads 0
- ///
- internal sealed class Blob_Zeros : IBlob
- {
- public int Read(long byte_pos, byte[] buffer, int offset, int count)
- {
- Array.Clear(buffer, offset, count);
- return count;
- }
-
- public void Dispose()
- {
- }
- }
-
internal sealed class Blob_ZeroPadAdapter : IBlob
{
IBlob srcBlob;
@@ -58,44 +42,6 @@ namespace BizHawk.Emulation.DiscSystem
{
}
}
-
- ///
- /// For use with blobs which are prematurely ended: buffers what there is, and zero-pads the rest
- ///
- public sealed class Blob_ZeroPadBuffer : IBlob
- {
- public static Blob_ZeroPadBuffer MakeBufferFrom(IBlob baseBlob, long start, int bufferLength)
- {
- var ret = new Blob_ZeroPadBuffer();
-
- //allocate the entire buffer we'll need, and it will already be zero-padded
- ret.buffer = new byte[bufferLength];
-
- //read as much as is left
- baseBlob.Read(start, ret.buffer, 0, bufferLength);
-
- //if any less got read, well, there were already zeroes there
- return ret;
- }
-
- public int Read(long byte_pos, byte[] buffer, int offset, int count)
- {
- int have = buffer.Length;
- int todo = count;
- if (have < todo)
- todo = have;
- Buffer.BlockCopy(this.buffer, 0, buffer, offset, todo);
- return todo;
- }
-
- byte[] buffer;
-
- public void Dispose()
- {
- buffer = null;
- }
- }
-
}
}
\ No newline at end of file
diff --git a/BizHawk.Emulation.DiscSystem/Disc.ID.cs b/BizHawk.Emulation.DiscSystem/Disc.ID.cs
deleted file mode 100644
index 034269fbe9..0000000000
--- a/BizHawk.Emulation.DiscSystem/Disc.ID.cs
+++ /dev/null
@@ -1,119 +0,0 @@
-using System;
-
-//disc type identification logic
-
-namespace BizHawk.Emulation.DiscSystem
-{
- public enum DiscType
- {
- ///
- /// Nothing is known about this disc type
- ///
- UnknownFormat,
-
- ///
- /// This is definitely a CDFS disc, but we can't identify anything more about it
- ///
- UnknownCDFS,
-
- ///
- /// Sony PSX
- ///
- SonyPSX,
-
- ///
- /// Sony PSP
- ///
- SonyPSP,
-
- ///
- /// Sega Saturn
- ///
- SegaSaturn,
-
- ///
- /// Its not clear whether we can ever have enough info to ID a turboCD disc (we're using hashes)
- ///
- TurboCD,
-
- ///
- /// MegaDrive addon
- ///
- MegaCD
- }
-
- sealed public partial class Disc
- {
- ///
- /// Attempts to determine the type of the disc.
- /// In the future, we might return a struct or a class with more detailed information
- ///
- public DiscType DetectDiscType()
- {
- //sega doesnt put anything identifying in the cdfs volume info. but its consistent about putting its own header here in sector 0
- if (DetectSegaSaturn()) return DiscType.SegaSaturn;
-
- // not fully tested yet
- if (DetectMegaCD()) return DiscType.MegaCD;
-
- // not fully tested yet
- if (DetectPSX()) return DiscType.SonyPSX;
-
- //we dont know how to detect TurboCD.
- //an emulator frontend will likely just guess TurboCD if the disc is UnknownFormat
-
- var iso = new ISOFile();
- bool isIso = iso.Parse(DiscStream.Open_LBA_2048(this));
-
- if (isIso)
- {
- var appId = System.Text.Encoding.ASCII.GetString(iso.VolumeDescriptors[0].ApplicationIdentifier).TrimEnd('\0', ' ');
- //NOTE: PSX magical drop F (JP SLPS_02337) doesn't have the correct iso PVD fields
- //if (appId == "PLAYSTATION")
- // return DiscType.SonyPSX;
- if(appId == "PSP GAME")
- return DiscType.SonyPSP;
-
- return DiscType.UnknownCDFS;
- }
-
- return DiscType.UnknownFormat;
- }
-
- ///
- /// This is reasonable approach to ID saturn.
- ///
- bool DetectSegaSaturn()
- {
- return StringAt("SEGA SEGASATURN", 0);
- }
-
- ///
- /// probably wrong
- ///
- bool DetectMegaCD()
- {
- return StringAt("SEGADISCSYSTEM", 0) || StringAt("SEGADISCSYSTEM", 16);
- }
-
- bool DetectPSX()
- {
- if (!StringAt(" Licensed by ",0, 4)) return false;
- return (StringAt("Sony Computer Entertainment Euro", 32, 4)
- || StringAt("Sony Computer Entertainment Inc.", 32, 4)
- || StringAt("Sony Computer Entertainment Amer", 32, 4)
- || StringAt("Sony Computer Entertainment of A", 32, 4)
- );
- }
-
- private bool StringAt(string s, int n, int lba = 0)
- {
- byte[] data = new byte[2048];
- ReadLBA_2048(lba, data, 0);
- byte[] cmp = System.Text.Encoding.ASCII.GetBytes(s);
- byte[] cmp2 = new byte[cmp.Length];
- Buffer.BlockCopy(data, n, cmp2, 0, cmp.Length);
- return System.Linq.Enumerable.SequenceEqual(cmp, cmp2);
- }
- }
-}
\ No newline at end of file
diff --git a/BizHawk.Emulation.DiscSystem/DiscTOC.cs b/BizHawk.Emulation.DiscSystem/DiscTOC.cs
deleted file mode 100644
index e3f35e31fc..0000000000
--- a/BizHawk.Emulation.DiscSystem/DiscTOC.cs
+++ /dev/null
@@ -1,226 +0,0 @@
-using System;
-using System.Text;
-using System.Collections.Generic;
-
-namespace BizHawk.Emulation.DiscSystem
-{
-
-
- ///
- /// The TOC contains information directly describing the structure of the disc, as well as some more logically structured information derived from that.
- /// Additionally, this class contains methods to synchronize between them.
- /// This is a bit weird.. Perhaps the different views of the data should be seaprated.
- ///
- /// One final caveat - I think the TOC should be independent for independent sessions.. the concept of multi-sessioning is so thoroughly ill-supported here, it will require radical renovation ever to support.
- ///
- /// Sessions -> Tracks : These are the highest-level data structures of the disc. We should probably rename this to something like DiscStructure, and save DiscTOC for the actual TOC.
- /// TOCPoint : These are the basic logical unit of data stored in the TOC. They're basically bookmarks for tracks.
- /// TOCEntry : These are the basic unit of data in the rawest view of the TOC. They're stored in the lead-in Q subchannel, and there are multiple redundant copies, and they store several different types of information.
- ///
- public class DiscTOC
- {
- ///
- /// Right now support for anything other than 1 session is totally not working
- ///
- public List Sessions = new List();
-
- ///
- /// List of Points described by the TOC
- ///
- public List Points = new List();
-
-
- ///
- /// Todo - comment about what this actually means
- /// TODO - this is redundant with Sectors.Count
- ///
- public int length_aba;
-
- ///
- /// todo - comment about what this actually means
- ///
- public Timestamp FriendlyLength { get { return new Timestamp(length_aba); } }
-
- ///
- /// todo - comment about what this actually means
- ///
- public long BinarySize
- {
- get { return length_aba * 2352; }
- }
-
- ///
- /// seeks the point immediately before (or equal to) this LBA
- ///
- public TOCPoint SeekPoint(int lba)
- {
- int aba = lba + 150;
- for(int i=0;i aba)
- return Points[i - 1];
- }
- return Points[Points.Count - 1];
- }
-
-
- ///
- ///
- ///
- public class TOCPoint
- {
- public int Num;
- public int ABA, TrackNum, IndexNum;
- public Track Track;
-
- public int LBA
- {
- get { return ABA - 150; }
- }
- }
-
- ///
- /// Generates the Points list from the current logical TOC
- ///
- public void SynthesizeTOCPointsFromSessions()
- {
- int num = 0;
- Points.Clear();
- foreach (var ses in Sessions)
- {
- foreach (var track in ses.Tracks)
- foreach (var index in track.Indexes)
- {
- var tp = new TOCPoint
- {
- Num = num++,
- ABA = index.aba,
- TrackNum = track.num,
- IndexNum = index.num,
- Track = track
- };
- Points.Add(tp);
- }
-
- var tpLeadout = new TOCPoint();
- var lastTrack = ses.Tracks[ses.Tracks.Count - 1];
- tpLeadout.Num = num++;
- tpLeadout.ABA = lastTrack.Indexes[1].aba + lastTrack.length_aba;
- tpLeadout.IndexNum = 0;
- tpLeadout.TrackNum = 100;
- tpLeadout.Track = null; //no leadout track.. now... or ever?
- Points.Add(tpLeadout);
- }
- }
-
- public class Session
- {
- public int num;
- public List