From ff2e91722de73a0c5aaff30eb4717d05cca673c9 Mon Sep 17 00:00:00 2001 From: alyosha-tas Date: Sun, 16 Jun 2019 18:18:21 -0400 Subject: [PATCH] Vectrex: Input fix --- BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/Audio.cs | 5 +++-- .../Consoles/GCE/Vectrex/VectrexHawk.IEmulator.cs | 2 +- .../Consoles/GCE/Vectrex/VectrexHawkControllers.cs | 10 +++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/Audio.cs b/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/Audio.cs index 876c755b54..0f60a066c4 100644 --- a/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/Audio.cs +++ b/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/Audio.cs @@ -152,8 +152,9 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex value &= 0xFF; - Register[port_sel] = value; - + // do not write to input ports, controller input is directly assigned seperately + if (port_sel < 14) { Register[port_sel] = value; } + sync_psg_state(); if (port_sel == 13) diff --git a/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/VectrexHawk.IEmulator.cs b/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/VectrexHawk.IEmulator.cs index b0d97a692a..1eea433a37 100644 --- a/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/VectrexHawk.IEmulator.cs +++ b/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/VectrexHawk.IEmulator.cs @@ -33,7 +33,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex _islag = true; // button inputs go to port 14 in the audio registers - audio.Register[14] = _controllerDeck.ReadPort1(controller); + audio.Register[14] = (byte)(_controllerDeck.ReadPort1(controller) & 0xF); audio.Register[14] |= (byte)(_controllerDeck.ReadPort2(controller) << 4); do_frame(); diff --git a/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/VectrexHawkControllers.cs b/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/VectrexHawkControllers.cs index cf7d15bb0a..300e8c8dbd 100644 --- a/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/VectrexHawkControllers.cs +++ b/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/VectrexHawkControllers.cs @@ -45,12 +45,12 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex public byte Read(IController c) { - byte result = 0x0; + byte result = 0xFF; - if (c.IsPressed($"P{PortNum} Button 1")) { result |= 0x1; } - if (c.IsPressed($"P{PortNum} Button 2")) { result |= 0x2; } - if (c.IsPressed($"P{PortNum} Button 3")) { result |= 0x4; } - if (c.IsPressed($"P{PortNum} Button 4")) { result |= 0x8; } + if (c.IsPressed($"P{PortNum} Button 1")) { result &= 0xFE; } + if (c.IsPressed($"P{PortNum} Button 2")) { result &= 0xFD; } + if (c.IsPressed($"P{PortNum} Button 3")) { result &= 0xFB; } + if (c.IsPressed($"P{PortNum} Button 4")) { result &= 0xF7; } return result; }