Question about button remaping

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

Question about button remaping

Postby CommanderPro97 » Wed Sep 06, 2017 7:51 pm

I would like to know more about the button remapping i'm look at remapper here: https://www.consoletuner.com/wiki/index ... 2:remapper

Last Of Us (PS3)
Code: Select all
 
#include <remapper.gph>
 
// Changed mappings:
// BUTTON_4  mapped to BUTTON_5
// BUTTON_7  mapped to BUTTON_8
// BUTTON_5  mapped to BUTTON_4
// BUTTON_8  mapped to BUTTON_7
// BUTTON_18 mapped to BUTTON_4
// BUTTON_20 mapped to BUTTON_8
 
const uint8 LastofUSLayout[39] = {
    RMP_USB_A,
    BUTTON_1BUTTON_2BUTTON_3BUTTON_5, BUTTON_4, BUTTON_6BUTTON_8,
    BUTTON_7BUTTON_9BUTTON_10, BUTTON_11, BUTTON_12, BUTTON_13, BUTTON_14,
    BUTTON_15, BUTTON_16, BUTTON_17BUTTON_14, BUTTON_19, BUTTON_8, 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
};
 
init {
    // using the controller on Input-A.
    remapper(LastofUSLayout);
} 


I tried using the input translator but that won't work don't know why so i just did a script to test it out but won't work. I would like to know more on how to do this because i have the xbox elite controller and wondows update can't install the update for the controller for some reasons, so i'll just use the titan two.

Rest of the script:
Code: Select all
#pragma METAINFO("<author_name>", 1, 0, "")
 
 
uint8 statusIn,  protocolIn,  deviceIn;
uint8 statusOut, protocolOut, deviceOut;
 
main {
// -------------------------------------------------------------------------- //
// |         Crossover (XB1 Controller and Elite Controller on PS4)         | //
// -------------------------------------------------------------------------- //
    statusIn  = port_status(PORT_USB_A, &protocolIn,  &deviceIn);
    statusOut = port_status(PORT_USB_C, &protocolOut, &deviceOut);
 
    if(protocolIn == PROTOCOL_XB1 || protocolIn == PROTOCOL_XB1_WRC && protocolOut == PROTOCOL_PS4) {
        set_val(BUTTON_2, 0.0);
     //Ignore Xbox Elite paddle buttons since they pass in the buttons programmed in the xbox accessory app.
    if (get_actual(BUTTON_18)) {
        set_val(BUTTON_18, 0.0);
    }
    if (get_actual(BUTTON_19)) {
        set_val(BUTTON_19, 0.0);
    }
    if (get_actual(BUTTON_20)) {
        set_val(BUTTON_20, 0.0);
    }
    if (get_actual(BUTTON_21)) {
        set_val(BUTTON_21, 0.0);
    }
    // Hold view button for swipe. Then use right stick for swipe direction.
        set_val(POINT_1_Y, 0.0);
        set_val(POINT_1_X, 0.0);
    if(is_active(BUTTON_2)) {
        set_val(BUTTON_19, 100.0);
        set_val(POINT_1_Y, get_val(STICK_1_Y));
        set_val(STICK_1_Y, get_actual(BUTTON_20));
        set_val(POINT_1_X, get_val(STICK_1_X));
        set_val(STICK_1_X, get_actual(BUTTON_21));
    // Hold view button and click right stick click for touch click.   
        set_val(BUTTON_6, 0.0);
    if(get_actual(BUTTON_6)) {
        set_val(BUTTON_18, 100.0);
    }
    }
    }
// ========================================================================== //
}
 
#include <remapper.gph>
 
// Changed mappings:
// BUTTON_4  mapped to BUTTON_5
// BUTTON_7  mapped to BUTTON_8
// BUTTON_5  mapped to BUTTON_4
// BUTTON_8  mapped to BUTTON_7
 
