/gptokeyb2

GamePad TO Key Board v2

Primary LanguageCGNU General Public License v2.0GPL-2.0

GamePad TO KeyBoard 2

Gamepad to Keyboard/mouse/xbox360(gamepad) emulator

About

gptokeyb2 is a fairly big rewrite of gptokeyb. It uses a finite state machine (FSM) and a better configuration system. The new FSM allows much more complex control schemes, allowing greater possibilities in controlling ports.

Features:

  • multiple controller layouts that can be moved between.
  • customizable text input engine

While gptokeyb2 has a lot more flexibility, it is also backwards compatible with gptokeyb, allowing an easy drop in replacement of the older program without any extra work.

Build

mkdir build
cd build
cmake ..
cmake --build .
strip gptokeyb2

Usage

./gptokeyb2 "program" -c "controls.ini" &
./program
kill -9 $(pidof gptokeyb2)

Complex Example:

[config]
deadzone_triggers = 3000
mouse_scale = 6114
mouse_delay = 16
mouse_slow_scale = 30

deadzone_mode = axial
deadzone = 1000
deadzone_scale = 7
deadzone_delay = 16

[controls]
# Clear any defaults
overlay = clear

a = mouse_left                          # Mouse Left
b = mouse_right                         # Mouse Right
x = s                                   # Stop
y = g                                   # Guard

l1 = ctrl                               # Force attack
l2 = shift                              # Add to selection
r1 = mouse_slow                         # Slow mouse
r2 = x                                  # Scatter

back = hold_state hotkey                # back + button combos

up = 1
down = 3
left = 4
right = 2

left_analog = mouse_movement
right_analog = arrow_keys repeat

[controls:hotkey]
overlay = parent

l1 = n                               # Select next unit
l2 = e                               # Select everything on screen
r1 = tab                             # Show/Hide sidebar
r2 = home                            # Center screen on selection

[controls:analog_0]
# Controls for devices with 0 analog sticks.
overlay = controls

# Toggle to dpad_mouse
r1 = push_state dpad_mouse

up = 1
down = 3
left = 4
right = 2

[controls:dpad_mouse]
overlay = controls

# Toggle to back
r1 = pop_state

dpad = mouse_movement