[SOLVED]SDL v2.0.20 Linux - SDL_JoystickName() - Giving Strange Results?

Hi,

I do most of my game programming on a remote Windows 11 desktop.
(It’s game project’s main target platform OS unfortunately)

I booted up the game on my Linux today for preparation of Linux Steam release.
USB gamepads worked ok, but the custom mapping was not loading at game run.

On Windows(R) the above worked fine, but am using SDL v2.0.22.
On my Linux the game is using SDL 2.0.20.

The problem with gamepads on my Linux is with the “SDL_JoystickName()” command.
I’ll investigate more in the morning, just wondering if this was a known issue on Linux SDL v2.0.20?

Thanks!

Jesse

Hi Again,

Looking again at the code, there might be an issue on my end…
…I’ll hit it with a hammer in the morning and get back to you

Jesse

Ok, got it working, thanks!

    for (Uint8 indexFour = 0; indexFour < 4; indexFour++)
    {
        if (  ( strcmp(joystickNameTemp[indexFour], input->JoystickName[indexFour]) != 0 )  )
        {
            input->JoyUP[indexFour] = Axis1;
            input->JoyDOWN[indexFour] = Axis1;
            input->JoyLEFT[indexFour] = Axis0;
            input->JoyRIGHT[indexFour] = Axis0;
            input->JoyButton1[indexFour] = Button0;
            input->JoyButton2[indexFour] = Button1;

            printf("* Joystick #%i data not matched - joystick reset!\n", indexFour);
        }

        else
        {
            SDL_strlcpy(input->JoystickName[indexFour], joystickNameTemp[indexFour], sizeof input->JoystickName[indexFour]);
        }