Accessibility: Very Sensitive Playstation Joypad - 4 Selectable Modes

Easy to tweak sensitivity settings at the top of the script. Method to block the menu button and also start/select/back. Features custom modes (hold L1 and move left stick to select): left-stick, d-pad, right-stick and six-axis all on one stick.
Version1.00
AuthorSpecialEffect
Publish DateTue, 25 Oct 2016 - 17:09
Last UpdateTue, 25 Oct 2016 - 17:09
Downloads69
RATE


0

0

Release Notes: Via OneSwitch.org.uk
Code: Select all
// PLAYSTATION MOST SENSITIVE
// L1+ LEFT=L-STICK  UP=D-PAD   RIGHT=R-STICK   DOWN=SIX-AXIS (SEE BOTTOM OF SCRIPT FOR MORE HELP)
 
//     _                         _ _     _ _ _ _           ____            _       _       
//    / \   ___ ___ ___  ___ ___(_) |__ (_) (_) |_ _   _  / ___|  ___ _ __(_)_ __ | |_ ___
//   / _ \ / __/ __/ _ \/ __/ __| | '_ \| | | | __| | | | \___ \ / __| '__| | '_ \| __/ __|
//  / ___ \ (_| (_|  __/\__ \__ \ | |_) | | | | |_| |_| |  ___) | (__| |  | | |_) | |_\__ \
// /_/   \_\___\___\___||___/___/_|_.__/|_|_|_|\__|\__, | |____/ \___|_|  |_| .__/ \__|___/

//                                                 |___/                    |_|           
 
 
//  October 2016
//  Please consider supporting www.SpecialEffect.org.uk
//  Script based on set-up created by OneSwitch.org.uk with help from the ConsoleTuner community
 
 
// JOYSTICK SENSITIVITY ADJUSTMENT (FOR A VERY SENSITIVE THUMB-STICK, TRY SENSITIVITY = 327, MIDPOINT = 25, JOY_DEADZONE = 35 for Playstation controllers, or 150,70,40 for less accurate Xbox controllers)
define SENSITIVITY = 327; // SENSITIVITY (327 MAX - suitable for Playstation controllers).
define MID_POINT = 25; // INPUT MIDPOINT IS (set low for weaker input, 50 for default).
define TRIGGERS_SENS = 7; // 1 = NORMAL > 5 = VERY SENSITIVE
 
define JOY_DEADZONE = 35; // 20 (SMALLEST) -99 (LARGEST) TO ADJUST DEADZONE
define TWEAK = 20; // will add to JOY-DEADZONE - normally useful for one-stick steering
define JOY_BUTTONS_DEADZONE = 80; // JOYSTICK ACTING AS BUTTONS - NEEDS A BIGGER DEADZONE TO AVOID ACCIDENTAL PRESSES
define Z_DEADZONE = 1; // TRIGGERS
define LSTICK_MAX = 100; // ANALOGUE CONTROLS MAXIMUM OUPUT (0-100%)
define RSTICK_MAX = 100;
define TRIGGERS_MAX = 100;
 
 
// MODES
define CLEAR_LED = 9;
define LEFTSTICK = 0;
define DPAD = 1;
define RIGHTSTICK = 2;
define CUSTOM = 3;
 
define RESTRICTED = 1;          // 0 = OFF   1 = BLOCK MENU BUTTON
define EXTRA_RESTRICTIONS = 1// 0 = OFF   1 = BLOCK BACK/SELECT/SHARE/START/OPTIONS
 
int profile = CLEAR_LED;
int LZ;
int RZ;
 
 
 
