InputCommon: Rename class InputPlugin to InputConfig

This commit is contained in:
Lioncash
2014-08-31 00:04:15 -04:00
parent ea7eee1f58
commit 1a3ebbb831
12 changed files with 85 additions and 88 deletions

View File

@ -16,21 +16,21 @@
namespace Wiimote
{
static InputPlugin g_plugin(WIIMOTE_INI_NAME, _trans("Wiimote"), "Wiimote");
static InputConfig s_config(WIIMOTE_INI_NAME, _trans("Wiimote"), "Wiimote");
static int s_last_number = 4;
InputPlugin *GetPlugin()
InputConfig* GetConfig()
{
return &g_plugin;
return &s_config;
}
void Shutdown()
{
for (const ControllerEmu* i : g_plugin.controllers)
for (const ControllerEmu* i : s_config.controllers)
{
delete i;
}
g_plugin.controllers.clear();
s_config.controllers.clear();
WiimoteReal::Stop();
@ -42,13 +42,13 @@ void Initialize(void* const hwnd, bool wait)
{
// add 4 wiimotes
for (unsigned int i = WIIMOTE_CHAN_0; i<MAX_BBMOTES; ++i)
g_plugin.controllers.push_back(new WiimoteEmu::Wiimote(i));
s_config.controllers.push_back(new WiimoteEmu::Wiimote(i));
g_controller_interface.SetHwnd(hwnd);
g_controller_interface.Initialize();
g_plugin.LoadConfig(false);
s_config.LoadConfig(false);
WiimoteReal::Initialize(wait);
@ -83,7 +83,7 @@ void Pause()
void ControlChannel(int _number, u16 _channelID, const void* _pData, u32 _Size)
{
if (WIIMOTE_SRC_HYBRID & g_wiimote_sources[_number])
((WiimoteEmu::Wiimote*)g_plugin.controllers[_number])->ControlChannel(_channelID, _pData, _Size);
((WiimoteEmu::Wiimote*)s_config.controllers[_number])->ControlChannel(_channelID, _pData, _Size);
}
// __________________________________________________________________________________________________
@ -101,7 +101,7 @@ void ControlChannel(int _number, u16 _channelID, const void* _pData, u32 _Size)
void InterruptChannel(int _number, u16 _channelID, const void* _pData, u32 _Size)
{
if (WIIMOTE_SRC_HYBRID & g_wiimote_sources[_number])
((WiimoteEmu::Wiimote*)g_plugin.controllers[_number])->InterruptChannel(_channelID, _pData, _Size);
((WiimoteEmu::Wiimote*)s_config.controllers[_number])->InterruptChannel(_channelID, _pData, _Size);
}
// __________________________________________________________________________________________________
@ -115,7 +115,7 @@ void Update(int _number)
//PanicAlert( "Wiimote_Update" );
// TODO: change this to a try_to_lock, and make it give empty input on failure
std::lock_guard<std::recursive_mutex> lk(g_plugin.controls_lock);
std::lock_guard<std::recursive_mutex> lk(s_config.controls_lock);
if (_number <= s_last_number)
{
@ -125,7 +125,7 @@ void Update(int _number)
s_last_number = _number;
if (WIIMOTE_SRC_EMU & g_wiimote_sources[_number])
((WiimoteEmu::Wiimote*)g_plugin.controllers[_number])->Update();
((WiimoteEmu::Wiimote*)s_config.controllers[_number])->Update();
else
WiimoteReal::Update(_number);
}
@ -158,7 +158,7 @@ void DoState(u8 **ptr, PointerWrap::Mode mode)
PointerWrap p(ptr, mode);
p.Do(s_last_number);
for (unsigned int i=0; i<MAX_BBMOTES; ++i)
((WiimoteEmu::Wiimote*)g_plugin.controllers[i])->DoState(p);
((WiimoteEmu::Wiimote*)s_config.controllers[i])->DoState(p);
}
// ___________________________________________________________________________