Trying to send keystrokes to NES emulator

Discussion in 'Python' started by srinathava@gmail.com, Dec 1, 2006.

  1. Guest

    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/
     
    , Dec 1, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lucas Tam
    Replies:
    5
    Views:
    6,239
    WizyDig
    Dec 2, 2004
  2. Replies:
    6
    Views:
    646
  3. kernelerror

    asking for source codes nes emulator

    kernelerror, Apr 12, 2008, in forum: Java
    Replies:
    0
    Views:
    395
    kernelerror
    Apr 12, 2008
  4. Stedwick
    Replies:
    8
    Views:
    300
    Kajan Sittampalam
    Dec 25, 2008
  5. Babu Raj
    Replies:
    2
    Views:
    254
    Brian Candler
    Nov 26, 2009
Loading...

Share This Page