mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-26 12:21:39 +00:00
added SDL_GameControllerDB support
added `SDL_GameControllerAddMappingsFromFile` to allow support for SDL_GameControllerDB as a option, for those who prefer Community-driven Gamepad database (tends to be far more up-to-date than main SDL)
This commit is contained in:
parent
2afc09295d
commit
ec13b6f0f6
1 changed files with 7 additions and 0 deletions
|
|
@ -344,6 +344,13 @@ void hid::Init()
|
||||||
SDL_AddEventWatch(HID_OnSDLEvent, nullptr);
|
SDL_AddEventWatch(HID_OnSDLEvent, nullptr);
|
||||||
|
|
||||||
SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER);
|
SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER);
|
||||||
|
|
||||||
|
// Load SDL_GameControllerDB mappings from file
|
||||||
|
const char* mappingFile = "gamecontrollerdb.txt";
|
||||||
|
int mappingsAdded = SDL_GameControllerAddMappingsFromFile(mappingFile);
|
||||||
|
if (mappingsAdded > 0) {
|
||||||
|
LOGFN("Loaded {} controller mapping(s) from SDL_GameControllerDB file", mappingsAdded, mappingFile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t hid::GetState(uint32_t dwUserIndex, XAMINPUT_STATE* pState)
|
uint32_t hid::GetState(uint32_t dwUserIndex, XAMINPUT_STATE* pState)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue