Better Gamepad key support (an SKSE Plugin) by NeoH4x0r
Skyrim » Utilities
Added: 19/11/2015 - 03:29AM
Updated: 21/07/2017 - 03:33AM

151 Endorsements Latest version

1,485 Unique D/Ls

2,423 Total D/Ls

22,311 Total Views

Uploaded by NeoH4x0r


Last updated at 3:33, 21 Jul 2017 Uploaded at 3:29, 19 Nov 2015

NOTE: This will not work with Skyrim Special Edition

Mod: Better Gamepad key support (an SKSE Plugin)

The latest version can also be found here:

SCRIPTING FUNCTIONS ================================================================================================

added in v1.7.3.8
; Will toggle the state of the gamepad from enabled to disabled
Function ToggleGamepad() global native

added in v1.7.3.5
; returns the left-stick position from right to left (a value between -32768 to 32767)
float Function GetLX() global native

; returns the left-stick position from up to down (a value between -32768 to 32767)
float Function GetLY() global native

; returns the right-stick position from right to left (a value between -32768 to 32767)
float Function GetRX() global native

; returns the right-stick position from up to down (a value between -32768 to 32767)
float Function GetRY() global native

; direction enumeration:
kDiretion_none               = 0,
kDiretion_up     = 1,
kDiretion_upright    = 2,
kDiretion_right = 3,
kDiretion_downright = 4,
kDiretion_down = 5,
kDiretion_downleft          = 6,
kDiretion_left                  = 7,
kDiretion_upleft              = 8,
; returns the left stick's direction  (a value between 0 and 8)
int Function GetLSDirection() global native
; returns the left stick's direction (a value between 0 and 8)
int Function GetRSDirection() global native

They can be accessed like this: 

float lx = Controller.GetLX()

---- these can also be accessed from scaleform by calling 

float lx = _global.skse.plugins.neoh4x0r-gpad.GetLX()
-or maybe- _global.GetLX()

DESCRIPTION ========================================================================================================

Adds better support for Gamepad functions.
* All Gamepad Keys can be used with, and fully work with, the following input functions:
   IsKeyPressed | TapKey | HoldKey | ReleaseKey | GetMappedKey | IsKeyHeld | DisableKey | EnableKey | IsKeyDisabled | GetNthKeyPressed

* Input.IsKeyPressed function can detect pressing with following keys with a gamepad:
   Forward/Back/Strafe Left/Strafe Right and trigger buttons

* Added gamepad support for the following keys: 
   Auto-Move | Quick Map | Quick Inventory | Quick Magic | Quick Stats | Screenshot | Mult-Screenshot (takes 10 screenshots evey 0.5s)
   NOTE: these keys must be used with a scripted hotkey mod (you can even set them up using an MCM menu, if you add MCM support)

* Input.GetMappedKey: will automatically return the proper key code regardless of keyboard or gamepad usage

NOTE: the following feature is not available in the plugin version (there is nothing I can do from the plugin side)
It requires a hard-modifiction to skse and cannot be modified / altered / changed by an skse plugin.

There is a workaround available on the bugs page
(it requires disabling the gamepad temporarily while configuring SkyUI hotkeys)

* Input.GetMappedKey: now allows things like SkyUI to map keybaord keys and gamepad keys at the same time
  NOTE: you cannot use a keyboard and gamepad key for the same entry
  However, you can map entries to keyboard keys and map others to gamepad keys.

INSTALLATION ===========================================================================================================

Install the mod using NMM or any other mod manager that supports fomod installes.
-Or- Extract the SKSE/Plugins folder to skyrim/Data/SKSE/Plugins

UNINSTALLATION =========================================================================================================

Unintall the mod using NMM or any other mod manager that supports fomod installes.
-Or- Delete the neoh4x0r-gpad.dll/.pdb from skyrim/Data/SKSE/Plugins

ISSUES =================================================================================================================

* SkyUI hotkeys cannot be assigned using keyboard/mouse buttons when a gamepad is active (even though the key bindings would work)
 ** for a workaround you can disable the gamepad when setting up hotkeys that use keyboard/mouse buttons (you can re-enable the gamepad afterwards)

INCOMPATIBILITY =========================================================================================================

This mod can intercept vanilla calls to Input functions and return the proper key codes for keyboard/mouse/gamepad keys, but
it cannot work if the author has hard-coded the control codes and does not use the input functions to check them.

-- int iHotKey = 156 ; (num enter) [this key is not mapped by skyrim]
-- RegisterForKey(iHotKey);
-- Event OnKeyDown(Int KeyCode)
--   If KeyCode == iHotKey
--     ; do something
--   EndIf
-- EndEvent

-- In this example: Better Gamepad Key Support would no be able to translate the key as thier is no gamepad equivalent.
-- however if wanted to use the TAB key (TweenMenu) we could the following
-- int iHotKey = 156 ;
--  iHotKey = GetMappedKey("Tween Menu");
-- This will either be 15 (TAB) if no gampead is used and 277 (BTN_B) if a gamepad is used.

-- This plugin autotranslates calls to IsKeyPressed, etc by checking to make sure that  keycode that is passed in is correct
-- given the context -- if 15 was passed into IsKeyPressed and a gamepad was used it translate that to 277.
-- but nothing can be done about keys that have no mapping in skyim

See the bugs page for more specific information and/or workarounds.

Alternate Donwload locations/Source =========================================================================================

* The main download page:
* If you want the latest bleeding-egde vesrgion:
* if you want to view the source in flat-directory:
* if you want to view the source including svn log messages/get diffs/etc:

Change Log =============================================================================================================

v -
    + Fix an issue where scripts that only use OnKeyUp events would never fire simply because there was no delay between KeyDown/KeyUp events
       This should fix calls to TapKey, etc for mods like Souls Quick Menu and Helmet Toggle
v -
    + When a keyboard key (scancode) that is mapped to a control (such as Journal, etc) is passed into TapKey, etc -- the code will no longer
       automatically try to map that to a coresponding gamepad key.
v -
    + add a native function to enable/disable a controller from a script -- useful if something can only be done 
       with a keyboard and you want to script it.
v  - 
    + add support for sending multiple keyup/down events in same call
    + fix issue with keycodes above 255 not working as intended when calling TapKey/HoldKey/ReleaseKey
    + add the following ini options
v  - add support to send movement keydown events when using the left joystick on the gamepad (also fix an issue with sending raw input to the game)
v  - fixed an issue with controller scripts functions not being thread-safe (also added scaleform versions of them)
v  -
   + cleaned up code
   + addeded ability to read left/right stick controller position as well as direction  
v  -  Implemented all remaining input functions (all keys can, now, be correctly detected using Input.IsKeyPressed) and added config support
v  -  Improved general support and code cleanup ... fully support TapKey/HoldKey/ReleaseKey to mods regirested for OnKeyUp/OnKeyDown events
v  -  Initial Release (requires SKSE 1.7.3)