Page 2 of 2

Re: how do i connect it to ps4

PostPosted: Thu Aug 08, 2019 12:19 am
by Cokey
Mad wrote:
Code: Select all
#define DEADZONE 30.0
#include <xb1.gph>
 
main {
    analog_deadzone(XB1_LX, DEADZONE, 0.0);
    analog_deadzone(XB1_RX, DEADZONE, 0.0);
}
 
void analog_deadzone(int id, fix32 deadzone, fix32 ydeadzone) {
    if((int)ydeadzone) {
        set_val(id, abs(get_actual(id)) < deadzone ? 0.0 : get_actual(id));
        set_val(id+1, abs(get_actual(id+1)) < ydeadzone ? 0.0 : get_actual(id+1));
    }
    else if(sqrt(sq(get_actual(id)) + sq(get_actual(id+1))) < deadzone) {
        set_val(id, 0);
        set_val(id+1, 0);
    }
}


thanks, what does fix32 mean? and what values do i need to enter where?

also i save this a a gpc file and i paste it over to slot 1 that has my input translator on and it overrides it. Not sure how to get both on at same time.

Re: how do i connect it to ps4

PostPosted: Thu Aug 08, 2019 1:02 am
by Mad
fix32 is a datatype.

You change this:
Code: Select all
#define DEADZONE 30.0

where 30.0 is the deadzone

If you just want to remove a deadzone use this instead:

Code: Select all
#define StickNoise 8.0 // deadzone value to remove
 
main {
  if(abs(get_actual(STICK_1_X)) < StickNoise) { set_val(STICK_1_X, 0.0); }
  if(abs(get_actual(STICK_1_Y)) < StickNoise) { set_val(STICK_1_Y, 0.0); }
  if(abs(get_actual(STICK_2_X)) < StickNoise) { set_val(STICK_2_X, 0.0); }
  if(abs(get_actual(STICK_2_Y)) < StickNoise) { set_val(STICK_2_Y, 0.0); }
}


But if device monitor is showing the resting position as 0.0 you don't need this.

They should go in the same slot - Right click the memory slot and clear it and try again :smile0517:

Re: how do i connect it to ps4

PostPosted: Thu Aug 08, 2019 1:08 am
by Cokey
i cleard the memory slot, and tried again, it just keeps replacing anything on that slot, also tried other slots, and other scripts does the same thing, somethings not right here.

I notice both the translator file on the memory is colord green(the little green memory symble) so is the gpc script i try to put in.

But some other files from the online database are red, or blue.

Re: how do i connect it to ps4

PostPosted: Thu Aug 08, 2019 1:12 am
by Mad
You're trying to put two scripts in the same slot, not an input translator and script.

What script are you using? I'll add the deadzone remover

Re: how do i connect it to ps4

PostPosted: Thu Aug 08, 2019 1:20 am
by Cokey
Mad wrote:You're trying to put two scripts in the same slot, not an input translator and script.

What script are you using? I'll add the deadzone remover


you are correct i just figured that out, this file (Example-XB1 Controller on ps4) is on the online resources saved as a GPC, so it is just like any other input translator but with wrong saved file?

If i go to Input Translators tab, i see one or two i can use, but i dont see "Example-XB1 Controller on ps4" in the input translator tab.

I dowloaded one called Elite controller ps4 fix, Not sure what it is supposed to be fixing. but it allowes me to have the deadzone script with it

On the deadzone script you gave me you mentioned where i can define the deadzone value. Is 30.00 like the default deadzone?
I thought you'd want no deadzone so it be 0.00?

Re: how do i connect it to ps4

PostPosted: Thu Aug 08, 2019 1:36 am
by Mad
No its a script made by another member, not an input translator.

I wasn't sure what kind of script you wanted, the first one is suited to setting a deadzone.

The other one is for removing a deadzone - I have added the disable led and deadzone remover.

If your stick is showing 0.00 in device monitor then you don't need it like i said.

If your stick was showing for example a resting position of 3.60 you would change

Code: Select all
#define StickNoise 0.0

to
Code: Select all
#define StickNoise 3.6


Code: Select all
#pragma METAINFO("Example - XB1 Controller on PS4", 1, 0, "pablogroup")
 
#include <ps4.gph>
 
#define SHARE      PS4_SHARE
#define TOUCHPAD   PS4_TOUCH
#define HOME       PS4_PS
 
// Deadzone remover
#define StickNoise 0.0
 
uint8   statusInA, protocolInA, deviceInA;
uint8   statusInB, protocolInB, deviceInB;
uint8   statusOut, protocolOut, deviceOut;
 
init {
  led_set(LED_1, 0.0, 0);
  led_set(LED_2, 0.0, 0);
  led_set(LED_3, 0.0, 0);
  led_set(LED_4, 0.0, 0);
}
 
main {
    statusInA = port_status(PORT_USB_A, &protocolInA, &deviceInA);
    statusInB = port_status(PORT_USB_B, &protocolInB, &deviceInB);
    statusOut = port_status(PORT_USB_C, &protocolOut, &deviceOut);
    if(((protocolInA == PROTOCOL_XB1) || (protocolInB == PROTOCOL_XB1)) && (protocolOut == PROTOCOL_PS4)) {
        if(get_val(PS4_SHARE)) {
            set_val(PS4_SHARE, 0);
            set_val(PS4_TOUCH, 100);
        }
        if(event_active(HOME) && time_release(HOME) < 150) {
            combo_run(HomeBlock);
            combo_run(ShareButtonShortcut);
        }
    }
    if(abs(get_actual(STICK_1_X)) < StickNoise) { set_val(STICK_1_X, 0.0); }
    if(abs(get_actual(STICK_1_Y)) < StickNoise) { set_val(STICK_1_Y, 0.0); }
    if(abs(get_actual(STICK_2_X)) < StickNoise) { set_val(STICK_2_X, 0.0); }
    if(abs(get_actual(STICK_2_Y)) < StickNoise) { set_val(STICK_2_Y, 0.0); }
}
 
combo HomeBlock {
    set_val(HOME, 0);
    wait(300);
}
 
combo ShareButtonShortcut {
    set_val(SHARE, 100);
    wait(40);
}

Re: how do i connect it to ps4

PostPosted: Thu Aug 08, 2019 1:34 pm
by Cokey
thanks you.