mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 21:30:19 -06:00
InputConfig: Clean up controller management
This commit is contained in:
@ -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)...));
|
||||
}
|
||||
|
||||
const char* const ini_name;
|
||||
const char* const gui_name;
|
||||
const char* const profile_name;
|
||||
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; }
|
||||
|
||||
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;
|
||||
};
|
||||
|
Reference in New Issue
Block a user