Digging up an old thread here but I thought I'd post what I've done in the past.
- The simplest way to inject keys into MAME is to compile a custom version with the following #define set to 1. The file is src\osd\windows\input.c
Code:
#define FORCE_DIRECTINPUT 1
SendInput() works with DirectInput
- You can inject keys into MAME by attaching a dll to the MAME process and API hook the RawInput calls. - You can use a key to joystick app such as PPJoy or VJoy