InputConfig: Clean up controller management

This commit is contained in:
Lioncash 2015-10-25 22:28:15 -04:00
parent 59b54a77d3
commit b9975694ab
17 changed files with 146 additions and 171 deletions

View file

@ -8,6 +8,7 @@
#include "Common/Common.h"
#include "Core/ConfigManager.h"
#include "Core/HotkeyManager.h"
#include "InputCommon/GCPadStatus.h"
const std::string hotkey_labels[] =
{
@ -147,8 +148,8 @@ void GetStatus()
{
s_hotkey.err = PAD_ERR_NONE;
// get input
((HotkeyManager*)s_config.controllers[0])->GetInput(&s_hotkey);
// Get input
static_cast<HotkeyManager*>(s_config.GetController(0))->GetInput(&s_hotkey);
}
bool IsEnabled()
@ -182,8 +183,8 @@ bool IsPressed(int Id, bool held)
void Initialize(void* const hwnd)
{
if (s_config.controllers.empty())
s_config.controllers.push_back(new HotkeyManager());
if (s_config.ControllersNeedToBeCreated())
s_config.CreateController<HotkeyManager>();
g_controller_interface.Initialize(hwnd);
@ -203,12 +204,7 @@ void LoadConfig()
void Shutdown()
{
std::vector<ControllerEmu*>::const_iterator
i = s_config.controllers.begin(),
e = s_config.controllers.end();
for (; i != e; ++i)
delete *i;
s_config.controllers.clear();
s_config.ClearControllers();
g_controller_interface.Shutdown();
}