xScal Scaleform API 0.4.34

Input: gamepad

XInput digital button masks (1 to 65535) and an optional controller index (0 to 3, default 0). Combine buttons with bitwise OR. Extra held buttons do not stop a registered chord from matching.

ButtonValue
D-pad Up / Down / Left / Right0x0001 / 0x0002 / 0x0004 / 0x0008
Start / Back0x0010 / 0x0020
L3 / R30x0040 / 0x0080
LB / RB0x0100 / 0x0200
A / B / X / Y0x1000 / 0x2000 / 0x4000 / 0x8000

Controllers XInput does not report are read from HID over USB or Bluetooth and returned with XInput button values. A HID gamepad takes the first controller index XInput leaves empty, in connection order. When Steam Input also presents the controller as an Xbox pad, it appears at two indices.

PlayStation pads (DualSense, DualSense Edge, DualShock 4): Cross is A, Circle is B, Square is X, Triangle is Y, L1/R1 are the shoulders, Create/Share is Back, Options is Start. PS, touchpad and mute are not reported. Other HID pads: buttons 1 to 12 are X, A, B, Y, LB, RB, LT, RT, Back, Start, LS, RS; the hat switch is the D-pad.

Suppression filters Fallout 76's XInput calls only. Fallout 76 reads a USB DualShock 4 and a Bluetooth DualSense through its own PlayStation code, so suppression has no effect on those. A Bluetooth DualShock 4 is passed to the game through XInput and is suppressed like an Xbox pad. If xScal could not hook Fallout's XInput import, every suppression call returns false and the game's input is unchanged.

Input.RegisterGamepadButtons

Register a button mask for polling

__SFCodeObj.call("Input.RegisterGamepadButtons", buttons:uint, controller:uint = 0):Boolean

Arguments

NameTypeDescription
buttonsuintXInput button mask. 1 to 65535; see the button table.
controlleruintOptional. Default 0. XInput controller index, 0 to 3.

Returns Boolean

Registering the same mask again returns true.

Example

var l3AndR3:uint = 0x0040 | 0x0080; // 0x00C0
__SFCodeObj.call("Input.RegisterGamepadButtons", l3AndR3, 0);
if (__SFCodeObj.call("Input.AreGamepadButtonsPressed", l3AndR3, 0)) {
    // L3 and R3 are both held.
}

Input.AreGamepadButtonsPressed

Are all buttons of a registered mask held

__SFCodeObj.call("Input.AreGamepadButtonsPressed", buttons:uint, controller:uint = 0):Boolean

Arguments

NameTypeDescription
buttonsuintXInput button mask. 1 to 65535; see the button table.
controlleruintOptional. Default 0. XInput controller index, 0 to 3.

Returns Boolean

true only while every button in the registered mask is held and Fallout 76 is the foreground process. Reads the physical state, before suppression.

Input.UnregisterGamepadButtons

Unregister one mask for one controller

__SFCodeObj.call("Input.UnregisterGamepadButtons", buttons:uint, controller:uint = 0):Boolean

Arguments

NameTypeDescription
buttonsuintXInput button mask. 1 to 65535; see the button table.
controlleruintOptional. Default 0. XInput controller index, 0 to 3.

Returns Boolean

Returns false if the mask was not registered.

Input.ClearGamepadButtons

Unregister every mask on all four controllers

__SFCodeObj.call("Input.ClearGamepadButtons"):Boolean

No arguments.

Returns Boolean

Always true.

Input.PollGamepad

Read buttons, triggers and sticks of one controller

__SFCodeObj.call("Input.PollGamepad", controller:uint = 0):String

Arguments

NameTypeDescription
controlleruintOptional. Default 0. XInput controller index, 0 to 3.

Returns String (JSON)

FieldTypeDescription
connectedBoolean
ltintLeft trigger. 0 to 255.
rtintRight trigger. 0 to 255.
lxintLeft stick X. -32768 to 32767.
lyintLeft stick Y. -32768 to 32767.
rxintRight stick X. -32768 to 32767.
ryintRight stick Y. -32768 to 32767.
buttonsintXInput button mask. 0 to 65535.

Sample result

{"connected":true,"lt":0,"rt":255,"lx":-1200,"ly":30000,"rx":0,"ry":0,"buttons":4096}

Physical state in the XInput layout, read before suppression. Returns connected:false with zero values while Fallout 76 is not the foreground process, when no controller is at that index, or when the index is out of range.

Input.SuppressGamepadButtons

Hide buttons from Fallout 76

__SFCodeObj.call("Input.SuppressGamepadButtons", buttons:uint, controller:uint = 0):Boolean

Arguments

NameTypeDescription
buttonsuintXInput button mask. 1 to 65535; see the button table.
controlleruintOptional. Default 0. XInput controller index, 0 to 3.

Returns Boolean

Hides the mask from Fallout 76's XInput reads. xScal polling still sees the real buttons. Enable it when a custom window opens and remove it on every close path.

Example

var navigation:uint = 0x0001 | 0x0002; // D-pad Up and Down
__SFCodeObj.call("Input.SuppressGamepadButtons", navigation, 0);
// ...
__SFCodeObj.call("Input.UnsuppressGamepadButtons", navigation, 0);

Input.UnsuppressGamepadButtons

Stop hiding buttons

__SFCodeObj.call("Input.UnsuppressGamepadButtons", buttons:uint, controller:uint = 0):Boolean

Arguments

NameTypeDescription
buttonsuintXInput button mask. 1 to 65535; see the button table.
controlleruintOptional. Default 0. XInput controller index, 0 to 3.

Returns Boolean

Buttons of the mask that are still held stay hidden from the game until they are released, so closing a custom window does not open a game menu.

Input.SuppressGamepadAnalog

Zero triggers and sticks for Fallout 76

__SFCodeObj.call("Input.SuppressGamepadAnalog", controller:uint = 0):Boolean

Arguments

NameTypeDescription
controlleruintOptional. Default 0. XInput controller index, 0 to 3.

Returns Boolean

Fallout 76 reads zero triggers and centered sticks from that controller. Buttons are suppressed separately. Input.PollGamepad still returns the real values. Returns false for an index over 3 or when the XInput hook is not installed.

Input.UnsuppressGamepadAnalog

Pass triggers and sticks to Fallout 76 again

__SFCodeObj.call("Input.UnsuppressGamepadAnalog", controller:uint = 0):Boolean

Arguments

NameTypeDescription
controlleruintOptional. Default 0. XInput controller index, 0 to 3.

Returns Boolean

Input.ClearGamepadSuppressions

End every button and analog suppression

__SFCodeObj.call("Input.ClearGamepadSuppressions"):Boolean

No arguments.

Returns Boolean

For teardown and error paths. Held buttons stay hidden until released, as with Input.UnsuppressGamepadButtons. Returns false when the XInput hook is not installed.