Cyberpunk 2077 Input Translater I made for Ps5 & Gyro Joycon

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

Cyberpunk 2077 Input Translater I made for Ps5 & Gyro Joycon

Postby teddy18 » Wed Apr 28, 2021 12:27 am

Game Settings

Controls
Controller-Vibration 100
Steering sensitivity 100
Outer Deadzone: 0.90
Inner Deadzone: 0.10

First Person Camera
Horizontal Sensitivity: 31
Vertical Sensitivity: 26
Zoom Sensitivity 1
Show Advanced Options: On
Response Curve: default (recommended)
Horizontal Turning Bonus: 1.30
Vertical Turning Bonus: 0.30
Turning Ramp-Up Time: 0
Turning Delay: 0

Horizontal Turning (ADS): 0.30
Vertical Turning (ADS): 0.60
Turning Ramp-Up (ADS): 0,10
Turning Delay: 0 (ADS): 0,20

Third-Person Camera
Horizontal Sensitivity: 19
Vertical Sensitivity: 16
Response Curve: default (recommended)

German (Deutsch)

Controller

Controller-Vibration 100
Lenkempfindlichkeit 100
Aüsere NULLZONE 0.90
Innere Nullzone 0.10

First-Person-Kamera (Controller)

Horizontale Empfindlichkeit 21
Vertikale Empfindlichkeit 16
Verringerung der Zoom-Empfindlichkeit 1

Erweiterte Optionen Anteigen: An
Reaktionskurve Empfohlen
Horizontale Rotationsbonus 1.30
Vertikale Rotationsbonus 0.60
Ramp-up-Zeit 0
Rotationsverzögerung 0

Horizontale Rotationsbonus (ADS) 0.30
Vertikale Rotationsbonus (ADS) 0.60
Ramp-up-Zeit (ADS) 0.10
Rotationsverzögerung (ADS) 0.20

Third-Person.Kamera (Controller)
Horizontale Empfindlichkeit 19
Vertikale Empfindlichkeit 16
Reaktionskurve Empfohlen


MOuse 800 Dpi 125 Poling Rate
Titan Two Settings default

Testet on Ps5 60 Fps
Controller to Hori Tac Grip Ver 1.0 without bluetooth for authentication ( third-party PS4 controller)

Mouse in Port A
Keyboard in Port PROG (or INPUT-D with OTG adapter)

Hori Tac Grip in Usb Port B

Titan Firmware 2021-04-04, Ver 1.11-1

Gyro Control Joy Con Script

Code: Select all
#pragma METAINFO("Cyberpunk 2070 Ps4 Ps5 Gyro Control Joy Con ", 1, 1, "<teddy18>")
 
#include <switch.gph>
//Sensitivity for Gyro
#define SENSITIVITY_X   21.00
#define SENSITIVITY_Y   31.01
 
#define DEADZONE_X      18.05// Deadzone GYRO_1_YZ Input
#define DEADZONE_Y      18.16// Deadzone GYRO_1_YX Input
#define DEADZONE_D      0.16// Deadzone Diagonal input
 
