diff options
| author | Matthew Parlane <parlane@gmail.com> | 2013-01-12 00:01:27 +1300 |
|---|---|---|
| committer | Matthew Parlane <parlane@gmail.com> | 2013-01-12 00:01:27 +1300 |
| commit | 465df943a5ff7c58060e695cf0d1414de52a5b82 (patch) | |
| tree | 175052583f619110b2e1533fa5caa15189869c06 /Source/Core/InputCommon | |
| parent | 65072ad6fb273d5919fc3b419524224ab0e3dcba (diff) | |
| parent | f21f097e7a831e752ab36974897b2ba57e266dfc (diff) | |
Merge branch 'master' into wii-network
Diffstat (limited to 'Source/Core/InputCommon')
| -rw-r--r-- | Source/Core/InputCommon/Src/ControllerInterface/Xlib/Xlib.cpp | 3 | ||||
| -rw-r--r-- | Source/Core/InputCommon/Src/InputConfig.cpp | 47 | ||||
| -rw-r--r-- | Source/Core/InputCommon/Src/InputConfig.h | 2 |
3 files changed, 46 insertions, 6 deletions
diff --git a/Source/Core/InputCommon/Src/ControllerInterface/Xlib/Xlib.cpp b/Source/Core/InputCommon/Src/ControllerInterface/Xlib/Xlib.cpp index c2030a059d..fa30ba5c62 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/Xlib/Xlib.cpp +++ b/Source/Core/InputCommon/Src/ControllerInterface/Xlib/Xlib.cpp @@ -116,8 +116,7 @@ KeyboardMouse::Key::Key(Display* const display, KeyCode keycode, const char* key ControlState KeyboardMouse::Key::GetState() const { const KeyCode shift = XKeysymToKeycode(m_display, XK_Shift_L); - return (m_keyboard[m_keycode / 8] & (1 << (m_keycode % 8))) != 0 - && (m_keyboard[shift / 8] & (1 << (shift % 8))) == 0; + return (m_keyboard[m_keycode / 8] & (1 << (m_keycode % 8))) != 0; } ControlState KeyboardMouse::Button::GetState() const diff --git a/Source/Core/InputCommon/Src/InputConfig.cpp b/Source/Core/InputCommon/Src/InputConfig.cpp index b9d2a93b99..1988a9ebb7 100644 --- a/Source/Core/InputCommon/Src/InputConfig.cpp +++ b/Source/Core/InputCommon/Src/InputConfig.cpp @@ -16,6 +16,7 @@ // http://code.google.com/p/dolphin-emu/ #include "InputConfig.h" +#include "../../Core/Src/ConfigManager.h" InputPlugin::~InputPlugin() { @@ -26,18 +27,58 @@ InputPlugin::~InputPlugin() delete *i; } -bool InputPlugin::LoadConfig() +bool InputPlugin::LoadConfig(bool isGC) { IniFile inifile; + IniFile game_ini; + 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 = "Pad"; + path = "Profiles/GCPad/"; + } + else + { + type = "Wiimote"; + 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("Controls", (type + "Profile" + num[i]).c_str())) + { + game_ini.Get("Controls", (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"); + } + } + } + if (inifile.Load(File::GetUserPath(D_CONFIG_IDX) + ini_name + ".ini")) { std::vector< ControllerEmu* >::const_iterator i = controllers.begin(), e = controllers.end(); - for (; i!=e; ++i) + for (int n = 0; i!=e; ++i, ++n) { // load settings from ini - (*i)->LoadConfig(inifile.GetOrCreateSection((*i)->GetName().c_str())); + if (useProfile[n]) + { + IniFile profile_ini; + profile_ini.Load(File::GetUserPath(D_CONFIG_IDX) + path + profile[n] + ".ini"); + (*i)->LoadConfig(profile_ini.GetOrCreateSection("Profile")); + } + else + (*i)->LoadConfig(inifile.GetOrCreateSection((*i)->GetName().c_str())); // update refs (*i)->UpdateReferences(g_controller_interface); } diff --git a/Source/Core/InputCommon/Src/InputConfig.h b/Source/Core/InputCommon/Src/InputConfig.h index 4d25334ce7..71505bb935 100644 --- a/Source/Core/InputCommon/Src/InputConfig.h +++ b/Source/Core/InputCommon/Src/InputConfig.h @@ -42,7 +42,7 @@ public: ~InputPlugin(); - bool LoadConfig(); + bool LoadConfig(bool isGC); void SaveConfig(); std::vector< ControllerEmu* > controllers; |
