GPC SCRIPT LIBRARY

SixAxis remapper

If you would like to use the PS3/4's Sixaxis motion control feature in a PS3/4 game utilizing it, but prefer using a different control scheme or you are using a controller without any Motion control features (ie. Xbox):


This script remaps one of the Analog sticks, or Wii IR / PS4 Touchpad, to the Sixaxis Y & X axises, for use during motion control segments of a PS3 or PS4 game. Tested with "Bentley's Hackpack" and "LittleBigPlanet". Controls:
While holding Select:
- Start to enable/disable the remap
- L3/R3 to switch which stick is remapped
- HOME button (+ Wiimote) to use Wii IR
- PS button (+ DS4) to use Touchpad.
See the comments for all controls and features.
Version 2.01
Author CypherNova139
Published Date 2014-06-19 23:16:34
Latest Date 2016-12-01 11:03:17
Downloads 4937
Support Link Click Here
VOTE NOW

6

0
Contact Author
Scripts by Author
RELEASE NOTES
- New: Load/Save a custom profile, use a preset profile, and change all settings in-game!

- Added separate Y and X value for response sensitivity of the original axis vs. what Sixaxis values is sent to console.
- Added custom profile function (Select + L1 to load, Select + R1 to save custom profile)
- Added hold of ACCZ axis (holds at -25 - upside down, must be manually enabled in script)
- Added changing of which Sixaxis axises to remap on the fly (use Select + L2 to switch axises - this part of script also acts as the preset profiles)
- Added adjustment of sensitivity response from the original axis to the Sixaxis remaps (use Select + face buttons to adjust)
- Added support for Everybody's Gone To The Rapture (thanks to those who helped with this). Use profile #5 (Select + L2)
(PS4 Sixaxis remap support is not guaranteed due to current CM and PS4 limitations. Please stay tuned to the forums for more info)
Code:Select all
//  ____  _          _          _     
// / ___|(_)_  __   / \   __  _(_)___ 
// \___ \| \ \/ /  / _ \  \ \/ / / __|
//  ___) | |>  <  / ___ \  >  <| \__ \
// |____/|_/_/\_\/_/   \_\/_/\_\_|___/
                                   
//If you would like to use the PS3/4's Sixaxis feature in a game utilizing it, but prefer using a different control scheme, or you are using a controller without the Sixaxis / Motion control features....
// This script remaps one of the sticks / Wii IR / PS4 Touchpad to the Sixaxis Y & X axises.

//New: Modify and save your favorite customization settings while in-game! See controls below...

//Controls:
//
//Move selected axis (Default: Left stick) to use the Sixaxis feature in-game. 
//
//While holding Select:
// Start: Enable/disable the script, in case the game is at a point where both sticks are expected as normal.
// L1 : Load profile saved on the CronusMAX.
// R1 : Save current settings into a profile.
// L3/R3: Switch which stick to remap.
// L2 : Switch which Sixaxis axises are subject to the remap. See "Axis modes" note below. (A rumble indicates successful change, or in the case of default setting no rumble occurs)
// /\ : Increment sensitivity response of Sixaxis Y axis output compared to axis in use. (Max 50) 
//  X : Decrement sensitivity response of Sixaxis Y axis output compared to axis in use. 
// () : Increment sensitivity response of Sixaxis X axis output compared to axis in use. (Max 50)
// [] : Decrement sensitivity response of Sixaxis X axis output compared to axis in use. 
//(PS4) PS: Utilize the Touchpad instead of the sticks to use Sixaxis.
//(Wii) HOME: Utilize the Wii Remote IR sensing instead of the sticks to use Sixaxis.


// Notes:
// This script assumes a 2D movement plane that a normal thumbstick provides.
// A game expecting more 3D movement such as heavily using the Gyro may require adjusting the sensitivity and the axises to use with your game!
//
// Axis modes:
// 0 - Default
// 1 - ACCY ACCX (default)
// 2 - GYROY GYROX
// 3 - ACCY GYROX
// 4 - GYROY ACCX
// 5 - (Profile for EGTTR) - GYROY ACCX divY = 4 divX = 15 accZhold = 1
//
//TRACE values
//TRACE 1: 0 / 1 = Remap enabled (1) or disabled (0)
//TRACE 2: Current "Stickmode" from switching wihch sixaxis axises are remapped (Select + L2)
//TRACE 3: Profile was loaded (1) or saved (2).
//TRACE 5: Current division value of Y axis. (updates while holding Select)
//TRACE 6: Current division value of X axis. (updates while holding Select)

int StickY, StickX, SixY, SixX, invX, invY, divY, divX, stickmode, AccZhold, enable;

init {
    //Defaults:
    // Which stick would you prefer remapped at startup?
    StickY = PS3_LY
    StickX = PS3_LX
    // Which Sixaxis axises would you prefer to use?
    //ACC = position, GYRO = speed
    SixY = PS4_ACCY
    SixX = PS4_ACCX
    
    // Enable the Sixaxis remap at startup?
    enable = 1

    // Note: Sixaxis axis values are only to +/-25 instead of +/-100. To get better, slower axis response in-game, how should we divide the values presented in the remap?
    // A higher number means more response from the original axis is needed to use the Sixaxis feature.
    // 1 is division disabled - presents as original axis value. 2 is a bit fast, 3 seems to be the sweet spot for precise movement with less axis travel, 4 may require more travel along the original axis.
    //
    // Note: Y (up/down) and X (left/right) axises each have their own value, to accomodate games that are a bit more picky in their use of the Sixaxis.
    // 
    divY = 3
    divX = 3
    
    //By default, Hold the ACCZ axis in a specific position? (default: -25 upside-down state)
    AccZhold = 0

    // Default Inversion values.
    // Sixaxis X axis is inverted compared to the thumbsticks, this will get automatically fixed here.
    // If using a Wii Remote's IR, the inversion is not needed.
	defaultinvert()

    set_val(TRACE_1, enable);
}


main {

    // press - send to console
    if(event_release(PS3_SELECT) && get_ptime(PS3_SELECT) < 140) {
        combo_run(cpress);
    } 
    // hold - customize part of script
    if(get_val(PS3_SELECT) && get_ptime(PS3_SELECT) > 140) { 
        combo_run(customize);
    }
    // Completely block output to console from the controller. If button was pressed, then the press is recreated.
    if(get_val(PS3_SELECT)) {
        set_val(PS3_SELECT,0);
    }

// ----

    //LY (left stick up/down)
    if(enable == 1) {
        set_val(SixY, get_val(StickY) / divY * invY);
        set_val(StickY, 0);
    }
    //LX (left stick left/right)
    if(enable == 1) {
        set_val(SixX, get_val(StickX) / divX * invX); 
        set_val(StickX, 0);
    }

	if(AccZhold == 1) {
	//(note: -25 == upside down controller)
		set_val(PS4_ACCZ, -25);
	}
}


