aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Applets
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2021-10-28 18:06:45 -0300
committerGitHub <noreply@github.com>2021-10-28 23:06:45 +0200
commita7a40a77f2c07ea0ea9f6e7bfb57dbe9fce06db7 (patch)
tree75902cdb890a4ed2e735c5d074ca03054641b83f /Ryujinx.HLE/HOS/Applets
parent5c66a36ed65f76e27c86e6481fda59f313463da3 (diff)
Add support for the brazilian portuguese language code (#2792)
* Add support for the brazilian portuguese language code * Fix error applet message
Diffstat (limited to 'Ryujinx.HLE/HOS/Applets')
-rw-r--r--Ryujinx.HLE/HOS/Applets/Error/ErrorApplet.cs12
1 files changed, 6 insertions, 6 deletions
diff --git a/Ryujinx.HLE/HOS/Applets/Error/ErrorApplet.cs b/Ryujinx.HLE/HOS/Applets/Error/ErrorApplet.cs
index c8bdf3e1..84562176 100644
--- a/Ryujinx.HLE/HOS/Applets/Error/ErrorApplet.cs
+++ b/Ryujinx.HLE/HOS/Applets/Error/ErrorApplet.cs
@@ -94,13 +94,14 @@ namespace Ryujinx.HLE.HOS.Applets.Error
SystemLanguage.LatinAmericanSpanish => "es-419",
SystemLanguage.SimplifiedChinese => "zh-Hans",
SystemLanguage.TraditionalChinese => "zh-Hant",
+ SystemLanguage.BrazilianPortuguese => "pt-BR",
_ => "en-US"
};
}
- public string CleanText(string value)
+ private static string CleanText(string value)
{
- return Regex.Replace(Encoding.Unicode.GetString(Encoding.UTF8.GetBytes(value)), @"[^\u0009\u000A\u000D\u0020-\u007E]", "");
+ return Regex.Replace(value, @"[^\u0000\u0009\u000A\u000D\u0020-\uFFFF]..", "").Replace("\0", "");
}
private string GetMessageText(uint module, uint description, string key)
@@ -112,13 +113,12 @@ namespace Ryujinx.HLE.HOS.Applets.Error
Nca nca = new Nca(_horizon.Device.FileSystem.KeySet, ncaFileStream);
IFileSystem romfs = nca.OpenFileSystem(NcaSectionType.Data, _horizon.FsIntegrityCheckLevel);
string languageCode = SystemLanguageToLanguageKey(_horizon.State.DesiredSystemLanguage);
- string filePath = "/" + Path.Combine(module.ToString(), $"{description:0000}", $"{languageCode}_{key}").Replace(@"\", "/");
+ string filePath = $"/{module}/{description:0000}/{languageCode}_{key}";
if (romfs.FileExists(filePath))
{
romfs.OpenFile(out IFile binaryFile, filePath.ToU8Span(), OpenMode.Read).ThrowIfFailure();
-
- StreamReader reader = new StreamReader(binaryFile.AsStream());
+ StreamReader reader = new StreamReader(binaryFile.AsStream(), Encoding.Unicode);
return CleanText(reader.ReadToEnd());
}
@@ -149,7 +149,7 @@ namespace Ryujinx.HLE.HOS.Applets.Error
}
string message = GetMessageText(module, description, "DlgMsg");
-
+
if (message == "")
{
message = "An error has occured.\n\n"