Frsky XSR SIM USB Dongle To XboxOne DRL Sim

Xbox One DRL Sim Play with every binded to "XSR SIM USB Dongle" transmitter wirelessly //------------------------------------- // by Felix // Radio in MODE 2, + Frsky_XSR_SIM_USB_Dongle + Titan One // Mixes on radio (My is T16X) // CH1 Ail HID_STICK_2_X -> XB1_RX; // CH2 Ele HID_STICK_2_Y -> XB1_RY; // CH3 rud HID_STICK_1_X -> XB1_LX; // CH4 SB HID_BUTTON_8 -> XB1_A; + RB // CH5 SA HID_BUTTON_5 -> XB1_B; + MENU // CH6 Thr HID_STICK_1_Y -> XB1_LY; // CH13 SC HID_BUTTON_7 -> XB1_X // CH14 SE HID_BUTTON_4 -> used in code for throttle scaling; //-------------------------------------
Version1.00
AuthorFelixS
Publish DateSat, 5 Dec 2020 - 13:26
Last UpdateSat, 5 Dec 2020 - 13:26
Downloads55
RATE


0

0

Code: Select all
// GPC Online Library
// Frsky_XSR_SIM_USB_DongleToXboxOneDRLSim.gpc
 
 
//-------------------------------------
//  by Felix
//  Radio in MODE 2, + Frsky_XSR_SIM_USB_Dongle + Titan One
//  Mixes on radio (My is T16X)
//  CH1  Ail     HID_STICK_2_X -> XB1_RX;
//  CH2  Ele     HID_STICK_2_Y -> XB1_RY;
//  CH3  rud     HID_STICK_1_X -> XB1_LX;
//  CH4  SB      HID_BUTTON_8 -> XB1_A; + RB
//  CH5  SA      HID_BUTTON_5 -> XB1_B; + MENU
//  CH6  Thr     HID_STICK_1_Y -> XB1_LY;
//  CH13 SC      HID_BUTTON_7 -> XB1_X
//  CH14 SE      HID_BUTTON_4 -> used in code for throttle scaling;
//-------------------------------------
 
//Clear all mapping
unmap ALL_REMAPS;
//mapping used inputs(channels from radio)
remap HID_STICK_1_X -> XB1_LX;
remap HID_STICK_1_Y -> XB1_LY;
remap HID_STICK_2_X -> XB1_RX;
remap HID_STICK_2_Y -> XB1_RY;
remap HID_BUTTON_8 -> XB1_A;
remap HID_BUTTON_5 -> XB1_B;
remap HID_BUTTON_7 -> XB1_X;
//empty just for emulation
remap HID_BUTTON_1 -> XB1_RB;
remap HID_BUTTON_2 -> XB1_MENU;
 
 
init
{
 
}
 
main
{
    // A B X RB MENU  Xbox buttons
    if(get_val(HID_BUTTON_8) == 50)
    {
        set_val(HID_BUTTON_8, 100); // A
    }
    else if(get_val(HID_BUTTON_8) == 49)
    {
        set_val(HID_BUTTON_8, 0);
        set_val(HID_BUTTON_1,100); //RB
    }
    else
    {
        set_val(HID_BUTTON_8, 0);
    }
 
    if(get_val(HID_BUTTON_5) == 50)
    {
        set_val(HID_BUTTON_5, 100); // B
    }
    else if(get_val(HID_BUTTON_5) == 49)
    {
        set_val(HID_BUTTON_5, 0);
        set_val(HID_BUTTON_2,100); //MENU
    }
    else
    {
        set_val(HID_BUTTON_5, 0);
    }
 
    if(get_val(HID_BUTTON_7) == 0)
    {
        set_val(HID_BUTTON_7, 100); // X
    }
    else
        set_val(HID_BUTTON_7, 0); // X
 
 
//Left stick
    if(get_val(HID_STICK_1_X) > 0)
        set_val(HID_STICK_1_X, get_val(HID_STICK_1_X) - 100);
    else
        set_val(HID_STICK_1_X, get_val(HID_STICK_1_X) + 100);
 
    if(get_val(HID_BUTTON_4))
        SetThtottleWithScaling();
    else
        SetThtottleWithoutScaling();
 
 
//Right Stick
    if(get_val(HID_STICK_2_X) > 0)
        set_val(HID_STICK_2_X, get_val(HID_STICK_2_X) - 100);
    else
        set_val(HID_STICK_2_X, get_val(HID_STICK_2_X) + 100);
 
    if(get_val(HID_STICK_2_Y) < 1)
        set_val(HID_STICK_2_Y, inv(get_val(HID_STICK_2_Y)) - 100);
    else
        set_val(HID_STICK_2_Y, 100 - get_val(HID_STICK_2_Y));
 
}
 
function SetThtottleWithoutScaling()
{
    if(get_val(HID_STICK_1_Y) < 1)
        set_val(HID_STICK_1_Y, inv(get_val(HID_STICK_1_Y)) - 100);
    else
        set_val(HID_STICK_1_Y, 100 - get_val(HID_STICK_1_Y));
}
 
function SetThtottleWithScaling()
{
    if(get_val(HID_STICK_1_Y) < 1)
        set_val(HID_STICK_1_Y, inv(get_val(HID_STICK_1_Y) / 2) - 100);
    else
        set_val(HID_STICK_1_Y, inv(get_val(HID_STICK_1_Y)) / 2);
}