8BitDo Lite SE: Remap for Xbox / Playstation Titan 2 use

GPC2 script programming for Titan Two. Code examples, questions, requests.

8BitDo Lite SE: Remap for Xbox / Playstation Titan 2 use

Postby SpecialEffect » Tue Aug 02, 2022 1:38 pm

This very lightweight gamepad can be used with Playstation / Xbox if set to "D", and plugged into the front left of a Titan Two).

The code has scope to increase the sensitivity of the sticks, and also to work better with an Xbox Adaptive Controller.

Code: Select all
#pragma METAINFO("8BitDo Lite SE (XBOX/PS) sensitive", 1, 0, "SpecialEffect.org.uk")
#include <switch.gph>         // Nintendo Switch terms headerfile
#include <xb1.gph>             // XB1 terms
#include <remapper.gph>
#define REMAP_CUSTOM        // Set remapping options: REMAP_CUSTOM - adjust the remapping array in the REMAPPING section below.
#define DEADZONE 5.0
#define SENSITIVITY 1.5     // Adjust this figure upwards to increase sensitivity
 
// REMAP INPUT-A 8BitDo Lite SE
const uint8 RemappingCustom[43] = {
    RMP_USB_A,
    BUTTON_1BUTTON_9BUTTON_6BUTTON_4BUTTON_5BUTTON_3BUTTON_17,
    BUTTON_8BUTTON_2BUTTON_10, BUTTON_11, BUTTON_12, BUTTON_13, BUTTON_14,
    BUTTON_7, BUTTON_16, BUTTON_15, BUTTON_18, BUTTON_19, BUTTON_20, BUTTON_21,
    STICK_1_X, STICK_1_Y, STICK_2_X, STICK_2_Y,
    POINT_1_X, POINT_1_Y, POINT_2_X, POINT_2_Y,
    ACCEL_1_X, ACCEL_1_Y, ACCEL_1_Z, ACCEL_2_X, ACCEL_2_Y, ACCEL_2_Z,
    GYRO_1_XGYRO_1_YGYRO_1_Z,
    PADDLE_1PADDLE_2PADDLE_3PADDLE_4
};
 