#define sprint_threshold    92.00// Set threshold
#define inner_deadzoneX      22.63 // Create a Deadzone
#define inner_deadzoneY      22.43 // Create a Deadzone
 
 
main {
 {   static fix32 offset_x;
     static fix32 offset_y;
 if(abs(get_val(STICK_1_X)) <= DEADZONE_X && abs(get_val(STICK_1_Y)) <= DEADZONE_Y) {
     motion_aiming(offset_x, offset_y);
    }
 }
     // Adds an inner deadzone without stripping away the obfuscation noise created by XIM.
    if(abs(get_val(STICK_1_Y)) > 5.00 && abs(get_val(STICK_1_Y)) < inner_deadzoneY) {
        set_val(STICK_1_Y, 0.0);
    }
    if(abs(get_val(STICK_1_X)) > 5.00 && abs(get_val(STICK_1_X)) < inner_deadzoneX) {
        set_val(STICK_1_X, 0.0);
    }
 
    // Creates an outer deadzone to prevent Joy-Con stick drift.
    if(get_val(STICK_1_Y) <= sprint_threshold * -1.00) {
        set_val(STICK_1_Y, -100);
    }
    if(get_val(STICK_1_Y) >= sprint_threshold) {
        set_val(STICK_1_Y, 100);
    }
    if(get_val(STICK_1_X) <= sprint_threshold * -1.00) {
        set_val(STICK_1_X, -100);
    }
    if(get_val(STICK_1_X) >= sprint_threshold) {
        set_val(STICK_1_X, 100);
    }   
 
}
//
void motion_aiming(fix32 offset_x, fix32 offset_y) {
    static fix32 accel_x, accel_y;
    static fix32 stick_x, stick_y;
    if(accel_x != get_actual(GYRO_1_Z) || accel_y != get_actual(GYRO_1_X)) {
        accel_x = get_actual(GYRO_1_Z);
        accel_y = get_actual(GYRO_1_X);
        stick_x = (accel_x - offset_x) * SENSITIVITY_X;
        stick_y = (accel_y - offset_y) * SENSITIVITY_Y;
 
        fix32 signal_x = (stick_x < 0.0) ? (stick_x = inv(stick_x), -1.0) : (stick_x > 0.0) ? 1.0 : 0.0;
        fix32 signal_y = (stick_y < 0.0) ? (stick_y = inv(stick_y), -1.0) : (stick_y > 0.0) ? 1.0 : 0.0;
        fix32 angle = atan2(stick_y, stick_x);
 
        stick_x = clamp(((DEADZONE_X * pow(cos(angle), DEADZONE_D)) + stick_x) * signal_x, -100.0, 100.0);
        stick_y = clamp(((DEADZONE_Y * pow(sin(angle), DEADZONE_D)) + stick_y) * signal_y, -100.0, 100.0);
    }
    set_val(STICK_1_X, stick_x);
    set_val(STICK_1_Y, stick_y);
    return;
}


Ver 1.2 Push Sl Button to Turn off Gyro if you are in Menu for upgrade weapon sell

Code: Select all
#pragma METAINFO("Cyberpunk 2070 Ps4 Ps5 Gyro Control Joy Con", 1, 2, "<teddy18>")
 
#include <switch.gph>
//Sensitivity for Gyro
#define SENSITIVITY_X   21.00
#define SENSITIVITY_Y   31.01
 
#define DEADZONE_X      18.05// Deadzone GYRO_1_YZ Input
#define DEADZONE_Y      18.16// Deadzone GYRO_1_YX Input
#define DEADZONE_D      0.16// Deadzone Diagonal input
 
