2011-01-21 03:59:50 +00:00
using System ;
2011-01-11 02:55:51 +00:00
2013-11-04 01:39:19 +00:00
namespace BizHawk.Emulation.Common
2011-01-11 02:55:51 +00:00
{
2016-12-13 21:56:20 +00:00
/// <summary>
/// This service defines a core as a core. It is the primary service
/// and the absolute minimum requirement to have a functional core in BizHawk
/// a client can not operate without this minimum requirement
/// </summary>
2014-12-04 02:12:57 +00:00
public interface IEmulator : IEmulatorService , IDisposable
2011-07-30 20:49:36 +00:00
{
2014-12-04 03:38:30 +00:00
/// <summary>
2017-04-19 15:36:08 +00:00
/// Gets the service provider.
/// This is the intended mechanism to get services from a core
2014-12-04 03:38:30 +00:00
/// Retrieves an IEmulatorService from the core,
/// if the core does not have the type specified, it will return null
/// </summary>
IEmulatorServiceProvider ServiceProvider { get ; }
2013-11-06 02:15:29 +00:00
/// <summary>
2017-04-19 15:36:08 +00:00
/// Gets the definition that defines all the possible inputs and types that the core can receive
2016-12-12 19:14:01 +00:00
/// By design this should not change during the lifetime of the instance of the core
/// To change the definition, a new instance should be created
2013-11-06 02:15:29 +00:00
/// </summary>
2011-07-30 20:49:36 +00:00
ControllerDefinition ControllerDefinition { get ; }
2016-12-12 19:14:01 +00:00
2013-11-06 02:15:29 +00:00
/// <summary>
2016-12-12 19:14:01 +00:00
/// Runs the emulator core for 1 frame
/// note that (some?) cores expect you to call SoundProvider.GetSamples() after each FrameAdvance()
2017-05-02 13:52:42 +00:00
/// please do this, even when <seealso cref="rendersound"/> = false
2017-05-02 01:09:11 +00:00
/// <param name="controller">The <seealso cref="IController"/> instance that the core will use for input.
/// The <seealso cref="IController"/> provided by the client must provide the buttons specified by the core through the <seealso cref="ControllerDefinition"/> property
/// </param>
2016-12-12 19:14:01 +00:00
/// <param name="render">Whether or not to render video, cores will pass false here in cases such as frame skipping</param>
/// <param name="rendersound">Whether or not to render audio, cores will pass here false here in cases such as fast forwarding where bypassing sound may improve speed</param>
2013-11-06 02:15:29 +00:00
/// </summary>
2017-05-02 01:09:11 +00:00
void FrameAdvance ( IController controller , bool render , bool rendersound = true ) ;
2011-07-30 20:49:36 +00:00
2013-11-06 02:15:29 +00:00
/// <summary>
2017-04-19 15:36:08 +00:00
/// Gets the current frame count
2013-11-06 02:15:29 +00:00
/// </summary>
2011-07-30 20:49:36 +00:00
int Frame { get ; }
2013-11-06 02:15:29 +00:00
/// <summary>
2017-04-19 15:36:08 +00:00
/// Gets the unique Id of the platform currently being emulated, for instance "NES"
2013-11-06 02:15:29 +00:00
/// </summary>
2011-07-30 20:49:36 +00:00
string SystemId { get ; }
2013-11-06 02:15:29 +00:00
/// <summary>
2017-04-19 15:36:08 +00:00
/// Gets a value indicating whether the core is in deterministic mode.
/// This flag is a contract with the client.
2013-11-06 02:15:29 +00:00
/// 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
/// </summary>
2012-10-03 15:31:04 +00:00
bool DeterministicEmulation { get ; }
2011-07-30 20:49:36 +00:00
2013-11-06 02:15:29 +00:00
/// <summary>
/// Resets the Frame and Lag counters, and any other similar counters a core might implement
/// </summary>
2013-11-03 16:29:51 +00:00
void ResetCounters ( ) ;
2013-11-06 02:15:29 +00:00
2012-12-10 00:43:43 +00:00
/// <summary>
2017-04-19 15:36:08 +00:00
/// Gets the core communications module in use by this core.
2012-12-10 00:43:43 +00:00
/// </summary>
2016-12-12 19:14:01 +00:00
/// <seealso cref="BizHawk.Emulation.Common.CoreComm" />
2012-12-10 00:43:43 +00:00
CoreComm CoreComm { get ; }
2014-10-19 01:22:47 +00:00
}
2011-01-11 02:55:51 +00:00
}