mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 19:44:55 +00:00
Use UTF-8 exclusively internally
This removes SystemString, SystemChar, etc. All filepaths and log strings are assumed to be UTF-8, with conversions to UTF-16 for Windows APIs as appropriate. Updates amuse, athena, boo, kabufua and nod
This commit is contained in:
@@ -259,18 +259,6 @@ std::string CVar::toLiteral(bool* isValid) const {
|
||||
return m_value;
|
||||
}
|
||||
|
||||
std::wstring CVar::toWideLiteral(bool* isValid) const {
|
||||
if (m_type != EType::Literal && (com_developer && com_developer->toBoolean())) {
|
||||
if (isValid != nullptr)
|
||||
*isValid = false;
|
||||
} else if (isValid != nullptr) {
|
||||
*isValid = true;
|
||||
}
|
||||
|
||||
// Even if it's not a literal, it's still safe to return
|
||||
return hecl::UTF8ToWide(m_value);
|
||||
}
|
||||
|
||||
bool CVar::fromVec2f(const atVec2f& val) {
|
||||
if (!safeToModify(EType::Vec2f))
|
||||
return false;
|
||||
@@ -398,15 +386,6 @@ bool CVar::fromLiteral(std::string_view val) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CVar::fromLiteral(std::wstring_view val) {
|
||||
if (!safeToModify(EType::Literal))
|
||||
return false;
|
||||
|
||||
m_value.assign(hecl::WideToUTF8(val));
|
||||
setModified();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CVar::fromLiteralToType(std::string_view val) {
|
||||
if (!safeToModify(m_type) || !isValidInput(val))
|
||||
return false;
|
||||
@@ -415,8 +394,6 @@ bool CVar::fromLiteralToType(std::string_view val) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CVar::fromLiteralToType(std::wstring_view val) { return fromLiteralToType(hecl::WideToUTF8(val)); }
|
||||
|
||||
bool CVar::isModified() const { return True(m_flags & EFlags::Modified); }
|
||||
bool CVar::modificationRequiresRestart() const { return True(m_flags & EFlags::ModifyRestart); }
|
||||
|
||||
@@ -523,8 +500,6 @@ bool CVar::isValidInput(std::string_view input) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CVar::isValidInput(std::wstring_view input) const { return isValidInput(hecl::WideToUTF8(input)); }
|
||||
|
||||
bool CVar::safeToModify(EType type) const {
|
||||
// Are we NoDevelper?
|
||||
if (isNoDeveloper())
|
||||
|
||||
Reference in New Issue
Block a user