0 of 0

File information

Last updated

Original upload

Created by

Jack Humbert

Uploaded by

jackhumbert

Virus scan

Safe to use

About this mod

Allows for joysticks and other gamepads to be used and configured via redscript in Cyberpunk 2077.

Requirements
Permissions and credits
Mirrors
Changelogs
Example redscript configuration for the Xbox One controller (included in the mod):

// This replicates the regular Xbox One game controller setup
public class CustomGameController_045E_02EA extends ICustomGameController {
  public func OnSetup() -> Void {
    this.SetButton(1  - 1, EInputKey.IK_Pad_A_CROSS);
    this.SetButton(2  - 1, EInputKey.IK_Pad_B_CIRCLE);
    this.SetButton(3  - 1, EInputKey.IK_Pad_X_SQUARE);
    this.SetButton(4  - 1, EInputKey.IK_Pad_Y_TRIANGLE);
    this.SetButton(5  - 1, EInputKey.IK_Pad_LeftShoulder);
    this.SetButton(6  - 1, EInputKey.IK_Pad_RightShoulder);
    this.SetButton(7  - 1, EInputKey.IK_Pad_Back_Select);
    this.SetButton(8  - 1, EInputKey.IK_Pad_Start);
    this.SetButton(9  - 1, EInputKey.IK_Pad_LeftThumb);
    this.SetButton(10 - 1, EInputKey.IK_Pad_RightThumb);
    this.SetButton(11 - 1, EInputKey.IK_Pad_DigitUp);
    this.SetButton(12 - 1, EInputKey.IK_Pad_DigitRight);
    this.SetButton(13 - 1, EInputKey.IK_Pad_DigitDown);
    this.SetButton(14 - 1, EInputKey.IK_Pad_DigitLeft);

    this.SetAxis(1 - 1, EInputKey.IK_Pad_LeftAxisY,    false, 0.5, 0.05);
    this.SetAxis(2 - 1, EInputKey.IK_Pad_LeftAxisX,    false, 0.5, 0.05);
    this.SetAxis(3 - 1, EInputKey.IK_Pad_RightAxisY,   false, 0.5, 0.05);
    this.SetAxis(4 - 1, EInputKey.IK_Pad_RightAxisX,   false, 0.5, 0.05);
    this.SetAxis(5 - 1, EInputKey.IK_Pad_LeftTrigger,  false, 0.0, 0.05);
    this.SetAxis(6 - 1, EInputKey.IK_Pad_RightTrigger, false, 0.0, 0.05);
  }

  public func OnUpdate() -> Void {
  }
}

All options are described here:
public abstract native class ICustomGameController extends IScriptable {
  public native let pid: Uint16;
  public native let vid: Uint16;
  public native let id: Int32;
  public native let buttons: array<Bool>;
  // This is the enum used by `switches` interally:
  //   Center    = 0
  //   Up        = 1
  //   UpRight   = 2
  //   Right     = 3
  //   DownRight = 4
  //   Down      = 5
  //   DownLeft  = 6
  //   Left      = 7
  //   UpLeft    = 8
  public native let switches: array<Uint32>;
  public native let axes: array<Float>;
 
  public native let buttonKeys: array<EInputKey>;
  public native let axisKeys: array<EInputKey>;
  public native let axisInversions: array<Bool>;
  public native let axisCenters: array<Float>;
  public native let axisDeadzones: array<Float>;

  // Maps a controller button to a key
  //   button: 0-indexed
  //   key: https://nativedb.red4ext.com/EInputKey
  public native func SetButton(button: Int32, key: EInputKey);

  // Maps a controller axis to a key
  //   axis: 0-indexed
  //   key: https://nativedb.red4ext.com/EInputKey
  //   inverted: whether or not the axis should be inverted
  //   center: value between 0.0-1.0 that acts as the natural position of the axis
  //   deadzone: value between 0.0-1.0 that acts as a threshold for movement
  public native func SetAxis(axis: Int32, key: EInputKey, inverted: Bool, center: Float, deadzone: Float);

  // Called after the controller is created but not intialized (no values are read yet)
  // Use this to call SetButton & SetAxis
  public abstract func OnSetup() -> Void;

  // Called after new values are read, but before they're assigned
  public abstract func OnUpdate() -> Void;

  // Called when axis values are read from the controller, after center & deadzone correction
  //   index: 0-indexed axis index
  //   value: axis value to be compared & assigned if different
  public abstract func GetAxisValue(index: Uint32, value: Float) -> Float;
}