Allow loading controller profiles from game ini.

Currently loads the same profile for all 4 controllers, and overwrites the default control settings.
This commit is contained in:
Rachel Bryk 2013-01-08 19:15:11 -05:00
parent 4f4aa4860d
commit b8691df723
6 changed files with 25 additions and 8 deletions

View File

@ -47,7 +47,6 @@
#include "VideoBackendBase.h"
#include "Movie.h"
namespace BootManager
{
@ -137,6 +136,11 @@ bool BootCore(const std::string& _rFilename)
}
}
if (game_ini.Exists("Core", "WiiProfile"))
game_ini.Get("Core", "WiiProfile", &StartUp.strWiiControllerProfile);
if (game_ini.Exists("Core", "GCProfile"))
game_ini.Get("Core", "GCProfile", &StartUp.strGCControllerProfile);
// Run the game
// Init the core
if (!Core::Init())
@ -169,6 +173,8 @@ void Stop()
StartUp.bDSPHLE = config_cache.bDSPHLE;
StartUp.bDisableWiimoteSpeaker = config_cache.bDisableWiimoteSpeaker;
StartUp.m_strVideoBackend = config_cache.strBackend;
StartUp.strGCControllerProfile = "";
StartUp.strWiiControllerProfile = "";
VideoBackend::ActivateBackend(StartUp.m_strVideoBackend);
}
}

View File

@ -138,7 +138,9 @@ struct SCoreStartupParameter
int iTheme;
int iPosX, iPosY, iWidth, iHeight;
std::string strGCControllerProfile;
std::string strWiiControllerProfile;
enum EBootBS2
{
BOOT_DEFAULT,

View File

@ -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(SConfig::GetInstance().m_LocalCoreStartupParameter.strGCControllerProfile);
}
void GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)

View File

@ -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(SConfig::GetInstance().m_LocalCoreStartupParameter.strWiiControllerProfile);
WiimoteReal::Initialize();

View File

@ -26,10 +26,13 @@ InputPlugin::~InputPlugin()
delete *i;
}
bool InputPlugin::LoadConfig()
bool InputPlugin::LoadConfig(std::string ini)
{
IniFile inifile;
if (inifile.Load(File::GetUserPath(D_CONFIG_IDX) + ini_name + ".ini"))
std::string ini2 = ini;
if (ini == "")
ini = ini_name;
if (inifile.Load(File::GetUserPath(D_CONFIG_IDX) + ini + ".ini"))
{
std::vector< ControllerEmu* >::const_iterator
i = controllers.begin(),
@ -37,7 +40,11 @@ bool InputPlugin::LoadConfig()
for (; i!=e; ++i)
{
// load settings from ini
(*i)->LoadConfig(inifile.GetOrCreateSection((*i)->GetName().c_str()));
std::string section;
section = (*i)->GetName();
if (ini2 != "")
section = "Profile";
(*i)->LoadConfig(inifile.GetOrCreateSection(section.c_str()));
// update refs
(*i)->UpdateReferences(g_controller_interface);
}

View File

@ -42,7 +42,7 @@ public:
~InputPlugin();
bool LoadConfig();
bool LoadConfig(std::string ini);
void SaveConfig();
std::vector< ControllerEmu* > controllers;