MCPcopy Create free account
hub / github.com/clementgallet/libTAS / SDL_GameControllerMapping

Function SDL_GameControllerMapping

src/library/inputs/sdlgamecontroller.cpp:164–184  ·  view source on GitHub ↗

Override */

Source from the content-addressed store, hash-verified

162}
163
164/* Override */ char *SDL_GameControllerMapping( SDL_GameController * gamecontroller )
165{
166 LOG(LL_TRACE, LCF_SDL | LCF_JOYSTICK, "%s call with id %d", __func__, gamecontroller?*reinterpret_cast<int*>(gamecontroller):-1);
167
168 if (!gamecontroller)
169 return NULL;
170
171 int* gcid = reinterpret_cast<int*>(gamecontroller);
172
173 if (*gcid < 0 || *gcid >= Global::shared_config.nb_controllers)
174 return NULL;
175
176 /* Check if controller is available */
177 if (gcids[*gcid] == -1)
178 return NULL;
179
180 /* Return the mapping of my own xbox 360 controller.
181 * The game is supposed to free the char*, so we must
182 * allocate it. */
183 return duplicateMapping();
184}
185
186/* Override */ char *SDL_GameControllerMappingForDeviceIndex(int joystick_index)
187{

Callers 1

mainFunction · 0.85

Calls 1

duplicateMappingFunction · 0.85

Tested by

no test coverage detected