1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 04:02:42 +01:00

cfg: Partial support for case-insensitivity for true-false settings

This commit is contained in:
Eladash 2022-11-04 20:13:28 +02:00 committed by Megamouse
parent 69368d972d
commit b57ab74ee7

View File

@ -165,9 +165,17 @@ namespace cfg
bool from_string(std::string_view value, bool /*dynamic*/ = false) override
{
if (value == "false")
if (value.size() != 4 && value.size() != 5)
{
return false;
}
char copy[5];
std::transform(value.begin(), value.end(), std::begin(copy), ::tolower);
if (value.size() == 5 && std::string_view{copy, 5} == "false")
m_value = false;
else if (value == "true")
else if (value.size() == 4 && std::string_view{copy, 4} == "true")
m_value = true;
else
return false;