2016-12-14 20:12:16 +00:00
|
|
|
|
using BizHawk.Emulation.Common;
|
2014-06-26 19:19:26 +00:00
|
|
|
|
|
|
|
|
|
namespace BizHawk.Client.Common
|
|
|
|
|
{
|
|
|
|
|
public class AndAdapter : IController
|
|
|
|
|
{
|
2016-12-14 20:12:16 +00:00
|
|
|
|
public ControllerDefinition Definition
|
2014-06-26 19:19:26 +00:00
|
|
|
|
{
|
2016-12-14 20:12:16 +00:00
|
|
|
|
get { return Source.Definition; }
|
2014-06-26 19:19:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-14 20:12:16 +00:00
|
|
|
|
public bool IsPressed(string button)
|
2014-06-26 19:19:26 +00:00
|
|
|
|
{
|
2016-12-14 20:12:16 +00:00
|
|
|
|
if (Source != null && SourceAnd != null)
|
2014-06-26 19:19:26 +00:00
|
|
|
|
{
|
2016-12-14 20:12:16 +00:00
|
|
|
|
return Source.IsPressed(button) & SourceAnd.IsPressed(button);
|
2014-06-26 19:19:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-14 20:12:16 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// pass floats solely from the original source
|
|
|
|
|
// this works in the code because SourceOr is the autofire controller
|
|
|
|
|
public float GetFloat(string name)
|
|
|
|
|
{
|
|
|
|
|
return Source.GetFloat(name);
|
2014-06-26 19:19:26 +00:00
|
|
|
|
}
|
2016-12-14 20:12:16 +00:00
|
|
|
|
|
|
|
|
|
internal IController Source { get; set; }
|
|
|
|
|
internal IController SourceAnd { get; set; }
|
2014-06-26 19:19:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class ORAdapter : IController
|
|
|
|
|
{
|
2016-12-14 20:12:16 +00:00
|
|
|
|
public ControllerDefinition Definition
|
|
|
|
|
{
|
|
|
|
|
get { return Source.Definition; }
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-26 19:19:26 +00:00
|
|
|
|
public bool IsPressed(string button)
|
|
|
|
|
{
|
2016-12-14 20:12:16 +00:00
|
|
|
|
return (Source != null ? Source.IsPressed(button) : false)
|
|
|
|
|
| (SourceOr != null ? SourceOr.IsPressed(button) : false);
|
2014-06-26 19:19:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// pass floats solely from the original source
|
|
|
|
|
// this works in the code because SourceOr is the autofire controller
|
2016-12-14 20:12:16 +00:00
|
|
|
|
public float GetFloat(string name)
|
2016-12-06 16:22:03 +00:00
|
|
|
|
{
|
2016-12-14 20:12:16 +00:00
|
|
|
|
return Source.GetFloat(name);
|
2016-12-06 16:22:03 +00:00
|
|
|
|
}
|
2014-06-26 19:19:26 +00:00
|
|
|
|
|
2016-12-14 20:12:16 +00:00
|
|
|
|
internal IController Source { get; set; }
|
|
|
|
|
internal IController SourceOr { get; set; }
|
2014-06-26 19:19:26 +00:00
|
|
|
|
}
|
|
|
|
|
}
|