mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
InputCommon: fix serialization of control expression with line breaks
The control expression editor allows line breaks, but the serialization was losing anything after the first line break (/r /n). Instead of opting to encode them and decode them on serialization (which I tried but was not safe, as it would lose /n written in the string by users), I opted to replace them with a space.
This commit is contained in:
@ -117,7 +117,10 @@ void ControlGroup::SaveConfig(IniFile::Section* sec, const std::string& defdev,
|
||||
for (auto& c : controls)
|
||||
{
|
||||
// control expression
|
||||
sec->Set(group + c->name, c->control_ref->GetExpression(), "");
|
||||
std::string expression = c->control_ref->GetExpression();
|
||||
// We can't save line breaks in a single line config. Restoring them is too complicated.
|
||||
ReplaceBreaksWithSpaces(expression);
|
||||
sec->Set(group + c->name, expression, "");
|
||||
|
||||
// range
|
||||
sec->Set(group + c->name + "/Range", c->control_ref->range * 100.0, 100.0);
|
||||
@ -135,7 +138,9 @@ void ControlGroup::SaveConfig(IniFile::Section* sec, const std::string& defdev,
|
||||
}
|
||||
else
|
||||
{
|
||||
sec->Set(base + name, ext->GetSelectionSetting().GetInputReference().GetExpression(), "None");
|
||||
std::string expression = ext->GetSelectionSetting().GetInputReference().GetExpression();
|
||||
ReplaceBreaksWithSpaces(expression);
|
||||
sec->Set(base + name, expression, "None");
|
||||
}
|
||||
|
||||
for (auto& ai : ext->GetAttachmentList())
|
||||
|
Reference in New Issue
Block a user