Cyberpunk 2077 Input Translater I made for Ps5 & Gyro Joycon

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

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

Postby teddy18 » Wed Jun 16, 2021 2:45 pm

I am Serbia I live in Germany

I have still to test I don't had a look on your script because watch the Em
And my joy con war emty

If you want we can have contract on discord
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 teddy18 » Wed Jun 16, 2021 3:47 pm

is not working on Joy con

I have gyro inputs but the inputs are not sended to right stick Stick

my scrept

Code: Select all
#pragma METAINFO("Resident Evil 2 Remake Xbox One 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      30.02// Deadzone GYRO_1_YZ Input
#define DEADZONE_Y      30.02// Deadzone GYRO_1_YX Input
#define DEADZONE_D      0.13// Deadzone Diagonal input
 
#define sprint_threshold    92.00// Set threshold
#define inner_deadzoneX      33.43 // Create a Deadzone
#define inner_deadzoneY      33.24// Create a Deadzone
 
init {
    const uint8 cmap[] = { 0x02, 0x2A, 0x01, 0x2A, 0x2A, 0x2A, 0x2A, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x12, 0x13, 0x2A, 0x2A, 0x2A, 0x17, 0x18, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A };
    remapper(cmap);
}
 
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;
}


This line sende gyro input to Right stick { 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);
}
}


in your code is the line there i have seen you modi fine my script but Gyro inputs are not sendet to right stick
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 » Wed Jun 16, 2021 4:03 pm

Please send me your Discord id or server link where I can find you as private message. We will make it to work with JoyCons too.
User avatar
mss1988
Staff Sergeant
Staff Sergeant
 
Posts: 13
Joined: Mon May 24, 2021 1:07 pm

Previous

Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 84 guests