Atari 2600 - stub out the paddle controller

This commit is contained in:
adelikat 2017-06-27 17:22:45 -05:00
parent 74dd25e831
commit c3b890c60c
2 changed files with 122 additions and 79 deletions

View File

@ -14,6 +14,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
{ {
typeof(UnpluggedController), // Order must match Atari2600ControllerTypes enum values typeof(UnpluggedController), // Order must match Atari2600ControllerTypes enum values
typeof(StandardController), typeof(StandardController),
typeof(PaddleController)
}; };
public Atari2600ControllerDeck(Atari2600ControllerTypes controller1, Atari2600ControllerTypes controller2) public Atari2600ControllerDeck(Atari2600ControllerTypes controller1, Atari2600ControllerTypes controller2)

View File

@ -11,7 +11,8 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
public enum Atari2600ControllerTypes public enum Atari2600ControllerTypes
{ {
Unplugged, Unplugged,
Joystick Joystick,
Paddle
} }
/// <summary> /// <summary>
@ -94,4 +95,45 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
"Up", "Down", "Left", "Right", "Button" "Up", "Down", "Left", "Right", "Button"
}; };
} }
public class PaddleController : IPort
{
public PaddleController(int portNum)
{
PortNum = portNum;
Definition = new ControllerDefinition
{
BoolButtons = BaseDefinition
.Select(b => $"P{PortNum} " + b)
.ToList(),
FloatControls = { "P" + PortNum + " Paddle X" },
FloatRanges = { new[] { -127.0f, 0, 127.0f }, } // No idea what values should be here
};
}
public int PortNum { get; }
public void SyncState(Serializer ser)
{
// Nothing todo, I think
}
public ControllerDefinition Definition { get; }
private static readonly string[] BaseDefinition =
{
"Button"
};
public byte Read(IController c)
{
byte result = 0xFF;
if (c.IsPressed($"P{PortNum} Button")) { result &= 0xF7; } // TODO
//int x = (int)c.GetFloat(Definition.FloatControls[0]);
return result;
}
}
} }