From ff1580def4352605004203b5b1b011e8a3bfd3ca Mon Sep 17 00:00:00 2001 From: Sour Date: Fri, 13 Dec 2024 19:36:48 +0900 Subject: [PATCH] SNES: Fixed input issues with Pocky & Rocky Caused by the game enabling controller auto-read in the middle of the auto-read "portion" of the frame --- Core/SNES/InternalRegisters.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Core/SNES/InternalRegisters.cpp b/Core/SNES/InternalRegisters.cpp index f7ee85b62..fdb68482f 100644 --- a/Core/SNES/InternalRegisters.cpp +++ b/Core/SNES/InternalRegisters.cpp @@ -263,6 +263,14 @@ void InternalRegisters::Write(uint16_t addr, uint8_t value) if(!autoRead) { _autoReadClockStart = 0; _autoReadNextClock = 0; + } else if(_autoReadClockStart != 0 && _autoReadClockStart <= _console->GetMasterClock()) { + //If enable flag was enabled after the first clock of the process, skip auto-read for this frame + //Pocky & Rocky seems to enable auto-read in the middle of the auto-read process (scanline ~226) + //in some scenarios (e.g: when player 2 presses Y+Left at the same time) and if the auto-read + //starts in the middle of its process, this corrupts input in a way that the game does not expect. + //TODO determine the exact behavior when auto-read is enabled/disabled mid-way through the auto-read "portion" or the frame + _autoReadClockStart = 0; + _autoReadNextClock = 0; } }