pctl: Implement IsRestrictionEnabled and fix CheckFreeCommunicationPermission (#1747)

* pctl: Implement IsRestrictionEnabled and fix CheckFreeCommunicationPermission

* fix comment
This commit is contained in:
Ac_K 2020-11-24 21:19:06 +01:00 committed by GitHub
parent 44c1f16280
commit 632a84155b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,8 +10,12 @@ namespace Ryujinx.HLE.HOS.Services.Pctl.ParentalControlServiceFactory
private ulong _titleId; private ulong _titleId;
private bool _freeCommunicationEnabled; private bool _freeCommunicationEnabled;
private int[] _ratingAge; private int[] _ratingAge;
// TODO: Find where they are set.
private bool _restrictionEnabled = false;
private bool _featuresRestriction = false; private bool _featuresRestriction = false;
private bool _stereoVisionRestrictionConfigurable = true; private bool _stereoVisionRestrictionConfigurable = true;
private bool _stereoVisionRestriction = false; private bool _stereoVisionRestriction = false;
public IParentalControlService(ServiceCtx context, bool withInitialize, int permissionFlag) public IParentalControlService(ServiceCtx context, bool withInitialize, int permissionFlag)
@ -73,13 +77,15 @@ namespace Ryujinx.HLE.HOS.Services.Pctl.ParentalControlServiceFactory
// CheckFreeCommunicationPermission() // CheckFreeCommunicationPermission()
public ResultCode CheckFreeCommunicationPermission(ServiceCtx context) public ResultCode CheckFreeCommunicationPermission(ServiceCtx context)
{ {
Logger.Stub?.PrintStub(LogClass.ServicePctl); // TODO: This checks some extra internal fields which are to be determined.
if (!_freeCommunicationEnabled) if (!_freeCommunicationEnabled && _restrictionEnabled)
{ {
return ResultCode.FreeCommunicationDisabled; return ResultCode.FreeCommunicationDisabled;
} }
Logger.Stub?.PrintStub(LogClass.ServicePctl);
return ResultCode.Success; return ResultCode.Success;
} }
@ -90,6 +96,20 @@ namespace Ryujinx.HLE.HOS.Services.Pctl.ParentalControlServiceFactory
return IsStereoVisionPermittedImpl(); return IsStereoVisionPermittedImpl();
} }
[Command(1031)]
// IsRestrictionEnabled() -> b8
public ResultCode IsRestrictionEnabled(ServiceCtx context)
{
if ((_permissionFlag & 0x140) == 0)
{
return ResultCode.PermissionDenied;
}
context.ResponseData.Write(_restrictionEnabled);
return ResultCode.Success;
}
[Command(1061)] // 4.0.0+ [Command(1061)] // 4.0.0+
// ConfirmStereoVisionRestrictionConfigurable() // ConfirmStereoVisionRestrictionConfigurable()
public ResultCode ConfirmStereoVisionRestrictionConfigurable(ServiceCtx context) public ResultCode ConfirmStereoVisionRestrictionConfigurable(ServiceCtx context)