#define sprint_threshold    92.00// Set threshold
#define inner_deadzoneX      22.63 // Create a Deadzone
#define inner_deadzoneY      22.43 // Create a Deadzone
bool GyroOff;// Switch SL BUtton to toggle on/off Gyrof
main {   
 {   static fix32 offset_x;
     static fix32 offset_y;
 if(abs(get_val(STICK_1_X)) <= DEADZONE_X && abs(get_val(STICK_1_Y)) <= DEADZONE_Y) {
     motion_aiming(offset_x, offset_y);
    }
 } 
     // Adds an inner deadzone without stripping away the obfuscation noise created by XIM.
    if(abs(get_val(STICK_1_Y)) > 5.00 && abs(get_val(STICK_1_Y)) < inner_deadzoneY) {
        set_val(STICK_1_Y, 0.0);
    }
    if(abs(get_val(STICK_1_X)) > 5.00 && abs(get_val(STICK_1_X)) < inner_deadzoneX) {
        set_val(STICK_1_X, 0.0);
    }
 
    // Creates an outer deadzone to prevent Joy-Con stick drift.
    if(get_val(STICK_1_Y) <= sprint_threshold * -1.00) {
        set_val(STICK_1_Y, -100);
    }
    if(get_val(STICK_1_Y) >= sprint_threshold) {
        set_val(STICK_1_Y, 100);
    }
    if(get_val(STICK_1_X) <= sprint_threshold * -1.00) {
        set_val(STICK_1_X, -100);
    }
    if(get_val(STICK_1_X) >= sprint_threshold) {
        set_val(STICK_1_X, 100);
    }
    // Switch SL BUtton to toggle on/off Gyrof
    if(get_actual(BUTTON_20)){
        GyroOff =! GyroOff;
    }
    if(GyroOff) {
        set_val(STICK_1_X, 0);
    set_val(STICK_1_Y, 0);
    }   
}
//
void motion_aiming(fix32 offset_x, fix32 offset_y) {
    static fix32 accel_x, accel_y;
    static fix32 stick_x, stick_y;
    if(accel_x != get_actual(GYRO_1_Z) || accel_y != get_actual(GYRO_1_X)) {
        accel_x = get_actual(GYRO_1_Z);
        accel_y = get_actual(GYRO_1_X);
        stick_x = (accel_x - offset_x) * SENSITIVITY_X;
        stick_y = (accel_y - offset_y) * SENSITIVITY_Y;
 
        fix32 signal_x = (stick_x < 0.0) ? (stick_x = inv(stick_x), -1.0) : (stick_x > 0.0) ? 1.0 : 0.0;
        fix32 signal_y = (stick_y < 0.0) ? (stick_y = inv(stick_y), -1.0) : (stick_y > 0.0) ? 1.0 : 0.0;
        fix32 angle = atan2(stick_y, stick_x);
 
        stick_x = clamp(((DEADZONE_X * pow(cos(angle), DEADZONE_D)) + stick_x) * signal_x, -100.0, 100.0);
        stick_y = clamp(((DEADZONE_Y * pow(sin(angle), DEADZONE_D)) + stick_y) * signal_y, -100.0, 100.0);
    }
    set_val(STICK_1_X, stick_x);
    set_val(STICK_1_Y, stick_y);
    return;
}
Attachments
Cyberpunk 2070 Ps4 Ps5 Gyro Control Joy Con 1.1.gpc
Cyberpunk 2077 Gyro Control Joy Con 1.1
(2.32 KiB) Downloaded 104 times
Cyberpunk 2077 Ps4 Ps5 Ver 3.0.txt
Cyberpunk 2077 Settings
(1.64 KiB) Downloaded 110 times
Cyberpunk 2077 (Ps4 Ps5) Ver 3.0.git
Cyberpunk 2077 Input Translater
(134 Bytes) Downloaded 98 times
Cyberpunk 2077 Ps4 Ps5 Ver 3.0.git
Cyberpunk 2077 Input Translater
(99 Bytes) Downloaded 94 times
User avatar
teddy18
Lieutenant
Lieutenant
 
Posts: 346
Joined: Sun Jul 19, 2015 4:18 pm

Re: Cyberpunk 2077 Input Translater I made for Ps5 & Gyro Jo

Postby Mad » Fri Apr 30, 2021 11:11 pm

Thanks for sharing Teddy. :smile0517:

Despite the hate I had fun with cyberpunk.
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord (2K / FPS)
Mad
Major General
Major General
 
Posts: 4532
Joined: Wed May 22, 2019 5:39 am

Re: Cyberpunk 2077 Input Translater I made for Ps5 & Gyro Jo

Postby teddy18 » Sat May 01, 2021 8:53 pm

Thank you the game is awesome
User avatar
teddy18
Lieutenant
Lieutenant
 
Posts: 346
Joined: Sun Jul 19, 2015 4:18 pm

Re: Cyberpunk 2077 Input Translater I made for Ps5 & Gyro Jo

Postby mss1988 » Mon Jun 14, 2021 5:55 am

Thank you for this excellent script. Since the first time I tried it, it totally exceeded my expectations how good it works.

I modified it to support gyro calibration and sensitivity adjustment.
Can I have your permission to release the modified version?
User avatar
mss1988
Staff Sergeant
Staff Sergeant
 
Posts: 13
Joined: Mon May 24, 2021 1:07 pm

Re: Cyberpunk 2077 Input Translater I made for Ps5 & Gyro Jo

Postby teddy18 » Mon Jun 14, 2021 7:26 pm

mss1988 wrote:Thank you for this excellent script. Since the first time I tried it, it totally exceeded my expectations how good it works.

I modified it to support gyro calibration and sensitivity adjustment.
Can I have your permission to release the modified version?



Yes of course please send me your script on pn your

Do can speak German ?
User avatar
teddy18
Lieutenant
Lieutenant
 
Posts: 346
Joined: Sun Jul 19, 2015 4:18 pm

Re: Cyberpunk 2077 Input Translater I made for Ps5 & Gyro Jo

Postby mss1988 » Tue Jun 15, 2021 5:45 am

teddy18 wrote:
mss1988 wrote:Thank you for this excellent script. Since the first time I tried it, it totally exceeded my expectations how good it works.

I modified it to support gyro calibration and sensitivity adjustment.
Can I have your permission to release the modified version?



Yes of course please send me your script on pn your


Here's work in progress version. I have to finish a couple of more things before it's ready to be published.

teddy18 wrote:Do can speak German ?

Nein Entschuldigung.

EDIT:

To calibrate, put gamepad on stable surface (e.g. floor) and click L3 + R3 + HOME and wait for 5 seconds.
To change sensitivity use R3 + D-PAD UP/DOWN.

EDIT2:
I didn't test it with JoyCons, I will do that in following days.

EDIT3:
Removed WIP script.

The version 1.0 of the script is available in Online Resources, name:
Motion Aiming with Calibration and DualShock 4 Touch Mimic
viewtopic.php?f=26&t=18364#p112873

And on GitHub:
https://github.com/mlnst/T2MotionAimingWCalib
Last edited by mss1988 on Sat Jun 19, 2021 11:28 pm, edited 2 times in total.
User avatar
mss1988
Staff Sergeant
Staff Sergeant
 
Posts: 13
Joined: Mon May 24, 2021 1:07 pm

Re: Cyberpunk 2077 Input Translater I made for Ps5 & Gyro Jo

Postby teddy18 » Tue Jun 15, 2021 12:16 pm

Thank you will testet IT later

I think for Calibration you need other button map because I have experience
With joyshookmaper
That the calibration work properly I have to set auto Calibration when the script start
That will be great if that will be work on Titan two

But other idde you can connect controller on Port B Titan two like you Ps4 Controller etc dependent witch console you use

Add in the script that only button pressed on usb Port B will calibration the joy Cons
Or you can add if you press a keyboard but
User avatar
teddy18
Lieutenant
Lieutenant
 
Posts: 346
Joined: Sun Jul 19, 2015 4:18 pm

Re: Cyberpunk 2077 Input Translater I made for Ps5 & Gyro Jo

Postby mss1988 » Tue Jun 15, 2021 1:38 pm

Don't worry. There's 2 seconds delay before calibration starts. Therefore the controller will stay sill while the calibration is running. Like I said, you have to put it on solid surface, and not touch it while it's calibrating.
User avatar
mss1988
Staff Sergeant
Staff Sergeant
 
Posts: 13
Joined: Mon May 24, 2021 1:07 pm

Re: Cyberpunk 2077 Input Translater I made for Ps5 & Gyro Jo

Postby teddy18 » Tue Jun 15, 2021 5:06 pm

Ok I am Curious how you code the calibration Function

Where are from ?
User avatar
teddy18
Lieutenant
Lieutenant
 
Posts: 346
Joined: Sun Jul 19, 2015 4:18 pm

Re: Cyberpunk 2077 Input Translater I made for Ps5 & Gyro Jo

Postby mss1988 » Tue Jun 15, 2021 6:38 pm

I take average value of 3000 measurements of x, y and z values while the controller is totally still. Then subtract those offsets on gyro aiming.

I'm originally from Serbia, but I live in France.
User avatar
mss1988
Staff Sergeant
Staff Sergeant
 
Posts: 13
Joined: Mon May 24, 2021 1:07 pm

Next

Return to GPC2 Script Programming

Who is online

Users browsing this forum: Baidu [Spider] and 85 guests