Skip to content

Uses Positional Face Button Layout instead of Button Labels#627

Open
AL2009man wants to merge 10 commits intofgsfdsfgs:portfrom
AL2009man:PositionalLayout
Open

Uses Positional Face Button Layout instead of Button Labels#627
AL2009man wants to merge 10 commits intofgsfdsfgs:portfrom
AL2009man:PositionalLayout

Conversation

@AL2009man
Copy link
Copy Markdown

@AL2009man AL2009man commented Jun 13, 2025

this SDL Hint will disable SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS. allowing all Controllers to use the positional layout (SDL3-style) as opposed to Button Labels. refer to #693 for more info

This addresses a specific problem with Nintendo Switch controllers where the Face Buttons are assigned in a literal Button Symbol position, causes muscle memory issues while maintaining consistency across all modern controllers.

for those who...somehow, prefer the prior setup: you can restore it by either rebinding it from Key Binding (per controller) or set useNintendoLayout to 1 (global, affects all Controllers).

this SDL Hint will disable `SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS`. allowing all Controllers to use the positional layout (SDL3-style) as opposed to Button Labels.

This addresses a specific problem with Nintendo Switch controllers where the Face Buttons are assigned in a literal Button Symbol position, causes muscle memory issues while maintaining consistency across all modern controllers.

