GPC Library

Inversion

This handy script allows you to change to normal or inverted camera controls at any time, without having to use the game's options menus, allowing for quick changes of camera controls to your liking.

Also supported is the ability to remap
- L1/R1/Bumpers to L2/R2/Triggers
- Swap sticks, for those who prefer it.
- Swap Select/Start to Touchpad Left/Right.
Supports any controller!

I made this script as sometimes I don't 'get' the game's camera controls, depending on the type of camera view (1st/3rd person) I'm currently viewing....

Controls:
R3 : Switch between saved profiles on the fly.
While holding Select:
L1/L2/R1/R2: Select what axises to invert.
Triangle / Y: Switch trigger remap mode.
Square / X: Switch stick remap mode. (Axis inversions still operate when using a stick swap.)
Cross / A: Enable Select/Start to Touchpad Left/Right swap.
(See comments for all controls; Both sticks are supported.)
Version 2.41
Author CypherNova139
Publish Date 2014-08-27 00:45:30
Update Date 2017-12-18 05:27:48
Downloads 871
Forum Link Click Here
RATE


10

0

Release Notes: Added Select/ Start to Touchpad press on Left/Right swap, for non-DS4 controllers on certain PS4 games / PS2-on-PS4 games.

(2.41) Bug Fixes:
- Fixed incorrect implementation of Touchpad swap.
- Fixed saved profile not loading thumbstick swap if it was saved with a Touchpad->stick swap.
- Documentation readability / updates.
Code:Select all
//  ___                                      
// |_ _|_ ____   _____ _ __ ___ _  ___  _ __  
//  | || '_ \ \ / / _ \ '__/ __| |/ _ \| '_ \ 
//  | || | | \ V /  __/ |  \__ \ | (_) | | | |
// |___|_| |_|\_/ \___|_|  |___/_|\___/|_| |_|
//                             (_)
//v 2.4.1


// This handy script allows you to change to normal or inverted camera controls at any time, without having to use the game's options menus,
// allowing for quick changes of camera controls to your liking. Supports any controller!

// What is supported in this script is the ability to remap:
// - Reversing stick axis values (i.e. inverted)
// - L1/R1/Bumpers to L2/R2/Triggers
// - Swap sticks, for those who prefer it
// - Swap sticks to Touchpad
// - Swap Select/Start to Touchpad Left/Right.

// ... I made this script as sometimes I don't 'get' the game's camera controls, depending on the type of camera view (1st/3rd person) I'm currently viewing.
// Example: I'm playing a 3rd person game 'inverted', then I'm scoping in on a target - which is 'normal' controls to me when using 1st person.

// ----------------

// Supported controllers:
// PS3, PS4, XB360, XB1, Wii Remote + Nunchuk
// Supported controllers, but not tested:
// Wii Remote + Pro controller
// Wii U Pro controller
// Technically Unsupported:
// Wii Remote (There are no supported buttons to invert or remap on just a Wiimote).

// ----------------

//Controls:
// R3 (or 'triggerkey', defined below): Switch profiles on the fly. Useful if you are in the middle of a game.
// Select (hold): Options menu. LEDs will indicate what axises are inverted. (LED on = Inverted) Also see TRACE_1-4 below.
//LED 4 / L1 = LY  (left up/down)
//LED 3 / L2 = LX  (left left/right)
//LED 2 / R1 = RY  (right up/down)
//LED 1 / R2 = RX  (right left/right)
//While holding Select:
// L1,L2,R1,R2: Invert/normalize left or right stick axises. These changes are live and available for use immediately.
// L3:          Save Profile #1 to current settings. (A rumble will indicate success)
// R3:          Save Profile #2 to current settings. (A rumble will indicate success)
// Start:       View / Switch profile settings on the LEDs. (Press again to switch which profile is viewed. A rumble will indicate which profile is selected. Changes are live immediately.)
// Triangle / Y: Enable/Disable/Switch the mode in which L1/R1/bumpers and L2/R2/Triggers are swapped. Useful for those with Xbox controllers wishing to use the triggers instead of the bumpers.
//               See defaults below for mode descriptions. (A rumble will indicate a sucessful mode change, except for 0/disabled. Changes are live immediately.)
// Square / X : Enable/Disable/Switch the mode in which the sticks or their axises are are swapped.
//               See defaults below for mode descriptions. (A rumble will indicate a sucessful mode change, except for 0/disabled. Changes are live immediately. Stick inversions are unaffected by swap.)
// Cross / A : Enable/Disable Select/Start <-> Touchpad Left/Right press swap. Useful for PS4 games expecting the touchpad on non-DS4 controllers.
//               See defaults below for mode descriptions. (A rumble will indicate a sucessful mode change, except for 0/disabled. Changes are live immediately. Mode disabled on DS4 controllers due to touchpad stick swap conflict.)

