Skyrim
0 of 0

File information

Last updated

Original upload

Created by

NeoH4x0r

Uploaded by

NeoH4x0r

Virus scan

Some manually verified files

About this mod

Adds better support for xinput gamepads and mice (fixes input simulation for gamepad and mice)
So things just work as intended...

Requirements
Permissions and credits
=========================================================================================
NOTE: This will not work with Skyrim Special Edition and 
I have no plans to port it because I don't have the time to do it.

That being said, the source code has been made available (and the permissions changed) to allow
anyone who wants to port it to be able to do so.


To my knowledge there has been no [**working] SSE port created.

**The last that I heard (and it was awhile ago) user:dunc001 was attempting to work on a SSE port, but was not having any success getting it to work. (I have not heard any update about it since then)

If you know someone who is capable (and wants to) port it -- let them know that the source is available and that
the permissions allow ports to Skyrim SSE (and future elder-scrolls games).

So...please do not ask: When will an SSE port be created ?
I do not know the answer to that question and I am likely to ignore such inquiries (I'm getting too many as it stands). 
=========================================================================================



Mod: Better Gamepad key support (an SKSE Plugin)

The latest version can also be found here:
http://www.netsolutions.dynu.com:81/websvn/Tesv_skyrim/utilities/skse/tags/neoh4x0r-gpad/latest/


WHAT DOES THIS DO? ================================================================================================
This skse plugin does the following: (see the description towards the bottom for more info & the change log)

  • Fixes input simulation for mice and gamepads (skse functions: IsKeyPressed | TapKey | HoldKey | ReleaseKey | GetMappedKey | IsKeyHeld | DisableKey | EnableKey | IsKeyDisabled | GetNthKeyPressed)
  • Allows the following controls to be used with gamepad and a user-created hotkey using GetMappedControl(control) and TapKey (these controls must be bound in controlmap.txt) (Auto-Move | Quick Map | Quick Inventory | Quick Magic | Quick Stats | Screenshot | Mult-Screenshot)
  • Adds support to IsKeyPressed to detect Forward/Back/Strafe Left/Strafe Right and trigger buttons with a gamepad
  • adds support for the left-joystick to send (Forward/Back/Strafe Left/Strafe Right) when moving the joystick in those directions (this was an attempt to help mods that rely on those keys for some functionality and allows the joystick to satisfy them)
  • Allows the gamepad to be enabled/disabled via scripting (useful for turning off the gamepad inside an MCM menu for hotkey mapping keyboard/mouse keys)
  • Adds ability to get raw left and right joystick position from the gamepad via scripting
  • Adds ability to get left and right joystick direction from from the gamepad via scripting

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:
enum
{
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 ========================================================================================================

UPDATE: Apparently the simulated input function below also affect the mouse -- this is due to the fact that input simulation in SKSE is broken for anything other than the keyboard (so simulate left/right attack without BKGS -- the attack controls would have to be mapped to keyboard keys).

Again it's due to broken/unfinished/abandoned code in SKSE


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)

* This feature has been removed because it as interfering with some mods, I'm leaving it up to the author to write good scripts that work properly 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.


*  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.

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



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.

Please note that this feature has been disabled -- as it was causing, too, many issues with scripted hotkey mods
Example:
-- 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: http://www.netsolutions.dynu.com/DownloadID/1049
* If you want the latest bleeding-egde vesrgion:
http://www.netsolutions.dynu.com:81/websvn/tesv_skyrim/utilities/skse/tags/neoh4x0r-gpad/
* if you want to view the source in flat-directory:
http://www.netsolutions.dynu.com:81/websvn/tesv_skyrim/utilities/skse/branches/gamepad-work-plugin/
* if you want to view the source including svn log messages/get diffs/etc:
http://www.netsolutions.dynu.com:81/viewvc/skse/branches/gamepad-work-plugin/

Change Log =============================================================================================================
 
 v 1.7.3.14 - fix IsKeyHeld/IsKeyPressed for keyboard keys when using a gamepad
 v 1.7.3.13 -
          + removed ini options send_movement_keys & send_major_movement_keys_only (they were too buggy and cause input lag)
          + add ini options disable_joystick_movement_simulation & disable_joystick_automove
          + fixed input timings in xinput / sendinput
          + improved the code (add a little polish and error checking)
v 1.7.3.12 - updated fomod
v 1.7.3.10 / v 1.7.3.11 -
    + 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 1.7.3.9 -
    + 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 1.7.3.8 -
    + 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 1.7.3.7  - 
    + 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
        send_major_movement_keys_only
        enable_verbose_debug
v 1.7.3.6  - 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 1.7.3.5  - fixed an issue with controller scripts functions not being thread-safe (also added scaleform versions of them)
v 1.7.3.4  -
   + cleaned up code
   + addeded ability to read left/right stick controller position as well as direction  
v 1.7.3.3  -  Implemented all remaining input functions (all keys can, now, be correctly detected using Input.IsKeyPressed) and added config support
v 1.7.3.2  -  Improved general support and code cleanup ... fully support TapKey/HoldKey/ReleaseKey to mods regirested for OnKeyUp/OnKeyDown events
v 1.7.3.1  -  Initial Release (requires SKSE 1.7.3)


Credits  =============================================================================================================
I'd like to thank the following people:
Bethesda Softworks: for creating Skyrim
SKSE dev team: for making skse (and working wih me to make this happen)
bla08, Tastou, timebomb - for provding feedback prior to release
dunc001 and Curalmil - for pointing out that it also fixes mouse input simulation (where the controlmap.txt file would have to modified without it)