main {
 
if (get_actual(SWITCH_CAPTURE)) set_val(SWITCH_CAPTURE, 0.0); // XAC ISSUE - REMOVE IF NOT USING A XAC
set_val(PADDLE_4, 0.0);set_val(POINT_1_X, 0.0); // BLOCK THESE as passed through via 8BitDo controller
 
// STICK SENSITIVITY
 
set_val(STICK_2_X, clamp(get_val(STICK_2_X) * SENSITIVITY, -100.0, 100.0));
set_val(STICK_2_Y, clamp(get_val(STICK_2_Y) * SENSITIVITY, -100.0, 100.0));
 
set_val(STICK_1_X, clamp(get_val(STICK_1_X) * SENSITIVITY, -100.0, 100.0));
set_val(STICK_1_Y, clamp(get_val(STICK_1_Y) * SENSITIVITY, -100.0, 100.0));
 
    // DEADZONE LX and LY
    if(get_actual(STICK_2_X) > -DEADZONE) {if(get_actual(STICK_2_X) < DEADZONE) {set_val(STICK_2_X,0.0);}}
    if(get_actual(STICK_2_Y) > -DEADZONE) {if(get_actual(STICK_2_Y) < DEADZONE) {set_val(STICK_2_Y,0.0);}}
 
    // DEADZONE RX and RY
    if(get_actual(STICK_1_X) > -DEADZONE) {if(get_actual(STICK_1_X) < DEADZONE) {set_val(STICK_1_X,0.0);}}
    if(get_actual(STICK_1_Y) > -DEADZONE) {if(get_actual(STICK_1_Y) < DEADZONE) {set_val(STICK_1_Y,0.0);}}
 
 
 
// 8BitDo Lite SE (INPUT-A) further treatment to get controls correct - probably an easier way to do this but I couldn't find it.
 
if (get_actual(BUTTON_8) && (get_port(BUTTON_16) == PORT_USB_A)) { set_val(SWITCH_L, 100.0);set_val(BUTTON_8, 0.0); }
if (get_actual(BUTTON_5) && (get_port(BUTTON_5) == PORT_USB_A)) { set_val(SWITCH_R, 100.0);set_val(BUTTON_5, 0.0); }
 
if (get_actual(BUTTON_9) && (get_port(BUTTON_9) == PORT_USB_A)) { set_val(SWITCH_ZL, 100.0);set_val(BUTTON_9, 0.0); }
if (get_actual(BUTTON_6) && (get_port(BUTTON_6) == PORT_USB_A)) { set_val(SWITCH_ZR, 100.0);set_val(BUTTON_6, 0.0); }
 
if (get_actual(BUTTON_18) && (get_port(BUTTON_18) == PORT_USB_A)) { set_val(SWITCH_LS, 100.0);set_val(BUTTON_18, 0.0); }
if (get_actual(BUTTON_19) && (get_port(BUTTON_19) == PORT_USB_A)) { set_val(SWITCH_RS, 100.0);set_val(BUTTON_19, 0.0); }
 
/*
// XAC (Xbox gamepad) remapping - okay for basic use (needs more logic to filter and pass through various legitimate controls)
 
if (get_actual(XB1_A) && (get_port(XB1_A) == PORT_USB_B)) { set_val(XB1_B, 100.0);set_val(XB1_A, 0.0); }
if (get_actual(XB1_B) && (get_port(XB1_B) == PORT_USB_B)) { set_val(XB1_A, 100.0);set_val(XB1_B, 0.0); }
if (get_actual(XB1_A) && (get_port(XB1_A) == PORT_USB_B)) {if (get_actual(XB1_B) && (get_port(XB1_B) == PORT_USB_B)) { set_val(XB1_A, 100.0); set_val(XB1_B, 100.0); }}
 
if (get_actual(XB1_X) && (get_port(XB1_X) == PORT_USB_B)) { set_val(XB1_Y, 100.0);set_val(XB1_X, 0.0); }
if (get_actual(XB1_Y) && (get_port(XB1_Y) == PORT_USB_B)) { set_val(XB1_X, 100.0);set_val(XB1_Y, 0.0); }
if (get_actual(XB1_X) && (get_port(XB1_X) == PORT_USB_B)) {if (get_actual(XB1_Y) && (get_port(XB1_Y) == PORT_USB_B)) { set_val(XB1_X, 100.0); set_val(XB1_Y, 100.0); }}
 
if (get_actual(SWITCH_ZL) && (get_port(SWITCH_ZL) == PORT_USB_B)) {set_val(SWITCH_ZL, 100.0);set_val(SWITCH_L, 0.0); }
*/

 
 
}
 
init {
#ifdef REMAP_CUSTOM
remapper(RemappingCustom);
printf("Remapping INPUT-A 8BitDo Lite SE controller");
#endif   
}
 
/*
#define SWITCH_HOME     BUTTON_1
#define SWITCH_MINUS    BUTTON_2
#define SWITCH_PLUS     BUTTON_3
#define SWITCH_R        BUTTON_4
#define SWITCH_ZR       BUTTON_5
#define SWITCH_RS       BUTTON_6
#define SWITCH_L        BUTTON_7
#define SWITCH_ZL       BUTTON_8
#define SWITCH_LS       BUTTON_9
#define SWITCH_UP       BUTTON_10
#define SWITCH_DOWN     BUTTON_11
#define SWITCH_LEFT     BUTTON_12
#define SWITCH_RIGHT    BUTTON_13
#define SWITCH_X        BUTTON_14
#define SWITCH_A        BUTTON_15
#define SWITCH_B        BUTTON_16
#define SWITCH_Y        BUTTON_17
#define SWITCH_CAPTURE  BUTTON_18
#define SWITCH_SL       BUTTON_19
#define SWITCH_SR       BUTTON_20
 
#define SWITCH_RX       STICK_1_X
#define SWITCH_RY       STICK_1_Y
#define SWITCH_LX       STICK_2_X
#define SWITCH_LY       STICK_2_Y
 
#define SWITCH_ACCX     ACCEL_1_X
#define SWITCH_ACCY     ACCEL_1_Y
#define SWITCH_ACCZ     ACCEL_1_Z
 
#define SWITCH_GYROX    GYRO_1_X
#define SWITCH_GYROY    GYRO_1_Y
#define SWITCH_GYROZ    GYRO_1_Z
*/
Last edited by SpecialEffect on Tue Aug 02, 2022 2:52 pm, edited 1 time in total.
User avatar
SpecialEffect
Sergeant Major of the Army
Sergeant Major of the Army
 
