1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-26 04:32:35 +01:00

input: fix custom pad config loading

This commit is contained in:
Megamouse 2021-09-05 03:12:23 +02:00
parent 17fb601c02
commit aca9884e76
2 changed files with 19 additions and 8 deletions

View File

@ -6,18 +6,23 @@ LOG_CHANNEL(input_log, "Input");
bool cfg_input::load(const std::string& title_id, const std::string& profile, bool strict) bool cfg_input::load(const std::string& title_id, const std::string& profile, bool strict)
{ {
// Check custom config first input_log.notice("Loading pad config (title_id='%s', profile='%s', strict=%d)", title_id, profile, strict);
std::string cfg_name; std::string cfg_name;
if (title_id.empty()) // Check custom config first
{ if (!title_id.empty())
cfg_name = rpcs3::utils::get_input_config_dir() + profile + ".yml";
}
else
{ {
cfg_name = rpcs3::utils::get_custom_input_config_path(title_id); cfg_name = rpcs3::utils::get_custom_input_config_path(title_id);
} }
// Check active global profile next
if ((title_id.empty() || !strict) && !fs::is_file(cfg_name))
{
cfg_name = rpcs3::utils::get_input_config_dir() + profile + ".yml";
}
// Fallback to default profile
if (!strict && !fs::is_file(cfg_name)) if (!strict && !fs::is_file(cfg_name))
{ {
cfg_name = rpcs3::utils::get_input_config_dir() + g_cfg_profile.default_profile + ".yml"; cfg_name = rpcs3::utils::get_input_config_dir() + g_cfg_profile.default_profile + ".yml";

View File

@ -91,8 +91,14 @@ void pad_thread::Init()
g_cfg_profile.load(); g_cfg_profile.load();
std::string active_profile = g_cfg_profile.active_profiles.get_value(pad::g_title_id);
if (active_profile.empty())
{
active_profile = g_cfg_profile.active_profiles.get_value(g_cfg_profile.global_key);
}
// Load in order to get the pad handlers // Load in order to get the pad handlers
if (!g_cfg_input.load(pad::g_title_id, g_cfg_profile.active_profiles.get_value(pad::g_title_id))) if (!g_cfg_input.load(pad::g_title_id, active_profile))
{ {
input_log.notice("Loaded empty pad config"); input_log.notice("Loaded empty pad config");
} }
@ -105,7 +111,7 @@ void pad_thread::Init()
} }
// Reload with proper defaults // Reload with proper defaults
if (!g_cfg_input.load(pad::g_title_id, g_cfg_profile.active_profiles.get_value(pad::g_title_id))) if (!g_cfg_input.load(pad::g_title_id, active_profile))
{ {
input_log.notice("Reloaded empty pad config"); input_log.notice("Reloaded empty pad config");
} }