// ----------------

//"TRACEs" (notifications, view in Device Monitor while your device is connected up to your PC)
//TRACE_1-4: Same as controller LEDs to indicate inversion status. 0 = off, 1 = on. Update status by holding Select. This is a workaround for 360 controller LEDs.
//TRACE_5: Same as TRACE_6 - except second digit shows status of stick swap.
//TRACE_6: (Shown in double digits when profiles are enabled)
//First digit: Status of profiles: 1 or 2 = Current profile you are using, 3 = Profile 1 saved, 4 = Profile 2 saved. 0 or not present = Profiles disabled.
//Second digit = Current trigger swap mode.

int invertLY, invertLX, invertRY, invertRX, triggerkey, profile, tswap, stswap, sL1, sL2, sR1, sR2, tL1, tL2, tR1, tR2, tpswap, tp1;

init {
// Your Default User Settings.
// Change these settings to your liking, i.e. what you need loaded by default when you first activate this script.

// Activate profiles: 0 = disable, 1 = enable.
    profile = 1


// Profile trigger key: When this button is pressed, the script will switch 'profiles'.
// It would be useful to map this to your weapon's scope button, or the button to use binoculars;
// something that you need to quickly invert the camera controls when you are using this object.
    triggerkey = PS3_R3


// Which bumper / trigger swap mode would you like by default?
// 0 = Unchanged.
// 1 = Switch bumper/L1/R1 to triggers/L2/R2, Common swap for Xbox controllers. EG. Use triggers/R2 to fire weapon in games that use R1/bumpers. 
// 2 = Swap L1/L2 only (L1/L2 -> L2/L1)
// 3 = Swap R1/R2 only (R1/R2 -> R2/R1)
// 4 = Swap Left and Right sides. (L1/L2 -> R1/R2). Might be useful for Wii Remote + Nunchuk.
// 5 = Swap Left/Right sides and swap Bumpers/Triggers. (L1/L2 -> R2/R1)
    tswap = 0


// Which thumbstick swap mode would you like by default?
// 0 = Unchanged.
// 1 = Switch axis postions on both sticks. (Left stick Up/Down(LY)/Left stick Left/Right(LX) to LX/LY, also RY/RX to RX/RY.) 
// 2 = Swap axis on left stick only (LY/LX to LX/LY)
// 3 = Swap axis on right stick only (RY/RX -> RX/RY)
// 4 = Swap Left and Right sticks. (LY/LX -> RY/RX).
// 5 = Swap Left/Right stick and swap axis positions. (LY/LX -> RX/RY)
// 6 = Swap Left Stick and Touchpad.
// 7 = Swap Right stick and Touchpad.
    stswap = 0


// Non-DS4 controllers: Are you playing a PS4 game requiring touchpad clicks on left or right of touchpad? (Examples: PS2-on-PS4 titles)
// *Do not use this specific feature (leave at 0) with a DS4 controller as it is not needed*
// 0 = Unchanged.
// 1 = Swap Select/Start for Touchpad Left/Right press.
	tpswap = 0
	
	
//----------------------------------------------
// There is no need to change anything else!

//Initial script setup follows:
//This script will start by not inverting anything.
    invertLY = 0
    invertLX = 0
    invertRY = 0
    invertRX = 0
//Setup trigger and stick swap, if any.
	triggerswap();
	stickswap();
}

main {

//Reset leds after customizing script
    if(get_val(PS3_SELECT) != 100) {
//        set_led(0,0);
//        set_led(1,0);
//        set_led(2,0);
//        set_led(3,0);
        reset_leds();
    }
    
// Select button: Send press to console, or edit script settings? 
    // press - send to console
    if(event_release(PS3_SELECT) && get_ptime(PS3_SELECT) < 175) {
//  devuse:		set_val(TRACE_1, get_val(TRACE_1) + 1)
//	Touchpad Left swap
		if(tpswap == 1) {
			tp1 = -85
			combo_run(cpresstp);
		} else {
			combo_run(cpress);
		}
    } 
    // hold - customize part of script
    if(get_val(PS3_SELECT) && get_ptime(PS3_SELECT) > 175) { 
        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);
    }

