MoltenGamepad

1.0 2.0 4.0

MoltenGamepad is a flexible input device remapper, geared towards gamepads. The development of this slowed down but it is perfectly functional. I use it mostly to slice my X52 Pro into several virtual gamepads for games that do not support joysticks (or fail to detect mine).

What I didn’t scratch yet is it’s command support via FIFO or socket for controlling a running instance via scripting but that is totally on my bucket list.

This software has to be compiled from source which is usually just invoking make after installing required dependencies. There is a helper script in installation/check_installation.sh that sets up required udev rules and allows running this software as user.

Launch parameters

Example to start with two virtual gamepads:

./moltengamepad –num-gamepads 2 –mimic-xpad

Once started press first a mapped button for the first gamepad to assign it. After that press a mapped button for second gamepad to assign it:

No moltengamepad.cfg found.
driver: wiimote driver initialized.
driver: x52_pro_controller driver initialized.
plug: x52_1 added
plug: x52_2 added
stdin: ready to read commands from standard input. Try "help" for more info.
slot: x52_1 assigned to slot virtpad1
slot: x52_2 assigned to slot virtpad2

And this is how it looks e.g. in AntiMicroX:

MoltenGamepad in action
MoltenGamepad in action

Configuration

The configuration is dropped in ~/.config/moltengamepad/gendevices/x52-pro.cfg. I do this automatically via a script depending on the game I’m starting. I know this is not how this is supposed to be done but wrapping my head around a configuration for MoltenGamepad was a pain in the neck to begin with because not many examples exist.

[events="superset" vendor="06a3" product="0762" driver="hid-generic"]

# 06a3:0762
# Options file is license as WTFPL http://www.wtfpl.net/
# Slices most of an X52 Pro into 2 virtual gamepads
 
name = "x52_pro_controller"
devname = "x52_"
exclusive = "false"
change_permissions = "false"
flatten = "false"
rumble = "false"
split=2
1.device_type = "gamepad"
2.device_type = "gamepad"
 
# btn_east = "cross", "The cross (X) button"
 
# Event mappings
 
# 1.key(288) = "cross", "Primary fire button"
1.btn_trigger = "left_trigger", "Gun Button Step 1"
# 1.key(302) = "right_trigger", "Gun Button Step 2"
1.btn_trigger_happy15 = "bbb", "Gun Button Step 2"
 
1.btn_thumb2 = "a", "A button"
1.btn_top = "b", "B button"
1.btn_top2 = "x", "C button"
1.btn_thumb = "y", "Safety fire button (Fire 2)"
1.btn_pinkie = "guide"
1.btn_base2 = "button_16"
 
1.abs_x = "left_x", "Left stick X axis"
1.abs_y = "left_y", "Left stick Y axis"
1.abs_rz = "right_x", "Right stick X axis (Z axis)"
1.abs_z = "right_y", "Right stick Y axis (Throttle axis)"
1.abs_hat0x = "leftright", "HAT POV up"
1.abs_hat0y = "updown", "HAT POV right"
1.btn_trigger_happy4 = "right_thumb", "POV2 up"
1.btn_trigger_happy5 = "right_shoulder", "POV2 right"
1.btn_trigger_happy6 = "left_thumb", "POV2 down"
1.btn_trigger_happy7 = "left_shoulder", "POV2 left"
 
2.btn_trigger_happy3 = "left_trigger", "Scrollwheel click"
2.btn_dead = "right_trigger", "Mouse button (click)"
# 2.btn_trigger_happy15 = "x", "I button"
 
2.btn_base = "a", "D button"
# 2.btn_base2 = "b", "E button"
 
2.key(719) = "left_shoulder", "Function button"
2.key(722) = "left_thumb", "Function page up"
2.key(723) = "left_thumb", "Function page down"
2.key(726) = "right_shoulder", "MFD select button"
2.key(724) = "right_thumb", "MFD select button up"
2.key(725) = "right_thumb", "MFD select button down"
 
2.abs(004) = "left_x", "Left stick X axis"
2.abs(003) = "left_y", "Left stick Y axis"
2.abs(040) = "right_x", "Mouse X"
2.abs(041) = "right_y", "Mouse Y"
2.btn_trigger_happy8 = "up", "Throttle POV up"
2.btn_trigger_happy9 = "right", "Throttle POV right"
2.btn_trigger_happy10 = "down", "Throttle POV down"
2.btn_trigger_happy11 = "left", "Throttle POV left"
2.btn_trigger_happy17 = "start_stop", "Start/Stop"
2.btn_trigger_happy18 = "back", "Reset"
 
# Aliases
 
# 1.btn_trigger = "primary"
alias primary a
alias secondary b
alias third x
alias fourth y
 
alias start start_stop
alias select back
alias mode guide
 
alias thumbl left_thumb
alias thumbr right_thumb
 
# right shoulder
alias tr right_shoulder
# right trigger
alias tr2 right_trigger
# left shoulder
alias tl left_shoulder
# left trigger
alias tl2 left_trigger
[events="superset" vendor="06a3" product="0762" driver="hid-generic"]

# 06a3:0762
# Options file is license as WTFPL http://www.wtfpl.net/
# Maps _some_ buttons of an X52 Pro to a virtual gamepad for No Man's Sky

name = "x52_pro_controller"
devname = "x52_"
exclusive = "false"
change_permissions = "true"
flatten = "false"
rumble = "false"
device_type = "gamepad"

# Event mappings

btn_trigger = "a", "A button (Fire Weapons)"
btn_thumb2 = "a", "A button (Fire Weapons)"
btn_top = "b", "B button (Boost)"
btn_top2 = "x", "C button (Langing/Exit Ship)"
btn_thumb = "y", "Safety fire button (Fire 2)"
btn_pinkie = "guide"

abs_x = "left_x", "Left stick X axis"
abs_y = "left_y", "Left stick Y axis"
abs_rz = "right_y", "Right stick Y axis (Throttle axis)"
abs_hat0x = "leftright", "HAT POV up"
abs_hat0y = "updown", "HAT POV right"
btn_trigger_happy4 = "right_thumb", "POV2 up"
btn_trigger_happy6 = "left_thumb", "POV2 down"
btn_trigger_happy5 = "right_shoulder", "POV2 right"
btn_trigger_happy7 = "left_shoulder", "POV2 left"

# hat from throttle:
btn_trigger_happy8 = "up", "Throttle POV up"
btn_trigger_happy9 = "right", "Throttle POV right"
btn_trigger_happy10 = "down", "Throttle POV down"
btn_trigger_happy11 = "left", "Throttle POV left"

btn_trigger_happy17 = "start_stop", "Start/Stop"
btn_trigger_happy18 = "back", "Reset"

# thumb button
btn_trigger_happy15 = "b", "B button (Boost)"

alias primary a
alias secondary b
alias third x
alias fourth y

alias start start_stop
alias select back
alias mode guide

alias thumbl left_thumb
alias thumbr right_thumb

# right shoulder
alias tr right_shoulder
# right trigger
alias tr2 right_trigger
# left shoulder
alias tl left_shoulder
# left trigger
alias tl2 left_trigger