I'm trying to write a bot for a game. The huge problem I'm running into for months now is keyboard simulation
My operation system is windows 10. On that OS when trying to simulate key press via code, windows 10 adds to the request a flag. This flag indicates that this key press came from a program, and not from the hardware.
That way games can check the user input and filter all of the key simulated presses
My game does that, So I have been trying to find a way to pass that.
VirtualBox
The first solution is to run the game from a virtual box. Then running the bot program from the host. When focusing on the VirtualBox the program is being able to simulate the keyboard with no problem. (That is because VirtualBox does the hard word of "fooling" the OS that the key simulation came from the hardware)
This way works pretty well, but the main disadvantage is that running the game on VM is super slow, the game flips a lot. I have tried multiple tutorials on how to get the best gaming results on VM but nothing really worked..
Real keyboard simulation
That idea came to me lately. I wonder if I can somehow fool my PC to think the key press came from the hardware.
Maybe using male to male USB cable and connect the PC to itself, then do real keyboard simulation (sending keyboard requests from one side of the USB and get it through the other).
Or maybe some other way to achieve that?
What I don't want
There are some solutions that will probably work, but I don't want to try:
The question is, do you have any idea how to simulate keyboard on such way that Windows 10 won't add the "rat" flag
Windows driver is exactly what you need. In your windows driver, create an keyboard HID device, then send your keys though this HID device.
Use Arduino to send your keys. ref to https://www.arduino.cc/reference/en/language/functions/usb/keyboard/