MFI ControllerMapping - platform field

The controllerdb doesn’t use a platform check for mfi controllers, but a seperate define (SDL_JOYSTICK_MFI). From what I can tell, mappings are shared on mfi platforms (ios and tvos).

When loading custom mappings for such platforms, should one use platform:iOS and platform:tvOS? Does something like a platform:MFI exist? Or is platform:iOS valid for all MFI platforms (tvOS included)?

Thank you.

If the mapping is compatible with both platforms, don’t bother adding this restriction.

Otherwise, platform field should match the value returned by SDL_GetPlatform : https://wiki.libsdl.org/SDL_GetPlatform .
List of all value for platform is available in the source file: https://hg.libsdl.org/SDL/file/tip/src/SDL.c#l395 .

I thought the platform field was required. It isn’t?

My bad, it depends on how you give the mapping to SDL.

You don’t need a platform value if you add mapping to SDL_gamecontrollerdb.h and compile SDL yourself, or if you pass a mapping to SDL_GameControllerAddMapping.

You need a platform field if you use SDL_GameControllerAddMappingsFromRW or SDL_GameControllerAddMappingsFromFile.

OK :slight_smile: Yes that was my understanding. The mappings will come from a file. I will be using platform:iOS for now, as tvos is not in the list of platforms. I’ll cross that bridge if we get there :wink:

Thx!