combo customize {
    set_val(TRACE_5, divY);
    set_val(TRACE_6, divX);
    if(event_press(PS3_START)) {
        if(enable == 1) {
            enable = 0;
            set_val(TRACE_1, 0);
        } else {
            enable = 1;
            set_val(TRACE_1, 1);
        }
    }
//  Use left stick
    if(event_press(PS3_L3)) {
        StickY = PS3_LY
        StickX = PS3_LX
        invX = -1
        invY = 1
    }
//  Use right stick
    if(event_press(PS3_R3)) {
        StickY = PS3_RY
        StickX = PS3_RX
        invX = -1
        invY = 1
    }
       // divY in
    if(event_press(PS3_TRIANGLE)) {
       divY = divY + 1
       if(divY > 50) {divY = 1}
    }
      // divY dec
    if(event_press(PS3_CROSS)) {
       divY = divY - 1
       if(divY < 1) {divY = 1}
    }
      // divX in
    if(event_press(PS3_CIRCLE)) {
       divX = divX + 1
       if(divY > 50) {divY = 1}
    }
     // divX dec
    if(event_press(PS3_SQUARE)) {
       divX = divX - 1
       if(divX < 1) {divX = 1}
    }
    // Load/save
    if(event_press(PS3_L1)) {
      loadprofile()
    }
    if(event_press(PS3_R1)) {
      saveprofile()
    }
    // Trigger swap setup
    if(event_press(PS3_L2)) {
        stickmode = stickmode + 1;
        if(stickmode == 6) {stickmode = 0}
        combo_run(stickswap);
        set_val(TRACE_2, stickmode);
        if(stickmode !=0) {
            combo_run(Rumble1);
        }
    }
    
//Use Wii IR
    if(event_press(PS3_PS) && get_controller() == PIO_WII) {
        StickY = WII_IRY
        StickX = WII_IRX
        invX = 1
        invY = 1
    }

//Use PS4 touchpad
    if(event_press(PS4_PS) && get_controller() == PIO_PS4) {
        StickY = PS4_TOUCHY
        StickX = PS4_TOUCHX
        invX = -1
        invY = 1
        set_val(TRACE_3, get_val(TRACE_3) + 4);
    }
    set_val(PS3_START, 0);
    set_val(PS3_L3, 0);
    set_val(PS3_R3, 0);
    set_val(PS3_PS, 0);
    set_val(PS3_TRIANGLE, 0);
    set_val(PS3_CIRCLE, 0);
    set_val(PS3_CROSS, 0);
    set_val(PS3_SQUARE, 0);
    set_val(PS3_L1, 0);
    set_val(PS3_L2, 0);
    set_val(PS3_R1, 0);
} 

combo cpress {
    set_val(PS3_SELECT, 100);
    wait(get_ptime(PS3_SELECT));
    set_val(PS3_SELECT, 0);
}
combo Rumble1 { 
    // 1 short rumble
    set_rumble(RUMBLE_B, 100);
    wait(200);
    set_rumble(RUMBLE_B, 0);
}
combo stickswap {
    if(stickmode == 0) {
    //Default
        SixY = PS4_ACCY
    	SixX = PS4_ACCX
    	divY = 3
    	divX = 3
    	AccZhold = 0
    	defaultinvert()
    }
    if(stickmode == 1) {
    //acc
        SixY = PS4_ACCY
    	SixX = PS4_ACCX
    }
    if(stickmode == 2) {
    //Gyro
        SixY = PS4_GYROY
    	SixX = PS4_GYROX
    }
    if(stickmode == 3) {
    //Y acc X gyro
        SixY = PS4_ACCY
    	SixX = PS4_GYROX
    }
    if(stickmode == 4) {
    //Y gyro X acc
        SixY = PS4_GYROY
    	SixX = PS4_ACCX
    }
    if(stickmode == 5) {
    //Game specific - EGTTR
        SixY = PS4_GYROY
    	SixX = PS4_ACCX
    	divY = 4
    	divX = 15
    	AccZhold = 1
    }
}
function loadprofile() {
            combo_run(Rumble1);
            StickY = get_pvar(SPVAR_1, 0, 200, 0);
            StickX = get_pvar(SPVAR_2, 0, 200, 0);
            SixY = get_pvar(SPVAR_3, 0, 200, 0);
            SixX = get_pvar(SPVAR_4, 0, 200, 0);
            divY = get_pvar(SPVAR_5, 0, 200, 0);
            divX = get_pvar(SPVAR_6, 0, 200, 0);
            enable = get_pvar(SPVAR_9, 0, 2, 0);
            AccZhold = get_pvar(SPVAR_10, 0, 2, 0);
            set_val(TRACE_2, 100);
            set_val(TRACE_3, 1);
            set_val(TRACE_4, StickX);
}
function saveprofile() {
            combo_run(Rumble1);
            set_pvar(SPVAR_1, StickY);
            set_pvar(SPVAR_2, StickX);
            set_pvar(SPVAR_3, SixY);
            set_pvar(SPVAR_4, SixX);
            set_pvar(SPVAR_5, divY);
            set_pvar(SPVAR_6, divX);
            set_pvar(SPVAR_9, enable);
            set_pvar(SPVAR_10, AccZhold);
            set_val(TRACE_3, 2);
}
function defaultinvert() {
    invX = -1
    invY = 1
}

Pin It on Pinterest

Share This