Vectrex: working controllers
This commit is contained in:
parent
95db4f2159
commit
9b2d926bc0
|
@ -59,7 +59,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
|||
ret = (byte)((portB_ret & 0x7F) | (PB7 ? 0x80 : 0x0));
|
||||
}
|
||||
|
||||
if (!dir_ctrl.Bit(5)) { ret |= (byte)(compare ? 0x0 : 0x20); }
|
||||
if (!dir_ctrl.Bit(5)) { ret |= (byte)(!compare ? 0x0 : 0x20); }
|
||||
|
||||
int_fl &= 0xE7;
|
||||
update_int_fl();
|
||||
|
@ -181,8 +181,16 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
|||
{
|
||||
if (sel0)
|
||||
{
|
||||
if (sel1) {/* sound samples direct to output */ audio.pcm_sample = (short)(portA_ret << 6); }
|
||||
else { ppu.vec_scale = portA_ret; if (portA_ret != 0) { Console.WriteLine("scale: " + portA_ret); } }
|
||||
if (sel1)
|
||||
{
|
||||
/* sound samples direct to output */
|
||||
audio.pcm_sample = (short)(portA_ret << 6);
|
||||
}
|
||||
else
|
||||
{
|
||||
ppu.vec_scale = portA_ret;
|
||||
if (portA_ret != 0) { Console.WriteLine("scale: " + portA_ret); }
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -195,7 +203,39 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
|||
ppu.bright = (byte)(portA_ret & 0x3F);
|
||||
ppu.bright_int_3 = (uint)(0xFF000000 | (ppu.bright << 16) | (ppu.bright << 8) | ppu.bright);
|
||||
}
|
||||
else { ppu.y_vel = (byte)(portA_ret ^ 0x80); }
|
||||
else
|
||||
{
|
||||
ppu.y_vel = (byte)(portA_ret ^ 0x80);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sel0)
|
||||
{
|
||||
if (sel1)
|
||||
{
|
||||
if (portA_ret >= joy2_UD) { compare = true; }
|
||||
else { compare = false; }
|
||||
}
|
||||
else
|
||||
{
|
||||
if (portA_ret >= joy1_UD) { compare = true; }
|
||||
else { compare = false; }
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sel1)
|
||||
{
|
||||
if (portA_ret >= joy2_LR) { compare = true; }
|
||||
else { compare = false; }
|
||||
}
|
||||
else
|
||||
{
|
||||
if (portA_ret >= joy1_LR) { compare = true; }
|
||||
else { compare = false; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -220,8 +260,16 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
|||
{
|
||||
if (sel0)
|
||||
{
|
||||
if (sel1) {/* sound samples direct to output */ audio.pcm_sample = (short)(portA_ret << 6); }
|
||||
else { ppu.vec_scale = portA_ret; if (portA_ret != 0) { Console.WriteLine("scale: " + portA_ret); } }
|
||||
if (sel1)
|
||||
{
|
||||
/* sound samples direct to output */
|
||||
audio.pcm_sample = (short)(portA_ret << 6);
|
||||
}
|
||||
else
|
||||
{
|
||||
ppu.vec_scale = portA_ret;
|
||||
if (portA_ret != 0) { Console.WriteLine("scale: " + portA_ret); }
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -234,7 +282,39 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
|||
ppu.bright = (byte)(portA_ret & 0x3F);
|
||||
ppu.bright_int_3 = (uint)(0xFF000000 | (ppu.bright << 16) | (ppu.bright << 8) | ppu.bright);
|
||||
}
|
||||
else { ppu.y_vel = (byte)(portA_ret ^ 0x80); }
|
||||
else
|
||||
{
|
||||
ppu.y_vel = (byte)(portA_ret ^ 0x80);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sel0)
|
||||
{
|
||||
if (sel1)
|
||||
{
|
||||
if (portA_ret >= joy2_UD) { compare = true; }
|
||||
else { compare = false; }
|
||||
}
|
||||
else
|
||||
{
|
||||
if (portA_ret >= joy1_UD) { compare = true; }
|
||||
else { compare = false; }
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sel1)
|
||||
{
|
||||
if (portA_ret >= joy2_LR) { compare = true; }
|
||||
else { compare = false; }
|
||||
}
|
||||
else
|
||||
{
|
||||
if (portA_ret >= joy1_LR) { compare = true; }
|
||||
else { compare = false; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
|||
|
||||
public ControllerDefinition ControllerDefinition => _controllerDeck.Definition;
|
||||
|
||||
byte joy1_LR, joy2_LR, joy1_UD, joy2_UD;
|
||||
|
||||
public bool FrameAdvance(IController controller, bool render, bool rendersound)
|
||||
{
|
||||
if (_tracer.Enabled)
|
||||
|
@ -37,7 +39,23 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
|||
audio.Register[14] |= (byte)(_controllerDeck.ReadPort2(controller) << 4);
|
||||
|
||||
// joystick position is based on pot reading
|
||||
joy1_LR = (byte)(Math.Floor(controller.GetFloat("P1 Stick X")) + 128);
|
||||
joy1_UD = (byte)(Math.Floor(controller.GetFloat("P1 Stick Y")) + 128);
|
||||
joy2_LR = (byte)(Math.Floor(controller.GetFloat("P2 Stick X")) + 128);
|
||||
joy2_UD = (byte)(Math.Floor(controller.GetFloat("P2 Stick Y")) + 128);
|
||||
|
||||
// override stick reading with digital input if supplied
|
||||
// On vectrex there is no such thing as pressing left + right or up + down
|
||||
// so convention will be up and right dominate
|
||||
if (controller.IsPressed("P1 Down")) { joy1_UD = 0xFF; }
|
||||
if (controller.IsPressed("P1 Up")) { joy1_UD = 0; }
|
||||
if (controller.IsPressed("P1 Left")) { joy1_LR = 0xFF; }
|
||||
if (controller.IsPressed("P1 Right")) { joy1_LR = 0; }
|
||||
|
||||
if (controller.IsPressed("P2 Down")) { joy2_UD = 0xFF; }
|
||||
if (controller.IsPressed("P2 Up")) { joy2_UD = 0; }
|
||||
if (controller.IsPressed("P2 Left")) { joy2_LR = 0xFF; }
|
||||
if (controller.IsPressed("P2 Right")) { joy2_LR = 0; }
|
||||
|
||||
|
||||
frame_end = false;
|
||||
|
|
|
@ -104,6 +104,12 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
|||
ser.Sync(nameof(PB7_undriven), ref PB7_undriven);
|
||||
ser.Sync(nameof(pot_val), ref pot_val);
|
||||
|
||||
ser.Sync(nameof(joy1_LR), ref joy1_LR);
|
||||
ser.Sync(nameof(joy1_UD), ref joy1_UD);
|
||||
ser.Sync(nameof(joy2_LR), ref joy2_LR);
|
||||
ser.Sync(nameof(joy2_UD), ref joy2_UD);
|
||||
|
||||
|
||||
// probably a better way to do this
|
||||
if (cart_RAM != null)
|
||||
{
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
|||
.Select(b => "P" + PortNum + " " + b)
|
||||
.ToList(),
|
||||
FloatControls = { "P" + PortNum + " Stick X", "P" + PortNum + " Stick Y" },
|
||||
FloatRanges = { new[] { -127.0f, 0, 127.0f }, new[] { -127.0f, 0, 127.0f } }
|
||||
FloatRanges = { new[] { 127.0f, 0, -128.0f }, new[] { -128.0f, 0, 127.0f } }
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -57,6 +57,10 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
|||
|
||||
private static readonly string[] BaseDefinition =
|
||||
{
|
||||
"Up",
|
||||
"Down",
|
||||
"Left",
|
||||
"Right",
|
||||
"Button 1",
|
||||
"Button 2",
|
||||
"Button 3",
|
||||
|
|
Loading…
Reference in New Issue