mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-09-11 18:28:50 +02:00
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
This commit is contained in:
parent
8c85bdf2ed
commit
d925de2d0e
1 changed files with 22 additions and 2 deletions
|
@ -8,6 +8,26 @@ namespace Ryujinx.HLE.HOS.Services.Lm.LogService
|
||||||
{
|
{
|
||||||
public ILogger() { }
|
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)]
|
[Command(0)]
|
||||||
// Log(buffer<unknown, 0x21>)
|
// Log(buffer<unknown, 0x21>)
|
||||||
public ResultCode Log(ServiceCtx context)
|
public ResultCode Log(ServiceCtx context)
|
||||||
|
@ -34,8 +54,8 @@ namespace Ryujinx.HLE.HOS.Services.Lm.LogService
|
||||||
|
|
||||||
while (ms.Position < ms.Length)
|
while (ms.Position < ms.Length)
|
||||||
{
|
{
|
||||||
byte type = reader.ReadByte();
|
int type = ReadEncodedInt(reader);
|
||||||
byte size = reader.ReadByte();
|
int size = ReadEncodedInt(reader);
|
||||||
|
|
||||||
LmLogField field = (LmLogField)type;
|
LmLogField field = (LmLogField)type;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue