<div dir="ltr"><div>There is currently no way to get the actual label of a button on the player's controller. The "get scancode name" command can be used for joystick buttons but returns a fixed name. There's also a separate system in Custom for defining OS-specific button names which can be embedded in strings with ${B#} codes but that won't help either, as it's intended for smoothing over PC/Android/Ouya/etc differences.</div><div><br></div><div>I spoke about wanting to implement something to make a best guess as to the button names, which would then be returned by "get scancode name" and used by ${B#} codes.</div><div>SDL has a function to get the type of a controller, as one of the following:</div><div>    SDL_CONTROLLER_TYPE_UNKNOWN,  (everything else)<br></div><div>    SDL_CONTROLLER_TYPE_XBOX360,<br>    SDL_CONTROLLER_TYPE_XBOXONE,<br>    SDL_CONTROLLER_TYPE_PS3,<br>    SDL_CONTROLLER_TYPE_PS4,<br>    SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO,<br>    SDL_CONTROLLER_TYPE_PS5,<br>    SDL_CONTROLLER_TYPE_AMAZON_LUNA,<br>    SDL_CONTROLLER_TYPE_GOOGLE_STADIA<br></div><div>So I can use that to at least easily handle PS3+ button names correctly (and I can go add that)... but not my PS1 controller. It also can tell the name of a controller, which we could use to try to detect PS controllers or ones such as NES, SNES or Gamecube where the actual button labels may not match what SDL/OHRRPGCE calls them... however I don't know whether the buttons are actually swapped around on these, because SDL has a config setting for whether to swap the buttons, and special cases for whether to respect the config setting (e.g. <a href="https://github.com/libsdl-org/SDL/issues/3497">https://github.com/libsdl-org/SDL/issues/3497</a>) and so many other special cases that it simply requires testing to figure out how it actually behaves.<br></div><div><br></div><div>Someone also started on a library to provide controller button names for SDL (<a href="https://github.com/cxong/SDL_JoystickButtonNames">https://github.com/cxong/SDL_JoystickButtonNames</a>) but unfortunately its database only has 4 controllers, and it doesn't even have defaults according to the SDL_CONTROLLER_TYPEs above. I was thinking of extending it with the defaults/guesses I described above, and we can extend its DB if anyone wants to report their controller. Or maybe it's just simpler to skip it.</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 19 May 2022 at 13:47, Matt Edson <<a href="mailto:colesloth@gmail.com">colesloth@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hey guys,</div><div><br></div><div>This is mostly for Ralph as I think he's done something before but in the event James has information first...</div><div><br></div><div>I'm at the very very end of Mr. Triangle's Maze. Game pad support! I need to be able to convey to the player what the buttons are when it's not keyboard related, but the problem I have is there's a lot of different kinds of game pads. The average player probably uses an X-Box equivalent but that's assuming.</div><div><br></div><div>I thought about just calling them left face button, right face button, etc. but then I remembered I saw a file TMC made where it showed different values for game pads. Ideally I'd like to use the correct button verbiage to not confuse players. Is there also a way to tell if the player is actively using a game pad or a keyboard beyond checking for individual keypresses?<br></div><div><br></div><div>Am I mis-remembering this?</div><div><br></div><div>Thanks fellahs!<br></div></div>
</blockquote></div>