aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThog <me@thog.eu>2019-12-08 14:35:25 +0100
committerGitHub <noreply@github.com>2019-12-08 14:35:25 +0100
commitd925de2d0e7f3a065020c63dc1274644284e4006 (patch)
treea845f687cd398c2984bebddd5b2cdc2e2ae12e11
parent8c85bdf2edf5ebd7965fbbd08106f2e8d877d73e (diff)
Fix ILogger type and size decoding (#842)
* Fix ILogger type and size decoding The type and size are custom encoded integer not byte. This fix issues on games that send messages longer than 127 characters. * Address gdk's comments
-rw-r--r--Ryujinx.HLE/HOS/Services/Lm/LogService/ILogger.cs24
1 files changed, 22 insertions, 2 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Lm/LogService/ILogger.cs b/Ryujinx.HLE/HOS/Services/Lm/LogService/ILogger.cs
index 357a1332..a269312e 100644
--- a/Ryujinx.HLE/HOS/Services/Lm/LogService/ILogger.cs
+++ b/Ryujinx.HLE/HOS/Services/Lm/LogService/ILogger.cs
@@ -8,6 +8,26 @@ namespace Ryujinx.HLE.HOS.Services.Lm.LogService
{
public ILogger() { }
+ private static int ReadEncodedInt(BinaryReader reader)
+ {
+ int result = 0;
+ int position = 0;
+
+ byte encoded;
+
+ do
+ {
+ encoded = reader.ReadByte();
+
+ result += (encoded & 0x7F) << (7 * position);
+
+ position++;
+
+ } while ((encoded & 0x80) != 0);
+
+ return result;
+ }
+
[Command(0)]
// Log(buffer<unknown, 0x21>)
public ResultCode Log(ServiceCtx context)
@@ -34,8 +54,8 @@ namespace Ryujinx.HLE.HOS.Services.Lm.LogService
while (ms.Position < ms.Length)
{
- byte type = reader.ReadByte();
- byte size = reader.ReadByte();
+ int type = ReadEncodedInt(reader);
+ int size = ReadEncodedInt(reader);
LmLogField field = (LmLogField)type;