diff options
| author | Mary <me@thog.eu> | 2022-01-12 17:43:00 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-12 17:43:00 +0100 |
| commit | d300a5a45b73c7d1fdb631a9d93db66c70903486 (patch) | |
| tree | ce219dcb2b992c77fe4fa415ca230d8311fbda0c /Ryujinx.HLE/Utilities/StringUtils.cs | |
| parent | f4bbc019b98fc026cd5e701d54be891e27077ff8 (diff) | |
sfdnsres: Fix serialization issues (#2992)
* sfdnsres: Fix serialization issues
Fix a crash on Monster Hunter Rise
* Address gdkchan's comments
* Address gdkchan's comments
Diffstat (limited to 'Ryujinx.HLE/Utilities/StringUtils.cs')
| -rw-r--r-- | Ryujinx.HLE/Utilities/StringUtils.cs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Ryujinx.HLE/Utilities/StringUtils.cs b/Ryujinx.HLE/Utilities/StringUtils.cs index 2b7cbffe..3027139b 100644 --- a/Ryujinx.HLE/Utilities/StringUtils.cs +++ b/Ryujinx.HLE/Utilities/StringUtils.cs @@ -60,6 +60,18 @@ namespace Ryujinx.HLE.Utilities return output; } + public static string ReadUtf8String(ReadOnlySpan<byte> data, out int dataRead) + { + dataRead = data.IndexOf((byte)0) + 1; + + if (dataRead <= 1) + { + return string.Empty; + } + + return Encoding.UTF8.GetString(data[..dataRead]); + } + public static string ReadUtf8String(ServiceCtx context, int index = 0) { ulong position = context.Request.PtrBuff[index].Position; |