for those who...somehow, prefer the prior setup: you can restore it by either rebinding it from Key Binding (per controller) or set `useNintendoLayout` to 1 (global, affects all Controllers).
@AL2009man AL2009man marked this pull request as ready for review June 13, 2025 01:43
@AL2009man AL2009man marked this pull request as ready for review June 13, 2025 01:43
AL2009man added a commit to AL2009man/perfect_dark that referenced this pull request Jun 13, 2025
this will be moved to a separate PR (fgsfdsfgs#627).
To compensate for Positional Layout change: the `n64joybinds` for `CK_A` and `CK_B` are reversed by default, if the user happens to use a third-party N64 Controller with PC Support: this should avoid less friction
AL2009man

This comment was marked as outdated.

@AL2009man AL2009man requested a review from fgsfdsfgs July 8, 2025 02:03
AL2009man added a commit to AL2009man/perfect_dark that referenced this pull request Jul 25, 2025
* added gitignore

* fixed Button Layout for Nitntendo Controllers

`SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS` will follow the Button Labels, which causes issues in games that uses it. This commit will turn it off by default, but the default can be restored via `useNintendoLayout` within pd.ini file

* fixed Face button layout for Nintendo Switch, Japanese face button layout

`SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS` is set to 0, which will follow the positional diamond-shaped face buttons on the game controller. making everything more streamlined and easier to translate across all modern contorllers. This solves a specific issue with

Japanese-style face buttons for `BUTTON_UI_ACCEPT`/`BUTTON_UI_CANCEL` actions has been added. A bit of a hacky workaround, but it'll do for now. By default: it'll only kicks in when using a Nintendo Switch controller, but `JapaneseButtonLayout` is accessible within `pd.ini`

* remove "/vscode" from .gitignore

leftovers due to switching to Visual Studios code

* updated documentation for the new button layout

* changed title from `inputIsSwitchController` to `inputIsNintendoSwitchController`

* putting guardrails for GitHub Action CI

* added UI Menu text to reflect the Japanese layout

when going to the Keybind page, you'd see "[JPN LAYOUT - B/A]" on UI Accept/Cancel text, UI Text will change dynamically.

* another attempt to fix build-i686-linux

* replaced Action-based swaps with hardcoded button inputs when using Japanese layout

also changed the guard function for GitHubAction CI

* ditched hardcoded button inputs for the time being

reverted back to the game action-based setup for the time being. this might be revised when a separate PR changes the Button Input labels. (make it easier to troubleshoot

* updated default Joystick deadzone to 6500 / 6

to better accout for uncalibrated joysticks: the default joystick slider will be increasing to 6 percent. This should address a specific issue for first-party Nintendo Switch Pro Controller users who can't calibrate their joystick drifts.

* removed NintendoLayout for the time being

this will be moved to a separate PR (fgsfdsfgs#627).

* Restored original default deadzone to prepare for future SDL2 release

libsdl-org/SDL#13260 addresses this particular issue for Nintendo Switch Pro Controller's center deadzone, this: the original default deadzone has been restored to 4 percent and 6 percent

* Adjustments Japanese Layout input handling

Cleaned up and fixed the remaining bugs within the input system. Options Menu's Bind UI should now correctly reflect the Japanese Layout

* attempt fix regression for i686-linux

* restored previous workaround for GitHub Action compiling

* replaced SDL Buttons with CK_BUTTON's

* removed Getter and Setter for Japanese Layout for now

temporarily removed Get and Set functions, as it's leftover code for a pending Menu UI toggle..

* Simplified Japanese Layout setup

To better prepare for `SDL_GetGamepadButtonLabel`/SDL3: the entire setup has been simplified by combining `inputIsJapaneseLayoutActive` and `inputRemapUIButton` into one, while giving it a new name

* attempt whitespace fix

* code cleanup

* fixed `SDL_VERSIONATLEAST number

double-checked SDL2 version to addrsss incorrect build release`
@fgsfdsfgs
Copy link
Copy Markdown
Owner

I'd argue useNintendoLayout should be set to 1 by default, to not confuse people that already had a config from before this change.

@AL2009man
Copy link
Copy Markdown
Author

AL2009man commented Aug 23, 2025

I'd argue useNintendoLayout should be set to 1 by default, to not confuse people that already had a config from before this change.

You sure? This will become a problem when you guys start migrating to SDL3, which will deprecate SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS in the process.

You'll have to create a entirely new Face Button swap detection mechanism if you really wanna ensure Nintendo Switch controller users maintain the same config setup as before.

edit: I can plan on making the NintendoLayout as the default and change #625 to follow useNintendoLayout, but this ultimately depends on @fgsfdsfgs' wishes.

@fgsfdsfgs
Copy link
Copy Markdown
Owner

fgsfdsfgs commented Aug 23, 2025

Well, my point is, if I take this PR by itself and merge it, by default it should work like it did before this PR, because updating and suddenly getting your accept/cancel buttons swapped is probably a bit jarring. And from your comments in the code it seems like useNintendoLayout=1 would correspond to that state? Or did I misread "this is default hint in SDL 2.0.6 and later" as the opposite of what it actually is?

To better reflect `SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS`: the name has been changed. that also means the order of which has been swapped out.
@AL2009man
Copy link
Copy Markdown
Author

AL2009man commented Aug 23, 2025

The way how I have written the notes is based upon SDL_Hints documents. Those who might be reading the code may not be familiar to those who haven't dabbled with SDL before. I'll go ahead and update the name and description to better clarity. (won't be pushed over to this PR until i get a response)

that means:

usePositionalFaceButtonLayout=0 - uses Button Labels function
usePositionalFaceButtonLayout=1 - uses Positional Face Button Layout

if usePositionalFaceButtonLayout is set to 0: the Face Button layout will be following the Button Labels (A/B/X/Y) of your controller. Prior to this PR: this is the default as per SDL SetHint, If using a Nintendo GameCube Controller, N64 Controller or heck, any NSO Nintendo Controllers: the layout of the physical face buttons will be more direct about it. Basically: this is the same function as before, but again: it only applies to Controllers that doesn't follow the Xbox/PlayStation layout...if you were to switch between a Xbox to Nintendo Switch controller for testings: you'd get a muscle memory issue.

if said toggle is set to 1: that specific SDL hint will instead be based on the Face Button's diamond-shape positions (SOUTH/EAST/WEST/NORTH) instead, and this will become the defacto default starting in SDL 3.2.0 while removing SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS entirely, the SDL maintainers will instead recommend you to create a "UI Accept and Cancel" system instead (refer to libsdl-org/SDL#6117, there's a reason why SDL maintainers ditched the Face Button Labels)

as for Accept/Cancel stuffs (#693): don't worry, I already have a plan. If you want usePositionalFaceButtonLayout=0: I'll need to go ahead and disabled the entire function when usePositionalFaceButtonLayout=0 is in use.

ultimately, @fgsfdsfgs: you got three choices, all three choice will ultimately lead you to a "illusion of choice":

  • set usePositionalFaceButtonLayout=0 as the default, retaining the Face Button label order from before
    • however: when the SDL3 migration begins: said toggle will have to be removed entirely, or implement a new Face Button-specific functionality to maintain backwards compatibility.
  • set usePositionalFaceButtonLayout=1 as the default, no need to deal with the headache during SDL3 migration.
  • set usePositionalFaceButtonLayout=0 as the default, but UI Accept/Cancel Swap support #693 will enable the toggle by default going forward, this better accounts for backwards compatibility

@fgsfdsfgs
Copy link
Copy Markdown
Owner

fgsfdsfgs commented Aug 23, 2025

One thing that's for sure is that we'll worry about the SDL3 migration when we get there. I'm still waiting on the Switch port to stabilize, so it'll probably take a while.

If this only applies to some controllers, then we can probably merge this as-is.

@AL2009man
Copy link
Copy Markdown
Author

AL2009man commented Aug 23, 2025

If this only applies to some controllers, then we can probably merge this as-is.

that's correct. if usePositionalFaceButtonLayout is set to 0: some controllers like the Nintendo Switch controllers' face buttons will be following the labels. If set to 1: it'll follow the Xbox-style layout regardless of what controller you're using, refer to this image if you'd like to have a better idea.

image

AL2009man added a commit to AL2009man/perfect_dark that referenced this pull request Jan 20, 2026
to prepare for fgsfdsfgs#627, this commit added Accept/Cancel Swap for Menu Navigation.

This function only applies when using a Nintendo Switch controller, but it can be forcefully enabled for all Controller Types within `pd.ini`'s `swapAcceptCancelButtons`
AL2009man added a commit to AL2009man/perfect_dark that referenced this pull request Feb 18, 2026
To prepare for fgsfdsfgs#627, this commit added Accept/Cancel Swap for Menu Navigation.

This function only applies when using a Nintendo Switch controller, but it can be forcefully enabled for all Controller Types within `pd.ini`'s `swapAcceptCancelButtons`
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.

2 participants