diff --git a/Ryujinx.HLE/HOS/Services/Prepo/IPrepoService.cs b/Ryujinx.HLE/HOS/Services/Prepo/IPrepoService.cs index 4f36d401..3fa1182d 100644 --- a/Ryujinx.HLE/HOS/Services/Prepo/IPrepoService.cs +++ b/Ryujinx.HLE/HOS/Services/Prepo/IPrepoService.cs @@ -31,7 +31,7 @@ namespace Ryujinx.HLE.HOS.Services.Prepo // SaveReport(u64, pid, buffer, buffer) 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, buffer) 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, buffer) + 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, buffer) + 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() : 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(); diff --git a/Ryujinx.HLE/HOS/Services/Prepo/Types/PrepoServicePermissionLevel.cs b/Ryujinx.HLE/HOS/Services/Prepo/Types/PrepoServicePermissionLevel.cs index 624c3fde..35774707 100644 --- a/Ryujinx.HLE/HOS/Services/Prepo/Types/PrepoServicePermissionLevel.cs +++ b/Ryujinx.HLE/HOS/Services/Prepo/Types/PrepoServicePermissionLevel.cs @@ -1,6 +1,4 @@ -using System; - -namespace Ryujinx.HLE.HOS.Services.Prepo +namespace Ryujinx.HLE.HOS.Services.Prepo { enum PrepoServicePermissionLevel {