Build Your Own Arcade Controls Forum

Main => Software Forum => Topic started by: tony.silveira on January 05, 2012, 09:31:38 pm

Title: "key forwarder", something like this exist?
Post by: tony.silveira on January 05, 2012, 09:31:38 pm
hey all,

in my never ending quest to get all my emu's to behave the same on my arcade machine, i'm curious if anything like a "key forwarder" exists, for lack of a better term.  let me explain, most my emu's pause by hitting the 'P' key.  some of the emu's i have set up use a different key, some are (PAUSE), some are ALT+PAUSE, even got one that is F9, none of these are mappable to a user defined key.

so i was wondering, some key sniffer that when launched before an emu via command line, would listen for the user to hit 'P' and then send the correct key command (PAUSE, F9, ALT+PAUSE, etc.) to the emu running.  not even sure if this would be possible?

just a thought, thanks for reading
Title: Re: "key forwarder", something like this exist?
Post by: Le Chuck on January 06, 2012, 12:23:17 am
Is there an issue with all those buttons being hit at once?  If you have your pause button on your CP being read as a joystick button you can use JoytoKey and map all of those buttons to it so it pauses across multiple platforms.  If it's read as a keyboard input you can get VJoy to map your pause button to a joystick button then use JoytoKey to map it back.  Sounds really retarded to go through all that.  Probably easier to just use autohotkey and set up your pause button to press all those buttons at once, or script autohotkey to do it based on which emulator you are running... all of which it can do.  There are a few ways to skin this cat, and I'm probably missing an even simpler one.   
Title: Re: "key forwarder", something like this exist?
Post by: headkaze on January 06, 2012, 03:24:57 am
Check out AutoHotkey. You could make up scripts to run before your emu's to remap (http://www.autohotkey.com/docs/misc/Remap.htm) whatever key to whatever key combo you want.

Eg.
Code: [Select]
p::Pauseor
Code: [Select]
p:::F9or
Code: [Select]
p::{Alt Pause}
Title: Re: "key forwarder", something like this exist?
Post by: Le Chuck on January 06, 2012, 01:40:06 pm
Check out AutoHotkey. You could make up scripts to run before your emu's to remap (http://www.autohotkey.com/docs/misc/Remap.htm) whatever key to whatever key combo you want.

Eg.
Code: [Select]
p::Pauseor
Code: [Select]
p:::F9or
Code: [Select]
p::{Alt Pause}

Tony, these are spot on except for the code for p to F9 has an extra : should just be p::F9.  If you want them all mapped to the P key you can do this:

Code: [Select]
p::send {pF9Pause}{Alt Down}Pause{Alt up}or
Code: [Select]
p::send pF9Pause^Pause
However depending on what program you're running autohotkey may not do the trick as not all emulators with fixed mapping recognize remapping.  The way around this would be to remap in your registry.  The following is taken from Autohotkey Forums (http://www.autohotkey.com/docs/misc/Remap.htm)

Remapping via the Registry's "Scancode Map"

Advantages:

    Registry remapping is generally more pure and effective than AutoHotkey's remapping. For example, it works in a broader variety of games, it has no known alt-tab issues, and it is capable of firing AutoHotkey's hook hotkeys (whereas AutoHotkey's remapping requires a workaround).
    If you choose to make the registry entries manually (explained below), absolutely no external software is needed to remap your keyboard. Even if you use KeyTweak to make the registry entries for you, KeyTweak does not need to stay running all the time (unlike AutoHotkey).


Disadvantages:

    Registry remapping is relatively permanent: a reboot is required to undo the changes or put new ones into effect.
    Its effect is global: it cannot create remappings specific to a particular user, application, or locale.
    It cannot send keystrokes that are modified by Shift, Control, Alt, or AltGr. For example, it cannot remap a lowercase character to an uppercase one.
    It is not supported on Windows 95/98/Me (AutoHotkey can do some limited Win9x remapping).
    It supports only the keyboard (AutoHotkey has mouse remapping and some limited joystick remapping).

How to Apply Changes to the Registry: There are at least two methods to remap keys via the registry:

    Use a program like KeyTweak (freeware) to visually remap your keys. It will change the registry for you.
    Remap keys manually by creating a .reg file (plain text) and loading it into the registry. This is demonstrated at www.autohotkey.com/forum/post-56216.html#56216 (http://www.autohotkey.com/forum/post-56216.html#56216)

Let me know what works and what doesn't.
Title: Re: "key forwarder", something like this exist?
Post by: tony.silveira on January 06, 2012, 03:49:06 pm
i appreciate the feedback guys.  here is what i tried for kega fusion:

#IfWinActive, Fusion 3.64
p::Pause
#IfWinActive

i compiled that script and put the line in my pre-emulator command line.  it runs but it's not pausing like i hoped.  i know it's running cause when i go back to my desktop, the ahk icon is active.

ah well
Title: Re: "key forwarder", something like this exist?
Post by: Le Chuck on January 06, 2012, 04:25:30 pm
I'm bingo on good advice. Try the guys at AHK help forums and see what they recommend. Make sure and post up once you get it working.
Title: Re: "key forwarder", something like this exist?
Post by: tony.silveira on January 06, 2012, 06:18:26 pm
wow, check out the link i found.  not sure how this little app works but it does!

http://www.gameex.info/forums/topic/8121-pause-any-emulator/ (http://www.gameex.info/forums/topic/8121-pause-any-emulator/)