Merge branch 'controller-profiles'
This commit is contained in:
commit
f1489a4e18
|
@ -47,7 +47,6 @@
|
|||
#include "VideoBackendBase.h"
|
||||
#include "Movie.h"
|
||||
|
||||
|
||||
namespace BootManager
|
||||
{
|
||||
|
||||
|
@ -154,6 +153,7 @@ void Stop()
|
|||
|
||||
SCoreStartupParameter& StartUp = SConfig::GetInstance().m_LocalCoreStartupParameter;
|
||||
|
||||
StartUp.m_strUniqueID = "00000000";
|
||||
if (config_cache.valid)
|
||||
{
|
||||
config_cache.valid = false;
|
||||
|
|
|
@ -138,7 +138,7 @@ struct SCoreStartupParameter
|
|||
|
||||
int iTheme;
|
||||
int iPosX, iPosY, iWidth, iHeight;
|
||||
|
||||
|
||||
enum EBootBS2
|
||||
{
|
||||
BOOT_DEFAULT,
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include "ControllerInterface/ControllerInterface.h"
|
||||
#include "GCPadEmu.h"
|
||||
#include "../ConfigManager.h"
|
||||
|
||||
#include "../../InputCommon/Src/InputConfig.h"
|
||||
|
||||
|
@ -55,7 +56,7 @@ void Initialize(void* const hwnd)
|
|||
g_controller_interface.Initialize();
|
||||
|
||||
// load the saved controller config
|
||||
g_plugin.LoadConfig();
|
||||
g_plugin.LoadConfig(true);
|
||||
}
|
||||
|
||||
void GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "WiimoteReal/WiimoteReal.h"
|
||||
#include "WiimoteEmu/WiimoteEmu.h"
|
||||
#include "Movie.h"
|
||||
#include "../ConfigManager.h"
|
||||
|
||||
#include "ControllerInterface/ControllerInterface.h"
|
||||
|
||||
|
@ -44,7 +45,7 @@ void Initialize(void* const hwnd)
|
|||
g_controller_interface.SetHwnd(hwnd);
|
||||
g_controller_interface.Initialize();
|
||||
|
||||
g_plugin.LoadConfig();
|
||||
g_plugin.LoadConfig(false);
|
||||
|
||||
WiimoteReal::Initialize();
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
|
||||
~InputPlugin();
|
||||
|
||||
bool LoadConfig();
|
||||
bool LoadConfig(bool isGC);
|
||||
void SaveConfig();
|
||||
|
||||
std::vector< ControllerEmu* > controllers;
|
||||
|
|
Loading…
Reference in New Issue