joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.65k stars 376 forks source link

Keyboard input problems in game SHAMUS #3020

Open Allofich opened 2 years ago

Allofich commented 2 years ago

Code of Conduct & Contributing Guidelines

Have you checked that no other similar bug report(s) already exists?

What operating system(s) this bug have occurred on?

Windows 10

What version(s) of DOSBox-X have this bug?

0.83.18

Describe the bug

Carrying over from https://github.com/joncampbell123/dosbox-x/issues/2453.

"The game also supports IBM PC mode, and runs without freezing in DOSBox-X when run when the machine type is not set to pcjr (but there are issues with keyboard input. See https://int10h.org/blog/2014/05/shamus-keyboard-woes-explained/) While the pcjr version doesn't seem to have the keyboard problems when moving the character (at least not as much), it still has a problem where the key press to start the game ("N" for "Novice" or "A" for "Advanced") also skips over the control explanation that appears immediately afterward. This problem also happens in DOSBox SVN. It doesn't happen in MAME."

Expected behavior

According to https://int10h.org/blog/2014/05/shamus-keyboard-woes-explained/, "Older PC/XT-class machines (which is what this game was targeted at) always booted up with a default delay of 500ms and repeat rate of 10 characters per second; this is what the game assumes, and under these conditions keyboard control isn't a problem." DOSBox-X should handle this somehow.

Steps to reproduce the behaviour

Start SHAMUS with machine set to something other than pcjr that emulates an IBM PC, such as the default setting.

Edit: Also, for the issue of skipping over the control explanation, start with machine set to either pcjr or not. In either case, the explanation is immediately skipped when you press the key to select difficulty.

Used configuration

No response

Emulator log

No response

Additional context

No response

joncampbell123 commented 2 years ago

Looking at src/hardware/keyboard.cpp line 631, there is already typematic delay emulation. Perhaps the BIOS POST emulation needs to configure that default.

rderooy commented 2 years ago

perhaps the mode command could be expanded to set the keyboard repeat rate and delay? such as:

MODE CON RATE=10 DELAY=500
Allofich commented 2 years ago

While creating this bug report I was focusing on the non-PCjr mode problems (hence "IBM PC mode" in the title and reproduction steps), but I just remembered that even in PCjr mode, while the in-game movement seems to be fine or maybe with just a touch of lag (it's hard to tell), it also has the problem that when starting the game by pressing the key to choose the difficulty level, the controls explanation that appears on the screen gets immediately skipped over. This may also be because of lingering key presses, even in PCjr mode. The explanation is not skipped when running the game in MAME.

Allofich commented 2 years ago

Increasing the keyboard rate value (which as I understand is actually the amount of time that is waited between key presses) does seem to fix the movement problem. It didn't stop the controls explanation from being skipped, though.