Skip to content

Commit

Permalink
Adds auto-detection for PS3 cocntroller.
Browse files Browse the repository at this point in the history
  • Loading branch information
klyoungblood committed Sep 4, 2016
1 parent 06d594b commit 5adaa12
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions SDL/SDLJoystick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,22 @@ SDLJoystick::SDLJoystick(bool init_SDL ): thread(NULL), running(true) {
SDL_setenv("SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS", "1", 0);
SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO);
}
if (g_Config.bPS3Controller)
fillMappingPS3();
else
fillMapping();

int numjoys = SDL_NumJoysticks();
SDL_JoystickEventState(SDL_ENABLE);
for (int i = 0; i < numjoys; i++) {
joys.push_back(SDL_JoystickOpen(i));
// printf("Initialized joystick %d: %s",i,SDL_JoystickNameForIndex(i));
if(strstr(SDL_JoystickNameForIndex(i),"PLAYSTATION(R)3 Controller"))
g_Config.bPS3Controller = true;
}

if (g_Config.bPS3Controller)
fillMappingPS3();
else
fillMapping();


}

SDLJoystick::~SDLJoystick(){
Expand Down

0 comments on commit 5adaa12

Please sign in to comment.