Page 1 of 1

Multiple keypads-to-virtual-joysticks remapping work-around

Posted: 11 Aug 2014, 02:51
by raron
I'm rather new to AHK, I've only dabbled a bit with it the last month or so. I suppose this might be useable (if only in a few instances), so I'm posting this here (maybe it should be under "gaming", I wasn't too sure where to put it).

I've managed to hack together a solution of sorts for remapping multiple keyboard's numpads to virtual controllers. I think any HID compatible keypads and other similar devices also works. As windows basically don't distinguish between keyboards connected to the system, the solution was to use an external program (HIDMacros) that can, which in turn calls some AHK scripts pushing virtual joystick buttons.

vJoy_ButtonPusherDaemon.ahk is the main thing that can configure it all (except vJoy virtual controllers - this have to be configured first), generates HIDMacros macros automatically (atm for numpads only), etc. HIDMacros in turn use HIDsendVJ.ahk to tell vJoy_ButtonPusherDaemon which buttons to, yeah, push. (Lame name but whatever). Only momentary button presses are used atm, of about 0.1 seconds.

Requires (in short):
- AutoHotKey (as the scripts are not compiled)
- HIDMacros configured and running in the background.
- vJoy virtual controllers installed and configured.
- vJoy_ButtonPusherDaemon.ahk configured and running in the background.

Plus a couple of other bits (vJoy SDK). Installation instruction included in the ReadMe.txt file.

Possibly somewhat messy code, a mix of my own dabblings with forum code :)

Keep in mind this is basically a work-around for multiple keyboards (or numpads, really). And also that the remapped keys should not be used by themselves in a game (or whatever program you use). Only the remapped virtual buttons should be used, or else the keyboards won't be distinguished (which makes all of this pointless...).


Some acknowledgements:
I could never have done this without the following helpful links:
evilC's excellent ADHD AHK Dynamic Hotkeys for Dummies
XX0's thread: Multiple keyboards workaround
And axlar's posts in the thread Using AHK to control vJoy
Also, evilC's UJR (Universal Joystick Remapper) deserves a mention, for one since I "borrowed" the idea of a Quickbind method :) And also since it offers more advanced remapping options (axis combining etc).

EDIT: Just a minor correction (vJoy must be configured separately first).

Re: Multiple keypads-to-virtual-joysticks remapping work-aro

Posted: 20 Aug 2014, 05:57
by Arcanist
I'd love to know what you use it for and if you could describe your setup. That's the most fun part about looking at other people's scripts

Re: Multiple keypads-to-virtual-joysticks remapping work-aro

Posted: 21 Aug 2014, 04:41
by raron
That's a good question.

Actually, I don't have any use for it, not atm at least. I basically did it out of a bit of boredom I suppose (IE procrastination :P).

What got me started was that someone who had an extra keypad, asked if it was possible to use it for extra functions in a game. The extra keypad didn't add extra keys to use for other functions than was already used by the regular numpad (as windows simply took it for being the same numpad).

I've only tested this with the numpad part of three keyboards I had lying around. So I confirmed for myself that at least that works (both in a game and in control panel - game controllers). That's basically it.. I shared it just in case it might be useable for others with a similar problem. Or something.


Btw, it might be that GlovePIE also can do the same thing by itself (without using HIDMacros), but I haven't gone that route.

Re: Multiple keypads-to-virtual-joysticks remapping work-around

Posted: 07 Apr 2016, 12:25
by raron
Long time since I've been meddling with this.

I just wanted to say I guess this is obsolete now that HIDMacros is obsolete and replaced with LUAMacros. I stumbled upon this from this fb page: https://www.facebook.com/LinusTech/vide ... 192422926/

Oh and yeah, seems I'm about a year late with that.. :oops:

Anyway, just FYI.