Posts: 197
Joined: Mon Apr 07, 2014 3:26 pm

Re: 8BitDo Lite SE: Remapping to use with Xbox / Playstation

Postby SpecialEffect » Tue Aug 02, 2022 1:40 pm

This version is aimed at Nintendo Switch use for editing into something more useful. It has a sensitivity boost already and the ability to use alongside an Xbox Adaptive Controller.

Code: Select all
#pragma METAINFO("8BitDo Lite SE (SWITCH) sensitive", 1, 0, "SpecialEffect.org.uk")
#include <switch.gph>         // Nintendo Switch terms headerfile
#include <xb1.gph>             // XB1 terms
#include <remapper.gph>
#define REMAP_CUSTOM        // Set remapping options: REMAP_CUSTOM - adjust the remapping array in the REMAPPING section below.
#define DEADZONE 5.0
#define SENSITIVITY 1.0     // Adjust this figure from 1.0 upwards to increase sensitivity
 
// REMAP INPUT-A 8BitDo Lite SE
const uint8 RemappingCustom[43] = {
    RMP_USB_A,
    BUTTON_1BUTTON_9BUTTON_6BUTTON_4BUTTON_5BUTTON_3BUTTON_17,
    BUTTON_8BUTTON_2BUTTON_10, BUTTON_11, BUTTON_12, BUTTON_13, BUTTON_14,
    BUTTON_7, BUTTON_16, BUTTON_15, BUTTON_18, BUTTON_19, BUTTON_20, BUTTON_21,
    STICK_1_X, STICK_1_Y, STICK_2_X, STICK_2_Y,
    POINT_1_X, POINT_1_Y, POINT_2_X, POINT_2_Y,
    ACCEL_1_X, ACCEL_1_Y, ACCEL_1_Z, ACCEL_2_X, ACCEL_2_Y, ACCEL_2_Z,
    GYRO_1_XGYRO_1_YGYRO_1_Z,
    PADDLE_1PADDLE_2PADDLE_3PADDLE_4
};
 
