BizHawk/BizHawk.Client.ApiHawk/Classes/Api/PluginBase.cs

51 lines
1.1 KiB
C#
Raw Normal View History

using BizHawk.Emulation.Common;
2018-09-01 04:21:34 +00:00
namespace BizHawk.Client.ApiHawk
2018-09-01 04:21:34 +00:00
{
public abstract class PluginBase : IPlugin
2018-09-01 04:21:34 +00:00
{
/// <summary>
/// The base class from which all
/// plugins will be derived
///
/// Actual plugins should implement
/// one of the below callback methods
/// or register memory callbacks in
/// their Init function.
/// </summary>
protected IApiContainer _api;
2018-09-01 04:21:34 +00:00
public PluginBase() { }
2018-09-01 04:21:34 +00:00
public abstract string Name { get; }
public abstract string Description { get; }
public bool Enabled => Running;
public bool Paused => !Running;
2018-09-01 04:21:34 +00:00
public bool Running { get; set; }
public void Stop()
{
Running = false;
}
public void Toggle()
{
Running = !Running;
}
public virtual void PreFrameCallback() { }
public virtual void PostFrameCallback() { }
public virtual void SaveStateCallback(string name) { }
public virtual void LoadStateCallback(string name) { }
public virtual void InputPollCallback() { }
public virtual void ExitCallback() { }
public virtual void Init (IApiContainer api)
{
_api = api;
Running = true;
}
2018-09-01 04:21:34 +00:00
}
}