VOGONS


First post, by tomaswoj

User metadata
Rank Newbie
Rank
Newbie

Hi All,

im porting Dosbox to Android (yes, yet another port 😀), and seems that in some cases/situations keyboard events tends to be ignored, while in others they work perfectly fine.

It is especially vivid for example in Doom/Wolfenstein, where arrow keys in game menu work perfectly fine, while looks they are ignored in game (i.e. i cannot move in game using arrow keys). I have a CPU load meter, and cycles are set to the level, that im usually at 95-98% CPU saturation, so its not that whole app gets inresponsible. Also steering using mouse seems to work quite smoothly.

Another case is startup of some games (like Ishar, or North and South), where on PC any Spacebar press will skip some splash screens/intros, but when i run it on the phone (exactly the same dosbox version) - i need to wait until they end, and cannot escape them.

On the contradict, these buttons work perfectly fine when testing them for example in DosNavigator on the very same phone.

Any suggestions?
Can it be that when emulator is heavily loaded, key dispatching needs to be done witihin some time limit, and otherwise they [key events] will be dropped?

Reply 1 of 1, by tomaswoj

User metadata
Rank Newbie
Rank
Newbie

Ok, issue solved 😀.

It seems that putting some sleep (like 50-100ms) between keyPressed and keyReleased definitely helps 😀. And this due to fact im working with virtual keyboard using onClick method (that is just one, on press), so internally each such virtual click i was changing to keyPressed(keycode); keyReleased(keycode) - immadietely after.

I still need to figure out what is the reasonable value between these two (not too high), but at least got it to work. Strangely enough, it worked fine (w/o/ sleep) with things like DosNavigator, or game menus, but not neccesarily work in-game 😒