schellingb / dosbox-pure

DOSBox Pure is a new fork of DOSBox built for RetroArch/Libretro aiming for simplicity and ease of use.
GNU General Public License v2.0
777 stars 65 forks source link

Keyboard keys don't register occasionally #550

Open redmist77 opened 2 weeks ago

redmist77 commented 2 weeks ago

I've been playing Pinball Fantasies lately and I've noticed that when I use the keyboard, sometimes the key presses don't register. I can't replicate it on-demand but it usually happens at least once if you play for about 10 minutes. PF uses the shift keys for the flippers. Gamepads don't seem to be affected.

This might be related to #152

Things I've tried

Disable automatic keyboard mapper - same issue. Different PCs - same issue. Clean install of various older versions of RetroArch with default settings - same issue. Tested with DOSBox Core & SVN cores in RetroArch - no problems.

I've tried playing around with various latency settings but no luck. I'm running on Windows 11.

schellingb commented 2 weeks ago

Can you check what you have set in RetroArch under Settings -> Drivers -> Input?

I tried to reproduce this by writing an external script that continually presses the keyboard keys 0,1,2,3,4,5,6,7,8,9 and let it run over 15 minutes while adding a bit of code to DOSBox to verify that the keys are pressed in that order, and it did not encountered any issues. Do you think it might be certain keys like shift and perhaps not numbers or letters? I did only that while on the DOS command line, maybe it is somehow specific to running a certain program inside DOS.

Edit: Also can you check what version of the DOSBox Pure core you are using? I assume it's the last release 0.9.9, I guess there is a chance this was already fixed since then.

If you are on the last official release, 0.9.9, can you try this current build instead and see if you can reproduce it with this? dosbox_pure_libretro_win64_dll_git_106f757.zip

redmist77 commented 2 weeks ago

It looks like only the dinput driver is affected. The current build that you posted still has the same issue. I wasn't able to reproduce it in any build when using the 'raw' driver.

As a side note, the build that you posted has a video issue where the colors are messed up on the table-selection screen on Pinball Fantasies. This is normal for most versions of DOSBox but setting the video to 'VGA' normally fixes it but not with that build.

schellingb commented 2 weeks ago

Hmm, that's weird, if it truly is only happening with certain input drivers then it should be a frontend issue. But you said it doesn't happen in the other DOSBox cores so maybe it's more complicated. I'll try to see if I can reproduce this.

As a side note, the build that you posted has a video issue where the colors are messed up on the table-selection screen on Pinball Fantasies. This is normal for most versions of DOSBox but setting the video to 'VGA' normally fixes it but not with that build.

@carlosefr If you're available for a bit of testing, can you look into this? This seems like something we might have broken with the recent aspect ratio improvements...

carlosefr commented 1 week ago

@schellingb I can't see how that could have happened from what I understand of the behavior that Pinball Fantasies depends on for those colors. And I'm almost sure I've ran Pinball Fantasies after those changes at least once. But I'll test in a few hours (it's actually something that I wonder why it was never fixed for SVGA).

@redmist77 Have you tried with "Game Focus" mode enabled in RetroArch?

schellingb commented 1 week ago

I found an issue especially with shift keys in RetroArch's dinput driver. It seems that very quick presses of shift keys can get missed by it. I issued a PR with a fix that hopefully resolves this. libretro/RetroArch#17185

redmist77 commented 1 week ago

@carlosefr Yeah, it happens with "Game Focus" on or off and with a Hotkey on or off.

carlosefr commented 1 week ago

@schellingb I spent a couple of hours digging into the issue with Pinball Fantasies and concluded that it's better to revert commit a1b4968 for now. I've opened PR #552 for this.

There is an older and deeper bug (or combination of bugs) in vga_draw.cpp, regardless of a1b4968. One symptom is the Pinball Fantasies' 640x480 table selection screen being misreported as 640x240 under SVGA (vga.draw.double_scan is somehow set to 1 under SVGA, when that mode certainly isn't double-scanned, triggering this code). The behaviour that a1b4968 tried to fix is another symptom, related but separate.

I find it curious why it doesn't happen with Syndicate. It also uses 640x480 with 16 colors but it's reported correctly in SVGA there. Maybe the answer to this question points to the solution.

I can try giving it another go over the weekend. I think it will take some time to track this down but, if successful, I believe that would mean switching to vgaonly for Pinball Fantasies wouldn't be needed anymore. The reason why it doesn't work there is the same reason why a1b4968 broke it under vgaonly it seems.

Edit: Opened issue #553 for the Pinball Fantasies + SVGA case.