I have a game in dolphin and I am trying to make a python program that can interact with it and I wrote the following code using the library https://github.com/SavinaRoja/PyUserInput.
from pykeyboard import PyKeyboard
k = PyKeyboard()
m.click(131, 289) #makes the dolphin window the current window
k.tap_key('O') # presses the O key
This code will work on all the programs I have tried. But it does not work for some emulators. Is there something I am doing wrong or can this library just not interact with the dolphin emulator. If this library does not work could someone tell me a library or way to make python code simulate a keyboard press for the dolphin emulator
You can try this fork of mine that lets you run embedded python scripts: https://github.com/felk/dolphin/
For example, to rapidly press A on a gamecube game, you can do the following:
from dolphin import controller, event
while True:
await event.frameadvance()
buttons = controller.get_gc_buttons(0)
buttons["A"] = True
controller.set_gc_buttons(0, buttons)
await event.frameadvance()
# do nothing every other frame
The embedded python includes a full standard library, so you can try opening a socket or http server to make it communicate with some external program.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With