mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-10-01 12:30:00 +02:00
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"
This commit is contained in:
parent
b08d889f95
commit
57dfa09e3a
2 changed files with 34 additions and 13 deletions
|
@ -22,9 +22,9 @@ namespace Ryujinx.HLE.HOS.Services.Lm
|
||||||
|
|
||||||
public long Log(ServiceCtx Context)
|
public long Log(ServiceCtx Context)
|
||||||
{
|
{
|
||||||
byte[] LogBuffer = Context.Memory.ReadBytes(
|
|
||||||
Context.Request.PtrBuff[0].Position,
|
(long BufPos, long BufSize) = Context.Request.GetBufferType0x21();
|
||||||
Context.Request.PtrBuff[0].Size);
|
byte[] LogBuffer = Context.Memory.ReadBytes(BufPos, BufSize);
|
||||||
|
|
||||||
using (MemoryStream MS = new MemoryStream(LogBuffer))
|
using (MemoryStream MS = new MemoryStream(LogBuffer))
|
||||||
{
|
{
|
||||||
|
@ -50,20 +50,36 @@ namespace Ryujinx.HLE.HOS.Services.Lm
|
||||||
|
|
||||||
string FieldStr = string.Empty;
|
string FieldStr = string.Empty;
|
||||||
|
|
||||||
if (Field == LmLogField.Skip)
|
if (Field == LmLogField.Start)
|
||||||
{
|
{
|
||||||
Reader.ReadByte();
|
Reader.ReadBytes(Size);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
else if (Field == LmLogField.Stop)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
else if (Field == LmLogField.Line)
|
else if (Field == LmLogField.Line)
|
||||||
{
|
{
|
||||||
FieldStr = Field + ": " + Reader.ReadInt32();
|
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)) + "\"";
|
FieldStr = Field + ": \"" + Encoding.UTF8.GetString(Reader.ReadBytes(Size)) + "\"";
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FieldStr = "Field" + Field + ": \"" + Encoding.UTF8.GetString(Reader.ReadBytes(Size)) + "\"";
|
||||||
|
}
|
||||||
|
|
||||||
SB.AppendLine(" " + FieldStr);
|
SB.AppendLine(" " + FieldStr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,17 @@ namespace Ryujinx.HLE.HOS.Services.Lm
|
||||||
{
|
{
|
||||||
enum LmLogField
|
enum LmLogField
|
||||||
{
|
{
|
||||||
Skip = 1,
|
Start = 0,
|
||||||
|
Stop = 1,
|
||||||
Message = 2,
|
Message = 2,
|
||||||
Line = 3,
|
Line = 3,
|
||||||
Filename = 4,
|
Filename = 4,
|
||||||
Function = 5,
|
Function = 5,
|
||||||
Module = 6,
|
Module = 6,
|
||||||
Thread = 7
|
Thread = 7,
|
||||||
|
DropCount = 8,
|
||||||
|
Time = 9,
|
||||||
|
ProgramName = 10,
|
||||||
|
Count
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue