mirror of
https://github.com/starr-dusT/yuzu-mainline
synced 2024-03-05 21:12:25 -08:00
pctl: rewrite IParentalControlService
This commit is contained in:
parent
5ab49c833d
commit
89c2fd3d28
@ -4,7 +4,7 @@
|
|||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/file_sys/control_metadata.h"
|
#include "core/file_sys/control_metadata.h"
|
||||||
#include "core/file_sys/patch_manager.h"
|
#include "core/file_sys/patch_manager.h"
|
||||||
#include "core/hle/service/ipc_helpers.h"
|
#include "core/hle/service/cmif_serialization.h"
|
||||||
#include "core/hle/service/pctl/parental_control_service.h"
|
#include "core/hle/service/pctl/parental_control_service.h"
|
||||||
#include "core/hle/service/pctl/pctl_results.h"
|
#include "core/hle/service/pctl/pctl_results.h"
|
||||||
|
|
||||||
@ -12,37 +12,38 @@ namespace Service::PCTL {
|
|||||||
|
|
||||||
IParentalControlService::IParentalControlService(Core::System& system_, Capability capability_)
|
IParentalControlService::IParentalControlService(Core::System& system_, Capability capability_)
|
||||||
: ServiceFramework{system_, "IParentalControlService"}, capability{capability_},
|
: ServiceFramework{system_, "IParentalControlService"}, capability{capability_},
|
||||||
service_context{system_, "IParentalControlService"} {
|
service_context{system_, "IParentalControlService"}, synchronization_event{service_context},
|
||||||
|
unlinked_event{service_context}, request_suspension_event{service_context} {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{1, &IParentalControlService::Initialize, "Initialize"},
|
{1, D<&IParentalControlService::Initialize>, "Initialize"},
|
||||||
{1001, &IParentalControlService::CheckFreeCommunicationPermission, "CheckFreeCommunicationPermission"},
|
{1001, D<&IParentalControlService::CheckFreeCommunicationPermission>, "CheckFreeCommunicationPermission"},
|
||||||
{1002, nullptr, "ConfirmLaunchApplicationPermission"},
|
{1002, D<&IParentalControlService::ConfirmLaunchApplicationPermission>, "ConfirmLaunchApplicationPermission"},
|
||||||
{1003, nullptr, "ConfirmResumeApplicationPermission"},
|
{1003, D<&IParentalControlService::ConfirmResumeApplicationPermission>, "ConfirmResumeApplicationPermission"},
|
||||||
{1004, &IParentalControlService::ConfirmSnsPostPermission, "ConfirmSnsPostPermission"},
|
{1004, D<&IParentalControlService::ConfirmSnsPostPermission>, "ConfirmSnsPostPermission"},
|
||||||
{1005, nullptr, "ConfirmSystemSettingsPermission"},
|
{1005, nullptr, "ConfirmSystemSettingsPermission"},
|
||||||
{1006, &IParentalControlService::IsRestrictionTemporaryUnlocked, "IsRestrictionTemporaryUnlocked"},
|
{1006, D<&IParentalControlService::IsRestrictionTemporaryUnlocked>, "IsRestrictionTemporaryUnlocked"},
|
||||||
{1007, nullptr, "RevertRestrictionTemporaryUnlocked"},
|
{1007, nullptr, "RevertRestrictionTemporaryUnlocked"},
|
||||||
{1008, nullptr, "EnterRestrictedSystemSettings"},
|
{1008, nullptr, "EnterRestrictedSystemSettings"},
|
||||||
{1009, nullptr, "LeaveRestrictedSystemSettings"},
|
{1009, nullptr, "LeaveRestrictedSystemSettings"},
|
||||||
{1010, nullptr, "IsRestrictedSystemSettingsEntered"},
|
{1010, D<&IParentalControlService::IsRestrictedSystemSettingsEntered>, "IsRestrictedSystemSettingsEntered"},
|
||||||
{1011, nullptr, "RevertRestrictedSystemSettingsEntered"},
|
{1011, nullptr, "RevertRestrictedSystemSettingsEntered"},
|
||||||
{1012, nullptr, "GetRestrictedFeatures"},
|
{1012, nullptr, "GetRestrictedFeatures"},
|
||||||
{1013, &IParentalControlService::ConfirmStereoVisionPermission, "ConfirmStereoVisionPermission"},
|
{1013, D<&IParentalControlService::ConfirmStereoVisionPermission>, "ConfirmStereoVisionPermission"},
|
||||||
{1014, nullptr, "ConfirmPlayableApplicationVideoOld"},
|
{1014, nullptr, "ConfirmPlayableApplicationVideoOld"},
|
||||||
{1015, nullptr, "ConfirmPlayableApplicationVideo"},
|
{1015, nullptr, "ConfirmPlayableApplicationVideo"},
|
||||||
{1016, nullptr, "ConfirmShowNewsPermission"},
|
{1016, nullptr, "ConfirmShowNewsPermission"},
|
||||||
{1017, &IParentalControlService::EndFreeCommunication, "EndFreeCommunication"},
|
{1017, D<&IParentalControlService::EndFreeCommunication>, "EndFreeCommunication"},
|
||||||
{1018, &IParentalControlService::IsFreeCommunicationAvailable, "IsFreeCommunicationAvailable"},
|
{1018, D<&IParentalControlService::IsFreeCommunicationAvailable>, "IsFreeCommunicationAvailable"},
|
||||||
{1031, &IParentalControlService::IsRestrictionEnabled, "IsRestrictionEnabled"},
|
{1031, D<&IParentalControlService::IsRestrictionEnabled>, "IsRestrictionEnabled"},
|
||||||
{1032, &IParentalControlService::GetSafetyLevel, "GetSafetyLevel"},
|
{1032, D<&IParentalControlService::GetSafetyLevel>, "GetSafetyLevel"},
|
||||||
{1033, nullptr, "SetSafetyLevel"},
|
{1033, nullptr, "SetSafetyLevel"},
|
||||||
{1034, nullptr, "GetSafetyLevelSettings"},
|
{1034, nullptr, "GetSafetyLevelSettings"},
|
||||||
{1035, &IParentalControlService::GetCurrentSettings, "GetCurrentSettings"},
|
{1035, D<&IParentalControlService::GetCurrentSettings>, "GetCurrentSettings"},
|
||||||
{1036, nullptr, "SetCustomSafetyLevelSettings"},
|
{1036, nullptr, "SetCustomSafetyLevelSettings"},
|
||||||
{1037, nullptr, "GetDefaultRatingOrganization"},
|
{1037, nullptr, "GetDefaultRatingOrganization"},
|
||||||
{1038, nullptr, "SetDefaultRatingOrganization"},
|
{1038, nullptr, "SetDefaultRatingOrganization"},
|
||||||
{1039, &IParentalControlService::GetFreeCommunicationApplicationListCount, "GetFreeCommunicationApplicationListCount"},
|
{1039, D<&IParentalControlService::GetFreeCommunicationApplicationListCount>, "GetFreeCommunicationApplicationListCount"},
|
||||||
{1042, nullptr, "AddToFreeCommunicationApplicationList"},
|
{1042, nullptr, "AddToFreeCommunicationApplicationList"},
|
||||||
{1043, nullptr, "DeleteSettings"},
|
{1043, nullptr, "DeleteSettings"},
|
||||||
{1044, nullptr, "GetFreeCommunicationApplicationList"},
|
{1044, nullptr, "GetFreeCommunicationApplicationList"},
|
||||||
@ -51,20 +52,20 @@ IParentalControlService::IParentalControlService(Core::System& system_, Capabili
|
|||||||
{1047, nullptr, "NotifyApplicationDownloadStarted"},
|
{1047, nullptr, "NotifyApplicationDownloadStarted"},
|
||||||
{1048, nullptr, "NotifyNetworkProfileCreated"},
|
{1048, nullptr, "NotifyNetworkProfileCreated"},
|
||||||
{1049, nullptr, "ResetFreeCommunicationApplicationList"},
|
{1049, nullptr, "ResetFreeCommunicationApplicationList"},
|
||||||
{1061, &IParentalControlService::ConfirmStereoVisionRestrictionConfigurable, "ConfirmStereoVisionRestrictionConfigurable"},
|
{1061, D<&IParentalControlService::ConfirmStereoVisionRestrictionConfigurable>, "ConfirmStereoVisionRestrictionConfigurable"},
|
||||||
{1062, &IParentalControlService::GetStereoVisionRestriction, "GetStereoVisionRestriction"},
|
{1062, D<&IParentalControlService::GetStereoVisionRestriction>, "GetStereoVisionRestriction"},
|
||||||
{1063, &IParentalControlService::SetStereoVisionRestriction, "SetStereoVisionRestriction"},
|
{1063, D<&IParentalControlService::SetStereoVisionRestriction>, "SetStereoVisionRestriction"},
|
||||||
{1064, &IParentalControlService::ResetConfirmedStereoVisionPermission, "ResetConfirmedStereoVisionPermission"},
|
{1064, D<&IParentalControlService::ResetConfirmedStereoVisionPermission>, "ResetConfirmedStereoVisionPermission"},
|
||||||
{1065, &IParentalControlService::IsStereoVisionPermitted, "IsStereoVisionPermitted"},
|
{1065, D<&IParentalControlService::IsStereoVisionPermitted>, "IsStereoVisionPermitted"},
|
||||||
{1201, nullptr, "UnlockRestrictionTemporarily"},
|
{1201, nullptr, "UnlockRestrictionTemporarily"},
|
||||||
{1202, nullptr, "UnlockSystemSettingsRestriction"},
|
{1202, nullptr, "UnlockSystemSettingsRestriction"},
|
||||||
{1203, nullptr, "SetPinCode"},
|
{1203, nullptr, "SetPinCode"},
|
||||||
{1204, nullptr, "GenerateInquiryCode"},
|
{1204, nullptr, "GenerateInquiryCode"},
|
||||||
{1205, nullptr, "CheckMasterKey"},
|
{1205, nullptr, "CheckMasterKey"},
|
||||||
{1206, nullptr, "GetPinCodeLength"},
|
{1206, D<&IParentalControlService::GetPinCodeLength>, "GetPinCodeLength"},
|
||||||
{1207, nullptr, "GetPinCodeChangedEvent"},
|
{1207, nullptr, "GetPinCodeChangedEvent"},
|
||||||
{1208, nullptr, "GetPinCode"},
|
{1208, nullptr, "GetPinCode"},
|
||||||
{1403, &IParentalControlService::IsPairingActive, "IsPairingActive"},
|
{1403, D<&IParentalControlService::IsPairingActive>, "IsPairingActive"},
|
||||||
{1406, nullptr, "GetSettingsLastUpdated"},
|
{1406, nullptr, "GetSettingsLastUpdated"},
|
||||||
{1411, nullptr, "GetPairingAccountInfo"},
|
{1411, nullptr, "GetPairingAccountInfo"},
|
||||||
{1421, nullptr, "GetAccountNickname"},
|
{1421, nullptr, "GetAccountNickname"},
|
||||||
@ -72,18 +73,18 @@ IParentalControlService::IParentalControlService(Core::System& system_, Capabili
|
|||||||
{1425, nullptr, "RequestPostEvents"},
|
{1425, nullptr, "RequestPostEvents"},
|
||||||
{1426, nullptr, "GetPostEventInterval"},
|
{1426, nullptr, "GetPostEventInterval"},
|
||||||
{1427, nullptr, "SetPostEventInterval"},
|
{1427, nullptr, "SetPostEventInterval"},
|
||||||
{1432, &IParentalControlService::GetSynchronizationEvent, "GetSynchronizationEvent"},
|
{1432, D<&IParentalControlService::GetSynchronizationEvent>, "GetSynchronizationEvent"},
|
||||||
{1451, nullptr, "StartPlayTimer"},
|
{1451, D<&IParentalControlService::StartPlayTimer>, "StartPlayTimer"},
|
||||||
{1452, nullptr, "StopPlayTimer"},
|
{1452, D<&IParentalControlService::StopPlayTimer>, "StopPlayTimer"},
|
||||||
{1453, nullptr, "IsPlayTimerEnabled"},
|
{1453, D<&IParentalControlService::IsPlayTimerEnabled>, "IsPlayTimerEnabled"},
|
||||||
{1454, nullptr, "GetPlayTimerRemainingTime"},
|
{1454, nullptr, "GetPlayTimerRemainingTime"},
|
||||||
{1455, nullptr, "IsRestrictedByPlayTimer"},
|
{1455, D<&IParentalControlService::IsRestrictedByPlayTimer>, "IsRestrictedByPlayTimer"},
|
||||||
{1456, &IParentalControlService::GetPlayTimerSettings, "GetPlayTimerSettings"},
|
{1456, D<&IParentalControlService::GetPlayTimerSettings>, "GetPlayTimerSettings"},
|
||||||
{1457, &IParentalControlService::GetPlayTimerEventToRequestSuspension, "GetPlayTimerEventToRequestSuspension"},
|
{1457, D<&IParentalControlService::GetPlayTimerEventToRequestSuspension>, "GetPlayTimerEventToRequestSuspension"},
|
||||||
{1458, &IParentalControlService::IsPlayTimerAlarmDisabled, "IsPlayTimerAlarmDisabled"},
|
{1458, D<&IParentalControlService::IsPlayTimerAlarmDisabled>, "IsPlayTimerAlarmDisabled"},
|
||||||
{1471, nullptr, "NotifyWrongPinCodeInputManyTimes"},
|
{1471, nullptr, "NotifyWrongPinCodeInputManyTimes"},
|
||||||
{1472, nullptr, "CancelNetworkRequest"},
|
{1472, nullptr, "CancelNetworkRequest"},
|
||||||
{1473, &IParentalControlService::GetUnlinkedEvent, "GetUnlinkedEvent"},
|
{1473, D<&IParentalControlService::GetUnlinkedEvent>, "GetUnlinkedEvent"},
|
||||||
{1474, nullptr, "ClearUnlinkedEvent"},
|
{1474, nullptr, "ClearUnlinkedEvent"},
|
||||||
{1601, nullptr, "DisableAllFeatures"},
|
{1601, nullptr, "DisableAllFeatures"},
|
||||||
{1602, nullptr, "PostEnableAllFeatures"},
|
{1602, nullptr, "PostEnableAllFeatures"},
|
||||||
@ -119,19 +120,9 @@ IParentalControlService::IParentalControlService(Core::System& system_, Capabili
|
|||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
RegisterHandlers(functions);
|
RegisterHandlers(functions);
|
||||||
|
|
||||||
synchronization_event =
|
|
||||||
service_context.CreateEvent("IParentalControlService::SynchronizationEvent");
|
|
||||||
unlinked_event = service_context.CreateEvent("IParentalControlService::UnlinkedEvent");
|
|
||||||
request_suspension_event =
|
|
||||||
service_context.CreateEvent("IParentalControlService::RequestSuspensionEvent");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IParentalControlService::~IParentalControlService() {
|
IParentalControlService::~IParentalControlService() = default;
|
||||||
service_context.CloseEvent(synchronization_event);
|
|
||||||
service_context.CloseEvent(unlinked_event);
|
|
||||||
service_context.CloseEvent(request_suspension_event);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IParentalControlService::CheckFreeCommunicationPermissionImpl() const {
|
bool IParentalControlService::CheckFreeCommunicationPermissionImpl() const {
|
||||||
if (states.temporary_unlocked) {
|
if (states.temporary_unlocked) {
|
||||||
@ -176,20 +167,19 @@ void IParentalControlService::SetStereoVisionRestrictionImpl(bool is_restricted)
|
|||||||
settings.is_stero_vision_restricted = is_restricted;
|
settings.is_stero_vision_restricted = is_restricted;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IParentalControlService::Initialize(HLERequestContext& ctx) {
|
Result IParentalControlService::Initialize() {
|
||||||
LOG_DEBUG(Service_PCTL, "called");
|
LOG_DEBUG(Service_PCTL, "called");
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
|
||||||
|
|
||||||
if (False(capability & (Capability::Application | Capability::System))) {
|
if (False(capability & (Capability::Application | Capability::System))) {
|
||||||
LOG_ERROR(Service_PCTL, "Invalid capability! capability={:X}", capability);
|
LOG_ERROR(Service_PCTL, "Invalid capability! capability={:X}", capability);
|
||||||
return;
|
R_THROW(PCTL::ResultNoCapability);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(ogniK): Recovery flag initialization for pctl:r
|
// TODO(ogniK): Recovery flag initialization for pctl:r
|
||||||
|
|
||||||
const auto tid = system.GetApplicationProcessProgramID();
|
const auto program_id = system.GetApplicationProcessProgramID();
|
||||||
if (tid != 0) {
|
if (program_id != 0) {
|
||||||
const FileSys::PatchManager pm{tid, system.GetFileSystemController(),
|
const FileSys::PatchManager pm{program_id, system.GetFileSystemController(),
|
||||||
system.GetContentProvider()};
|
system.GetContentProvider()};
|
||||||
const auto control = pm.GetControlMetadata();
|
const auto control = pm.GetControlMetadata();
|
||||||
if (control.first) {
|
if (control.first) {
|
||||||
@ -199,7 +189,7 @@ void IParentalControlService::Initialize(HLERequestContext& ctx) {
|
|||||||
states.free_communication = false;
|
states.free_communication = false;
|
||||||
states.stereo_vision = false;
|
states.stereo_vision = false;
|
||||||
states.application_info = ApplicationInfo{
|
states.application_info = ApplicationInfo{
|
||||||
.application_id = tid,
|
.application_id = program_id,
|
||||||
.age_rating = control.first->GetRatingAge(),
|
.age_rating = control.first->GetRatingAge(),
|
||||||
.parental_control_flag = control.first->GetParentalControlFlag(),
|
.parental_control_flag = control.first->GetParentalControlFlag(),
|
||||||
.capability = capability,
|
.capability = capability,
|
||||||
@ -211,231 +201,234 @@ void IParentalControlService::Initialize(HLERequestContext& ctx) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rb.Push(ResultSuccess);
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IParentalControlService::CheckFreeCommunicationPermission(HLERequestContext& ctx) {
|
Result IParentalControlService::CheckFreeCommunicationPermission() {
|
||||||
LOG_DEBUG(Service_PCTL, "called");
|
LOG_DEBUG(Service_PCTL, "called");
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
|
||||||
if (!CheckFreeCommunicationPermissionImpl()) {
|
if (!CheckFreeCommunicationPermissionImpl()) {
|
||||||
rb.Push(PCTL::ResultNoFreeCommunication);
|
R_THROW(PCTL::ResultNoFreeCommunication);
|
||||||
} else {
|
} else {
|
||||||
rb.Push(ResultSuccess);
|
states.free_communication = true;
|
||||||
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
states.free_communication = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IParentalControlService::ConfirmSnsPostPermission(HLERequestContext& ctx) {
|
Result IParentalControlService::ConfirmLaunchApplicationPermission(
|
||||||
|
InBuffer<BufferAttr_HipcPointer> restriction_bitset, u64 nacp_flag, u64 application_id) {
|
||||||
|
LOG_WARNING(Service_PCTL, "(STUBBED) called, nacp_flag={:#x} application_id={:016X}", nacp_flag,
|
||||||
|
application_id);
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IParentalControlService::ConfirmResumeApplicationPermission(
|
||||||
|
InBuffer<BufferAttr_HipcPointer> restriction_bitset, u64 nacp_flag, u64 application_id) {
|
||||||
|
LOG_WARNING(Service_PCTL, "(STUBBED) called, nacp_flag={:#x} application_id={:016X}", nacp_flag,
|
||||||
|
application_id);
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IParentalControlService::ConfirmSnsPostPermission() {
|
||||||
LOG_WARNING(Service_PCTL, "(STUBBED) called");
|
LOG_WARNING(Service_PCTL, "(STUBBED) called");
|
||||||
|
R_THROW(PCTL::ResultNoFreeCommunication);
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
|
||||||
rb.Push(PCTL::ResultNoFreeCommunication);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IParentalControlService::IsRestrictionTemporaryUnlocked(HLERequestContext& ctx) {
|
Result IParentalControlService::IsRestrictionTemporaryUnlocked(
|
||||||
const bool is_temporary_unlocked = false;
|
Out<bool> out_is_temporary_unlocked) {
|
||||||
|
*out_is_temporary_unlocked = false;
|
||||||
LOG_WARNING(Service_PCTL, "(STUBBED) called, is_temporary_unlocked={}", is_temporary_unlocked);
|
LOG_WARNING(Service_PCTL, "(STUBBED) called, is_temporary_unlocked={}",
|
||||||
|
*out_is_temporary_unlocked);
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
R_SUCCEED();
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
rb.Push<u8>(is_temporary_unlocked);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IParentalControlService::ConfirmStereoVisionPermission(HLERequestContext& ctx) {
|
Result IParentalControlService::IsRestrictedSystemSettingsEntered(
|
||||||
|
Out<bool> out_is_restricted_system_settings_entered) {
|
||||||
|
*out_is_restricted_system_settings_entered = false;
|
||||||
|
LOG_WARNING(Service_PCTL, "(STUBBED) called, is_temporary_unlocked={}",
|
||||||
|
*out_is_restricted_system_settings_entered);
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IParentalControlService::ConfirmStereoVisionPermission() {
|
||||||
LOG_DEBUG(Service_PCTL, "called");
|
LOG_DEBUG(Service_PCTL, "called");
|
||||||
states.stereo_vision = true;
|
states.stereo_vision = true;
|
||||||
|
R_SUCCEED();
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IParentalControlService::EndFreeCommunication(HLERequestContext& ctx) {
|
Result IParentalControlService::EndFreeCommunication() {
|
||||||
LOG_WARNING(Service_PCTL, "(STUBBED) called");
|
LOG_WARNING(Service_PCTL, "(STUBBED) called");
|
||||||
|
R_SUCCEED();
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IParentalControlService::IsFreeCommunicationAvailable(HLERequestContext& ctx) {
|
Result IParentalControlService::IsFreeCommunicationAvailable() {
|
||||||
LOG_WARNING(Service_PCTL, "(STUBBED) called");
|
LOG_WARNING(Service_PCTL, "(STUBBED) called");
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
|
||||||
if (!CheckFreeCommunicationPermissionImpl()) {
|
if (!CheckFreeCommunicationPermissionImpl()) {
|
||||||
rb.Push(PCTL::ResultNoFreeCommunication);
|
R_THROW(PCTL::ResultNoFreeCommunication);
|
||||||
} else {
|
} else {
|
||||||
rb.Push(ResultSuccess);
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IParentalControlService::IsRestrictionEnabled(HLERequestContext& ctx) {
|
Result IParentalControlService::IsRestrictionEnabled(Out<bool> out_restriction_enabled) {
|
||||||
LOG_DEBUG(Service_PCTL, "called");
|
LOG_DEBUG(Service_PCTL, "called");
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
|
||||||
if (False(capability & (Capability::Status | Capability::Recovery))) {
|
if (False(capability & (Capability::Status | Capability::Recovery))) {
|
||||||
LOG_ERROR(Service_PCTL, "Application does not have Status or Recovery capabilities!");
|
LOG_ERROR(Service_PCTL, "Application does not have Status or Recovery capabilities!");
|
||||||
rb.Push(PCTL::ResultNoCapability);
|
*out_restriction_enabled = false;
|
||||||
rb.Push(false);
|
R_THROW(PCTL::ResultNoCapability);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rb.Push(pin_code[0] != '\0');
|
*out_restriction_enabled = pin_code[0] != '\0';
|
||||||
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IParentalControlService::GetSafetyLevel(HLERequestContext& ctx) {
|
Result IParentalControlService::GetSafetyLevel(Out<u32> out_safety_level) {
|
||||||
const u32 safety_level = 0;
|
*out_safety_level = 0;
|
||||||
|
LOG_WARNING(Service_PCTL, "(STUBBED) called, safety_level={}", *out_safety_level);
|
||||||
LOG_WARNING(Service_PCTL, "(STUBBED) called, safety_level={}", safety_level);
|
R_SUCCEED();
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
rb.Push(safety_level);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IParentalControlService::GetCurrentSettings(HLERequestContext& ctx) {
|
Result IParentalControlService::GetCurrentSettings(Out<RestrictionSettings> out_settings) {
|
||||||
LOG_INFO(Service_PCTL, "called");
|
LOG_INFO(Service_PCTL, "called");
|
||||||
|
*out_settings = restriction_settings;
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
R_SUCCEED();
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
rb.PushRaw(restriction_settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IParentalControlService::GetFreeCommunicationApplicationListCount(HLERequestContext& ctx) {
|
Result IParentalControlService::GetFreeCommunicationApplicationListCount(Out<s32> out_count) {
|
||||||
const u32 count = 4;
|
*out_count = 4;
|
||||||
|
LOG_WARNING(Service_PCTL, "(STUBBED) called, count={}", *out_count);
|
||||||
LOG_WARNING(Service_PCTL, "(STUBBED) called, count={}", count);
|
R_SUCCEED();
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
rb.Push(count);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IParentalControlService::ConfirmStereoVisionRestrictionConfigurable(HLERequestContext& ctx) {
|
Result IParentalControlService::ConfirmStereoVisionRestrictionConfigurable() {
|
||||||
LOG_DEBUG(Service_PCTL, "called");
|
LOG_DEBUG(Service_PCTL, "called");
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
|
||||||
|
|
||||||
if (False(capability & Capability::StereoVision)) {
|
if (False(capability & Capability::StereoVision)) {
|
||||||
LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!");
|
LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!");
|
||||||
rb.Push(PCTL::ResultNoCapability);
|
R_THROW(PCTL::ResultNoCapability);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pin_code[0] == '\0') {
|
if (pin_code[0] == '\0') {
|
||||||
rb.Push(PCTL::ResultNoRestrictionEnabled);
|
R_THROW(PCTL::ResultNoRestrictionEnabled);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rb.Push(ResultSuccess);
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IParentalControlService::IsStereoVisionPermitted(HLERequestContext& ctx) {
|
Result IParentalControlService::IsStereoVisionPermitted(Out<bool> out_is_permitted) {
|
||||||
LOG_DEBUG(Service_PCTL, "called");
|
LOG_DEBUG(Service_PCTL, "called");
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
|
||||||
if (!ConfirmStereoVisionPermissionImpl()) {
|
if (!ConfirmStereoVisionPermissionImpl()) {
|
||||||
rb.Push(PCTL::ResultStereoVisionRestricted);
|
*out_is_permitted = false;
|
||||||
rb.Push(false);
|
R_THROW(PCTL::ResultStereoVisionRestricted);
|
||||||
} else {
|
} else {
|
||||||
rb.Push(ResultSuccess);
|
*out_is_permitted = true;
|
||||||
rb.Push(true);
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IParentalControlService::IsPairingActive(HLERequestContext& ctx) {
|
Result IParentalControlService::GetPinCodeLength(Out<s32> out_length) {
|
||||||
const bool is_pairing_active = false;
|
*out_length = 0;
|
||||||
|
LOG_WARNING(Service_PCTL, "(STUBBED) called, length={}", *out_length);
|
||||||
LOG_WARNING(Service_PCTL, "(STUBBED) called, is_pairing_active={}", is_pairing_active);
|
R_SUCCEED();
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
rb.Push<u8>(is_pairing_active);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IParentalControlService::GetSynchronizationEvent(HLERequestContext& ctx) {
|
Result IParentalControlService::IsPairingActive(Out<bool> out_is_pairing_active) {
|
||||||
|
*out_is_pairing_active = false;
|
||||||
|
LOG_WARNING(Service_PCTL, "(STUBBED) called, is_pairing_active={}", *out_is_pairing_active);
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IParentalControlService::GetSynchronizationEvent(
|
||||||
|
OutCopyHandle<Kernel::KReadableEvent> out_event) {
|
||||||
LOG_INFO(Service_PCTL, "called");
|
LOG_INFO(Service_PCTL, "called");
|
||||||
|
*out_event = synchronization_event.GetHandle();
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 1};
|
R_SUCCEED();
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
rb.PushCopyObjects(synchronization_event->GetReadableEvent());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IParentalControlService::GetPlayTimerSettings(HLERequestContext& ctx) {
|
Result IParentalControlService::StartPlayTimer() {
|
||||||
LOG_WARNING(Service_PCTL, "(STUBBED) called");
|
LOG_WARNING(Service_PCTL, "(STUBBED) called");
|
||||||
|
R_SUCCEED();
|
||||||
const PlayTimerSettings timer_settings{};
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 15};
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
rb.PushRaw(timer_settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IParentalControlService::GetPlayTimerEventToRequestSuspension(HLERequestContext& ctx) {
|
Result IParentalControlService::StopPlayTimer() {
|
||||||
|
LOG_WARNING(Service_PCTL, "(STUBBED) called");
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IParentalControlService::IsPlayTimerEnabled(Out<bool> out_is_play_timer_enabled) {
|
||||||
|
*out_is_play_timer_enabled = false;
|
||||||
|
LOG_WARNING(Service_PCTL, "(STUBBED) called, enabled={}", *out_is_play_timer_enabled);
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IParentalControlService::IsRestrictedByPlayTimer(Out<bool> out_is_restricted_by_play_timer) {
|
||||||
|
*out_is_restricted_by_play_timer = false;
|
||||||
|
LOG_WARNING(Service_PCTL, "(STUBBED) called, restricted={}", *out_is_restricted_by_play_timer);
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IParentalControlService::GetPlayTimerSettings(
|
||||||
|
Out<PlayTimerSettings> out_play_timer_settings) {
|
||||||
|
LOG_WARNING(Service_PCTL, "(STUBBED) called");
|
||||||
|
*out_play_timer_settings = {};
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IParentalControlService::GetPlayTimerEventToRequestSuspension(
|
||||||
|
OutCopyHandle<Kernel::KReadableEvent> out_event) {
|
||||||
LOG_INFO(Service_PCTL, "called");
|
LOG_INFO(Service_PCTL, "called");
|
||||||
|
*out_event = request_suspension_event.GetHandle();
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 1};
|
R_SUCCEED();
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
rb.PushCopyObjects(request_suspension_event->GetReadableEvent());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IParentalControlService::IsPlayTimerAlarmDisabled(HLERequestContext& ctx) {
|
Result IParentalControlService::IsPlayTimerAlarmDisabled(Out<bool> out_play_timer_alarm_disabled) {
|
||||||
const bool is_play_timer_alarm_disabled = false;
|
*out_play_timer_alarm_disabled = false;
|
||||||
|
LOG_INFO(Service_PCTL, "called, is_play_timer_alarm_disabled={}",
|
||||||
LOG_INFO(Service_PCTL, "called, is_play_timer_alarm_disabled={}", is_play_timer_alarm_disabled);
|
*out_play_timer_alarm_disabled);
|
||||||
|
R_SUCCEED();
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
rb.Push<u8>(is_play_timer_alarm_disabled);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IParentalControlService::GetUnlinkedEvent(HLERequestContext& ctx) {
|
Result IParentalControlService::GetUnlinkedEvent(OutCopyHandle<Kernel::KReadableEvent> out_event) {
|
||||||
LOG_INFO(Service_PCTL, "called");
|
LOG_INFO(Service_PCTL, "called");
|
||||||
|
*out_event = unlinked_event.GetHandle();
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 1};
|
R_SUCCEED();
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
rb.PushCopyObjects(unlinked_event->GetReadableEvent());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IParentalControlService::SetStereoVisionRestriction(HLERequestContext& ctx) {
|
Result IParentalControlService::GetStereoVisionRestriction(
|
||||||
IPC::RequestParser rp{ctx};
|
Out<bool> out_stereo_vision_restriction) {
|
||||||
const auto can_use = rp.Pop<bool>();
|
|
||||||
LOG_DEBUG(Service_PCTL, "called, can_use={}", can_use);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
|
||||||
if (False(capability & Capability::StereoVision)) {
|
|
||||||
LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!");
|
|
||||||
rb.Push(PCTL::ResultNoCapability);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SetStereoVisionRestrictionImpl(can_use);
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IParentalControlService::GetStereoVisionRestriction(HLERequestContext& ctx) {
|
|
||||||
LOG_DEBUG(Service_PCTL, "called");
|
LOG_DEBUG(Service_PCTL, "called");
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
|
||||||
if (False(capability & Capability::StereoVision)) {
|
if (False(capability & Capability::StereoVision)) {
|
||||||
LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!");
|
LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!");
|
||||||
rb.Push(PCTL::ResultNoCapability);
|
*out_stereo_vision_restriction = false;
|
||||||
rb.Push(false);
|
R_THROW(PCTL::ResultNoCapability);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rb.Push(ResultSuccess);
|
*out_stereo_vision_restriction = settings.is_stero_vision_restricted;
|
||||||
rb.Push(settings.is_stero_vision_restricted);
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IParentalControlService::ResetConfirmedStereoVisionPermission(HLERequestContext& ctx) {
|
Result IParentalControlService::SetStereoVisionRestriction(bool stereo_vision_restriction) {
|
||||||
|
LOG_DEBUG(Service_PCTL, "called, can_use={}", stereo_vision_restriction);
|
||||||
|
|
||||||
|
if (False(capability & Capability::StereoVision)) {
|
||||||
|
LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!");
|
||||||
|
R_THROW(PCTL::ResultNoCapability);
|
||||||
|
}
|
||||||
|
|
||||||
|
SetStereoVisionRestrictionImpl(stereo_vision_restriction);
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IParentalControlService::ResetConfirmedStereoVisionPermission() {
|
||||||
LOG_DEBUG(Service_PCTL, "called");
|
LOG_DEBUG(Service_PCTL, "called");
|
||||||
|
|
||||||
states.stereo_vision = false;
|
states.stereo_vision = false;
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
R_SUCCEED();
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::PCTL
|
} // namespace Service::PCTL
|
||||||
|
@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "core/hle/service/cmif_types.h"
|
||||||
#include "core/hle/service/kernel_helpers.h"
|
#include "core/hle/service/kernel_helpers.h"
|
||||||
|
#include "core/hle/service/os/event.h"
|
||||||
#include "core/hle/service/pctl/pctl_types.h"
|
#include "core/hle/service/pctl/pctl_types.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
@ -19,28 +21,38 @@ private:
|
|||||||
bool ConfirmStereoVisionPermissionImpl() const;
|
bool ConfirmStereoVisionPermissionImpl() const;
|
||||||
void SetStereoVisionRestrictionImpl(bool is_restricted);
|
void SetStereoVisionRestrictionImpl(bool is_restricted);
|
||||||
|
|
||||||
void Initialize(HLERequestContext& ctx);
|
Result Initialize();
|
||||||
void CheckFreeCommunicationPermission(HLERequestContext& ctx);
|
Result CheckFreeCommunicationPermission();
|
||||||
void ConfirmSnsPostPermission(HLERequestContext& ctx);
|
Result ConfirmLaunchApplicationPermission(InBuffer<BufferAttr_HipcPointer> restriction_bitset,
|
||||||
void IsRestrictionTemporaryUnlocked(HLERequestContext& ctx);
|
u64 nacp_flag, u64 application_id);
|
||||||
void ConfirmStereoVisionPermission(HLERequestContext& ctx);
|
Result ConfirmResumeApplicationPermission(InBuffer<BufferAttr_HipcPointer> restriction_bitset,
|
||||||
void EndFreeCommunication(HLERequestContext& ctx);
|
u64 nacp_flag, u64 application_id);
|
||||||
void IsFreeCommunicationAvailable(HLERequestContext& ctx);
|
Result ConfirmSnsPostPermission();
|
||||||
void IsRestrictionEnabled(HLERequestContext& ctx);
|
Result IsRestrictionTemporaryUnlocked(Out<bool> out_is_temporary_unlocked);
|
||||||
void GetSafetyLevel(HLERequestContext& ctx);
|
Result IsRestrictedSystemSettingsEntered(Out<bool> out_is_restricted_system_settings_entered);
|
||||||
void GetCurrentSettings(HLERequestContext& ctx);
|
Result ConfirmStereoVisionPermission();
|
||||||
void GetFreeCommunicationApplicationListCount(HLERequestContext& ctx);
|
Result EndFreeCommunication();
|
||||||
void ConfirmStereoVisionRestrictionConfigurable(HLERequestContext& ctx);
|
Result IsFreeCommunicationAvailable();
|
||||||
void IsStereoVisionPermitted(HLERequestContext& ctx);
|
Result IsRestrictionEnabled(Out<bool> out_restriction_enabled);
|
||||||
void IsPairingActive(HLERequestContext& ctx);
|
Result GetSafetyLevel(Out<u32> out_safety_level);
|
||||||
void GetSynchronizationEvent(HLERequestContext& ctx);
|
Result GetCurrentSettings(Out<RestrictionSettings> out_settings);
|
||||||
void GetPlayTimerSettings(HLERequestContext& ctx);
|
Result GetFreeCommunicationApplicationListCount(Out<s32> out_count);
|
||||||
void GetPlayTimerEventToRequestSuspension(HLERequestContext& ctx);
|
Result ConfirmStereoVisionRestrictionConfigurable();
|
||||||
void IsPlayTimerAlarmDisabled(HLERequestContext& ctx);
|
Result IsStereoVisionPermitted(Out<bool> out_is_permitted);
|
||||||
void GetUnlinkedEvent(HLERequestContext& ctx);
|
Result GetPinCodeLength(Out<s32> out_length);
|
||||||
void SetStereoVisionRestriction(HLERequestContext& ctx);
|
Result IsPairingActive(Out<bool> out_is_pairing_active);
|
||||||
void GetStereoVisionRestriction(HLERequestContext& ctx);
|
Result GetSynchronizationEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);
|
||||||
void ResetConfirmedStereoVisionPermission(HLERequestContext& ctx);
|
Result StartPlayTimer();
|
||||||
|
Result StopPlayTimer();
|
||||||
|
Result IsPlayTimerEnabled(Out<bool> out_is_play_timer_enabled);
|
||||||
|
Result IsRestrictedByPlayTimer(Out<bool> out_is_restricted_by_play_timer);
|
||||||
|
Result GetPlayTimerSettings(Out<PlayTimerSettings> out_play_timer_settings);
|
||||||
|
Result GetPlayTimerEventToRequestSuspension(OutCopyHandle<Kernel::KReadableEvent> out_event);
|
||||||
|
Result IsPlayTimerAlarmDisabled(Out<bool> out_play_timer_alarm_disabled);
|
||||||
|
Result GetUnlinkedEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);
|
||||||
|
Result GetStereoVisionRestriction(Out<bool> out_stereo_vision_restriction);
|
||||||
|
Result SetStereoVisionRestriction(bool stereo_vision_restriction);
|
||||||
|
Result ResetConfirmedStereoVisionPermission();
|
||||||
|
|
||||||
struct States {
|
struct States {
|
||||||
u64 current_tid{};
|
u64 current_tid{};
|
||||||
@ -65,10 +77,10 @@ private:
|
|||||||
std::array<char, 8> pin_code{};
|
std::array<char, 8> pin_code{};
|
||||||
Capability capability{};
|
Capability capability{};
|
||||||
|
|
||||||
Kernel::KEvent* synchronization_event;
|
|
||||||
Kernel::KEvent* unlinked_event;
|
|
||||||
Kernel::KEvent* request_suspension_event;
|
|
||||||
KernelHelpers::ServiceContext service_context;
|
KernelHelpers::ServiceContext service_context;
|
||||||
|
Event synchronization_event;
|
||||||
|
Event unlinked_event;
|
||||||
|
Event request_suspension_event;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::PCTL
|
} // namespace Service::PCTL
|
||||||
|
Loading…
Reference in New Issue
Block a user