From fad2468e3014334e1a050d0c60deb244b85923ff Mon Sep 17 00:00:00 2001 From: Rachel Bryk Date: Wed, 9 Jan 2013 20:41:14 -0500 Subject: [PATCH] Make sure profile actually exists. --- Source/Core/InputCommon/Src/InputConfig.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Source/Core/InputCommon/Src/InputConfig.cpp b/Source/Core/InputCommon/Src/InputConfig.cpp index 7d1bf11de8..a0b396db0a 100644 --- a/Source/Core/InputCommon/Src/InputConfig.cpp +++ b/Source/Core/InputCommon/Src/InputConfig.cpp @@ -34,21 +34,31 @@ bool InputPlugin::LoadConfig(bool isGC) bool useProfile[4] = {false, false, false, false}; std::string num[4] = {"1", "2", "3", "4"}; std::string profile[4]; + std::string path; if (SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID() != "00000000") { std::string type; if (isGC) + { type = "GC"; + path = "Profiles/GCPad/"; + } else + { type = "Wii"; + path = "Profiles/Wiimote/"; + } game_ini.Load(File::GetUserPath(D_GAMECONFIG_IDX) + SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID() + ".ini"); for (int i = 0; i < 4; i++) { if (game_ini.Exists("Core", (type + "Profile" + num[i]).c_str())) { - useProfile[i] = true; game_ini.Get("Core", (type + "Profile" + num[i]).c_str(), &profile[i]); + if (File::Exists(File::GetUserPath(D_CONFIG_IDX) + path + profile[i] + ".ini")) + useProfile[i] = true; + else + PanicAlertT("Selected controller profile does not exist"); } } } @@ -64,11 +74,6 @@ bool InputPlugin::LoadConfig(bool isGC) if (useProfile[n]) { IniFile profile_ini; - std::string path; - if (isGC) - path = "Profiles/GCPad/"; - else - path = "Profiles/Wiimote/"; profile_ini.Load(File::GetUserPath(D_CONFIG_IDX) + path + profile[n] + ".ini"); (*i)->LoadConfig(profile_ini.GetOrCreateSection("Profile")); }