diff options
| author | Markus Wick <degasus@users.noreply.github.com> | 2015-11-19 09:10:36 +0100 |
|---|---|---|
| committer | Markus Wick <degasus@users.noreply.github.com> | 2015-11-19 09:10:36 +0100 |
| commit | 1f4b16dacfae71c0479c5a63452adcc25ea32337 (patch) | |
| tree | efe360c37c96b88a05db5de26099f706a62b72b8 /Source/Core/InputCommon/InputConfig.h | |
| parent | 59b54a77d33f2a59fabfc4d5a7643538d9b81327 (diff) | |
| parent | b9975694ab133e964e84ae829e9ae93cca863cc4 (diff) | |
Merge pull request #3202 from lioncash/input
InputConfig: Clean up controller management
Diffstat (limited to 'Source/Core/InputCommon/InputConfig.h')
| -rw-r--r-- | Source/Core/InputCommon/InputConfig.h | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/Source/Core/InputCommon/InputConfig.h b/Source/Core/InputCommon/InputConfig.h index d827e25927..d8ebdd1a7e 100644 --- a/Source/Core/InputCommon/InputConfig.h +++ b/Source/Core/InputCommon/InputConfig.h @@ -4,29 +4,40 @@ #pragma once -#include <map> +#include <memory> +#include <string> +#include <utility> #include <vector> -#include "Common/FileUtil.h" -#include "Common/IniFile.h" -#include "Common/Thread.h" - -#include "InputCommon/ControllerEmu.h" -#include "InputCommon/ControllerInterface/ControllerInterface.h" +class ControllerEmu; class InputConfig { public: - InputConfig(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) {} + InputConfig(const std::string& ini_name, const std::string& gui_name, const std::string& profile_name) + : m_ini_name(ini_name), m_gui_name(gui_name), m_profile_name(profile_name) + { + } bool LoadConfig(bool isGC); void SaveConfig(); - std::vector<ControllerEmu*> controllers; + template <typename T, typename... Args> + void CreateController(Args&&... args) + { + m_controllers.emplace_back(std::make_unique<T>(std::forward<Args>(args)...)); + } + + ControllerEmu* GetController(int index); + void ClearControllers(); + bool ControllersNeedToBeCreated() const; + + std::string GetGUIName() const { return m_gui_name; } + std::string GetProfileName() const { return m_profile_name; } - const char* const ini_name; - const char* const gui_name; - const char* const profile_name; +private: + std::vector<std::unique_ptr<ControllerEmu>> m_controllers; + const std::string m_ini_name; + const std::string m_gui_name; + const std::string m_profile_name; }; |
