Re: [DirectPython] directinput and MAME?
Status: Inactive
Brought to you by:
hsalo
From: Heikki S. <ho...@gm...> - 2007-12-20 14:24:55
|
_____ From: dir...@li... [mailto:dir...@li...] On Behalf Of Alec Bennett Sent: 19. joulukuuta 2007 10:08 To: dir...@li... Subject: [DirectPython] directinput and MAME? I'm trying to send keystrokes from Python to MAME. In case anyone's interested and doesn't know, MAME is an emulator to play classic arcade games (mamedev.org). I'm sending keystrokes from Python on Win32 like this: import win32api import win32com.client shell=win32com.client.Dispatch("WScript.Shell") shell.SendKeys("1") This works in everything but MAME which, as I've just learned, uses DirectInput. Can anyone think of a way to send keystrokes under this environment? I know it's possible, since there's a program called joykeys (http://members.aol.com/bretjohn/ <http://members.aol.com/bretjohn/> ) that translates joystick motion to keystrokes and works in Mame. Thanks for any help. Hi, You should be able to send keyboard events with win32api.keybd_event() ( http://msdn2.microsoft.com/en-us/library/ms646304.aspx ). These should work with applications using DirectInput for keyboard events too (at least with more recent OS versions, I think DirectInput used some more direct approach in older systems but I am not 100% sure about it). Just remeber that only the focus window will receive these events. Also note that SendInput() has superseded this function, but keybd_event() still works and is somewhat easier to use. -- Heikki Salo |