1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-11-14 17:26:38 +00:00

pctl: Stub IsFreeCommunicationAvailable (#1893)

* pctl: Stub IsFreeCommunicationAvailable

This PR stub call IsFreeCommunicationAvailable since it's the same as call CheckFreeCommunicationPermission without a sets of an internal field.
I've fixed a wrong logic found while I'm checked the call by RE.

This fix #1883.

* Fix comments
This commit is contained in:
Ac_K 2021-01-10 21:26:59 +01:00 committed by GitHub
parent 6ed19c1488
commit 3c09abf9e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,3 +1,4 @@
using LibHac.Ns;
using Ryujinx.Common.Logging; using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Services.Arp; using Ryujinx.HLE.HOS.Services.Arp;
using System; using System;
@ -8,14 +9,13 @@ namespace Ryujinx.HLE.HOS.Services.Pctl.ParentalControlServiceFactory
{ {
private int _permissionFlag; private int _permissionFlag;
private ulong _titleId; private ulong _titleId;
private bool _freeCommunicationEnabled; private ParentalControlFlagValue _parentalControlFlag;
private int[] _ratingAge; private int[] _ratingAge;
// TODO: Find where they are set. // TODO: Find where they are set.
private bool _restrictionEnabled = false; 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)
@ -51,7 +51,7 @@ namespace Ryujinx.HLE.HOS.Services.Pctl.ParentalControlServiceFactory
// TODO: Call nn::arp::GetApplicationControlProperty here when implemented, if it return ResultCode.Success we assign fields. // TODO: Call nn::arp::GetApplicationControlProperty here when implemented, if it return ResultCode.Success we assign fields.
_ratingAge = Array.ConvertAll(context.Device.Application.ControlData.Value.RatingAge.ToArray(), Convert.ToInt32); _ratingAge = Array.ConvertAll(context.Device.Application.ControlData.Value.RatingAge.ToArray(), Convert.ToInt32);
_freeCommunicationEnabled = context.Device.Application.ControlData.Value.ParentalControl == LibHac.Ns.ParentalControlFlagValue.FreeCommunication; _parentalControlFlag = context.Device.Application.ControlData.Value.ParentalControl;
} }
} }
@ -77,13 +77,16 @@ namespace Ryujinx.HLE.HOS.Services.Pctl.ParentalControlServiceFactory
// CheckFreeCommunicationPermission() // CheckFreeCommunicationPermission()
public ResultCode CheckFreeCommunicationPermission(ServiceCtx context) public ResultCode CheckFreeCommunicationPermission(ServiceCtx context)
{ {
// TODO: This checks some extra internal fields which are to be determined. if (_parentalControlFlag == ParentalControlFlagValue.FreeCommunication && _restrictionEnabled)
if (!_freeCommunicationEnabled && _restrictionEnabled)
{ {
// TODO: It seems to checks if an entry exists in the FreeCommunicationApplicationList using the TitleId.
// Then it returns FreeCommunicationDisabled if the entry doesn't exist.
return ResultCode.FreeCommunicationDisabled; return ResultCode.FreeCommunicationDisabled;
} }
// NOTE: This sets an internal field to true. Usage have to be determined.
Logger.Stub?.PrintStub(LogClass.ServicePctl); Logger.Stub?.PrintStub(LogClass.ServicePctl);
return ResultCode.Success; return ResultCode.Success;
@ -96,6 +99,23 @@ namespace Ryujinx.HLE.HOS.Services.Pctl.ParentalControlServiceFactory
return IsStereoVisionPermittedImpl(); return IsStereoVisionPermittedImpl();
} }
[Command(1018)]
// IsFreeCommunicationAvailable()
public ResultCode IsFreeCommunicationAvailable(ServiceCtx context)
{
if (_parentalControlFlag == ParentalControlFlagValue.FreeCommunication && _restrictionEnabled)
{
// TODO: It seems to checks if an entry exists in the FreeCommunicationApplicationList using the TitleId.
// Then it returns FreeCommunicationDisabled if the entry doesn't exist.
return ResultCode.FreeCommunicationDisabled;
}
Logger.Stub?.PrintStub(LogClass.ServicePctl);
return ResultCode.Success;
}
[Command(1031)] [Command(1031)]
// IsRestrictionEnabled() -> b8 // IsRestrictionEnabled() -> b8
public ResultCode IsRestrictionEnabled(ServiceCtx context) public ResultCode IsRestrictionEnabled(ServiceCtx context)