diff options
| author | Alex Barney <thealexbarney@gmail.com> | 2019-06-15 20:31:18 -0500 |
|---|---|---|
| committer | Ac_K <Acoustik666@gmail.com> | 2019-06-16 03:31:18 +0200 |
| commit | 350a3667f755ffa80737995c953b31102f7bc523 (patch) | |
| tree | b106b45d8d95b77667ac03186817bf11d61c52a5 /Ryujinx.HLE/Utilities/StringUtils.cs | |
| parent | 5c1bc524092b3c5d867ce6204ac9db27b7359d3f (diff) | |
Implement OutputAccessLogToSdCard and expose an FS access log option (#700)
* Add OutputAccessLogToSdCard
* Add config options for the FS access log
Diffstat (limited to 'Ryujinx.HLE/Utilities/StringUtils.cs')
| -rw-r--r-- | Ryujinx.HLE/Utilities/StringUtils.cs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Ryujinx.HLE/Utilities/StringUtils.cs b/Ryujinx.HLE/Utilities/StringUtils.cs index e6602f48..055b8339 100644 --- a/Ryujinx.HLE/Utilities/StringUtils.cs +++ b/Ryujinx.HLE/Utilities/StringUtils.cs @@ -72,5 +72,28 @@ namespace Ryujinx.HLE.Utilities return Encoding.UTF8.GetString(ms.ToArray()); } } + + public static string ReadUtf8StringSend(ServiceCtx context, int index = 0) + { + long position = context.Request.SendBuff[index].Position; + long size = context.Request.SendBuff[index].Size; + + using (MemoryStream ms = new MemoryStream()) + { + while (size-- > 0) + { + byte value = context.Memory.ReadByte(position++); + + if (value == 0) + { + break; + } + + ms.WriteByte(value); + } + + return Encoding.UTF8.GetString(ms.ToArray()); + } + } } } |