main {
 
if (get_actual(SWITCH_CAPTURE)) set_val(SWITCH_CAPTURE, 0.0); // XAC ISSUE - REMOVE IF NOT USING A XAC
 
 
// STICK SENSITIVITY
 
set_val(STICK_2_X, clamp(get_val(STICK_2_X) * SENSITIVITY, -100.0, 100.0));
set_val(STICK_2_Y, clamp(get_val(STICK_2_Y) * SENSITIVITY, -100.0, 100.0));
 
set_val(STICK_1_X, clamp(get_val(STICK_1_X) * SENSITIVITY, -100.0, 100.0));
set_val(STICK_1_Y, clamp(get_val(STICK_1_Y) * SENSITIVITY, -100.0, 100.0));
 
    // DEADZONE LX and LY
    if(get_actual(STICK_2_X) > -DEADZONE) {if(get_actual(STICK_2_X) < DEADZONE) {set_val(STICK_2_X,0.0);}}
    if(get_actual(STICK_2_Y) > -DEADZONE) {if(get_actual(STICK_2_Y) < DEADZONE) {set_val(STICK_2_Y,0.0);}}
 
    // DEADZONE RX and RY
    if(get_actual(STICK_1_X) > -DEADZONE) {if(get_actual(STICK_1_X) < DEADZONE) {set_val(STICK_1_X,0.0);}}
    if(get_actual(STICK_1_Y) > -DEADZONE) {if(get_actual(STICK_1_Y) < DEADZONE) {set_val(STICK_1_Y,0.0);}}
 
 
 
// 8BitDo Lite SE (INPUT-A) further treatment to get controls correct - probably an easier way to do this but I couldn't find it.
 
if (get_actual(BUTTON_8) && (get_port(BUTTON_16) == PORT_USB_A)) { set_val(SWITCH_L, 100.0);set_val(BUTTON_8, 0.0); }
if (get_actual(BUTTON_5) && (get_port(BUTTON_5) == PORT_USB_A)) { set_val(SWITCH_R, 100.0);set_val(BUTTON_5, 0.0); }
 
if (get_actual(BUTTON_9) && (get_port(BUTTON_9) == PORT_USB_A)) { set_val(SWITCH_ZL, 100.0);set_val(BUTTON_9, 0.0); }
if (get_actual(BUTTON_6) && (get_port(BUTTON_6) == PORT_USB_A)) { set_val(SWITCH_ZR, 100.0);set_val(BUTTON_6, 0.0); }
 
if (get_actual(BUTTON_18) && (get_port(BUTTON_18) == PORT_USB_A)) { set_val(SWITCH_LS, 100.0);set_val(BUTTON_18, 0.0); }
if (get_actual(BUTTON_19) && (get_port(BUTTON_19) == PORT_USB_A)) { set_val(SWITCH_RS, 100.0);set_val(BUTTON_19, 0.0); }
 
 
// XAC (Xbox gamepad) remapping - okay for basic use (needs more logic to filter and pass through various legitimate controls)
 
if (get_actual(XB1_A) && (get_port(XB1_A) == PORT_USB_B)) { set_val(XB1_B, 100.0);set_val(XB1_A, 0.0); }
if (get_actual(XB1_B) && (get_port(XB1_B) == PORT_USB_B)) { set_val(XB1_A, 100.0);set_val(XB1_B, 0.0); }
if (get_actual(XB1_A) && (get_port(XB1_A) == PORT_USB_B)) {if (get_actual(XB1_B) && (get_port(XB1_B) == PORT_USB_B)) { set_val(XB1_A, 100.0); set_val(XB1_B, 100.0); }}
 
if (get_actual(XB1_X) && (get_port(XB1_X) == PORT_USB_B)) { set_val(XB1_Y, 100.0);set_val(XB1_X, 0.0); }
if (get_actual(XB1_Y) && (get_port(XB1_Y) == PORT_USB_B)) { set_val(XB1_X, 100.0);set_val(XB1_Y, 0.0); }
if (get_actual(XB1_X) && (get_port(XB1_X) == PORT_USB_B)) {if (get_actual(XB1_Y) && (get_port(XB1_Y) == PORT_USB_B)) { set_val(XB1_X, 100.0); set_val(XB1_Y, 100.0); }}
 
if (get_actual(SWITCH_ZL) && (get_port(SWITCH_ZL) == PORT_USB_B)) {set_val(SWITCH_ZL, 100.0);set_val(SWITCH_L, 0.0); }
 
 
 
}
 
init {
#ifdef REMAP_CUSTOM
remapper(RemappingCustom);
printf("Remapping INPUT-A 8BitDo Lite SE controller");
#endif   
}
 
/*
#define SWITCH_HOME     BUTTON_1
#define SWITCH_MINUS    BUTTON_2
#define SWITCH_PLUS     BUTTON_3
#define SWITCH_R        BUTTON_4
#define SWITCH_ZR       BUTTON_5
#define SWITCH_RS       BUTTON_6
#define SWITCH_L        BUTTON_7
#define SWITCH_ZL       BUTTON_8
#define SWITCH_LS       BUTTON_9
#define SWITCH_UP       BUTTON_10
#define SWITCH_DOWN     BUTTON_11
#define SWITCH_LEFT     BUTTON_12
#define SWITCH_RIGHT    BUTTON_13
#define SWITCH_X        BUTTON_14
#define SWITCH_A        BUTTON_15
#define SWITCH_B        BUTTON_16
#define SWITCH_Y        BUTTON_17
#define SWITCH_CAPTURE  BUTTON_18
#define SWITCH_SL       BUTTON_19
#define SWITCH_SR       BUTTON_20
 
#define SWITCH_RX       STICK_1_X
#define SWITCH_RY       STICK_1_Y
#define SWITCH_LX       STICK_2_X
#define SWITCH_LY       STICK_2_Y
 
#define SWITCH_ACCX     ACCEL_1_X
#define SWITCH_ACCY     ACCEL_1_Y
#define SWITCH_ACCZ     ACCEL_1_Z
 
#define SWITCH_GYROX    GYRO_1_X
#define SWITCH_GYROY    GYRO_1_Y
#define SWITCH_GYROZ    GYRO_1_Z
*/
User avatar
SpecialEffect
Sergeant Major of the Army
Sergeant Major of the Army
 
Posts: 197
Joined: Mon Apr 07, 2014 3:26 pm


Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 25 guests