Skip to content

Commit

Permalink
Use a hint for gamecontrollerdb.txt, log controller GUID/Mapping strings
Browse files Browse the repository at this point in the history
  • Loading branch information
flibitijibibo committed Jun 29, 2021
1 parent 02a048f commit 591b3a3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/SDL2-CS
Submodule SDL2-CS updated 1 files
+8 −4 src/SDL2.cs
17 changes: 15 additions & 2 deletions src/FNAPlatform/SDL2_FNAPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ out prevUserData
);
if (File.Exists(mappingsDB))
{
SDL.SDL_GameControllerAddMappingsFromFile(
SDL.SDL_SetHint(
SDL.SDL_HINT_GAMECONTROLLERCONFIG_FILE,
mappingsDB
);
}
Expand Down Expand Up @@ -2105,9 +2106,21 @@ private static void INTERNAL_AddInstance(int dev)
}

// Print controller information to stdout.
string deviceInfo;
string mapping = SDL.SDL_GameControllerMapping(INTERNAL_devices[which]);
if (string.IsNullOrEmpty(mapping))
{
deviceInfo = "Mapping not found";
}
else
{
deviceInfo = "Mapping: " + mapping;
}
FNALoggerEXT.LogInfo(
"Controller " + which.ToString() + ": " +
SDL.SDL_GameControllerName(INTERNAL_devices[which])
SDL.SDL_GameControllerName(INTERNAL_devices[which]) + ", " +
"GUID: " + INTERNAL_guids[which] + ", " +
deviceInfo
);
}

Expand Down

0 comments on commit 591b3a3

Please sign in to comment.