2011-01-11 02:55:51 +00:00
|
|
|
|
using System;
|
2011-01-21 03:59:50 +00:00
|
|
|
|
using System.Collections.Generic;
|
2011-01-11 02:55:51 +00:00
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
namespace BizHawk
|
|
|
|
|
{
|
2011-07-11 23:26:20 +00:00
|
|
|
|
public class NullEmulator : IEmulator, IVideoProvider, ISoundProvider
|
|
|
|
|
{
|
|
|
|
|
public string SystemId { get { return "NULL"; } }
|
|
|
|
|
public static readonly ControllerDefinition NullController = new ControllerDefinition { Name = "Null Controller" };
|
2011-01-12 02:05:48 +00:00
|
|
|
|
|
2011-07-11 23:26:20 +00:00
|
|
|
|
private int[] frameBuffer = new int[256 * 192];
|
|
|
|
|
private Random rand = new Random();
|
2011-06-11 22:15:08 +00:00
|
|
|
|
public CoreInputComm CoreInputComm { get; set; }
|
|
|
|
|
public CoreOutputComm CoreOutputComm { get; private set; }
|
2011-07-11 23:26:20 +00:00
|
|
|
|
public IVideoProvider VideoProvider { get { return this; } }
|
|
|
|
|
public ISoundProvider SoundProvider { get { return this; } }
|
sound api changes. added a new ISyncSoundProvider, which works similarly to ISoundProvider except the source (not the sink) determines the number of samples to process. Added facilities to metaspu, dcfilter, speexresampler to work with ISyncSoundProvider. Add ISyncSoundProvider to IEmulator. All IEmulators must provide sync sound, but they need not provide async sound. When async is needed and an IEmulator doesn't provide it, the frontend will wrap it in a vecna metaspu. SNES, GB changed to provide sync sound only. All other emulator cores mostly unchanged; they just provide stub fakesync alongside async, for now. For the moment, the only use of the sync sound is for realtime audio throttling, where it works and sounds quite nice. In the future, sync sound will be supported for AV dumping as well.
2012-10-11 00:44:59 +00:00
|
|
|
|
public ISyncSoundProvider SyncSoundProvider { get { return new FakeSyncSound(this, 735); } }
|
|
|
|
|
public bool StartAsyncSound() { return true; }
|
|
|
|
|
public void EndAsyncSound() { }
|
|
|
|
|
|
2011-07-11 23:26:20 +00:00
|
|
|
|
public NullEmulator()
|
|
|
|
|
{
|
|
|
|
|
var domains = new List<MemoryDomain>(1);
|
|
|
|
|
domains.Add(new MemoryDomain("Main RAM", 1, Endian.Little, addr => 0, (a, v) => { }));
|
|
|
|
|
memoryDomains = domains.AsReadOnly();
|
|
|
|
|
CoreOutputComm = new CoreOutputComm();
|
|
|
|
|
CoreInputComm = new CoreInputComm();
|
|
|
|
|
}
|
2011-07-30 20:49:36 +00:00
|
|
|
|
public void ResetFrameCounter()
|
|
|
|
|
{
|
|
|
|
|
Frame = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-20 19:52:47 +00:00
|
|
|
|
public void FrameAdvance(bool render, bool rendersound)
|
2011-07-11 23:26:20 +00:00
|
|
|
|
{
|
|
|
|
|
if (render == false) return;
|
|
|
|
|
for (int i = 0; i < 256 * 192; i++)
|
|
|
|
|
frameBuffer[i] = Colors.Luminosity((byte)rand.Next());
|
|
|
|
|
}
|
|
|
|
|
public ControllerDefinition ControllerDefinition { get { return NullController; } }
|
|
|
|
|
public IController Controller { get; set; }
|
2011-02-26 21:36:46 +00:00
|
|
|
|
|
2011-07-11 23:26:20 +00:00
|
|
|
|
public int Frame { get; set; }
|
|
|
|
|
public int LagCount { get { return 0; } set { return; } }
|
|
|
|
|
public bool IsLagFrame { get { return false; } }
|
2011-05-01 12:59:26 +00:00
|
|
|
|
|
2012-09-14 22:28:38 +00:00
|
|
|
|
public byte[] ReadSaveRam() { return null; }
|
|
|
|
|
public void StoreSaveRam(byte[] data) { }
|
|
|
|
|
public void ClearSaveRam() { }
|
2012-10-03 15:31:04 +00:00
|
|
|
|
public bool DeterministicEmulation { get { return true; } }
|
2011-07-11 23:26:20 +00:00
|
|
|
|
public bool SaveRamModified { get; set; }
|
|
|
|
|
public void SaveStateText(TextWriter writer) { }
|
|
|
|
|
public void LoadStateText(TextReader reader) { }
|
|
|
|
|
public void SaveStateBinary(BinaryWriter writer) { }
|
|
|
|
|
public void LoadStateBinary(BinaryReader reader) { }
|
|
|
|
|
public byte[] SaveStateBinary() { return new byte[1]; }
|
|
|
|
|
public int[] GetVideoBuffer() { return frameBuffer; }
|
2012-06-25 02:50:34 +00:00
|
|
|
|
public int VirtualWidth { get { return 256; } }
|
|
|
|
|
public int BufferWidth { get { return 256; } }
|
2011-07-11 23:26:20 +00:00
|
|
|
|
public int BufferHeight { get { return 192; } }
|
|
|
|
|
public int BackgroundColor { get { return 0; } }
|
|
|
|
|
public void GetSamples(short[] samples) { }
|
2011-03-19 09:12:56 +00:00
|
|
|
|
public void DiscardSamples() { }
|
2012-02-24 20:38:35 +00:00
|
|
|
|
public int MaxVolume { get; set; }
|
2011-07-11 23:26:20 +00:00
|
|
|
|
private IList<MemoryDomain> memoryDomains;
|
|
|
|
|
public IList<MemoryDomain> MemoryDomains { get { return memoryDomains; } }
|
|
|
|
|
public MemoryDomain MainMemory { get { return memoryDomains[0]; } }
|
|
|
|
|
public void Dispose() { }
|
|
|
|
|
}
|
2011-06-02 02:59:18 +00:00
|
|
|
|
|
2011-07-11 23:26:20 +00:00
|
|
|
|
public class NullSound : ISoundProvider
|
|
|
|
|
{
|
|
|
|
|
public static readonly NullSound SilenceProvider = new NullSound();
|
2011-06-02 02:59:18 +00:00
|
|
|
|
|
2011-07-11 23:26:20 +00:00
|
|
|
|
public void GetSamples(short[] samples) { }
|
|
|
|
|
public void DiscardSamples() { }
|
2012-02-24 20:38:35 +00:00
|
|
|
|
public int MaxVolume { get; set; }
|
2011-07-11 23:26:20 +00:00
|
|
|
|
}
|
2011-01-11 02:55:51 +00:00
|
|
|
|
}
|