TwitchPlaysX
TwitchPlaysX copied to clipboard
use pydirectinput to send keystrokes rather than win32api’s keybd_event
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 of 0x41
or ord("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.