2010-06-03 18:05:08 +00:00
|
|
|
|
|
|
|
#include "Config.h"
|
|
|
|
|
2010-06-04 20:03:03 +00:00
|
|
|
|
2010-06-03 18:05:08 +00:00
|
|
|
Plugin::Plugin( const char* const _ini_name, const char* const _gui_name, const char* const _profile_name )
|
|
|
|
: ini_name(_ini_name)
|
|
|
|
, gui_name(_gui_name)
|
|
|
|
, profile_name(_profile_name)
|
|
|
|
{
|
|
|
|
// GCPads
|
|
|
|
//for ( unsigned int i = 0; i<4; ++i )
|
|
|
|
//controllers.push_back( new GCPad( i ) );
|
|
|
|
// Wiimotes / disabled, cause it only the GUI half is done
|
|
|
|
//for ( unsigned int i = 0; i<4; ++i )
|
|
|
|
// controllers.push_back( new Wiimote( i ) );
|
|
|
|
};
|
|
|
|
|
|
|
|
Plugin::~Plugin()
|
|
|
|
{
|
|
|
|
// delete pads
|
|
|
|
std::vector<ControllerEmu*>::const_iterator i = controllers.begin(),
|
|
|
|
e = controllers.end();
|
|
|
|
for ( ; i != e; ++i )
|
|
|
|
delete *i;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Plugin::LoadConfig()
|
|
|
|
{
|
|
|
|
IniFile inifile;
|
2010-06-04 20:03:03 +00:00
|
|
|
inifile.Load(std::string(File::GetUserPath(D_CONFIG_IDX)) + ini_name + ".ini");
|
2010-06-03 18:05:08 +00:00
|
|
|
|
|
|
|
std::vector< ControllerEmu* >::const_iterator i = controllers.begin(),
|
|
|
|
e = controllers.end();
|
2010-06-04 20:03:03 +00:00
|
|
|
for ( ; i!=e; ++i ) {
|
|
|
|
(*i)->LoadConfig(inifile.GetOrCreateSection((*i)->GetName().c_str()));
|
|
|
|
}
|
2010-06-03 18:05:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Plugin::SaveConfig()
|
|
|
|
{
|
2010-06-04 20:03:03 +00:00
|
|
|
std::string ini_filename = (std::string(File::GetUserPath(D_CONFIG_IDX)) + ini_name + ".ini" );
|
|
|
|
|
2010-06-03 18:05:08 +00:00
|
|
|
IniFile inifile;
|
2010-06-04 20:03:03 +00:00
|
|
|
inifile.Load(ini_filename);
|
2010-06-03 18:05:08 +00:00
|
|
|
|
|
|
|
std::vector< ControllerEmu* >::const_iterator i = controllers.begin(),
|
|
|
|
e = controllers.end();
|
|
|
|
for ( ; i!=e; ++i )
|
2010-06-04 20:03:03 +00:00
|
|
|
(*i)->SaveConfig(inifile.GetOrCreateSection((*i)->GetName().c_str()));
|
2010-06-03 18:05:08 +00:00
|
|
|
|
2010-06-04 20:03:03 +00:00
|
|
|
inifile.Save(ini_filename);
|
2010-06-03 18:05:08 +00:00
|
|
|
}
|