diff options
| author | Léo Lam <leo@leolam.fr> | 2020-10-20 02:10:29 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-20 02:10:29 +0200 |
| commit | fc3b474cceb2a24df21640140be4beb95b9b9fd1 (patch) | |
| tree | 84c89656ad79357c819b129a927db20cec1cdf9e /Source/Core/InputCommon/ControllerEmu | |
| parent | b26c2e7adb80436f131f1a50e462ee7c25792c48 (diff) | |
| parent | 4fff04db3ce16c72d8b3b95df2285a129605fde4 (diff) | |
Merge pull request #8318 from iwubcode/dynamic_input_textures
InputCommon: Dynamic Input Textures
Diffstat (limited to 'Source/Core/InputCommon/ControllerEmu')
| -rw-r--r-- | Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp | 24 | ||||
| -rw-r--r-- | Source/Core/InputCommon/ControllerEmu/ControllerEmu.h | 4 |
2 files changed, 28 insertions, 0 deletions
diff --git a/Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp b/Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp index a9c5844b48..8fc54fde06 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp @@ -112,6 +112,12 @@ void EmulatedController::SetDefaultDevice(ciface::Core::DeviceQualifier devq) } } +void EmulatedController::SetDynamicInputTextureManager( + InputCommon::DynamicInputTextureManager* dynamic_input_tex_config_manager) +{ + m_dynamic_input_tex_config_manager = dynamic_input_tex_config_manager; +} + void EmulatedController::LoadConfig(IniFile::Section* sec, const std::string& base) { std::string defdev = GetDefaultDevice().ToString(); @@ -123,6 +129,11 @@ void EmulatedController::LoadConfig(IniFile::Section* sec, const std::string& ba for (auto& cg : groups) cg->LoadConfig(sec, defdev, base); + + if (base.empty()) + { + GenerateTextures(sec); + } } void EmulatedController::SaveConfig(IniFile::Section* sec, const std::string& base) @@ -133,6 +144,11 @@ void EmulatedController::SaveConfig(IniFile::Section* sec, const std::string& ba for (auto& ctrlGroup : groups) ctrlGroup->SaveConfig(sec, defdev, base); + + if (base.empty()) + { + GenerateTextures(sec); + } } void EmulatedController::LoadDefaults(const ControllerInterface& ciface) @@ -147,4 +163,12 @@ void EmulatedController::LoadDefaults(const ControllerInterface& ciface) SetDefaultDevice(default_device_string); } } + +void EmulatedController::GenerateTextures(IniFile::Section* sec) +{ + if (m_dynamic_input_tex_config_manager) + { + m_dynamic_input_tex_config_manager->GenerateTextures(sec, GetName()); + } +} } // namespace ControllerEmu diff --git a/Source/Core/InputCommon/ControllerEmu/ControllerEmu.h b/Source/Core/InputCommon/ControllerEmu/ControllerEmu.h index b6808f1c0b..bcc25886f3 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControllerEmu.h +++ b/Source/Core/InputCommon/ControllerEmu/ControllerEmu.h @@ -17,6 +17,7 @@ #include "Common/MathUtil.h" #include "InputCommon/ControlReference/ExpressionParser.h" #include "InputCommon/ControllerInterface/Device.h" +#include "InputCommon/DynamicInputTextureManager.h" class ControllerInterface; @@ -182,6 +183,7 @@ public: const ciface::Core::DeviceQualifier& GetDefaultDevice() const; void SetDefaultDevice(const std::string& device); void SetDefaultDevice(ciface::Core::DeviceQualifier devq); + void SetDynamicInputTextureManager(InputCommon::DynamicInputTextureManager*); void UpdateReferences(const ControllerInterface& devi); void UpdateSingleControlReference(const ControllerInterface& devi, ControlReference* ref); @@ -224,6 +226,8 @@ protected: void UpdateReferences(ciface::ExpressionParser::ControlEnvironment& env); private: + void GenerateTextures(IniFile::Section* sec); + InputCommon::DynamicInputTextureManager* m_dynamic_input_tex_config_manager = nullptr; ciface::Core::DeviceQualifier m_default_device; bool m_default_device_is_connected{false}; }; |
