forked from Mirror/Ryujinx
prepo: Implement SaveSystemReport and SaveSystemReportWithUser (#2379)
This commit is contained in:
parent
0b00473e5d
commit
7cf3ce7ed2
2 changed files with 31 additions and 7 deletions
|
@ -31,7 +31,7 @@ namespace Ryujinx.HLE.HOS.Services.Prepo
|
||||||
// SaveReport(u64, pid, buffer<u8, 9>, buffer<bytes, 5>)
|
// SaveReport(u64, pid, buffer<u8, 9>, buffer<bytes, 5>)
|
||||||
public ResultCode SaveReport(ServiceCtx context)
|
public ResultCode SaveReport(ServiceCtx context)
|
||||||
{
|
{
|
||||||
if (((int)_permission & 1) == 0)
|
if ((_permission & PrepoServicePermissionLevel.User) == 0)
|
||||||
{
|
{
|
||||||
return ResultCode.PermissionDenied;
|
return ResultCode.PermissionDenied;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ namespace Ryujinx.HLE.HOS.Services.Prepo
|
||||||
// SaveReportWithUser(nn::account::Uid, u64, pid, buffer<u8, 9>, buffer<bytes, 5>)
|
// SaveReportWithUser(nn::account::Uid, u64, pid, buffer<u8, 9>, buffer<bytes, 5>)
|
||||||
public ResultCode SaveReportWithUser(ServiceCtx context)
|
public ResultCode SaveReportWithUser(ServiceCtx context)
|
||||||
{
|
{
|
||||||
if (((int)_permission & 1) == 0)
|
if ((_permission & PrepoServicePermissionLevel.User) == 0)
|
||||||
{
|
{
|
||||||
return ResultCode.PermissionDenied;
|
return ResultCode.PermissionDenied;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ namespace Ryujinx.HLE.HOS.Services.Prepo
|
||||||
// GetSystemSessionId() -> u64
|
// GetSystemSessionId() -> u64
|
||||||
public ResultCode GetSystemSessionId(ServiceCtx context)
|
public ResultCode GetSystemSessionId(ServiceCtx context)
|
||||||
{
|
{
|
||||||
if (((int)_permission & 1) == 0)
|
if ((_permission & PrepoServicePermissionLevel.User) == 0)
|
||||||
{
|
{
|
||||||
return ResultCode.PermissionDenied;
|
return ResultCode.PermissionDenied;
|
||||||
}
|
}
|
||||||
|
@ -99,6 +99,32 @@ namespace Ryujinx.HLE.HOS.Services.Prepo
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[CommandHipc(20100)]
|
||||||
|
// SaveSystemReport(u64, pid, buffer<u8, 9>, buffer<bytes, 5>)
|
||||||
|
public ResultCode SaveSystemReport(ServiceCtx context)
|
||||||
|
{
|
||||||
|
if ((_permission & PrepoServicePermissionLevel.System) != 0)
|
||||||
|
{
|
||||||
|
return ResultCode.PermissionDenied;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We don't care about the differences since we don't use the play report.
|
||||||
|
return ProcessReport(context, withUserID: false);
|
||||||
|
}
|
||||||
|
|
||||||
|
[CommandHipc(20101)]
|
||||||
|
// SaveSystemReportWithUser(nn::account::Uid, u64, pid, buffer<u8, 9>, buffer<bytes, 5>)
|
||||||
|
public ResultCode SaveSystemReportWithUser(ServiceCtx context)
|
||||||
|
{
|
||||||
|
if ((_permission & PrepoServicePermissionLevel.System) != 0)
|
||||||
|
{
|
||||||
|
return ResultCode.PermissionDenied;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We don't care about the differences since we don't use the play report.
|
||||||
|
return ProcessReport(context, withUserID: true);
|
||||||
|
}
|
||||||
|
|
||||||
private ResultCode ProcessReport(ServiceCtx context, bool withUserID)
|
private ResultCode ProcessReport(ServiceCtx context, bool withUserID)
|
||||||
{
|
{
|
||||||
UserId userId = withUserID ? context.RequestData.ReadStruct<UserId>() : new UserId();
|
UserId userId = withUserID ? context.RequestData.ReadStruct<UserId>() : new UserId();
|
||||||
|
@ -136,7 +162,7 @@ namespace Ryujinx.HLE.HOS.Services.Prepo
|
||||||
|
|
||||||
private string ReadReportBuffer(byte[] buffer, string room, UserId userId)
|
private string ReadReportBuffer(byte[] buffer, string room, UserId userId)
|
||||||
{
|
{
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
MessagePackObject deserializedReport = MessagePackSerializer.UnpackMessagePackObject(buffer);
|
MessagePackObject deserializedReport = MessagePackSerializer.UnpackMessagePackObject(buffer);
|
||||||
|
|
||||||
builder.AppendLine();
|
builder.AppendLine();
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
using System;
|
namespace Ryujinx.HLE.HOS.Services.Prepo
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Prepo
|
|
||||||
{
|
{
|
||||||
enum PrepoServicePermissionLevel
|
enum PrepoServicePermissionLevel
|
||||||
{
|
{
|
||||||
|
|
Reference in a new issue