ptitSeb / Serious-Engine

A port to the OpenPandora (and working fine on plain Linux) of the open source version of a game engine developed by Croteam for the classic Serious Sam games. Status: Working (for both FE and SE).
https://pyra-handheld.com/boards/threads/serious-sam-first-encounter.77225/
GNU General Public License v2.0
75 stars 24 forks source link

Does this support SDL2 game controller mapping? #18

Open parkerlreed opened 4 years ago

parkerlreed commented 4 years ago

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?

ptitSeb commented 4 years ago

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).

parkerlreed commented 4 years ago

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

parkerlreed commented 4 years ago

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()
ptitSeb commented 4 years ago

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