| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <memory> |
| 7 |
#include <string> |
| 8 |
#include <utility> |
| 9 |
#include <vector> |
| 10 |
|
| 11 |
#include "InputCommon/ControllerInterface/ControllerInterface.h" |
| 12 |
#include "InputCommon/DynamicInputTextureManager.h" |
| 13 |
|
| 14 |
namespace Common |
| 15 |
{ |
| 16 |
class IniFile; |
| 17 |
} |
| 18 |
|
| 19 |
namespace ControllerEmu |
| 20 |
{ |
| 21 |
class EmulatedController; |
| 22 |
} |
| 23 |
|
| 24 |
class InputConfig |
| 25 |
{ |
| 26 |
public: |
| 27 |
InputConfig(std::string ini_name, std::string gui_name, std::string profile_directory_name, |
| 28 |
std::string profile_key); |
| 29 |
|
| 30 |
~InputConfig(); |
| 31 |
|
| 32 |
bool LoadConfig(); |
| 33 |
void SaveConfig(); |
| 34 |
|
| 35 |
template <typename T, typename... Args> |
| 36 |
void CreateController(Args&&... args) |
| 37 |
{ |
| 38 |
m_controllers.emplace_back(std::make_unique<T>(std::forward<Args>(args)...)); |
| 39 |
} |
| 40 |
|
| 41 |
ControllerEmu::EmulatedController* GetController(int index) const; |
| 42 |
void ClearControllers(); |
| 43 |
bool ControllersNeedToBeCreated() const; |
| 44 |
bool IsControllerControlledByGamepadDevice(int index) const; |
| 45 |
|
| 46 |
std::string GetGUIName() const { return m_gui_name; } |
| 47 |
std::string GetProfileKey() const { return m_profile_key; } |
| 48 |
std::string GetProfileDirectoryName() const { return m_profile_directory_name; } |
| 49 |
std::string GetUserProfileDirectoryPath() const; |
| 50 |
std::string GetSysProfileDirectoryPath() const; |
| 51 |
int GetControllerCount() const; |
| 52 |
|
| 53 |
|
| 54 |
void RegisterHotplugCallback(); |
| 55 |
void UnregisterHotplugCallback(); |
| 56 |
|
| 57 |
void GenerateControllerTextures(const Common::IniFile& file); |
| 58 |
void GenerateControllerTextures(); |
| 59 |
|
| 60 |
private: |
| 61 |
Common::EventHook m_hotplug_event_hook; |
| 62 |
std::vector<std::unique_ptr<ControllerEmu::EmulatedController>> m_controllers; |
| 63 |
const std::string m_ini_name; |
| 64 |
const std::string m_gui_name; |
| 65 |
const std::string m_profile_directory_name; |
| 66 |
const std::string m_profile_key; |
| 67 |
InputCommon::DynamicInputTextureManager m_dynamic_input_tex_config_manager; |
| 68 |
}; |