Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

input: fix pad profile override with existing custom pad configs #13965

Merged
merged 1 commit into from Jun 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 11 additions & 3 deletions rpcs3/Emu/Io/pad_config.cpp
Expand Up @@ -4,20 +4,28 @@

LOG_CHANNEL(input_log, "Input");

extern std::string g_pad_profile_override;

bool cfg_input::load(const std::string& title_id, const std::string& profile, bool strict)
{
input_log.notice("Loading pad config (title_id='%s', profile='%s', strict=%d)", title_id, profile, strict);

std::string cfg_name;

// Check custom config first
if (!title_id.empty())
// Check profile override first
if (!strict && !g_pad_profile_override.empty())
{
cfg_name = rpcs3::utils::get_input_config_dir() + g_pad_profile_override + ".yml";
}

// Check custom config next
if (!title_id.empty() && !fs::is_file(cfg_name))
{
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))
if ((title_id.empty() || !strict) && !profile.empty() && !fs::is_file(cfg_name))
{
cfg_name = rpcs3::utils::get_input_config_dir() + profile + ".yml";
}
Expand Down
11 changes: 3 additions & 8 deletions rpcs3/Input/pad_thread.cpp
Expand Up @@ -103,19 +103,14 @@ void pad_thread::Init()

g_cfg_profile.load();

std::string active_profile = g_pad_profile_override;
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(pad::g_title_id);

if (active_profile.empty())
{
active_profile = g_cfg_profile.active_profiles.get_value(g_cfg_profile.global_key);
}
active_profile = g_cfg_profile.active_profiles.get_value(g_cfg_profile.global_key);
}

input_log.notice("Using pad profile: '%s'", active_profile);
input_log.notice("Using pad profile: '%s' (override='%s')", active_profile, g_pad_profile_override);

// Load in order to get the pad handlers
if (!g_cfg_input.load(pad::g_title_id, active_profile))
Expand Down