2014-06-26 19:19:26 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
using BizHawk.Emulation.Common;
|
|
|
|
|
|
|
|
|
|
namespace BizHawk.Client.Common
|
|
|
|
|
{
|
|
|
|
|
public class AndAdapter : IController
|
|
|
|
|
{
|
|
|
|
|
public bool IsPressed(string button)
|
|
|
|
|
{
|
|
|
|
|
return this[button];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 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); }
|
|
|
|
|
|
|
|
|
|
public IController Source { get; set; }
|
|
|
|
|
public IController SourceAnd { get; set; }
|
2016-12-12 18:30:32 +00:00
|
|
|
|
public ControllerDefinition Definition { get { return Source.Definition; } set { throw new InvalidOperationException(); } }
|
2014-06-26 19:19:26 +00:00
|
|
|
|
|
|
|
|
|
public bool this[string button]
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (Source != null && SourceAnd != null)
|
|
|
|
|
{
|
|
|
|
|
return Source[button] & SourceAnd[button];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
throw new InvalidOperationException();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class ORAdapter : IController
|
|
|
|
|
{
|
|
|
|
|
public bool IsPressed(string button)
|
|
|
|
|
{
|
|
|
|
|
return this[button];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 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); }
|
|
|
|
|
|
|
|
|
|
public IController Source { get; set; }
|
|
|
|
|
public IController SourceOr { get; set; }
|
2016-12-06 16:22:03 +00:00
|
|
|
|
|
2016-12-12 18:30:32 +00:00
|
|
|
|
public ControllerDefinition Definition
|
2016-12-06 16:22:03 +00:00
|
|
|
|
{
|
2016-12-12 18:30:32 +00:00
|
|
|
|
get { return Source.Definition; }
|
2016-12-06 16:22:03 +00:00
|
|
|
|
set { throw new InvalidOperationException(); }
|
|
|
|
|
}
|
2014-06-26 19:19:26 +00:00
|
|
|
|
|
|
|
|
|
public bool this[string button]
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2016-12-06 16:22:03 +00:00
|
|
|
|
return (Source != null ? Source[button] : false)
|
|
|
|
|
| (SourceOr != null ? SourceOr[button] : false);
|
2014-06-26 19:19:26 +00:00
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
throw new InvalidOperationException();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|