mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 09:09:52 -06:00
Plugin that should eventually replace the GCPad and emulated Wiimote plugin:
It's currently only really usable on Windows. Linux/OS X will need keyboard support added in, but SDL should work for joysticks on non-Windows without too many modifications. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5254 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
54
Source/Plugins/Plugin_GCPadNew/Src/Config.cpp
Normal file
54
Source/Plugins/Plugin_GCPadNew/Src/Config.cpp
Normal file
@ -0,0 +1,54 @@
|
||||
|
||||
#include "Config.h"
|
||||
|
||||
Plugin::Plugin()
|
||||
{
|
||||
// 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;
|
||||
|
||||
std::ifstream file;
|
||||
file.open( (std::string(File::GetUserPath(D_CONFIG_IDX)) + CONFIG_FILE_NAME ).c_str() );
|
||||
inifile.Load( file );
|
||||
file.close();
|
||||
|
||||
std::vector< ControllerEmu* >::const_iterator i = controllers.begin(),
|
||||
e = controllers.end();
|
||||
for ( ; i!=e; ++i )
|
||||
(*i)->LoadConfig( inifile[ (*i)->GetName() ] );
|
||||
}
|
||||
|
||||
void Plugin::SaveConfig()
|
||||
{
|
||||
IniFile inifile;
|
||||
|
||||
std::vector< ControllerEmu* >::const_iterator i = controllers.begin(),
|
||||
e = controllers.end();
|
||||
for ( ; i!=e; ++i )
|
||||
(*i)->SaveConfig( inifile[ (*i)->GetName() ] );
|
||||
|
||||
// dont need to save empty values
|
||||
inifile.Clean();
|
||||
|
||||
std::ofstream file;
|
||||
file.open( (std::string(File::GetUserPath(D_CONFIG_IDX)) + CONFIG_FILE_NAME ).c_str() );
|
||||
inifile.Save( file );
|
||||
file.close();
|
||||
}
|
Reference in New Issue
Block a user