// Swap Start / Touchpad Right
//Touchpad Right / Start swap (Left/Select is handled slightly different, due to Select also being used for this script's customization)
    if(event_press(PS3_START) && tpswap == 1) {
// devuse:    	set_val(TRACE_6, get_val(TRACE_6) + 1)
		tp1 = 85
    	combo_run(cpresstp);
    }
    if(tpswap == 1 && !combo_running(customize)) {
		set_val(PS3_START, 0);
    }

//Triggerkey: switches profiles on the fly
    if(event_press(triggerkey) && !combo_running(customize)) {
//        set_val(TRACE_5, get_val(TRACE_5) + 1);
        switchprofiles();
    }


//The actual inversions!!!
    //LY (left stick up/down)
    if(invertLY == 1) {
//deadzone... to be implemented
//        if(get_val(PS3_LY) <-20 || get_val(PS3_LY) > 20) {
        set_val(PS3_LY, get_val(PS3_LY) * -1);
//        }
    }
    //LX (left stick left/right)
    if(invertLX == 1) {
        set_val(PS3_LX, get_val(PS3_LX) * -1);
    }
    //RY (right stick up/down)
    if(invertRY == 1) {
        set_val(PS3_RY, get_val(PS3_RY) * -1);
    }
    //RX (right stick left/right)
    if(invertRX == 1) {
        set_val(PS3_RX, get_val(PS3_RX) * -1);

    }

//Trigger swap
    if(tswap > 0 && !combo_running(customize)) {
        swap(tL1, tL2);
        swap(tR1, tR2);
    }
//Stick Swap
    if(stswap > 0 && !combo_running(customize)) {
        swap(sL1, sL2);
        swap(sR1, sR2);
    }

}    


combo Rumble1 { 
    // 1 short rumble
    set_rumble(RUMBLE_B, 100);
    wait(200);
    set_rumble(RUMBLE_B, 0);
}

combo Rumble11 { 
    // 1 short rumble, 1 long rumble
	call(Rumble1);
    wait(250);
    set_rumble(RUMBLE_B, 100);
    wait(400);
    set_rumble(RUMBLE_B, 0);
}

combo Rumble2 { 
    // 2 short rumbles
    set_rumble(RUMBLE_B, 100);
    wait(200);
    set_rumble(RUMBLE_B, 0);
    wait(200);
    set_rumble(RUMBLE_B, 100);
    wait(200);
    set_rumble(RUMBLE_B, 0);
}

combo Rumble22 { 
    // 2 short rumbles, 1 long rumble
	call(Rumble2);
    wait(250);
    set_rumble(RUMBLE_B, 100);
    wait(400);
    set_rumble(RUMBLE_B, 0);
}

combo customize {
//Press Start to view profile inversion settings.
    if(event_press(PS3_START)) {
        switchprofiles();
    }

//LED notifications on what inversions are enabled
//4 / L1 = LY 
//3 / L2 = LX
//2 / R1 = RY
//1 / R2 = RX

    if(invertLY == 1) {
        set_led(3, 1);
        set_val(TRACE_1, 1);
    } else { 
        set_led(3, 0);
        set_val(TRACE_1, 0);
    }
    if(invertLX == 1) {
        set_led(2, 1);
        set_val(TRACE_2, 1);
    } else { 
        set_led(2, 0);
        set_val(TRACE_2, 0);
    }
    if(invertRY == 1) {
        set_led(1, 1);
        set_val(TRACE_3, 1);
    } else { 
        set_led(1, 0);
        set_val(TRACE_3, 0);
    }
    if(invertRX == 1) {
        set_led(0, 1);
        set_val(TRACE_4, 1);
    } else { 
        set_led(0, 0);
        set_val(TRACE_4, 0);
    }
//LY
    if(event_press(PS3_L1)) {invertLY=!invertLY}

//LX
    if(event_press(PS3_L2)) {invertLX=!invertLX}

//RY
    if(event_press(PS3_R1)) {invertRY=!invertRY}

//RX
    if(event_press(PS3_R2)) {invertRX=!invertRX}

// Profile save
    if(event_press(PS3_L3)) {
        set_val(TRACE_6, 30 + tswap);
        set_pvar(SPVAR_1, invertLY);
        set_pvar(SPVAR_2, invertLX);
        set_pvar(SPVAR_3, invertRY);
        set_pvar(SPVAR_4, invertRX);
        set_pvar(SPVAR_9, tswap);
        set_pvar(SPVAR_11, stswap);
		set_pvar(SPVAR_13, tpswap);
        combo_run(Rumble11);
    }
    if(event_press(PS3_R3)) {
        set_val(TRACE_6, 40 + tswap);
        set_pvar(SPVAR_5, invertLY);
        set_pvar(SPVAR_6, invertLX);
        set_pvar(SPVAR_7, invertRY);
        set_pvar(SPVAR_8, invertRX);
        set_pvar(SPVAR_10, tswap);
        set_pvar(SPVAR_12, stswap);
		set_pvar(SPVAR_14, tpswap);
        combo_run(Rumble22);
    }

// Trigger swap setup
    if(event_press(PS3_TRIANGLE)) {
        tswap = tswap + 1;
        if(tswap == 6) {tswap = 0}
        triggerswap();
        set_val(TRACE_6, profile * 10 + tswap);
        if(tswap !=0) {
            combo_run(Rumble1);
        }
    }
    
    // Stick swap setup
    if(event_press(PS3_SQUARE)) {
        stswap = stswap + 1;
        if(stswap == 8) {stswap = 0}
        stickswap();
        set_val(TRACE_5, profile * 10 + stswap);
        if(stswap !=0) {
            combo_run(Rumble1);
        }
    }

    // Start/Touchpad Right swap
    if(event_press(PS3_CROSS) && get_controller() != PIO_PS4) {
    	tpswap = !tpswap;
    	if(tpswap !=0) {
            combo_run(Rumble1);
        }
	}
//Disable commands to console while selecting script options
    set_val(PS3_L1, 0);
    set_val(PS3_L2, 0);
    set_val(PS3_R1, 0);
    set_val(PS3_R2, 0);
    set_val(PS3_L3, 0);
    set_val(PS3_R3, 0);
    set_val(PS3_TRIANGLE, 0);
    set_val(PS3_SQUARE, 0);
    set_val(PS3_CROSS, 0);
    set_val(PS3_SQUARE, 0);
    set_val(PS3_START, 0);
}

