Skip to content

Repository files navigation

gamepad2mkb Github All Releases

basic mouse and keyboard emulator via gamepad
supports directx, xinput and uinput (linux)
a specific key can be used for timed actions example
settimerduration = 2.5
settimeron = btback

usage

gamepad2mkb.exe "path to file"
or specify a path via conf/conf.ini
if no file is specified then defaults to gamepad map
specified by paddefinition in confconf.ini

[gamepad map]
' location mke
paddefinition = conf.mke

install

open zip file and copy contents to preferd folder
this application is portable.

configuration

options via conf/conf.ini

requirements

sdl2 (32bit) v2.28.5.0
https://github.com/libsdl-org/SDL/releases

or for linux
get sdl2:
sudo apt install libsdl1.2-dev\

linux notes

compile with (on debian based distro):
fbc gamepad2mkb.bas gamepad.o
or manually compile uinput helper first:
gcc -c gamepad.c -o gamepad.o
if needed set:
chmod +x gamepad2mkb

Permissions and device path
/dev/uinput typically requires root or membership in a specific group (e.g., input).
if needed run sudo ./gamepad2mkb
or check with:
sudo evtest
should display something like:
/dev/input/event15: GamepadEmu
/dev/input/event16: GamepadEmuMouse
if gamepad2mkb has succesfuly added an
event system to uinput.

performance

windows 7 / windows 10(1903)
ram usage ~2MB / 2MB
handles ~112 / ~300
threads ~1 / ~7
cpu ~0% / ~0%
tested on intel i5-6600T

navigation

close window console : close application

mapping explained

regular keys: a-Z and 0 - 1
example = key a, key 0, etc
special keys: return, escape, ctrl and shift (left and right), f1 to f5
example = key escape, key return, key rctrl, key lshift, key f1
directional keys: up, down, left right
example = key up, key down
mouse buttons: mouse left, mouse right
example = mouse left

mapping axis
example map axis left to key:
lstick_left_2key = key a
mousemovement can be mapped / unmapped via:
lstick2mouse = true
or
lstick2mouse = false

example .mke structure

[general]
mapversion = 1.1
settimerduration = 2.5
settimeron = btback
' set deadzone gamepad [0 - 256] default 128
deadzone = 64
acceleratex = 14.5
acceleratey = 12.5
' set to true alternative method of moving mousepointer and mouseclick
' use for some older games by nobilis, kheops, etc default false
spritecursor = false

[joystick01]
lstick_left_2key    =
lstick_right_2key   =
lstick_up_2key      =
lstick_down_2key    =
rstick_left_2key    =
rstick_right_2key   =
rstick_up_2key      =
rstick_down_2key    =
lstick2mouse        = true
rstick2mouse        = true
SDL_CONTROLLER_BUTTON_A                 = mouse left
SDL_CONTROLLER_BUTTON_B                 = key h
SDL_CONTROLLER_BUTTON_X                 = mouse right
SDL_CONTROLLER_BUTTON_Y                 = key i
SDL_CONTROLLER_BUTTON_BACK              = key return
SDL_CONTROLLER_BUTTON_GUIDE             =
SDL_CONTROLLER_BUTTON_START             = key escape
SDL_CONTROLLER_BUTTON_LEFTSTICK         =
SDL_CONTROLLER_BUTTON_RIGHTSTICK        =
SDL_CONTROLLER_BUTTON_LEFTSHOULDER      =
SDL_CONTROLLER_BUTTON_RIGHTSHOULDER     =
SDL_CONTROLLER_AXIS_TRIGGERLEFT         = mouse right
SDL_CONTROLLER_AXIS_TRIGGERRIGHT        = mouse left
SDL_CONTROLLER_BUTTON_DPAD_UP           = key up
SDL_CONTROLLER_BUTTON_DPAD_DOWN         = key down
SDL_CONTROLLER_BUTTON_DPAD_LEFT         = key left
SDL_CONTROLLER_BUTTON_DPAD_RIGHT        = key right

internal readable button labels (used for settimeron)

' init map to readable generic button name
gpmap.bt(SDL_CONTROLLER_BUTTON_A)               = "bta"
gpmap.bt(SDL_CONTROLLER_BUTTON_B)               = "btb"
gpmap.bt(SDL_CONTROLLER_BUTTON_X)               = "btx"
gpmap.bt(SDL_CONTROLLER_BUTTON_Y)               = "bty"
gpmap.bt(SDL_CONTROLLER_BUTTON_BACK)            = "btback"
gpmap.bt(SDL_CONTROLLER_BUTTON_GUIDE)           = "btguide"
gpmap.bt(SDL_CONTROLLER_BUTTON_START)           = "btstart"
gpmap.bt(SDL_CONTROLLER_BUTTON_LEFTSTICK)       = "btlstick"
gpmap.bt(SDL_CONTROLLER_BUTTON_RIGHTSTICK)      = "btrstick"
gpmap.bt(SDL_CONTROLLER_BUTTON_LEFTSHOULDER)    = "btlshoulder"
gpmap.bt(SDL_CONTROLLER_BUTTON_RIGHTSHOULDER)   = "btrshoulder"
gpmap.bt(SDL_CONTROLLER_AXIS_TRIGGERLEFT + 100) = "btrtrigger"
gpmap.bt(SDL_CONTROLLER_AXIS_TRIGGERRIGHT+ 100) = "btltrigger"
gpmap.bt(SDL_CONTROLLER_BUTTON_DPAD_UP)         = "btdpup"
gpmap.bt(SDL_CONTROLLER_BUTTON_DPAD_DOWN)       = "btdpdown"
gpmap.bt(SDL_CONTROLLER_BUTTON_DPAD_LEFT)       = "btdpleft"
gpmap.bt(SDL_CONTROLLER_BUTTON_DPAD_RIGHT)      = "btdpright"

About

basic mouse and keyboard emulator via gamepad in freebasic and sdl2

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages