Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xbox Controller Needs Rebinding if Powered Off #391

Open
1 task done
kilbouri opened this issue Aug 23, 2024 · 8 comments
Open
1 task done

Xbox Controller Needs Rebinding if Powered Off #391

kilbouri opened this issue Aug 23, 2024 · 8 comments
Labels
bug Something isn't working not our fault This isn't an inherent issue with the Lime3DS emulator

Comments

@kilbouri
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Affected Build(s)

Stable 2117.1

Description of Issue

Xbox controller (bluetooth XB1) bindings stop working if the controller is powered off and back on again. My guess is that it receives a new device ID and therefore the stored bindings are no longer mapped to the controller properly.

Expected Behavior

Bindings keep working if the controller is powered off and back on again.

Reproduction Steps

  1. Auto-map a bluetooth Xbox 1 controller (others may reproduce as well)
  2. Verify the bindings are working in-game
  3. Power controller off (hold the Xbox logo)
  4. Power controller back on
  5. Verify the bindings are no longer working in-game
  6. Auto-map the controller again
  7. Bindings now work in-game

Log File

lime3ds_log.txt

System Configuration

CPU: i5 8600K
GPU/Driver: RX 6750XT (24.6.1)
RAM: 32GB
OS: Windows 11 23H2 22631.4037

@kilbouri kilbouri added the bug Something isn't working label Aug 23, 2024
@ghost
Copy link

ghost commented Aug 30, 2024

I have not been able to recreate this issue on 2117.1 with a Dualsense, no matter what i did
And since another user reported the Switch controller as well, seems like more controllers are effected
I do not own an effected controller, so I can't recreate and find the reason of this bug sadly

Hope another person can fix this

@Tartifless
Copy link

This issue is only related with XBOX genuine controller and is linked with SDL2 guid.

The bytes 2 and 3 from guid change with every launch of the app, here is the example with a Xbox series X controller.

  1. Open app and configure controller, the guid in the config file is: 03005b185e040000130b000009057200
  2. Close, re-open app and reconfiguring, now the guid is 030011d65e040000130b000009057200

This is a real pain in the ASS as it requires reconfiguring the same controller over and over again.

I have implemented a fix in my software regarding this issue when using latest SDL versions : i just replace the CRC bytes with 0000, the guid 030000005e040000130b000009057200 is now stable and the controller config remains !

This is the best solution, and it will also avoid future SDL rework of this CRC part.

Maybe this can be implemented in lime3ds and Azahar also @kilbouri @kleidis

@Tartifless
Copy link

Maybe here, to modify the guid before getting the string:

static std::string GetGUID(SDL_Joystick* joystick) { SDL_JoystickGUID guid = SDL_JoystickGetGUID(joystick); char guid_str[33]; SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str)); return guid_str; }

@Xinoehp
Copy link

Xinoehp commented Mar 18, 2025

Can confirm this issue is still present in Azahar 2120 Release Candidate 3. If I find time, I'll look to raise a pull request and implement @Tartifless 's fix, though I can't promise I'll be able to so if anyone else can, it'd be great.

@kilbouri
Copy link
Author

Oh wow, there's activity here. Love it.

Given it has been a while, I want to add some new information. Between making this issue and now, I moved to Manjaro Linux. I cannot reproduce the issue with a fresh from-source build. Makes me wonder if this isn't so much an issue with specifically one type of controller, as it is with how device ids are assigned on Windows. But then, @kleidis can't reproduce it with a Dualsense... Maybe bluetooth vs wired connection makes a difference? Probably worth a deeper investigation with various types of controller and connection methods before patching.

Thanks everyone :)

@Tartifless
Copy link

Tartifless commented Mar 19, 2025

Hello,
As said: this is an issue with xbox genuine controllers, connected with bluetooth, on windows.
The issue is known and fixeable.

SDL team have fixed it here:
libsdl-org/SDL@4fc9509

So 2 options:

  1. wait until next sdl2 release and update sdl version of azahar
  2. fix in azahar code as per my post

Option 2 is done in other emulators, as they kept the guid from before sdl 2.24, without the crc part. That kept them from having issues when they updated sdl and the guid changed.

@OpenSauce04
Copy link
Member

I'm going to treat this as an upstream SDL bug and wait for the fix to make its way in from there

@OpenSauce04 OpenSauce04 added the not our fault This isn't an inherent issue with the Lime3DS emulator label Mar 19, 2025
@Tartifless
Copy link

Still using guid without crc is a safe option, more futureproof (empiric statement) as these sdl guys change the way it's calculated every other version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working not our fault This isn't an inherent issue with the Lime3DS emulator
Projects
None yet
Development

No branches or pull requests

4 participants