combo cpress {
    set_val(TRACE_3, get_ptime(PS3_SELECT));
// devuse: set_val(TRACE_1, get_val(TRACE_1) + 1)
//Recreate a probably recent Select button press
	set_val(PS3_SELECT, 100);
	wait(get_ptime(PS3_SELECT));
	set_val(PS3_SELECT, 0);
}

combo cpresstp {
//  devuse: set_val(TRACE_1, get_val(TRACE_1) + 1)
//Recreate a Touchpad button press, real or not.
	ps4_set_touchpad(tp1, -3);
    set_val(PS4_TOUCH, 100);
    wait(80);
}


function triggerswap() {
    if(tswap == 1) {
    //Common Xbox controller trigger swap: Invert bumpers/triggers - L2/R2 -> L1/R1
    //Left side - button pressed
        tL1 = PS3_L1
    //Left side - swap to
        tL2 = PS3_L2
        tR1 = PS3_R1
        tR2 = PS3_R2
    }
    if(tswap == 2) {
    //From Mode 1 - Left side only - L1 -> L2
        tL1 = PS3_L1
        tL2 = PS3_L2
        tR1 = PS3_R1
        tR2 = PS3_R1
    }
    if(tswap == 3) {
    //From Mode 1 - Right side only - R1 -> R2
        tL1 = PS3_L1
        tL2 = PS3_L1
        tR1 = PS3_R1
        tR2 = PS3_R2
    }
    if(tswap == 4) {
    //Swap left and right. - L1/L2 -> R1/R2
        tL1 = PS3_L1
        tL2 = PS3_R1
        tR1 = PS3_L2
        tR2 = PS3_R2
    }
    if(tswap == 5) {
    //Swap left and right AND invert triggers/bumpers.
        tL1 = PS3_L1
        tL2 = PS3_R2
        tR1 = PS3_L2
        tR2 = PS3_R1
    }
}

function stickswap() {
    if(stswap == 1) {
    //Switch Axis positions: LY->LX & RY->RX. (Both sticks.)
    //Left side - button pressed
        sL1 = PS3_LY
    //Left side - swap to
        sL2 = PS3_LX
        sR1 = PS3_RY
        sR2 = PS3_RX
    }
    if(stswap == 2) {
    //Switch Axis positions: Left stick LY->LX
        sL1 = PS3_LY
        sL2 = PS3_LX
        sR1 = PS3_RY
        sR2 = PS3_RY
    }
    if(stswap == 3) {
    //Switch axis positions: Right stick RY->RX
        sL1 = PS3_LY
        sL2 = PS3_LY
        sR1 = PS3_RY
        sR2 = PS3_RX
    }
    if(stswap == 4) {
    //Swap left and right sticks
        sL1 = PS3_LY
        sL2 = PS3_RY
        sR1 = PS3_LX
        sR2 = PS3_RX
    }
    if(stswap == 5) {
    //Swap sticks AND axis positions. (LY->RX, etc.)
        sL1 = PS3_LY
        sL2 = PS3_RX
        sR1 = PS3_LX
        sR2 = PS3_RY
    }
        if(stswap == 6) {
    //Swap touchpad and left stick.
        sL1 = PS4_TOUCHY
        sL2 = PS3_LY
        sR1 = PS4_TOUCHX
        sR2 = PS3_LX
    }
        if(stswap == 7) {
    //Swap touchpad and right stick.
        sL1 = PS4_TOUCHY
        sL2 = PS3_RY
        sR1 = PS4_TOUCHX
        sR2 = PS3_RX
    }

}

function switchprofiles() {
        if(profile == 1) {
            //Profile #2
            profile = 2;
            combo_run(Rumble2);
            invertLY = get_pvar(SPVAR_5, 0, 2, 0);
            invertLX = get_pvar(SPVAR_6, 0, 2, 0);
            invertRY = get_pvar(SPVAR_7, 0, 2, 0);
            invertRX = get_pvar(SPVAR_8, 0, 2, 0);
            tswap = get_pvar(SPVAR_10, 0, 8, 0);
            stswap = get_pvar(SPVAR_12, 0, 8, 0);
			tpswap = get_pvar(SPVAR_14, 0, 8, 0);
            set_val(TRACE_6, profile * 10 + tswap);
            set_val(TRACE_5, profile * 10 + stswap);
        } else if(profile == 2) {
            profile = 1;
            combo_run(Rumble1);
            invertLY = get_pvar(SPVAR_1, 0, 2, 0);
            invertLX = get_pvar(SPVAR_2, 0, 2, 0);
            invertRY = get_pvar(SPVAR_3, 0, 2, 0);
            invertRX = get_pvar(SPVAR_4, 0, 2, 0);
            tswap = get_pvar(SPVAR_9, 0, 8, 0);
            stswap = get_pvar(SPVAR_11, 0, 8, 0);
			tpswap = get_pvar(SPVAR_13, 0, 8, 0);
            set_val(TRACE_6, profile * 10 + tswap);
            set_val(TRACE_5, profile * 10 + stswap);
        }
		triggerswap();
		stickswap();
}
  • Rating

    10 / 10 here !

    If you own a ps3 and prefer an xbox controller, or even use a keyboard and mouse, this is a must to remap your keyboard to a controller. Go buy it now you won't be disappointed !

  • Rating

    Amazing device

    If you're like me and love your PS4 controller but want to use an Xbox One GET THIS you won't be sorry.

  • Rating

    Worth every penny

    The controller feels and performs as it does on the xbox right there on my ps3, awesome job guys, and worth every penny !!!

  • Rating

    Amazing Macro combos

    tested Super Street Fighter IV Arcade Edition. I was able to perform normal & FADC combos with some characters like Ryu and Ken with a single click. Amazing.

  • Rating

    As good as a XIM

    If you are a pc gamer, that needs a pc solution for console, get yourself a ControllerMAX you will not regret it.

  • Rating

    KB & Mouse RULES!

    All I can say playing 10 minutes with ControllerMAX properly configured it felt better then PC....YES I said it even better then PC, it's that smooth.

  • Rating

    Six-Axis 360!

    WOW! I can finally get that six-axis awesomeness on my Xbox 360. The best money I ever spent.

  • Rating

    Beats all rapidfire mods

    I've tried the Intensafire, Godfather even the new Wolf controller. The ControllerMAX beats them hands down and no wires or soldering too. 5 Stars!

  • Rating

    Just perfect!

    I can't believe how much this can do for the price tag - it blew me away. Best controller upgrade ever.

  • Rating

    Hugh Thanks!

    Without your help I couldn't be playing Xbox, thanks guys.

  • Rating

    Wow!

    I have to say after reading the forums for Destiny Mouse and Keyboard setup I was flying into getting it set up in 20 minutes. It works outstanding! I'm more then satisfied and its worth every penny!

  • Rating

    Achievement Unlocked!

    Idle boosting Complete 150 Multiplayer games, James Cameron's Avatar. My friend said it would be hard, I laughed then linked him.

  • Rating

    A++!

    Now this is a company you can count on and trust...keep up the great work guys!

  • Rating

    What Disability?

    I would like to thank you for making the CronusMax. I have this problem hitting L3 and R3, and today that problem was fixed. I love the remap feature on the Cronus max. You made my life easier.

  • Rating

    Awesome stuff guys!

    Playing Forza 5 with my original MS 360 wireless wheel makes the XB1 complete for me, thanks to the CronusMax. Thumbs up!