From c9b28041e343fe473c6ec3ce9665c527fdca8845 Mon Sep 17 00:00:00 2001 From: David Shadoff Date: Sun, 7 Jul 2024 12:06:30 -0400 Subject: [PATCH] Correct PC-FX controller control port behaviour ( #119 ) --- mednafen/src/pcfx/input.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mednafen/src/pcfx/input.cpp b/mednafen/src/pcfx/input.cpp index 1226383..6cab07d 100644 --- a/mednafen/src/pcfx/input.cpp +++ b/mednafen/src/pcfx/input.cpp @@ -238,11 +238,12 @@ uint16 FXINPUT_Read16(uint32 A, const v810_timestamp_t timestamp) if(A == 0x00 || A == 0x80) { int w = (A & 0x80) >> 7; + int scanning = (LatchPending[w] > 0) ? 1 : 0; if(latched[w]) - ret = 0x8; + ret = 0x8 | scanning; else - ret = 0x0; + ret = 0x0 | scanning; } else { @@ -287,6 +288,7 @@ void FXINPUT_Write16(uint32 A, uint16 V, const v810_timestamp_t timestamp) TapCounter[w] = 0; } LatchPending[w] = 1536; + latched[w] = false; PCFX_SetEvent(PCFX_EVENT_PAD, CalcNextEventTS(timestamp)); } control[w] = V & 0x7;