Race Integrity QoL (#3445)

* Add gDisableChangingSettings

* Add support for dropping a config file to overwrite CVars
This commit is contained in:
Garrett Cox
2023-11-28 22:42:37 -06:00
committed by GitHub
parent c4f34624ba
commit fdcd9a7508
12 changed files with 221 additions and 34 deletions
+18
View File
@@ -2,6 +2,7 @@
#include <string.h>
#include <vector>
#include <algorithm>
std::vector<std::string> sceneNames = {
"Inside the Deku Tree",
@@ -318,3 +319,20 @@ void SohUtils::CopyStringToCharArray(char* destination, std::string source, size
strncpy(destination, source.c_str(), size - 1);
destination[size - 1] = '\0';
}
std::string SohUtils::Sanitize(std::string stringValue) {
// Add backslashes.
for (auto i = stringValue.begin();;) {
auto const pos = std::find_if(i, stringValue.end(), [](char const c) { return '\\' == c || '\'' == c || '"' == c; });
if (pos == stringValue.end()) {
break;
}
i = std::next(stringValue.insert(pos, '\\'), 2);
}
// Removes others.
stringValue.erase(std::remove_if(stringValue.begin(), stringValue.end(), [](char const c) {
return '\n' == c || '\r' == c || '\0' == c || '\x1A' == c; }), stringValue.end());
return stringValue;
}