summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp
diff options
context:
space:
mode:
authoriwubcode <iwubcode@users.noreply.github.com>2019-08-17 14:40:58 -0500
committeriwubcode <iwubcode@users.noreply.github.com>2020-10-03 17:10:35 -0500
commitfd3af4c5d32a34b27c45b478c74fa1127b6438b9 (patch)
treedf55a2548a01e0cd0578abb41f2c9ad78d1db544 /Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp
parent8a1539f9487cff0b5785e2d341663e4d7136e2a3 (diff)
InputCommon: Introducing the "Dynamic Input Texture". Configuration links an emulated input action to an image based on what host key is defined for that emulated input. Specific regions are called out in configuration that mark where to replace an input button with a host key image.
Diffstat (limited to 'Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp')
-rw-r--r--Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp24
1 files changed, 24 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