main {
 
// INITIALISE
        if(profile == CLEAR_LED) {profile = LEFTSTICK; colorled(1,0,0,0);}
 
 
// OPTIONAL RESTRICTIONS
        if(RESTRICTED) {set_val(PS3_PS, 0);}
        if(EXTRA_RESTRICTIONS) {set_val(PS4_TOUCH,0); set_val(PS3_START,0); set_val(PS3_SELECT,0);}
 
// SET SENSITIVITY
deadzone(PS3_LX, PS3_LY, DZ_CIRCLE, 0); sensitivity (PS3_LX, MID_POINT, SENSITIVITY);sensitivity (PS3_LY, MID_POINT, SENSITIVITY);
deadzone(PS3_RX, PS3_RY, DZ_CIRCLE, 0); sensitivity (PS3_RX, MID_POINT, SENSITIVITY);sensitivity (PS3_RY, MID_POINT, SENSITIVITY);
 
// IF "L1" HELD...
 
    if(get_val(PS3_L1)) {
 
        if(event_press(PS3_UP)) load_slot(3); // CHANGE SLOT (L1+UP/DOWN)
        else if(event_press(PS3_DOWN)) load_slot(1);
 
        else if(get_val(PS3_LX) <= -JOY_BUTTONS_DEADZONE) { profile = LEFTSTICK; colorled(1,0,0,0); } // CHANGE SUB MODE VIA "L1" + STICK DIRECTION
        else if(get_val(PS3_LY) <= -JOY_BUTTONS_DEADZONE) { profile = DPAD; colorled(0,0,0,0); }
        else if(get_val (PS3_LX) >= JOY_BUTTONS_DEADZONE) { profile = RIGHTSTICK; colorled(0,1,0,0); }
        else if(get_val(PS3_LY) >= JOY_BUTTONS_DEADZONE) { profile = CUSTOM; colorled(2,2,2,2); }
 
        else if(get_val(PS3_L3) > 0) { set_val(PS4_TOUCH, 100); set_val(PS3_L3, 0); }
 
        set_val(TRACE_1, profile);
 
        set_val(PS3_UP, 0); set_val(PS3_DOWN, 0); // CLEAR CONTROLS
        set_val(PS3_L1, 0); set_val(PS3_R1, 0);
        set_val(PS3_LX, 0); set_val(PS3_LY, 0); set_val(PS3_RX, 0); set_val(PS3_RY, 0);
 
    } else if(event_release(PS3_L1) && get_ptime(PS3_L1) < 300) {combo_run(L1Tap);}
 
 
 
 
 
// LEFT-STICK MODE (BLUE)
 
        if(profile == LEFTSTICK) {
        if(get_val(PS3_UP) > 0) { set_val(PS3_L2, 100); set_val(PS3_UP, 0); } // REMAPPING
        if(get_val(PS3_RIGHT) > 0) { set_val(PS3_R1, 100); set_val(PS3_RIGHT, 0); }
        if(get_val(PS3_DOWN) > 0) { set_val(PS3_R2, 100); set_val(PS3_DOWN, 0); }
        if(get_val(PS3_LEFT) > 0) { set_val(PS3_L1, 100); set_val(PS3_LEFT, 0); }
//      if(get_val(PS3_L3) > 0) { set_val(PS3_CROSS, 100); set_val(PS3_L3, 0); }
 
 
        if(get_val(PS3_LX) <= JOY_DEADZONE && get_val(PS3_LX) >= JOY_DEADZONE*-1) set_val(PS3_LX,0); // DEAD-ZONE FILTER
        if(get_val(PS3_LY) <= JOY_DEADZONE && get_val(PS3_LY) >= JOY_DEADZONE*-1) set_val(PS3_LY,0);
        if(get_val(PS3_L2) <= Z_DEADZONE && get_val(PS3_L2) >= Z_DEADZONE*-1) set_val(PS3_L2,0);
 
        if(get_val(PS3_RX) <= JOY_DEADZONE && get_val(PS3_RX) >= JOY_DEADZONE*-1) set_val(PS3_RX,0); // DEAD-ZONE FILTER R-STICK
        if(get_val(PS3_RY) <= JOY_DEADZONE && get_val(PS3_RY) >= JOY_DEADZONE*-1) set_val(PS3_RY,0);
        if(get_val(PS3_R2) <= Z_DEADZONE && get_val(PS3_R2) >= Z_DEADZONE*-1) set_val(PS3_R2,0);
 
        if(get_val(PS3_LX) >= LSTICK_MAX) {set_val(PS3_LX, LSTICK_MAX);} // MAXIMUM STRENGTH LIMITER
        if(get_val(PS3_LX) <= -LSTICK_MAX) {set_val(PS3_LX, -LSTICK_MAX);}
        if(get_val(PS3_LY) >= LSTICK_MAX) {set_val(PS3_LY, LSTICK_MAX);}
        if(get_val(PS3_LY) <= -LSTICK_MAX) {set_val(PS3_LY, -LSTICK_MAX);}
 
 
        LZ = (get_val(PS3_L2)*TRIGGERS_SENS); // BOOST TRIGGERS SENSITIVITY
        if (LZ < 0 || LZ > TRIGGERS_MAX) LZ = TRIGGERS_MAX;
        set_val(PS3_L2, LZ);
 
        RZ = (get_val(PS3_R2)*TRIGGERS_SENS);
        if (RZ < 0 || RZ > TRIGGERS_MAX) RZ = TRIGGERS_MAX;
        set_val(PS3_R2, RZ);       
 
        }
 
 
 
// D-PAD MODE (BLACK)
 
        else if(profile == DPAD) {
        if(get_val(PS3_L3) > 0) { set_val(PS3_CROSS, 100); set_val(PS3_L3, 0); }
        if(abs(get_val(PS3_LY)) >= JOY_DEADZONE || abs(get_val(PS3_LX)) >= JOY_DEADZONE) {
            if(get_val(PS3_LY) <= -JOY_DEADZONE) set_val(PS3_UP, 100);
            else if(get_val(PS3_LY) >= JOY_DEADZONE) set_val(PS3_DOWN, 100);
            if(get_val(PS3_LX) <= -JOY_DEADZONE) set_val(PS3_LEFT, 100);
            else if(get_val(PS3_LX) >= JOY_DEADZONE) set_val(PS3_RIGHT, 100);
        }
 
        if(get_val(PS3_RX) <= JOY_DEADZONE && get_val(PS3_RX) >= JOY_DEADZONE*-1) set_val(PS3_RX,0); // DEAD-ZONE FILTER
        if(get_val(PS3_RY) <= JOY_DEADZONE && get_val(PS3_RY) >= JOY_DEADZONE*-1) set_val(PS3_RY,0);
 
 
        if(get_val(PS3_L2) >= TRIGGERS_MAX) {set_val(PS3_L2, TRIGGERS_MAX);} // LIMITER
        if(get_val(PS3_R2) <= Z_DEADZONE && get_val(PS3_R2) >= Z_DEADZONE*-1) set_val(PS3_R2,0);
        set_val(PS3_LX, 0); set_val(PS3_LY, 0);
        }
 
 
// RIGHT-STICK MODE (RED)
 
        else if(profile == RIGHTSTICK) {
        swap(PS3_LX, PS3_RX); swap(PS3_LY, PS3_RY); // REMAPPING
        if(get_val(PS3_UP) > 0) { set_val(PS3_L2, 100); set_val(PS3_UP, 0); }
        if(get_val(PS3_RIGHT) > 0) { set_val(PS3_R1, 100); set_val(PS3_RIGHT, 0); }
        if(get_val(PS3_DOWN) > 0) { set_val(PS3_R2, 100); set_val(PS3_DOWN, 0); }
        if(get_val(PS3_LEFT) > 0) { set_val(PS3_L1, 100); set_val(PS3_LEFT, 0); }
        if(get_val(PS3_L3) > 0) { set_val(PS3_R3, 100); set_val(PS3_L3, 0); }
 
        if(get_val(PS3_RX) <= JOY_DEADZONE && get_val(PS3_RX) >= JOY_DEADZONE*-1) set_val(PS3_RX,0); // DEAD-ZONE FILTER
        if(get_val(PS3_RY) <= JOY_DEADZONE && get_val(PS3_RY) >= JOY_DEADZONE*-1) set_val(PS3_RY,0);
        if(get_val(PS3_R2) <= Z_DEADZONE && get_val(PS3_R2) >= Z_DEADZONE*-1) set_val(PS3_R2,0);
 
        if(get_val(PS3_LX) <= JOY_DEADZONE && get_val(PS3_LX) >= JOY_DEADZONE*-1) set_val(PS3_LX,0); // DEAD-ZONE FILTER
        if(get_val(PS3_LY) <= JOY_DEADZONE && get_val(PS3_LY) >= JOY_DEADZONE*-1) set_val(PS3_LY,0);
 
        if(get_val(PS3_RX) >= RSTICK_MAX) {set_val(PS3_RX, RSTICK_MAX);} // MAXIMUM STRENGTH LIMITER
        if(get_val(PS3_RX) <= -RSTICK_MAX) {set_val(PS3_RX, -RSTICK_MAX);}
        if(get_val(PS3_RY) >= RSTICK_MAX) {set_val(PS3_RY, RSTICK_MAX);}
        if(get_val(PS3_RY) <= -RSTICK_MAX) {set_val(PS3_RY, -RSTICK_MAX);}
        if(get_val(PS3_L2) >= TRIGGERS_MAX) {set_val(PS3_L2, TRIGGERS_MAX);}
        }
 
 
// CUSTOM MODE (WHITE)
 
        else if(profile == CUSTOM) {
        if(get_val(PS3_UP) > 0) { set_val(PS3_L2, 100); set_val(PS3_UP, 0); } // REMAPPING
        if(get_val(PS3_RIGHT) > 0) { set_val(PS3_R1, 100); set_val(PS3_RIGHT, 0); }
        if(get_val(PS3_DOWN) > 0) { set_val(PS3_R2, 100); set_val(PS3_DOWN, 0); }
        if(get_val(PS3_LEFT) > 0) { set_val(PS3_L1, 100); set_val(PS3_LEFT, 0); }
        if(get_val(PS3_L3) > 0) { set_val(PS4_TOUCH, 100); set_val(PS3_L3, 0); }
 
        if(get_val(PS3_RX) <= JOY_DEADZONE && get_val(PS3_RX) >= JOY_DEADZONE*-1) set_val(PS3_RX,0); // DEAD-ZONE FILTER R-STICK
        if(get_val(PS3_RY) <= JOY_DEADZONE && get_val(PS3_RY) >= JOY_DEADZONE*-1) set_val(PS3_RY,0);
        if(get_val(PS3_R2) <= Z_DEADZONE && get_val(PS3_R2) >= Z_DEADZONE*-1) set_val(PS3_R2,0);
 
        if(get_val(PS3_LY) > 20) {set_val(PS3_ACCY, get_val(PS3_LY)/4); set_val(PS3_LY, 0);}
          else {set_val(PS3_ACCY, get_val(PS3_LY)/4); set_val(PS3_LY, 0);}
 
        if(get_val(PS3_LX) > 20) {set_val(PS4_ACCZ, -25);set_val(PS4_ACCX, get_val(PS3_LX)/4 * -1);set_val(PS4_GYROY, get_val(PS3_LX)/15 * -1);set_val(PS3_LX, 0);}
          else {set_val(PS4_ACCZ, -25); set_val(PS4_ACCX, get_val(PS3_LX)/4 * -1); set_val(PS4_GYROY, get_val(PS3_LX)/15 * -1); set_val(PS3_LX, 0);}
 
        if(get_val(PS3_L2) >= TRIGGERS_MAX) {set_val(PS3_L2, TRIGGERS_MAX);} // MAXIMUM STRENGTH LIMITER   
        }
}
 
 
combo L1Tap {set_val(PS3_L1, 100); wait(80);} // TAPPED "L1"
 
 
// COLOR LED INDICATION for PS4 *NO NEED TO EDIT BELOW*
//--------------------------------------------------------------
function colorled(a,b,c,d) {
set_led(LED_1,a);
set_led(LED_2,b);
set_led(LED_3,c);
set_led(LED_4,d);
}