t2:remapper

remapper


remapper — Configure controller mapping

Description


bool remapper(const uint8 layout[39]);

Configure the controller mapping according with layout[39] parameter. Once the controller mapping is configured, it remains active for the specified input port(s) until the memory slot is unloaded or remapper_reset() is called.

The function remapper() is equivalent to a Controller Remapper created using the Input Translator interface on Gtuner IV.

The default mapping layout is defined as:

const uint8 DefaultMappingLayout[39] = {
    RMP_USB_A | RMP_USB_B | RMP_USB_C | RMP_USB_D | RMP_BT_A | RMP_BT_B,
    BUTTON_1,  BUTTON_2,  BUTTON_3,  BUTTON_4,  BUTTON_5,  BUTTON_6,  BUTTON_7, 
    BUTTON_8,  BUTTON_9,  BUTTON_10, BUTTON_11, BUTTON_12, BUTTON_13, BUTTON_14, 
    BUTTON_15, BUTTON_16, BUTTON_17, 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_X,  GYRO_1_Y,  GYRO_1_Z
};

A new custom layout is created by changing the positions of the I/O Identifiers in the array. Any arrangement is possible, including mapping a accelerometer to a button or stick.

The first element of the array defines to which input port(s) the new layout should be applied.

Parameters


  • layout[39]: Constant array of 39 elements that defines an controller mapping and the port(s) the layout should be applied.

Return Value


Returns true if the mapping layout was successfully loaded, or FALSE if the mapping layout failed to load.

remapper() fails to load an new layout if there is an Input Translator with Controller Remapper already loaded by the user.

Examples


Example #1 remapper() example

#include <remapper.gph>
 
// Changed mappings:
// BUTTON_4  mapped to BUTTON_14
// BUTTON_5  mapped to BUTTON_15
// BUTTON_14 mapped to BUTTON_5
// BUTTON_15 mapped to BUTTON_17
// BUTTON_17 mapped to BUTTON_4
 
const uint8 GodOfWarLayout[39] = {
    RMP_USB_A, 
    BUTTON_1,  BUTTON_2,  BUTTON_3,  BUTTON_14, BUTTON_15, BUTTON_6,  BUTTON_7, 
    BUTTON_8,  BUTTON_9,  BUTTON_10, BUTTON_11, BUTTON_12, BUTTON_13, BUTTON_5, 
    BUTTON_17, BUTTON_16, BUTTON_4,  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_X,  GYRO_1_Y,  GYRO_1_Z
};
 
init {
    // Change the button layout to play Dark Souls as God of War 
    // using the controller on Input-A.
    remapper(GodOfWarLayout);
}

See Also

t2/remapper.txt · Last modified: 2018/03/08 08:46 by J2Kbr