A2600: boost grip controller
This commit is contained in:
parent
a2289dde10
commit
ca5585dfaa
BizHawk.Client.EmuHawk/tools/VirtualPads/schema
BizHawk.Emulation.Cores/Consoles/Atari/2600
|
@ -39,6 +39,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
return StandardController(controller);
|
||||
case Atari2600ControllerTypes.Paddle:
|
||||
return PaddleController(controller);
|
||||
case Atari2600ControllerTypes.BoostGrip:
|
||||
return BoostGripController(controller);
|
||||
case Atari2600ControllerTypes.Driving:
|
||||
return DrivingController(controller);
|
||||
}
|
||||
|
@ -145,6 +147,73 @@ namespace BizHawk.Client.EmuHawk
|
|||
};
|
||||
}
|
||||
|
||||
private static PadSchema BoostGripController(int controller)
|
||||
{
|
||||
return new PadSchema
|
||||
{
|
||||
DisplayName = $"Player {controller}",
|
||||
IsConsole = false,
|
||||
DefaultSize = new Size(174, 74),
|
||||
MaxSize = new Size(174, 74),
|
||||
Buttons = new[]
|
||||
{
|
||||
new PadSchema.ButtonSchema
|
||||
{
|
||||
Name = $"P{controller} Up",
|
||||
DisplayName = "",
|
||||
Icon = Properties.Resources.BlueUp,
|
||||
Location = new Point(23, 15),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
new PadSchema.ButtonSchema
|
||||
{
|
||||
Name = $"P{controller} Down",
|
||||
DisplayName = "",
|
||||
Icon = Properties.Resources.BlueDown,
|
||||
Location = new Point(23, 36),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
new PadSchema.ButtonSchema
|
||||
{
|
||||
Name = $"P{controller} Left",
|
||||
DisplayName = "",
|
||||
Icon = Properties.Resources.Back,
|
||||
Location = new Point(2, 24),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
new PadSchema.ButtonSchema
|
||||
{
|
||||
Name = $"P{controller} Right",
|
||||
DisplayName = "",
|
||||
Icon = Properties.Resources.Forward,
|
||||
Location = new Point(44, 24),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
new PadSchema.ButtonSchema
|
||||
{
|
||||
Name = $"P{controller} Button",
|
||||
DisplayName = "B",
|
||||
Location = new Point(132, 24),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
new PadSchema.ButtonSchema
|
||||
{
|
||||
Name = $"P{controller} Button 1",
|
||||
DisplayName = "B1",
|
||||
Location = new Point(68, 36),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
new PadSchema.ButtonSchema
|
||||
{
|
||||
Name = $"P{controller} Button 2",
|
||||
DisplayName = "B2",
|
||||
Location = new Point(100, 36),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static PadSchema DrivingController(int controller)
|
||||
{
|
||||
return new PadSchema
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
typeof(UnpluggedController), // Order must match Atari2600ControllerTypes enum values
|
||||
typeof(StandardController),
|
||||
typeof(PaddleController),
|
||||
typeof(BoostGripController),
|
||||
typeof(DrivingController)
|
||||
};
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
Unplugged,
|
||||
Joystick,
|
||||
Paddle,
|
||||
BoostGrip,
|
||||
Driving
|
||||
}
|
||||
|
||||
|
@ -161,6 +162,70 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
}
|
||||
}
|
||||
|
||||
public class BoostGripController : IPort
|
||||
{
|
||||
public BoostGripController(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition
|
||||
{
|
||||
BoolButtons = BaseDefinition
|
||||
.Select(b => $"P{PortNum} " + b)
|
||||
.ToList()
|
||||
};
|
||||
}
|
||||
|
||||
public int PortNum { get; }
|
||||
|
||||
public void SyncState(Serializer ser)
|
||||
{
|
||||
// Nothing todo, I think
|
||||
}
|
||||
|
||||
public ControllerDefinition Definition { get; }
|
||||
|
||||
private static readonly string[] BaseDefinition =
|
||||
{
|
||||
"Up", "Down", "Left", "Right", "Button",
|
||||
"Button 1",
|
||||
"Button 2"
|
||||
};
|
||||
|
||||
public byte Read(IController c)
|
||||
{
|
||||
byte result = 0xFF;
|
||||
|
||||
if (c.IsPressed($"P{PortNum} Up")) { result &= 0xEF; }
|
||||
if (c.IsPressed($"P{PortNum} Down")) { result &= 0xDF; }
|
||||
if (c.IsPressed($"P{PortNum} Left")) { result &= 0xBF; }
|
||||
if (c.IsPressed($"P{PortNum} Right")) { result &= 0x7F; }
|
||||
if (c.IsPressed($"P{PortNum} Button")) { result &= 0xF7; }
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public int Read_Pot(IController c, int pot)
|
||||
{
|
||||
bool is_pressed = false;
|
||||
|
||||
if (pot == 0)
|
||||
{
|
||||
is_pressed = c.IsPressed($"P{PortNum} Button 1");
|
||||
}
|
||||
else
|
||||
{
|
||||
is_pressed = c.IsPressed($"P{PortNum} Button 2");
|
||||
}
|
||||
|
||||
if (is_pressed)
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
return 65535;
|
||||
}
|
||||
}
|
||||
|
||||
public class DrivingController : IPort
|
||||
{
|
||||
public DrivingController(int portNum)
|
||||
|
|
|
@ -908,7 +908,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
// 6105 roughly centers the paddle in Breakout
|
||||
if (maskedAddr == 0x08) // INPT0
|
||||
{
|
||||
if (_core.ReadPot1(0)>0 && _capCharging && _core.Cpu.TotalExecutedCycles - _capChargeStart >= _core.ReadPot1(0))
|
||||
if (_core.ReadPot1(0) > 0 && _capCharging && _core.Cpu.TotalExecutedCycles - _capChargeStart >= _core.ReadPot1(0))
|
||||
{
|
||||
coll = 0x80;
|
||||
}
|
||||
|
@ -922,7 +922,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
|
||||
if (maskedAddr == 0x09) // INPT1
|
||||
{
|
||||
if (_core.ReadPot1(1) > 0 && _capCharging && _core.Cpu.TotalExecutedCycles - _capChargeStart >= _core.ReadPot1(1))
|
||||
if (_core.ReadPot1(1) > 0 && _capCharging && _core.Cpu.TotalExecutedCycles - _capChargeStart >= _core.ReadPot1(1))
|
||||
{
|
||||
coll = 0x80;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue