From 729d52d18ff112229a08daed027ccbf1b6403e96 Mon Sep 17 00:00:00 2001 From: beirich Date: Tue, 15 Mar 2011 03:36:02 +0000 Subject: [PATCH] PCE: fix up turbotap code, seems solid now --- BizHawk.Emulation/Consoles/PC Engine/Input.cs | 26 ++++++++++++------- .../Consoles/PC Engine/PCEngine.cs | 2 +- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/BizHawk.Emulation/Consoles/PC Engine/Input.cs b/BizHawk.Emulation/Consoles/PC Engine/Input.cs index 3832094d78..3f91a68623 100644 --- a/BizHawk.Emulation/Consoles/PC Engine/Input.cs +++ b/BizHawk.Emulation/Consoles/PC Engine/Input.cs @@ -78,29 +78,35 @@ { bool prevSEL = SEL; InputByte = value; + + if (SEL && CLR) + SelectedController = 0; + if (CLR == false && prevSEL == false && SEL == true) - SelectedController = (SelectedController + 1) % 6; + SelectedController = (SelectedController + 1); } private byte ReadInput() { byte value = 0x3F; - if (CLR == false && SelectedController != 0) + + int player = SelectedController + 1; + if (player < 6) { if (SEL == false) // return buttons { - if (Controller["P" + SelectedController + " B1"]) value &= 0xFE; - if (Controller["P" + SelectedController + " B2"]) value &= 0xFD; - if (Controller["P" + SelectedController + " Select"]) value &= 0xFB; - if (Controller["P" + SelectedController + " Run"]) value &= 0xF7; + if (Controller["P" + player + " B1"]) value &= 0xFE; + if (Controller["P" + player + " B2"]) value &= 0xFD; + if (Controller["P" + player + " Select"]) value &= 0xFB; + if (Controller["P" + player + " Run"]) value &= 0xF7; } else { //return directions - if (Controller["P" + SelectedController + " Up"]) value &= 0xFE; - if (Controller["P" + SelectedController + " Right"]) value &= 0xFD; - if (Controller["P" + SelectedController + " Down"]) value &= 0xFB; - if (Controller["P" + SelectedController + " Left"]) value &= 0xF7; + if (Controller["P" + player + " Up"]) value &= 0xFE; + if (Controller["P" + player + " Right"]) value &= 0xFD; + if (Controller["P" + player + " Down"]) value &= 0xFB; + if (Controller["P" + player + " Left"]) value &= 0xF7; } } diff --git a/BizHawk.Emulation/Consoles/PC Engine/PCEngine.cs b/BizHawk.Emulation/Consoles/PC Engine/PCEngine.cs index 1aa0c933d2..9de56ff962 100644 --- a/BizHawk.Emulation/Consoles/PC Engine/PCEngine.cs +++ b/BizHawk.Emulation/Consoles/PC Engine/PCEngine.cs @@ -100,7 +100,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx public void FrameAdvance(bool render) { Controller.UpdateControls(Frame++); - SelectedController = 0; + PSG.BeginFrame(Cpu.TotalExecutedCycles); if (SuperGrafx)