Skip to content

Conversation

@AL2009man
Copy link
Contributor

@AL2009man AL2009man commented Mar 5, 2025

what SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS does is that SDL's Controller API will follow on Button Labels, by default: it is set to 1. Consequences: the modern Nintendo Switch layout will be using the Nintendo Layout across Menu Navigation and Gameplay.

     (Y)              (X)
  (X)   (B)        (Y)   (A)
     (A)              (B)

  Standard         Nintendo

In the case of Sonic Unleashed: every single part of the game will be using Nintendo Layout, thus between the Daytime and Night time stages will make the gameplay much harder than it really is due to muscle memory. This will require Nintendo users to rely on a Button Remapping solution just to correct it.

This pull request is essentially a simple hack that adds SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS on hid::Init list and set the value to 0. Forcing the game to use the Positional Layout across all controllers, SDL3-style. The only downside is that for older Nintendo controllers like Wii family of controllers, GameCube or even SEGA Controllers; it'll will also follow the Face Button Positional layout. (refer to SDL_GameControllerDB's Mapping Guide)

Until Nintendo Switch controller support gets properly added (which for some reason: SDL_HINT_JOYSTICK_HIDAPI_SWITCH is missing) and/or Action Remapping gets added, this is considered a temporary fix on #488, as it'll make Nintendo controllers use the Positional layout instead of the Labeled layout.

Experimenting a way to add a hint for Button Labels. It should attempt to fix the Nintendo Layout issue when using a Nintendo Switch controller
@AL2009man AL2009man changed the title Face Button layout follows Positional Face Button layout follows Positional Button layout Mar 5, 2025
@AL2009man AL2009man changed the title Face Button layout follows Positional Button layout Face Button follows Positional Button layout instead of Labels Mar 5, 2025
@blueskythlikesclouds
Copy link
Member

I queued CI, you can test if this works through the CI build artifacts.

@AL2009man AL2009man marked this pull request as ready for review March 6, 2025 01:37
@AL2009man AL2009man closed this Mar 6, 2025
@AL2009man AL2009man reopened this Mar 6, 2025
@AL2009man
Copy link
Contributor Author

AL2009man commented Mar 6, 2025

I queued CI, you can test if this works through the CI build artifacts.

was able to test between the Release Build and the Debug build (that one is purely for testing reasons). Based on my quick testing session: I don't think the code is working as intended (despite me accidentally pressing merge review.)

I will have to look further into hid/driver/sdl_hid.cpp and see what I could do with it, I believe there's a likely chance that it's being overriding my existing changes.


edit: quick update - earlier: I was messing around with the bat file for experimentation. I intentionally unhinted the PS5 stuffs and it seems to ignore my change. There's a likely chance that something is indeed overriding the hint changes.


for now: don't merge this pull request until I (or others) able to confirm if it works.

@AL2009man AL2009man marked this pull request as draft March 6, 2025 02:06
@AL2009man AL2009man marked this pull request as ready for review March 6, 2025 05:07
@AL2009man
Copy link
Contributor Author

AL2009man commented Mar 6, 2025

After troubleshooting (turns out: my Visual Studios install got messed up, had to reinstall it) and testing between the main brand to my fork: I can directly confirm that the HINT does work as intended.

It should be ready to merge now.

Copy link
Member

@hyperbx hyperbx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation seems correct, needs testing with various Nintendo Switch controllers.

AL2009man added a commit to AL2009man/UnleashedRecomp that referenced this pull request Mar 20, 2025
since hedge-dev#1045 will include it: we're gonna get rid of it on this code section to avoid conflicts.
AL2009man added a commit to AL2009man/UnleashedRecomp that referenced this pull request Mar 22, 2025
to avoid conflictions with other PRs (hedge-dev#1086 and hedge-dev#1045): the remaining codebae was restore to how the master build look.

the downside is that it makes it far harder to test it's behavior with Steam Input mode. but this is only temporarily until it gets added to the Master branch.
@blueskythlikesclouds blueskythlikesclouds merged commit acf260a into hedge-dev:main Mar 28, 2025
9 checks passed
blueskythlikesclouds pushed a commit that referenced this pull request Mar 29, 2025
…SDL (#1086)

* Experimenting Button Label

Experimenting a way to add a hint for Button Labels. It should attempt to fix the Nintendo Layout issue when using a Nintendo Switch controller

* Create c-cpp.yml

* Create cmake-multi-platform.yml

* Create apply-patch.yml

* removing the workflows

* added experimental Steam Virtual Gamepad support

* restoring notes for Button Labels.

* Initial Gamepad Hotplug Logic improvements

This changes the way how a Controller will be prioritized. By default: it'll always prioritize based on Player 1. It should play nicely with Steam Deck's internal inputs when Steam Input is active

* Lightbar detection when using multiple PlayStation controllers at the same time.

An attempt to remedy the Lightbar activation. While Player 2/3/4 will override the in-game lightbar event upon connection: it'll later revert back to the in-game event.

* Attempt to reduce Input leaking

To avoid "the Controller is leaking" situation, there's now a Gamepad stat management that should reset Controller state based on connected controller.

* Lightbar active fix when gamepad plugged first prior to game launch

Another attempt to fix the lightbar by redoing the controller state mangement. For some reason: the Lightbar gets disabled when a controller is already plugged prior to game launch. It reverts back to normal until the next game event.

* Revert "restoring notes for Button Labels."

This reverts commit ef4e37c.

* Reapply "restoring notes for Button Labels."

This reverts commit f3ddd80.

* Moving all Gamepad Hotplug changes to separate branch

To ensure all Hotplug-related changes don't accidentally get leftover: this commit will revert all the back back to the accidental removal of Button Label's note.

* added SDL's GameController naming convention as Fallback

If EInputDeviceExplicit doesn't recognize a specific Controller Type or Device: it'll fallback to SDL's naming conventions. This helps troubleshooting Controller-related issues when using the debug console.

* Official device naming scheme for EInputDeviceExplicit

Changes some of EInputDeviceExplicit's names to match the device's official name (such as Nintendo Switch Pro Controller, Xbox Wireless Controller, Amazon Luna Controller, etc.)

* spacing formatting fix

* remove "SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS" hint

since #1045 will include it: we're gonna get rid of it on this code section to avoid conflicts.

* moved EInputDevice Unknown class to the top priority

* Replacing EInputDeviceExplicit with SDL_GameControllerName

Based on @hyperbx's suggestions: It'll look for SDL's Controller Name as opposed to EInputDevice's naming scheme.

* remove hid::GetInputDeviceName() from hid.ccp

Now that SDL_GameControllerName handles Controller naming conventions, the hid.ccp portion of GetInputDeviceName is no longer needed.

* Fix indentation

---------

Co-authored-by: Hyper <34012267+hyperbx@users.noreply.github.com>
@AL2009man AL2009man deleted the Nintendo-Layout-tempt-fix branch March 29, 2025 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants