mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-25 07:09:48 -06:00
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.
This commit is contained in:
@ -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
|
||||
|
@ -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};
|
||||
};
|
||||
|
Reference in New Issue
Block a user