SDLInputSource: Optionally load game_controller_db.txt from data dir
This commit is contained in:
parent
55b5ec7321
commit
e81e3edb23
|
@ -237,11 +237,22 @@ u32 SDLInputSource::ParseRGBForPlayerId(const std::string_view& str, u32 player_
|
||||||
|
|
||||||
void SDLInputSource::SetHints()
|
void SDLInputSource::SetHints()
|
||||||
{
|
{
|
||||||
const std::string controller_db_path = Path::Combine(EmuFolders::Resources, CONTROLLER_DB_FILENAME);
|
if (const std::string upath = Path::Combine(EmuFolders::DataRoot, CONTROLLER_DB_FILENAME);
|
||||||
if (FileSystem::FileExists(controller_db_path.c_str()))
|
FileSystem::FileExists(upath.c_str()))
|
||||||
SDL_SetHint(SDL_HINT_GAMECONTROLLERCONFIG_FILE, controller_db_path.c_str());
|
{
|
||||||
|
Log_InfoFmt("Using Controller DB from user directory: '{}'", upath);
|
||||||
|
SDL_SetHint(SDL_HINT_GAMECONTROLLERCONFIG_FILE, upath.c_str());
|
||||||
|
}
|
||||||
|
else if (const std::string rpath = Path::Combine(EmuFolders::Resources, CONTROLLER_DB_FILENAME);
|
||||||
|
FileSystem::FileExists(rpath.c_str()))
|
||||||
|
{
|
||||||
|
Log_InfoPrint("Using Controller DB from resources.");
|
||||||
|
SDL_SetHint(SDL_HINT_GAMECONTROLLERCONFIG_FILE, rpath.c_str());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
Log_ErrorFmt("Controller DB not found at '{}'", controller_db_path);
|
{
|
||||||
|
Log_ErrorFmt("Controller DB not found, it should be named '{}'", CONTROLLER_DB_FILENAME);
|
||||||
|
}
|
||||||
|
|
||||||
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE, m_controller_enhanced_mode ? "1" : "0");
|
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE, m_controller_enhanced_mode ? "1" : "0");
|
||||||
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, m_controller_enhanced_mode ? "1" : "0");
|
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, m_controller_enhanced_mode ? "1" : "0");
|
||||||
|
@ -276,6 +287,7 @@ bool SDLInputSource::InitializeSubsystem()
|
||||||
|
|
||||||
// we should open the controllers as the connected events come in, so no need to do any more here
|
// we should open the controllers as the connected events come in, so no need to do any more here
|
||||||
m_sdl_subsystem_initialized = true;
|
m_sdl_subsystem_initialized = true;
|
||||||
|
Log_InfoFmt("{} controller mappings are loaded.", SDL_GameControllerNumMappings());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue