Build Your Own Arcade Controls Forum

Main => Software Forum => Topic started by: DinoRoger on May 14, 2003, 12:17:15 am

Title: Emulating keyboard keys while in MAME?
Post by: DinoRoger on May 14, 2003, 12:17:15 am
When I press a certain key on the keyboard a macro is ran that will emulate keys being pressed.  Outide MAME it works without any problems.  When I am in a MAME game though the macro launches and runs but the keys are not emulated???  I can press they key for example 5 times and when I exit MAME I can see it actualy ran the macro all 5 times but its like MAME is blocking the keys.  from outside progams.  Anyone ever tinker with this or know a solution?
Title: Re:Emulating keyboard keys while in MAME?
Post by: BobA on May 14, 2003, 12:25:32 am
The AOS doc had a very confusing bit about keyboard remapping and the difficulties.  I wonder if it would be relevant to what you are experiencing?

Just a shot in the dark on my part.

BobA
Title: Re:Emulating keyboard keys while in MAME?
Post by: Howard_Casto on May 14, 2003, 12:38:21 am
Mame uses direct input.... in other words other programs can see the keys, but it's extremely difficult (practically impossible) to send keys to mame.  Sorry man but your out of luck.  
Title: Re:Emulating keyboard keys while in MAME?
Post by: u_rebelscum on May 14, 2003, 12:40:44 am
If you're using win mame (or mame32), mame looks at the keyboard input through directX.  Not through the normal win32, event based, method.

Do you know if the macro outputs the keypresses as a simulated keyboard device (directX should see this), or does it output them as "windows events" (ie: inserted after directX in the input data stream, so mame wouldn't see them).  My guess is it's the latter.
Title: Re:Emulating keyboard keys while in MAME?
Post by: TheTick on May 14, 2003, 10:56:00 am
1) Modify \src\windows\input.c
    Have your external app call a modified function in MAME that inserts the keystrokes directly into MAME's keyboard handler. i.e. win_poll_input() , keyboard_state[]

Best Way Better than the previous way
2) Code a wrapper for directX.
   Mame calls directX.directInput but is actually talking to your app. All calls are passed on, except when you want to insert some keypresses of your own.