PCE: fix up turbotap code, seems solid now

This commit is contained in:
beirich 2011-03-15 03:36:02 +00:00
parent 1408bcdb4b
commit 729d52d18f
2 changed files with 17 additions and 11 deletions

View File

@ -78,29 +78,35 @@
{ {
bool prevSEL = SEL; bool prevSEL = SEL;
InputByte = value; InputByte = value;
if (SEL && CLR)
SelectedController = 0;
if (CLR == false && prevSEL == false && SEL == true) if (CLR == false && prevSEL == false && SEL == true)
SelectedController = (SelectedController + 1) % 6; SelectedController = (SelectedController + 1);
} }
private byte ReadInput() private byte ReadInput()
{ {
byte value = 0x3F; byte value = 0x3F;
if (CLR == false && SelectedController != 0)
int player = SelectedController + 1;
if (player < 6)
{ {
if (SEL == false) // return buttons if (SEL == false) // return buttons
{ {
if (Controller["P" + SelectedController + " B1"]) value &= 0xFE; if (Controller["P" + player + " B1"]) value &= 0xFE;
if (Controller["P" + SelectedController + " B2"]) value &= 0xFD; if (Controller["P" + player + " B2"]) value &= 0xFD;
if (Controller["P" + SelectedController + " Select"]) value &= 0xFB; if (Controller["P" + player + " Select"]) value &= 0xFB;
if (Controller["P" + SelectedController + " Run"]) value &= 0xF7; if (Controller["P" + player + " Run"]) value &= 0xF7;
} }
else else
{ {
//return directions //return directions
if (Controller["P" + SelectedController + " Up"]) value &= 0xFE; if (Controller["P" + player + " Up"]) value &= 0xFE;
if (Controller["P" + SelectedController + " Right"]) value &= 0xFD; if (Controller["P" + player + " Right"]) value &= 0xFD;
if (Controller["P" + SelectedController + " Down"]) value &= 0xFB; if (Controller["P" + player + " Down"]) value &= 0xFB;
if (Controller["P" + SelectedController + " Left"]) value &= 0xF7; if (Controller["P" + player + " Left"]) value &= 0xF7;
} }
} }

View File

@ -100,7 +100,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
public void FrameAdvance(bool render) public void FrameAdvance(bool render)
{ {
Controller.UpdateControls(Frame++); Controller.UpdateControls(Frame++);
SelectedController = 0;
PSG.BeginFrame(Cpu.TotalExecutedCycles); PSG.BeginFrame(Cpu.TotalExecutedCycles);
if (SuperGrafx) if (SuperGrafx)