using System;
namespace BizHawk.Emulation.Common
{
public interface IEmulator : IEmulatorService, IDisposable
{
///
/// Retrieves an IEmulatorService from the core,
/// if the core does not have the type specified, it will return null
///
///
///
IEmulatorServiceProvider ServiceProvider { get; }
///
/// Sound provider for async operation. this is optional, and is only required after StartAsyncSound() is called and returns true
///
ISoundProvider SoundProvider { get; }
///
/// sound provider for sync operation. this is manditory
///
ISyncSoundProvider SyncSoundProvider { get; }
/// start async operation. (on construct, sync operation is assumed).
/// false if core doesn't support async sound; SyncSoundProvider will continue to be used in that case
bool StartAsyncSound();
///
/// end async operation, returning to sync operation. after this, all sound requests will go to the SyncSoundProvider
///
void EndAsyncSound();
///
/// Defines all the possible inputs and types that the core can receive
///
ControllerDefinition ControllerDefinition { get; }
IController Controller { get; set; }
///
// note that (some?) cores expect you to call SoundProvider.GetSamples() after each FrameAdvance()
// please do this, even when rendersound = false
///
void FrameAdvance(bool render, bool rendersound = true);
///
/// The frame count
///
int Frame { get; }
///
/// The unique Id of the given core, for instance "NES"
///
string SystemId { get; }
///
/// This flag is a contract with the client.
/// If true, the core agrees to behave in a completely deterministic manner,
/// Features like movie recording depend on this.
/// It is the client's responsibility to manage this flag.
/// If a core wants to implement non-deterministic features (like speed hacks, frame-skipping), it must be done only when this flag is false
/// if you want to set this, look in the emulator's constructor or Load() method
///
bool DeterministicEmulation { get; }
///
/// identifying information about a "mapper" or similar capability. null if no such useful distinction can be drawn
///
string BoardName { get; }
///
/// Resets the Frame and Lag counters, and any other similar counters a core might implement
///
void ResetCounters();
///
/// the corecomm module in use by this core.
///
CoreComm CoreComm { get; }
}
public static class VideoProviderGlue
{
// todo: this will go away
public static IVideoProvider VideoProvider(this IEmulator emu)
{
return emu.ServiceProvider.GetService();
}
}
}