Serious-Engine icon indicating copy to clipboard operation
Serious-Engine copied to clipboard

Does this support SDL2 game controller mapping?

Open parkerlreed opened this issue 5 years ago • 4 comments

I'm trying to use a controller in TFE but it doesn't get recognized when setting inputs.

I then thought it may be using the SDL2 game controller mapping and passed that as an environment variable but got nothing.

[parker@alarm Serious-Engine]$ SDL_GAMECONTROLLERCONFIG="060000007e0500000820000000000000,Nintendo Switch Combined Joy-Cons,platform:Linux,a:b0,b:b1,x:b3,y:b2,back:b9,guide:b11,start:b10,leftstick:b12,rightstick:b13,leftshoulder:b5,rightshoulder:b6,dpup:b14,dpdown:b15,dpleft:b16,dpright:b17,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b7,righttrigger:b8," ./Bin/ssam-tfe 
STUBBED: load window icon in /home/parker/build/Serious-Engine/Sources/SeriousSam/MainWindow.cpp, line 168.
STUBBED: Need SDL invisible window or something in /home/parker/build/Serious-Engine/Sources/SeriousSam/MainWindow.cpp, line 327.
STUBBED: !!! FIXME: get the code back in from Ryan's original port. in /home/parker/build/Serious-Engine/Sources/Engine/Base/Stream.cpp, line 921.
STUBBED: Report actual SDL device name? in /home/parker/build/Serious-Engine/Sources/Engine/Sound/SoundLibrary.cpp, line 269.
STUBBED: co-opt the existing T-buffer support for multisampling? in /home/parker/build/Serious-Engine/Sources/Engine/Graphics/SDL/SDLOpenGL.cpp, line 113.
STUBBED: this can't possibly be right, yeah? in /home/parker/build/Serious-Engine/Sources/Engine/Base/SDL/SDLEvents.cpp, line 147.
STUBBED: SDL2 can handle these events in /home/parker/build/Serious-Engine/Sources/SeriousSam/SeriousSam.cpp, line 1027.

Is there something weird that needs to be done for a controller to work?

parkerlreed avatar Jul 12 '20 18:07 parkerlreed

I have no idea, I never tried to use controler with on SeriousSam. I'll look at the code later, see if cntroler is even coded (I'm unsure).

ptitSeb avatar Jul 12 '20 18:07 ptitSeb

Yeah cursory glance there's no mention of "controller" in the codebase (according to github search)

parkerlreed avatar Jul 12 '20 19:07 parkerlreed

Oh GitHub search sucks... Big surprise.

The support seems to be there. I'll keep poking seeing if I can get it to see the controller

[parker@stealth Serious-Engine]$ grep -ri controlleradd .
./Sources/External/SDL2/SDL_gamecontroller.h: *  Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is:
./Sources/External/SDL2/SDL_gamecontroller.h:extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW( SDL_RWops * rw, int freerw );
./Sources/External/SDL2/SDL_gamecontroller.h:#define SDL_GameControllerAddMappingsFromFile(file)   SDL_GameControllerAddMappingsFromRW(SDL_RWFromFile(file, "rb"), 1)
./Sources/External/SDL2/SDL_gamecontroller.h:extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping( const char* mappingString );
./Sources/External/SDL2/SDL_hints.h: *  You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping()

parkerlreed avatar Jul 13 '20 15:07 parkerlreed

Mmm, no, that's just the SDL2 include header here. It's not any part of SeriousEngine code.

ptitSeb avatar Jul 13 '20 15:07 ptitSeb