mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-13 00:58:29 +02:00
InputCommon: Allow Wii remote extension to be set with an input expression.
This commit is contained in:
@ -4,6 +4,8 @@
|
||||
|
||||
#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
NumericSettingBase::NumericSettingBase(const NumericSettingDetails& details) : m_details(details)
|
||||
@ -25,6 +27,36 @@ const char* NumericSettingBase::GetUIDescription() const
|
||||
return m_details.ui_description;
|
||||
}
|
||||
|
||||
template <>
|
||||
void NumericSetting<int>::SetExpressionFromValue()
|
||||
{
|
||||
m_value.m_input.SetExpression(ValueToString(GetValue()));
|
||||
}
|
||||
|
||||
template <>
|
||||
void NumericSetting<double>::SetExpressionFromValue()
|
||||
{
|
||||
// We must use a dot decimal separator for expression parser.
|
||||
std::ostringstream ss;
|
||||
ss.imbue(std::locale::classic());
|
||||
ss << GetValue();
|
||||
|
||||
m_value.m_input.SetExpression(ss.str());
|
||||
}
|
||||
|
||||
template <>
|
||||
void NumericSetting<bool>::SetExpressionFromValue()
|
||||
{
|
||||
// Cast bool to prevent "true"/"false" strings.
|
||||
m_value.m_input.SetExpression(ValueToString(int(GetValue())));
|
||||
}
|
||||
|
||||
template <>
|
||||
SettingType NumericSetting<int>::GetType() const
|
||||
{
|
||||
return SettingType::Int;
|
||||
}
|
||||
|
||||
template <>
|
||||
SettingType NumericSetting<double>::GetType() const
|
||||
{
|
||||
|
Reference in New Issue
Block a user