input: add SDL_GameControllerDB

This commit is contained in:
Megamouse 2023-08-26 12:24:47 +02:00
parent d105b0bd9f
commit 452a4654da
8 changed files with 43 additions and 1 deletions

View file

@ -2,6 +2,8 @@
#include "stdafx.h"
#include "sdl_pad_handler.h"
#include "Emu/system_utils.hpp"
#include "Emu/system_config.h"
LOG_CHANNEL(sdl_log, "SDL");
@ -217,6 +219,24 @@ bool sdl_pad_handler::Init()
}
}, nullptr);
if (g_cfg.io.load_sdl_mappings)
{
const std::string db_path = rpcs3::utils::get_input_config_root() + "gamecontrollerdb.txt";
sdl_log.notice("Adding mappings from file '%s'", db_path);
if (fs::is_file(db_path))
{
if (SDL_GameControllerAddMappingsFromFile(db_path.c_str()) < 0)
{
sdl_log.error("Could not add mappings from file '%s'! SDL Error: %s", db_path, SDL_GetError());
}
}
else
{
sdl_log.error("Could not add mappings from file '%s'! File does not exist!", db_path);
}
}
m_is_init = true;
enumerate_devices();