aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Guillemard <thog@protonmail.com>2018-08-22 23:06:29 +0200
committergdkchan <gab.dark.100@gmail.com>2018-08-22 18:06:29 -0300
commit57dfa09e3aa47ef7407d9952519311e6ee67dc90 (patch)
tree93242f8c8955e6d3cf885f14d01838037a9e6174
parentb08d889f952b76145e38427f13736824cd8b6f06 (diff)
Improve LM implementation (#373)
- Manage end of the log packet correctly. - Add drop count, time, and program name parsing. - Use the correct buffer type. (0x21 not 0x9) - Prefix unknown fields with "Field"
-rw-r--r--Ryujinx.HLE/HOS/Services/Lm/ILogger.cs28
-rw-r--r--Ryujinx.HLE/HOS/Services/Lm/LmLogField.cs19
2 files changed, 34 insertions, 13 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Lm/ILogger.cs b/Ryujinx.HLE/HOS/Services/Lm/ILogger.cs
index 42d57c6f..5d999709 100644
--- a/Ryujinx.HLE/HOS/Services/Lm/ILogger.cs
+++ b/Ryujinx.HLE/HOS/Services/Lm/ILogger.cs
@@ -22,9 +22,9 @@ namespace Ryujinx.HLE.HOS.Services.Lm
public long Log(ServiceCtx Context)
{
- byte[] LogBuffer = Context.Memory.ReadBytes(
- Context.Request.PtrBuff[0].Position,
- Context.Request.PtrBuff[0].Size);
+
+ (long BufPos, long BufSize) = Context.Request.GetBufferType0x21();
+ byte[] LogBuffer = Context.Memory.ReadBytes(BufPos, BufSize);
using (MemoryStream MS = new MemoryStream(LogBuffer))
{
@@ -50,20 +50,36 @@ namespace Ryujinx.HLE.HOS.Services.Lm
string FieldStr = string.Empty;
- if (Field == LmLogField.Skip)
+ if (Field == LmLogField.Start)
{
- Reader.ReadByte();
+ Reader.ReadBytes(Size);
continue;
}
+ else if (Field == LmLogField.Stop)
+ {
+ break;
+ }
else if (Field == LmLogField.Line)
{
FieldStr = Field + ": " + Reader.ReadInt32();
}
- else
+ else if (Field == LmLogField.DropCount)
+ {
+ FieldStr = Field + ": " + Reader.ReadInt64();
+ }
+ else if (Field == LmLogField.Time)
+ {
+ FieldStr = Field + ": " + Reader.ReadInt64() + "s";
+ }
+ else if (Field < LmLogField.Count)
{
FieldStr = Field + ": \"" + Encoding.UTF8.GetString(Reader.ReadBytes(Size)) + "\"";
}
+ else
+ {
+ FieldStr = "Field" + Field + ": \"" + Encoding.UTF8.GetString(Reader.ReadBytes(Size)) + "\"";
+ }
SB.AppendLine(" " + FieldStr);
}
diff --git a/Ryujinx.HLE/HOS/Services/Lm/LmLogField.cs b/Ryujinx.HLE/HOS/Services/Lm/LmLogField.cs
index bd8c8e88..95474634 100644
--- a/Ryujinx.HLE/HOS/Services/Lm/LmLogField.cs
+++ b/Ryujinx.HLE/HOS/Services/Lm/LmLogField.cs
@@ -2,12 +2,17 @@ namespace Ryujinx.HLE.HOS.Services.Lm
{
enum LmLogField
{
- Skip = 1,
- Message = 2,
- Line = 3,
- Filename = 4,
- Function = 5,
- Module = 6,
- Thread = 7
+ Start = 0,
+ Stop = 1,
+ Message = 2,
+ Line = 3,
+ Filename = 4,
+ Function = 5,
+ Module = 6,
+ Thread = 7,
+ DropCount = 8,
+ Time = 9,
+ ProgramName = 10,
+ Count
}
} \ No newline at end of file