prepo: Implement SaveSystemReport and SaveSystemReportWithUser (#2379)

This commit is contained in:
Ac_K 2021-06-23 22:41:44 +02:00 committed by GitHub
parent 0b00473e5d
commit 7cf3ce7ed2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 7 deletions

View File

@ -31,7 +31,7 @@ namespace Ryujinx.HLE.HOS.Services.Prepo
// SaveReport(u64, pid, buffer<u8, 9>, buffer<bytes, 5>)
public ResultCode SaveReport(ServiceCtx context)
{
if (((int)_permission & 1) == 0)
if ((_permission & PrepoServicePermissionLevel.User) == 0)
{
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>)
public ResultCode SaveReportWithUser(ServiceCtx context)
{
if (((int)_permission & 1) == 0)
if ((_permission & PrepoServicePermissionLevel.User) == 0)
{
return ResultCode.PermissionDenied;
}
@ -80,7 +80,7 @@ namespace Ryujinx.HLE.HOS.Services.Prepo
// GetSystemSessionId() -> u64
public ResultCode GetSystemSessionId(ServiceCtx context)
{
if (((int)_permission & 1) == 0)
if ((_permission & PrepoServicePermissionLevel.User) == 0)
{
return ResultCode.PermissionDenied;
}
@ -99,6 +99,32 @@ namespace Ryujinx.HLE.HOS.Services.Prepo
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)
{
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)
{
StringBuilder builder = new StringBuilder();
StringBuilder builder = new StringBuilder();
MessagePackObject deserializedReport = MessagePackSerializer.UnpackMessagePackObject(buffer);
builder.AppendLine();

View File

@ -1,6 +1,4 @@
using System;
namespace Ryujinx.HLE.HOS.Services.Prepo
namespace Ryujinx.HLE.HOS.Services.Prepo
{
enum PrepoServicePermissionLevel
{