use pydirectinput to send keystrokes rather than win32api’s keybd_event#22
Open
Siphonay wants to merge 1 commit intohzoo:masterfrom
Open
use pydirectinput to send keystrokes rather than win32api’s keybd_event#22Siphonay wants to merge 1 commit intohzoo:masterfrom
Siphonay wants to merge 1 commit intohzoo:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello! I’m proposing this change because I was trying to use this with the BizHawk emulators but the keystrokes were getting ignored.
Turns out BizHawk reads key inputs at a driver level, and virtual keyboard events such as the ones sent by keybd_event from win32api will not work. This is the case for many games and programs. So I replaced this with pydirectinput which sends keystrokes at a driver level.
Previous configurations with ordinal addresses would still work, but the library already has all addresses mapped, so they have more convenient shorthands (eg. just
'a'instead of0x41orord("A"))The drawback to this is that the user has to install a third-party python library, but I think it’s worth it given that it gives TwitchPlaysX compatibility with virtually any game or program.
This should fix #15 and similar issues.