By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,427 Members | 1,378 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,427 IT Pros & Developers. It's quick & easy.

Trying to send keystrokes to NES emulator

P: n/a

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

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")


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 :)

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?


Dec 1 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.