HID and Default Protocol in Xbox/PS4

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

HID and Default Protocol in Xbox/PS4

Postby NyzdeN » Sun Sep 06, 2020 1:50 am

Hello guys!
I am developing a script in which I would like to do the following procedure:
    1. If you press the SHIFT button on the keyboard, xbox understands the HID protocol instead of the standard one;
    2. If you press the ALT button on the keyboard, xbox understands it as the console's standard protocol.

I performed numerous tests such as:
    1. Use HID protocol in xbox instead of the standard and write a script that does the opposite.
    2. Use the xbox protocol and write a script that alternates in the middle of the code to execute these specific buttons.
    3. I used KMG with virtual control, using HID protocol (GTuner Beta)

However I was not successful in any. Would you have a solution for this scenario?
The code would look something like.

Code: Select all
 
#include <xb1.gph>
#include "../workdir/_xkeys/xkeys.gph"
 
#define XKEYS_TO_MONITOR_MAX 2
uint8 KEY1, KEY2;
 
init {
    KEY1=xkeys_add(KEY_LEFTALT);
    KEY2=xkeys_add(KEY_LEFTSHIFT);
}
 
main {
     if(xkeys_is_active(KEY1)) combo_run(Example1);
     if(xkeys_is_active(KEY2)){
      // exec HID command (Native SHIFT keyboard)
   }
}
 
combo Example1 {
    set_val(XB1_Y, 100);
    wait(20);
    set_val(XB1_Y, 0);
    wait(20);
    set_val(XB1_RB, 100);
    wait(20);
    set_val(XB1_RB, 0);
 
}
 
 
User avatar
NyzdeN
Sergeant First Class
Sergeant First Class
 
Posts: 18
Joined: Tue Sep 10, 2019 3:33 am

Re: HID and Default Protocol in Xbox/PS4

Postby Mad » Sun Sep 06, 2020 8:04 am

You have to change protocol with port_connect and this takes roughly one second, then you can do whatever you need.
Code: Select all
#include <xb1.gph>
#include "xkeys.gph"
 
#define XKEYS_TO_MONITOR_MAX 2
 
#define DEFAULT_PROTOCOL PROTOCOL_XB1
 
uint8 KEY1, KEY2;
 
init {
    keymapping();
    mousemapping();
 
    KEY1=xkeys_add(KEY_LEFTALT);
    KEY2=xkeys_add(KEY_LEFTSHIFT);
}
 
main {
    key_passthru();
    mouse_passthru();
 
    // holding key1 calls port_connect once
    if(xkeys_event_active(KEY1)) {
        port_connect(PORT_USB_C, PROTOCOL_HID);
    }
    // on release back to DEFAULT_PROTOCOL
    if(xkeys_event_release(KEY1)) {
        port_connect(PORT_USB_C, DEFAULT_PROTOCOL);
    }
}
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord (2K / FPS)
Mad
Major General
Major General
 
Posts: 4533
Joined: Wed May 22, 2019 5:39 am

Re: HID and Default Protocol in Xbox/PS4

Postby NyzdeN » Mon Sep 07, 2020 2:49 am

Hello mad, thanks for the guidance.
Just to contextualize, I would like to obtain the following results as shown in the video below:
https://www.youtube.com/watch?v=jfA6X3RVEsM
(Note that at 8:20, the game (Fortnite) interprets different inputs (Xbox / Keyboard) as you press the keys)

Do you believe it is possible to do this, without the need for a "mod", just using script?

Thank you :smile0517:
User avatar
NyzdeN
Sergeant First Class
Sergeant First Class
 
Posts: 18
Joined: Tue Sep 10, 2019 3:33 am

Re: HID and Default Protocol in Xbox/PS4

Postby J2Kbr » Mon Sep 07, 2020 12:07 pm

Hi NyzdeN, please note that -currently- the Titan Two can output as regular controller OR keyboard/mouse. Both at the same time is not possible.
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: HID and Default Protocol in Xbox/PS4

Postby NyzdeN » Thu Sep 10, 2020 12:25 am

Thanks for the clarification Jeff.
Taking advantage of the moment, are there plans for T2 in future updates to accept this type of behavior? :wink:
User avatar
NyzdeN
Sergeant First Class
Sergeant First Class
 
Posts: 18
Joined: Tue Sep 10, 2019 3:33 am

Re: HID and Default Protocol in Xbox/PS4

Postby J2Kbr » Thu Sep 10, 2020 9:59 am

NyzdeN wrote:Thanks for the clarification Jeff.
Taking advantage of the moment, are there plans for T2 in future updates to accept this type of behavior? :wink:

yes, this is something on the plans. :smile0517:
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: HID and Default Protocol in Xbox/PS4

Postby toom3456 » Sat Sep 12, 2020 9:34 pm

any ETA on dual outputs?
User avatar
toom3456
Corporal
Corporal
 
Posts: 4
Joined: Sat Sep 12, 2020 9:33 pm


Return to GPC2 Script Programming

Who is online

Users browsing this forum: Google [Bot] and 105 guests