SourMesen / Mesen-S

Mesen-S is a cross-platform (Windows & Linux) SNES emulator built in C++ and C#
GNU General Public License v3.0
415 stars 100 forks source link

GB: P1 (FF00) data bus change isn't visible to joypad interrupt for SGB #160

Open redacted173 opened 4 years ago

redacted173 commented 4 years ago

Double Dragon 3 relies on the joypad interrupt for getting button states It makes a 11->00 transition on the control bits which is supposed to capture 1->0 (and 0->1 if there is bounce) transitions on the joypad data to trigger the interrupt. But the following code in Mesen looks like it may not capture any transition due to how button state is written and buffered (in ICD2) per SNES frame by the SGB bios. Both prevInput and newInput may have the same value. The result is it's not possible to get past the menu since no inputs are registered. In-game (outside of menu) button state is also read with the same interrupt code.

The joypad interrupt interrupt isn't very useful for a variety of reasons. This may be the only game that uses it for input processing.

https://github.com/SourMesen/Mesen-S/blob/d4f0b34605e1c641718966bd584967580f5a0be2/Core/GbPpu.cpp#L657