drhelius / Gearcoleco

ColecoVision emulator for macOS, Windows, Linux, BSD and RetroArch.
https://x.com/drhelius
GNU General Public License v3.0
62 stars 15 forks source link

Retroarch - Keypad buttons are not being released #27

Closed DasGroobinCat closed 1 year ago

DasGroobinCat commented 1 year ago

When a keypad button is pressed, the button stays pressed and is not released until a different keypad button is pressed. For example, if you start "Mousetrap" at skill level 1 using the keypad, pressing the 1 button again to cycle the red doors doesn’t work. Pressing any other keypad button and then pressing 1 again will cycle the door just once.

This can also be observed using the "Final Test Cartridge" to check the controller inputs and this bug would also explain why "Cabbage Patch Kids" skips the options screen after a Game Over, because the 1 key isn't being released from the first time it was pressed at the start of the game.

drhelius commented 1 year ago

Thanks for reporting, what platform are you running RA in? And what version?

DasGroobinCat commented 1 year ago

Retroarch 1.15.0 on both Windows 10 and Android 12 using Gearcoleco 1.0.1

msheehan79 commented 1 year ago

I also was able to reproduce this issue (Windows 10 x64) - what I noticed during my testing was that the code did not seem to respond well to receiving the pressed/released state for every button on both controllers on every frame.

I modified how the libretro input function works to keep track of the current and previous state for both controllers, and only will send down actual changes to button state to the core class. That seems to have resolved the keypad button issue reported here, as well as #23 based on my testing.

If you are able to compile it, you can try the change on my fork https://github.com/msheehan79/Gearcoleco

@drhelius I'm not super-familiar with the core emulator code and if my approach has any drawbacks, but if you are open to a PR I can submit it, or you are welcome to utilize some/any of the code in my fork if you find it helpful for fixing this directly.

drhelius commented 1 year ago

@msheehan79 thanks for your work. Your changes look good to me. I'm always open to PR so if you want to contribute your changes just open a PR and I'll happily test it an merge it.

msheehan79 commented 1 year ago

Sounds good, thanks. I'll submit a PR for this soon so you can test it out as well.