const uint8 LastofUSLayout[39] = {
    RMP_USB_A,
    BUTTON_1BUTTON_2BUTTON_3BUTTON_5, BUTTON_4, BUTTON_6BUTTON_8,
    BUTTON_7BUTTON_9BUTTON_10, BUTTON_11, BUTTON_12, BUTTON_13, BUTTON_14,
    BUTTON_15, BUTTON_16, BUTTON_17BUTTON_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
};
 
init {
    // using the controller on Input-A.
    remapper(LastofUSLayout);
}
 
//Auto Stealth
main {
    if(is_release(BUTTON_8)) {
        set_val(BUTTON_15, 100.0);
    }
}
 
//Auto Spot
main {
    if(is_active(BUTTON_7)) {
        set_val(BUTTON_6, 100.0);
    }
}
 
//4 Shoot Burst
main {
    // While BUTTON_19 is held-down
    if(get_val(BUTTON_19)) {
        // Burst
        combo_run (Burst);
    }
}
 
 
combo Burst{
    set_val(BUTTON_4, 100.0);
    wait(35);
    set_val(BUTTON_4, 0);
    wait(35);
    set_val(BUTTON_4, 100.0);
    wait(35);
    set_val(BUTTON_4, 0);
    wait(35);
    set_val(BUTTON_4, 100.0);
    wait(35);
    set_val(BUTTON_4, 0);
    wait(35);
    set_val(BUTTON_4, 100.0);
    wait(35);
}
 
//Turbo Fire
#pragma METAINFO("<Paddle4>", 1, 3, "")
 
// You will need to adjust the wait times as per the weapon/game until the weapon fires smoothly.
// If your weapon tries to fire at an uneven rate, you are setting the wait time too low!
// The hold times shouldn't be needed unless the game is particularly fussy.
 
#define turbo1          BUTTON_21
 
int turbo1hold;
int turbo1wait;
 
init {
 
        turbo1hold = 15; // The total time between firing a shot is hold+wait, in milliseconds.
        turbo1wait = 40;
 
}
main {
    if (get_val(turbo1)) {combo_run (turbofire1);}    // Rapidfire runs whenever the turbobutton is pressed.
}
 
combo turbofire1 {       
        set_val(turbo1,100);
        wait (turbo1hold);
        set_val(turbo1,0);
        wait (turbo1wait);
        set_val(turbo1,0);
}


Don't work in game:
Auto Stealth

The only thing that works is the xbox elite controller not the paddles yet, going to figure it out (I might just remap them with the scrip up above.

How would you store more scripts in the titan two. like use the drag and drop method to store the scripts in memory slot 1,2,3 i keep using the green button but that only goes to 0.
Last edited by CommanderPro97 on Tue Sep 12, 2017 1:45 am, edited 8 times in total.
User avatar
CommanderPro97
First Sergeant
First Sergeant
 
Posts: 51
Joined: Sun Aug 13, 2017 3:10 am

Re: Question about button remaping

Postby Prototype » Wed Sep 06, 2017 10:11 pm

Yes you can also do that with an Input Translator, there is a flipped trigger layout in the Online Resources.
Console tuner since my 1st controller.
Scripting, a game in the game.
Believe or dare, It's Titanic! :smile0517:
User avatar
Prototype
Major General
Major General
 
Posts: 3252
Joined: Sun Dec 16, 2012 1:43 pm

Re: Question about button remaping

Postby J2Kbr » Tue Sep 12, 2017 7:24 pm

Please note the button remap on the above script is being applied only to Input-A (RMP_USB_A), if the controller in use is on Input-B it will not work, in this case change the remapping declaration to:
Code: Select all
const uint8 LastofUSLayout[39] = {
    RMP_USB_A | RMP_USB_B,
    BUTTON_1BUTTON_2BUTTON_3BUTTON_5, BUTTON_4, BUTTON_6BUTTON_8,
    BUTTON_7BUTTON_9BUTTON_10, BUTTON_11, BUTTON_12, BUTTON_13, BUTTON_14,
    BUTTON_15, BUTTON_16, BUTTON_17BUTTON_14, BUTTON_19, BUTTON_8, 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
};
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm


Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 129 guests