MSHawk: inputs

This commit is contained in:
alyosha-tas 2020-01-19 09:08:20 -05:00
parent 59a22415d2
commit 0dbd6e7481
3 changed files with 14 additions and 3 deletions

View File

@ -19,6 +19,16 @@ namespace BizHawk.Emulation.Cores.Computers.MSX
{ {
_controller = controller; _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;
if (_controller.IsPressed("P1 Start")) ctrl1_byte |= 0x80;
_frame++; _frame++;
if (Tracer.Enabled) if (Tracer.Enabled)
@ -32,7 +42,7 @@ namespace BizHawk.Emulation.Cores.Computers.MSX
LibMSX.MSX_settracecallback(MSX_Pntr, tracecb); LibMSX.MSX_settracecallback(MSX_Pntr, tracecb);
LibMSX.MSX_frame_advance(MSX_Pntr, 0, 0, true, true); LibMSX.MSX_frame_advance(MSX_Pntr, ctrl1_byte, 0, true, true);
return true; return true;
} }

View File

@ -38,6 +38,7 @@ namespace MSXHawk
{ {
MemMap.controller_byte_1 = controller_1; MemMap.controller_byte_1 = controller_1;
MemMap.controller_byte_2 = controller_2; MemMap.controller_byte_2 = controller_2;
MemMap.start_pressed = (controller_1 & 0x80) > 0;
MemMap.lagged = true; MemMap.lagged = true;
int scanlinesPerFrame = 262; int scanlinesPerFrame = 262;

View File

@ -118,8 +118,8 @@ namespace MSXHawk
lagged = false; lagged = false;
uint8_t value = 0xFF; uint8_t value = 0xFF;
value &= ~(controller_byte_1 & 0xCF); value &= ~(controller_byte_1 & 0x3F);
value &= ~(controller_byte_2 & 0x30); value &= ~(controller_byte_2 & 0xC0);
return value; return value;
} }