Trying to send keystrokes to NES emulator

S

srinathava

Hi,

I am trying to send keystrokes to the NES emulator nester[1]. The idea
was to be able to use a standard NES controller whose "state" I can
read in using Python and then conveying that to the emulator.
Unfortunately, all the attempts I have made so far have failed. It
looks like the emulator is using some extremely low-level function to
read keystrokes and I cannot get in before it.

So far, I have tried the following functions from Python's win32api and
using ctypes:

1. SendInput
http://mail.python.org/pipermail/python-win32/2005-April/003131.html

2. keybd_event
win32api.keybd_event(90, 0, 0, 0)
This should have sent the 'z' key to the emulator which in Contra
makes the little guy shoot. However, the emulator just sits there.

3. SendKeys
import win32api
import win32com.client

shell = win32com.client.Dispatch("WScript.Shell")

shell.AppActivate("nester")
shell.SendKeys('s')

My suspicion is that nester is using something lower-level than where
these functions change stuff. I read about GetAsyncKeyState. However, I
couldn't figure out for the life of me how to force the return value of
the GetAsyncKeyState function.

I would really appreciate any help in this regard :)

Thanks!
Srinath (speaking only on behalf of myself)

PS: Does anyone know of a good way to play old NES games on the PC
using the classic NES controllers?

[1] http://nester.dranalli.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top