MSXHawk: joystick controls
This commit is contained in:
parent
b7869c2c70
commit
ca73e769ed
|
@ -19,15 +19,15 @@ namespace BizHawk.Emulation.Cores.Computers.MSX
|
|||
{
|
||||
_controller = controller;
|
||||
|
||||
byte ctrl1_byte = 0;
|
||||
if (_controller.IsPressed("P1 Up")) ctrl1_byte |= 0x01;
|
||||
if (_controller.IsPressed("P1 Down")) ctrl1_byte |= 0x02;
|
||||
if (_controller.IsPressed("P1 Left")) ctrl1_byte |= 0x04;
|
||||
if (_controller.IsPressed("P1 Right")) ctrl1_byte |= 0x08;
|
||||
if (_controller.IsPressed("P1 B1")) ctrl1_byte |= 0x10;
|
||||
if (_controller.IsPressed("P1 B2")) ctrl1_byte |= 0x20;
|
||||
byte ctrl1_byte = 0xFF;
|
||||
if (_controller.IsPressed("P1 Up")) ctrl1_byte -= 0x01;
|
||||
if (_controller.IsPressed("P1 Down")) ctrl1_byte -= 0x02;
|
||||
if (_controller.IsPressed("P1 Left")) ctrl1_byte -= 0x04;
|
||||
if (_controller.IsPressed("P1 Right")) ctrl1_byte -= 0x08;
|
||||
if (_controller.IsPressed("P1 B1")) ctrl1_byte -= 0x10;
|
||||
if (_controller.IsPressed("P1 B2")) ctrl1_byte -= 0x20;
|
||||
|
||||
if (_controller.IsPressed("P1 Start")) ctrl1_byte |= 0x80;
|
||||
//if (_controller.IsPressed("P1 Start")) ctrl1_byte |= 0x80;
|
||||
|
||||
_frame++;
|
||||
|
||||
|
@ -42,7 +42,7 @@ namespace BizHawk.Emulation.Cores.Computers.MSX
|
|||
|
||||
LibMSX.MSX_settracecallback(MSX_Pntr, tracecb);
|
||||
|
||||
LibMSX.MSX_frame_advance(MSX_Pntr, ctrl1_byte, 0, true, true);
|
||||
LibMSX.MSX_frame_advance(MSX_Pntr, ctrl1_byte, 0xFF, true, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -146,7 +146,8 @@ namespace MSXHawk
|
|||
{
|
||||
value &= 0xFF;
|
||||
|
||||
Register[port_sel] = value;
|
||||
if (port_sel != 0xE) { Register[port_sel] = value; }
|
||||
|
||||
|
||||
sync_psg_state();
|
||||
|
||||
|
|
|
@ -41,6 +41,15 @@ namespace MSXHawk
|
|||
|
||||
bool FrameAdvance(uint8_t controller_1, uint8_t controller_2, bool render, bool rendersound)
|
||||
{
|
||||
if ((MemMap.psg_pntr->Register[0xF] & 0x40) > 0)
|
||||
{
|
||||
MemMap.psg_pntr->Register[0xE] = controller_2;
|
||||
}
|
||||
else
|
||||
{
|
||||
MemMap.psg_pntr->Register[0xE] = controller_1;
|
||||
}
|
||||
|
||||
MemMap.controller_byte_1 = controller_1;
|
||||
MemMap.controller_byte_2 = controller_2;
|
||||
MemMap.start_pressed = (controller_1 & 0x80) > 0;
|
||||
|
|
|
@ -32,6 +32,10 @@ namespace MSXHawk
|
|||
{
|
||||
return PortA8;
|
||||
}
|
||||
else if (port == 0xA9)
|
||||
{
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
return 0xFF;
|
||||
}
|
||||
|
@ -55,6 +59,19 @@ namespace MSXHawk
|
|||
else if (port == 0xA1)
|
||||
{
|
||||
psg_pntr->WriteReg(value);
|
||||
|
||||
// update controller port data if port F is written to
|
||||
if (psg_pntr->port_sel == 0xF)
|
||||
{
|
||||
if ((psg_pntr->Register[0xF] & 0x40) > 0)
|
||||
{
|
||||
psg_pntr->Register[0xE] = controller_byte_2;
|
||||
}
|
||||
else
|
||||
{
|
||||
psg_pntr->Register[0xE] = controller_byte_1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (port == 0xA8)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue