drfiemost / Hurrican

A fork of Hurrican, freeware jump and shoot game created by Poke53280, with SDL2 enabled by default, support for libopenmpt and CRT simulation
MIT License
7 stars 2 forks source link

Port to SDL_GameController API #13

Closed drfiemost closed 2 years ago

drfiemost commented 2 years ago

Port to new SDL_GameController API to have a consistent experience with game controllers, see #7 Maybe take the chance to get rid of old SDL too?

Edit: also implement force-feedback support

s1eve-mcdichae1 commented 2 years ago

Heads-up, this is working fine with my namebrand Logitech controller, but on my no-name generic SNES pad from Amazon, the start button still does not do anything.

Is this just a limitation of the controller itself? I don't really know what "SDL" is or means; is it just that some controllers are compatible with it and some are not, or, how does this work? (Just wondering out loud, here, you don't have to teach me "how it works.")

drfiemost commented 2 years ago

You have to create a mapping using SDL2 Gamepad Mapper, if you're lucky it's already included in the SDL_GameControllerDB Anyway you need a file with the mapping string for your controller and set the environment variable SDL_GAMECONTROLLERCONFIG to point to that file. (I haven't tried this so YMMV)

The SDL library has its own embedded configuration: https://github.com/libsdl-org/SDL/blob/main/src/joystick/SDL_gamecontrollerdb.h

drfiemost commented 2 years ago

And now we have force-feedback too!

s1eve-mcdichae1 commented 2 years ago

FF working here 👍

s1eve-mcdichae1 commented 2 years ago

Anyway you need a file with the mapping string for your controller and set the environment variable SDL_GAMECONTROLLERCONFIG to point to that file. (I haven't tried this so YMMV)

Had to use a different tool but I generated a mapping string and set the environment variable, and the cheap Amazon SNES pad works now too!

drfiemost commented 2 years ago

That's good to hear! Tried with an xbox controller and it works fine out of the box. Now we have full features while retaining backward compatibility so this one can be closed.