[Ohrrpgce] OHR Game Pad Buttons as Strings

Ralph Versteegen teeemcee at gmail.com
Thu May 19 07:21:06 PDT 2022


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.

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.
SDL has a function to get the type of a controller, as one of the following:
    SDL_CONTROLLER_TYPE_UNKNOWN,  (everything else)
    SDL_CONTROLLER_TYPE_XBOX360,
    SDL_CONTROLLER_TYPE_XBOXONE,
    SDL_CONTROLLER_TYPE_PS3,
    SDL_CONTROLLER_TYPE_PS4,
    SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO,
    SDL_CONTROLLER_TYPE_PS5,
    SDL_CONTROLLER_TYPE_AMAZON_LUNA,
    SDL_CONTROLLER_TYPE_GOOGLE_STADIA
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.
https://github.com/libsdl-org/SDL/issues/3497) and so many other special
cases that it simply requires testing to figure out how it actually behaves.

Someone also started on a library to provide controller button names for
SDL (https://github.com/cxong/SDL_JoystickButtonNames) 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.


On Thu, 19 May 2022 at 13:47, Matt Edson <colesloth at gmail.com> wrote:

> Hey guys,
>
> This is mostly for Ralph as I think he's done something before but in the
> event James has information first...
>
> 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.
>
> 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?
>
> Am I mis-remembering this?
>
> Thanks fellahs!
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.motherhamster.org/pipermail/ohrrpgce-motherhamster.org/attachments/20220520/17f1ad3b/attachment.html>


More information about the Ohrrpgce mailing list