BizHawk/BizHawk.Emulation.DiscSystem/Disc.cs

108 lines
3.9 KiB
C#
Raw Normal View History

2011-05-08 09:07:46 +00:00
using System;
2011-08-07 03:21:03 +00:00
using System.Linq;
2011-05-08 09:07:46 +00:00
using System.Text;
using System.IO;
using System.Collections.Generic;
2015-06-23 18:57:11 +00:00
//ARCHITECTURE NOTE:
2015-06-27 09:57:22 +00:00
//No provisions are made for caching synthesized data for later accelerated use.
//This is because, in the worst case that might result in synthesizing an entire disc in memory.
//Instead, users should be advised to `hawk` the disc first for most rapid access so that synthesis won't be necessary and speed will be maximized.
//This will result in a completely flattened CCD where everything comes right off the hard drive
//Our choice here might be an unwise decision for disc ID and miscellaneous purposes but it's best for gaming and stream-converting (hawking and hashing)
2015-07-01 07:56:55 +00:00
//TODO: in principle, we could mount audio to decode only on an as-needed basis
//this might result in hiccups during emulation, though, so it should be an option.
//This would imply either decode-length processing (scan file without decoding) or decoding and discarding the data.
//We should probably have some richer policy specifications for this kind of thing, but it's not a high priority. Main workflow is still discohawking.
//Alternate policies would probably be associated with copious warnings (examples: ? ? ?)
2015-06-27 09:57:22 +00:00
namespace BizHawk.Emulation.DiscSystem
2011-05-08 09:07:46 +00:00
{
public partial class Disc : IDisposable
2011-05-08 09:07:46 +00:00
{
2015-07-08 07:54:05 +00:00
/// <summary>
/// Automagically loads a disc, without any fine-tuned control at all
/// </summary>
public static Disc LoadAutomagic(string path)
{
var job = new DiscMountJob { IN_FromPath = path };
//job.IN_DiscInterface = DiscInterface.MednaDisc; //TEST
job.Run();
return job.OUT_Disc;
}
/// <summary>
/// The DiscStructure corresponding to the TOCRaw
/// </summary>
public DiscStructure Structure;
2015-07-08 03:29:11 +00:00
/// <summary>
/// DiscStructure.Session 1 of the disc, since that's all thats needed most of the time.
/// </summary>
public DiscStructure.Session Session1 { get { return Structure.Sessions[1]; } }
2015-07-13 01:08:30 +00:00
/// <summary>
/// The name of a disc. Loosely based on the filename. Just for informational purposes.
/// </summary>
public string Name;
/// <summary>
2015-07-08 04:12:06 +00:00
/// The DiscTOCRaw corresponding to the RawTOCEntries.
/// TODO - there's one of these for every session, so... having one here doesnt make sense
2015-07-08 07:54:05 +00:00
/// so...
/// TODO - remove me
/// </summary>
2015-07-08 04:12:06 +00:00
public DiscTOC TOC;
2011-05-08 09:07:46 +00:00
2015-07-08 03:29:11 +00:00
/// <summary>
2015-07-08 04:12:06 +00:00
/// The raw TOC entries found in the lead-in track.
/// These aren't very useful, but theyre one of the most lowest-level data structures from which other TOC-related stuff is derived
2015-07-08 03:29:11 +00:00
/// </summary>
2015-07-08 04:12:06 +00:00
public List<RawTOCEntry> RawTOCEntries = new List<RawTOCEntry>();
2015-06-23 18:57:11 +00:00
2015-07-08 03:29:11 +00:00
/// <summary>
2015-07-08 04:12:06 +00:00
/// Free-form optional memos about the disc
2015-07-08 03:29:11 +00:00
/// </summary>
2015-07-08 04:12:06 +00:00
public Dictionary<string, object> Memos = new Dictionary<string, object>();
2011-05-08 09:07:46 +00:00
public void Dispose()
{
2015-06-23 18:57:11 +00:00
foreach (var res in DisposableResources)
{
2015-06-23 18:57:11 +00:00
res.Dispose();
}
}
2015-06-23 18:57:11 +00:00
/// <summary>
2015-07-08 04:12:06 +00:00
/// The DiscMountPolicy used to mount the disc. Consider this read-only.
/// NOT SURE WE NEED THIS
2015-06-23 18:57:11 +00:00
/// </summary>
2015-07-08 04:12:06 +00:00
//public DiscMountPolicy DiscMountPolicy;
2011-06-20 09:09:21 +00:00
2015-07-08 04:12:06 +00:00
//----------------------------------------------------------------------------
2015-01-05 23:01:23 +00:00
2015-07-08 04:12:06 +00:00
/// <summary>
/// Disposable resources (blobs, mostly) referenced by this disc
/// </summary>
internal List<IDisposable> DisposableResources = new List<IDisposable>();
2015-01-05 23:01:23 +00:00
2015-07-08 04:12:06 +00:00
/// <summary>
/// The sectors on the disc
2015-07-08 07:54:05 +00:00
/// TODO - replace with delegate (much faster disc loading, support of reading of arbitrary lead-out and lead-in sectors)
2015-07-08 04:12:06 +00:00
/// </summary>
internal List<ISectorSynthJob2448> Sectors = new List<ISectorSynthJob2448>();
2015-01-05 23:01:23 +00:00
2015-07-08 04:12:06 +00:00
/// <summary>
/// Parameters set during disc loading which can be referenced by the sector synthesizers
/// </summary>
internal SectorSynthParams SynthParams = new SectorSynthParams();
2011-05-08 09:07:46 +00:00
2015-07-02 06:06:03 +00:00
/// <summary>
2015-07-08 07:54:05 +00:00
/// Forbid public construction
2015-07-02 06:06:03 +00:00
/// </summary>
2015-07-08 07:54:05 +00:00
internal Disc()
{}
2011-06-20 09:09:21 +00:00
}
2011-05-08 09:07:46 +00:00
}