summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2024-02-22 03:41:55 +0100
committerLiam <byteslice@airmail.cc>2024-02-22 05:42:33 +0100
commit89c2fd3d2830d5b1e73c9e051e4af39772963036 (patch)
treefb95e6ac93fac3fe1dfa4c7702dfec08ff825c94 /src/core/hle/service
parentpctl: rewrite IParentalControlServiceFactory (diff)
downloadyuzu-89c2fd3d2830d5b1e73c9e051e4af39772963036.tar
yuzu-89c2fd3d2830d5b1e73c9e051e4af39772963036.tar.gz
yuzu-89c2fd3d2830d5b1e73c9e051e4af39772963036.tar.bz2
yuzu-89c2fd3d2830d5b1e73c9e051e4af39772963036.tar.lz
yuzu-89c2fd3d2830d5b1e73c9e051e4af39772963036.tar.xz
yuzu-89c2fd3d2830d5b1e73c9e051e4af39772963036.tar.zst
yuzu-89c2fd3d2830d5b1e73c9e051e4af39772963036.zip
Diffstat (limited to 'src/core/hle/service')
-rw-r--r--src/core/hle/service/pctl/parental_control_service.cpp341
-rw-r--r--src/core/hle/service/pctl/parental_control_service.h62
2 files changed, 204 insertions, 199 deletions
diff --git a/src/core/hle/service/pctl/parental_control_service.cpp b/src/core/hle/service/pctl/parental_control_service.cpp
index 4248b0184..f57f2f157 100644
--- a/src/core/hle/service/pctl/parental_control_service.cpp
+++ b/src/core/hle/service/pctl/parental_control_service.cpp
@@ -4,7 +4,7 @@
#include "core/core.h"
#include "core/file_sys/control_metadata.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/pctl_results.h"
@@ -12,37 +12,38 @@ namespace Service::PCTL {
IParentalControlService::IParentalControlService(Core::System& system_, 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
static const FunctionInfo functions[] = {
- {1, &IParentalControlService::Initialize, "Initialize"},
- {1001, &IParentalControlService::CheckFreeCommunicationPermission, "CheckFreeCommunicationPermission"},
- {1002, nullptr, "ConfirmLaunchApplicationPermission"},
- {1003, nullptr, "ConfirmResumeApplicationPermission"},
- {1004, &IParentalControlService::ConfirmSnsPostPermission, "ConfirmSnsPostPermission"},
+ {1, D<&IParentalControlService::Initialize>, "Initialize"},
+ {1001, D<&IParentalControlService::CheckFreeCommunicationPermission>, "CheckFreeCommunicationPermission"},
+ {1002, D<&IParentalControlService::ConfirmLaunchApplicationPermission>, "ConfirmLaunchApplicationPermission"},
+ {1003, D<&IParentalControlService::ConfirmResumeApplicationPermission>, "ConfirmResumeApplicationPermission"},
+ {1004, D<&IParentalControlService::ConfirmSnsPostPermission>, "ConfirmSnsPostPermission"},
{1005, nullptr, "ConfirmSystemSettingsPermission"},
- {1006, &IParentalControlService::IsRestrictionTemporaryUnlocked, "IsRestrictionTemporaryUnlocked"},
+ {1006, D<&IParentalControlService::IsRestrictionTemporaryUnlocked>, "IsRestrictionTemporaryUnlocked"},
{1007, nullptr, "RevertRestrictionTemporaryUnlocked"},
{1008, nullptr, "EnterRestrictedSystemSettings"},
{1009, nullptr, "LeaveRestrictedSystemSettings"},
- {1010, nullptr, "IsRestrictedSystemSettingsEntered"},
+ {1010, D<&IParentalControlService::IsRestrictedSystemSettingsEntered>, "IsRestrictedSystemSettingsEntered"},
{1011, nullptr, "RevertRestrictedSystemSettingsEntered"},
{1012, nullptr, "GetRestrictedFeatures"},
- {1013, &IParentalControlService::ConfirmStereoVisionPermission, "ConfirmStereoVisionPermission"},
+ {1013, D<&IParentalControlService::ConfirmStereoVisionPermission>, "ConfirmStereoVisionPermission"},
{1014, nullptr, "ConfirmPlayableApplicationVideoOld"},
{1015, nullptr, "ConfirmPlayableApplicationVideo"},
{1016, nullptr, "ConfirmShowNewsPermission"},
- {1017, &IParentalControlService::EndFreeCommunication, "EndFreeCommunication"},
- {1018, &IParentalControlService::IsFreeCommunicationAvailable, "IsFreeCommunicationAvailable"},
- {1031, &IParentalControlService::IsRestrictionEnabled, "IsRestrictionEnabled"},
- {1032, &IParentalControlService::GetSafetyLevel, "GetSafetyLevel"},
+ {1017, D<&IParentalControlService::EndFreeCommunication>, "EndFreeCommunication"},
+ {1018, D<&IParentalControlService::IsFreeCommunicationAvailable>, "IsFreeCommunicationAvailable"},
+ {1031, D<&IParentalControlService::IsRestrictionEnabled>, "IsRestrictionEnabled"},
+ {1032, D<&IParentalControlService::GetSafetyLevel>, "GetSafetyLevel"},
{1033, nullptr, "SetSafetyLevel"},
{1034, nullptr, "GetSafetyLevelSettings"},
- {1035, &IParentalControlService::GetCurrentSettings, "GetCurrentSettings"},
+ {1035, D<&IParentalControlService::GetCurrentSettings>, "GetCurrentSettings"},
{1036, nullptr, "SetCustomSafetyLevelSettings"},
{1037, nullptr, "GetDefaultRatingOrganization"},
{1038, nullptr, "SetDefaultRatingOrganization"},
- {1039, &IParentalControlService::GetFreeCommunicationApplicationListCount, "GetFreeCommunicationApplicationListCount"},
+ {1039, D<&IParentalControlService::GetFreeCommunicationApplicationListCount>, "GetFreeCommunicationApplicationListCount"},
{1042, nullptr, "AddToFreeCommunicationApplicationList"},
{1043, nullptr, "DeleteSettings"},
{1044, nullptr, "GetFreeCommunicationApplicationList"},
@@ -51,20 +52,20 @@ IParentalControlService::IParentalControlService(Core::System& system_, Capabili
{1047, nullptr, "NotifyApplicationDownloadStarted"},
{1048, nullptr, "NotifyNetworkProfileCreated"},
{1049, nullptr, "ResetFreeCommunicationApplicationList"},
- {1061, &IParentalControlService::ConfirmStereoVisionRestrictionConfigurable, "ConfirmStereoVisionRestrictionConfigurable"},
- {1062, &IParentalControlService::GetStereoVisionRestriction, "GetStereoVisionRestriction"},
- {1063, &IParentalControlService::SetStereoVisionRestriction, "SetStereoVisionRestriction"},
- {1064, &IParentalControlService::ResetConfirmedStereoVisionPermission, "ResetConfirmedStereoVisionPermission"},
- {1065, &IParentalControlService::IsStereoVisionPermitted, "IsStereoVisionPermitted"},
+ {1061, D<&IParentalControlService::ConfirmStereoVisionRestrictionConfigurable>, "ConfirmStereoVisionRestrictionConfigurable"},
+ {1062, D<&IParentalControlService::GetStereoVisionRestriction>, "GetStereoVisionRestriction"},
+ {1063, D<&IParentalControlService::SetStereoVisionRestriction>, "SetStereoVisionRestriction"},
+ {1064, D<&IParentalControlService::ResetConfirmedStereoVisionPermission>, "ResetConfirmedStereoVisionPermission"},
+ {1065, D<&IParentalControlService::IsStereoVisionPermitted>, "IsStereoVisionPermitted"},
{1201, nullptr, "UnlockRestrictionTemporarily"},
{1202, nullptr, "UnlockSystemSettingsRestriction"},
{1203, nullptr, "SetPinCode"},
{1204, nullptr, "GenerateInquiryCode"},
{1205, nullptr, "CheckMasterKey"},
- {1206, nullptr, "GetPinCodeLength"},
+ {1206, D<&IParentalControlService::GetPinCodeLength>, "GetPinCodeLength"},
{1207, nullptr, "GetPinCodeChangedEvent"},
{1208, nullptr, "GetPinCode"},
- {1403, &IParentalControlService::IsPairingActive, "IsPairingActive"},
+ {1403, D<&IParentalControlService::IsPairingActive>, "IsPairingActive"},
{1406, nullptr, "GetSettingsLastUpdated"},
{1411, nullptr, "GetPairingAccountInfo"},
{1421, nullptr, "GetAccountNickname"},
@@ -72,18 +73,18 @@ IParentalControlService::IParentalControlService(Core::System& system_, Capabili
{1425, nullptr, "RequestPostEvents"},
{1426, nullptr, "GetPostEventInterval"},
{1427, nullptr, "SetPostEventInterval"},
- {1432, &IParentalControlService::GetSynchronizationEvent, "GetSynchronizationEvent"},
- {1451, nullptr, "StartPlayTimer"},
- {1452, nullptr, "StopPlayTimer"},
- {1453, nullptr, "IsPlayTimerEnabled"},
+ {1432, D<&IParentalControlService::GetSynchronizationEvent>, "GetSynchronizationEvent"},
+ {1451, D<&IParentalControlService::StartPlayTimer>, "StartPlayTimer"},
+ {1452, D<&IParentalControlService::StopPlayTimer>, "StopPlayTimer"},
+ {1453, D<&IParentalControlService::IsPlayTimerEnabled>, "IsPlayTimerEnabled"},
{1454, nullptr, "GetPlayTimerRemainingTime"},
- {1455, nullptr, "IsRestrictedByPlayTimer"},
- {1456, &IParentalControlService::GetPlayTimerSettings, "GetPlayTimerSettings"},
- {1457, &IParentalControlService::GetPlayTimerEventToRequestSuspension, "GetPlayTimerEventToRequestSuspension"},
- {1458, &IParentalControlService::IsPlayTimerAlarmDisabled, "IsPlayTimerAlarmDisabled"},
+ {1455, D<&IParentalControlService::IsRestrictedByPlayTimer>, "IsRestrictedByPlayTimer"},
+ {1456, D<&IParentalControlService::GetPlayTimerSettings>, "GetPlayTimerSettings"},
+ {1457, D<&IParentalControlService::GetPlayTimerEventToRequestSuspension>, "GetPlayTimerEventToRequestSuspension"},
+ {1458, D<&IParentalControlService::IsPlayTimerAlarmDisabled>, "IsPlayTimerAlarmDisabled"},
{1471, nullptr, "NotifyWrongPinCodeInputManyTimes"},
{1472, nullptr, "CancelNetworkRequest"},
- {1473, &IParentalControlService::GetUnlinkedEvent, "GetUnlinkedEvent"},
+ {1473, D<&IParentalControlService::GetUnlinkedEvent>, "GetUnlinkedEvent"},
{1474, nullptr, "ClearUnlinkedEvent"},
{1601, nullptr, "DisableAllFeatures"},
{1602, nullptr, "PostEnableAllFeatures"},
@@ -119,19 +120,9 @@ IParentalControlService::IParentalControlService(Core::System& system_, Capabili
};
// clang-format on
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() {
- service_context.CloseEvent(synchronization_event);
- service_context.CloseEvent(unlinked_event);
- service_context.CloseEvent(request_suspension_event);
-}
+IParentalControlService::~IParentalControlService() = default;
bool IParentalControlService::CheckFreeCommunicationPermissionImpl() const {
if (states.temporary_unlocked) {
@@ -176,20 +167,19 @@ void IParentalControlService::SetStereoVisionRestrictionImpl(bool is_restricted)
settings.is_stero_vision_restricted = is_restricted;
}
-void IParentalControlService::Initialize(HLERequestContext& ctx) {
+Result IParentalControlService::Initialize() {
LOG_DEBUG(Service_PCTL, "called");
- IPC::ResponseBuilder rb{ctx, 2};
if (False(capability & (Capability::Application | Capability::System))) {
LOG_ERROR(Service_PCTL, "Invalid capability! capability={:X}", capability);
- return;
+ R_THROW(PCTL::ResultNoCapability);
}
// TODO(ogniK): Recovery flag initialization for pctl:r
- const auto tid = system.GetApplicationProcessProgramID();
- if (tid != 0) {
- const FileSys::PatchManager pm{tid, system.GetFileSystemController(),
+ const auto program_id = system.GetApplicationProcessProgramID();
+ if (program_id != 0) {
+ const FileSys::PatchManager pm{program_id, system.GetFileSystemController(),
system.GetContentProvider()};
const auto control = pm.GetControlMetadata();
if (control.first) {
@@ -199,7 +189,7 @@ void IParentalControlService::Initialize(HLERequestContext& ctx) {
states.free_communication = false;
states.stereo_vision = false;
states.application_info = ApplicationInfo{
- .application_id = tid,
+ .application_id = program_id,
.age_rating = control.first->GetRatingAge(),
.parental_control_flag = control.first->GetParentalControlFlag(),
.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");
- IPC::ResponseBuilder rb{ctx, 2};
if (!CheckFreeCommunicationPermissionImpl()) {
- rb.Push(PCTL::ResultNoFreeCommunication);
+ R_THROW(PCTL::ResultNoFreeCommunication);
} else {
- rb.Push(ResultSuccess);
+ states.free_communication = true;
+ R_SUCCEED();
}
-
- states.free_communication = true;
}
-void IParentalControlService::ConfirmSnsPostPermission(HLERequestContext& ctx) {
- LOG_WARNING(Service_PCTL, "(STUBBED) called");
+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();
+}
- IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(PCTL::ResultNoFreeCommunication);
+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();
}
-void IParentalControlService::IsRestrictionTemporaryUnlocked(HLERequestContext& ctx) {
- const bool is_temporary_unlocked = false;
+Result IParentalControlService::ConfirmSnsPostPermission() {
+ LOG_WARNING(Service_PCTL, "(STUBBED) called");
+ R_THROW(PCTL::ResultNoFreeCommunication);
+}
- LOG_WARNING(Service_PCTL, "(STUBBED) called, is_temporary_unlocked={}", is_temporary_unlocked);
+Result IParentalControlService::IsRestrictionTemporaryUnlocked(
+ Out<bool> out_is_temporary_unlocked) {
+ *out_is_temporary_unlocked = false;
+ LOG_WARNING(Service_PCTL, "(STUBBED) called, is_temporary_unlocked={}",
+ *out_is_temporary_unlocked);
+ R_SUCCEED();
+}
- IPC::ResponseBuilder rb{ctx, 3};
- rb.Push(ResultSuccess);
- rb.Push<u8>(is_temporary_unlocked);
+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();
}
-void IParentalControlService::ConfirmStereoVisionPermission(HLERequestContext& ctx) {
+Result IParentalControlService::ConfirmStereoVisionPermission() {
LOG_DEBUG(Service_PCTL, "called");
states.stereo_vision = true;
-
- IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(ResultSuccess);
+ R_SUCCEED();
}
-void IParentalControlService::EndFreeCommunication(HLERequestContext& ctx) {
+Result IParentalControlService::EndFreeCommunication() {
LOG_WARNING(Service_PCTL, "(STUBBED) called");
-
- IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(ResultSuccess);
+ R_SUCCEED();
}
-void IParentalControlService::IsFreeCommunicationAvailable(HLERequestContext& ctx) {
+Result IParentalControlService::IsFreeCommunicationAvailable() {
LOG_WARNING(Service_PCTL, "(STUBBED) called");
- IPC::ResponseBuilder rb{ctx, 2};
if (!CheckFreeCommunicationPermissionImpl()) {
- rb.Push(PCTL::ResultNoFreeCommunication);
+ R_THROW(PCTL::ResultNoFreeCommunication);
} else {
- rb.Push(ResultSuccess);
+ R_SUCCEED();
}
}
-void IParentalControlService::IsRestrictionEnabled(HLERequestContext& ctx) {
+Result IParentalControlService::IsRestrictionEnabled(Out<bool> out_restriction_enabled) {
LOG_DEBUG(Service_PCTL, "called");
- IPC::ResponseBuilder rb{ctx, 3};
if (False(capability & (Capability::Status | Capability::Recovery))) {
LOG_ERROR(Service_PCTL, "Application does not have Status or Recovery capabilities!");
- rb.Push(PCTL::ResultNoCapability);
- rb.Push(false);
- return;
+ *out_restriction_enabled = false;
+ R_THROW(PCTL::ResultNoCapability);
}
- rb.Push(pin_code[0] != '\0');
+ *out_restriction_enabled = pin_code[0] != '\0';
+ R_SUCCEED();
}
-void IParentalControlService::GetSafetyLevel(HLERequestContext& ctx) {
- const u32 safety_level = 0;
-
- LOG_WARNING(Service_PCTL, "(STUBBED) called, safety_level={}", safety_level);
-
- IPC::ResponseBuilder rb{ctx, 3};
- rb.Push(ResultSuccess);
- rb.Push(safety_level);
+Result IParentalControlService::GetSafetyLevel(Out<u32> out_safety_level) {
+ *out_safety_level = 0;
+ LOG_WARNING(Service_PCTL, "(STUBBED) called, safety_level={}", *out_safety_level);
+ R_SUCCEED();
}
-void IParentalControlService::GetCurrentSettings(HLERequestContext& ctx) {
+Result IParentalControlService::GetCurrentSettings(Out<RestrictionSettings> out_settings) {
LOG_INFO(Service_PCTL, "called");
-
- IPC::ResponseBuilder rb{ctx, 3};
- rb.Push(ResultSuccess);
- rb.PushRaw(restriction_settings);
+ *out_settings = restriction_settings;
+ R_SUCCEED();
}
-void IParentalControlService::GetFreeCommunicationApplicationListCount(HLERequestContext& ctx) {
- const u32 count = 4;
-
- LOG_WARNING(Service_PCTL, "(STUBBED) called, count={}", count);
-
- IPC::ResponseBuilder rb{ctx, 3};
- rb.Push(ResultSuccess);
- rb.Push(count);
+Result IParentalControlService::GetFreeCommunicationApplicationListCount(Out<s32> out_count) {
+ *out_count = 4;
+ LOG_WARNING(Service_PCTL, "(STUBBED) called, count={}", *out_count);
+ R_SUCCEED();
}
-void IParentalControlService::ConfirmStereoVisionRestrictionConfigurable(HLERequestContext& ctx) {
+Result IParentalControlService::ConfirmStereoVisionRestrictionConfigurable() {
LOG_DEBUG(Service_PCTL, "called");
- 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;
+ R_THROW(PCTL::ResultNoCapability);
}
if (pin_code[0] == '\0') {
- rb.Push(PCTL::ResultNoRestrictionEnabled);
- return;
+ R_THROW(PCTL::ResultNoRestrictionEnabled);
}
- rb.Push(ResultSuccess);
+ R_SUCCEED();
}
-void IParentalControlService::IsStereoVisionPermitted(HLERequestContext& ctx) {
+Result IParentalControlService::IsStereoVisionPermitted(Out<bool> out_is_permitted) {
LOG_DEBUG(Service_PCTL, "called");
- IPC::ResponseBuilder rb{ctx, 3};
if (!ConfirmStereoVisionPermissionImpl()) {
- rb.Push(PCTL::ResultStereoVisionRestricted);
- rb.Push(false);
+ *out_is_permitted = false;
+ R_THROW(PCTL::ResultStereoVisionRestricted);
} else {
- rb.Push(ResultSuccess);
- rb.Push(true);
+ *out_is_permitted = true;
+ R_SUCCEED();
}
}
-void IParentalControlService::IsPairingActive(HLERequestContext& ctx) {
- const bool is_pairing_active = false;
-
- LOG_WARNING(Service_PCTL, "(STUBBED) called, is_pairing_active={}", is_pairing_active);
+Result IParentalControlService::GetPinCodeLength(Out<s32> out_length) {
+ *out_length = 0;
+ LOG_WARNING(Service_PCTL, "(STUBBED) called, length={}", *out_length);
+ R_SUCCEED();
+}
- IPC::ResponseBuilder rb{ctx, 3};
- rb.Push(ResultSuccess);
- rb.Push<u8>(is_pairing_active);
+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();
}
-void IParentalControlService::GetSynchronizationEvent(HLERequestContext& ctx) {
+Result IParentalControlService::GetSynchronizationEvent(
+ OutCopyHandle<Kernel::KReadableEvent> out_event) {
LOG_INFO(Service_PCTL, "called");
-
- IPC::ResponseBuilder rb{ctx, 2, 1};
- rb.Push(ResultSuccess);
- rb.PushCopyObjects(synchronization_event->GetReadableEvent());
+ *out_event = synchronization_event.GetHandle();
+ R_SUCCEED();
}
-void IParentalControlService::GetPlayTimerSettings(HLERequestContext& ctx) {
+Result IParentalControlService::StartPlayTimer() {
LOG_WARNING(Service_PCTL, "(STUBBED) called");
+ R_SUCCEED();
+}
- const PlayTimerSettings timer_settings{};
-
- IPC::ResponseBuilder rb{ctx, 15};
- rb.Push(ResultSuccess);
- rb.PushRaw(timer_settings);
+Result IParentalControlService::StopPlayTimer() {
+ LOG_WARNING(Service_PCTL, "(STUBBED) called");
+ R_SUCCEED();
}
-void IParentalControlService::GetPlayTimerEventToRequestSuspension(HLERequestContext& ctx) {
- LOG_INFO(Service_PCTL, "called");
+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();
+}
- IPC::ResponseBuilder rb{ctx, 2, 1};
- rb.Push(ResultSuccess);
- rb.PushCopyObjects(request_suspension_event->GetReadableEvent());
+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();
}
-void IParentalControlService::IsPlayTimerAlarmDisabled(HLERequestContext& ctx) {
- const bool is_play_timer_alarm_disabled = false;
+Result IParentalControlService::GetPlayTimerSettings(
+ Out<PlayTimerSettings> out_play_timer_settings) {
+ LOG_WARNING(Service_PCTL, "(STUBBED) called");
+ *out_play_timer_settings = {};
+ R_SUCCEED();
+}
- LOG_INFO(Service_PCTL, "called, is_play_timer_alarm_disabled={}", is_play_timer_alarm_disabled);
+Result IParentalControlService::GetPlayTimerEventToRequestSuspension(
+ OutCopyHandle<Kernel::KReadableEvent> out_event) {
+ LOG_INFO(Service_PCTL, "called");
+ *out_event = request_suspension_event.GetHandle();
+ R_SUCCEED();
+}
- IPC::ResponseBuilder rb{ctx, 3};
- rb.Push(ResultSuccess);
- rb.Push<u8>(is_play_timer_alarm_disabled);
+Result IParentalControlService::IsPlayTimerAlarmDisabled(Out<bool> out_play_timer_alarm_disabled) {
+ *out_play_timer_alarm_disabled = false;
+ LOG_INFO(Service_PCTL, "called, is_play_timer_alarm_disabled={}",
+ *out_play_timer_alarm_disabled);
+ R_SUCCEED();
}
-void IParentalControlService::GetUnlinkedEvent(HLERequestContext& ctx) {
+Result IParentalControlService::GetUnlinkedEvent(OutCopyHandle<Kernel::KReadableEvent> out_event) {
LOG_INFO(Service_PCTL, "called");
-
- IPC::ResponseBuilder rb{ctx, 2, 1};
- rb.Push(ResultSuccess);
- rb.PushCopyObjects(unlinked_event->GetReadableEvent());
+ *out_event = unlinked_event.GetHandle();
+ R_SUCCEED();
}
-void IParentalControlService::SetStereoVisionRestriction(HLERequestContext& ctx) {
- IPC::RequestParser rp{ctx};
- const auto can_use = rp.Pop<bool>();
- LOG_DEBUG(Service_PCTL, "called, can_use={}", can_use);
+Result IParentalControlService::GetStereoVisionRestriction(
+ Out<bool> out_stereo_vision_restriction) {
+ LOG_DEBUG(Service_PCTL, "called");
- 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;
+ *out_stereo_vision_restriction = false;
+ R_THROW(PCTL::ResultNoCapability);
}
- SetStereoVisionRestrictionImpl(can_use);
- rb.Push(ResultSuccess);
+ *out_stereo_vision_restriction = settings.is_stero_vision_restricted;
+ R_SUCCEED();
}
-void IParentalControlService::GetStereoVisionRestriction(HLERequestContext& ctx) {
- LOG_DEBUG(Service_PCTL, "called");
+Result IParentalControlService::SetStereoVisionRestriction(bool stereo_vision_restriction) {
+ LOG_DEBUG(Service_PCTL, "called, can_use={}", stereo_vision_restriction);
- IPC::ResponseBuilder rb{ctx, 3};
if (False(capability & Capability::StereoVision)) {
LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!");
- rb.Push(PCTL::ResultNoCapability);
- rb.Push(false);
- return;
+ R_THROW(PCTL::ResultNoCapability);
}
- rb.Push(ResultSuccess);
- rb.Push(settings.is_stero_vision_restricted);
+ SetStereoVisionRestrictionImpl(stereo_vision_restriction);
+ R_SUCCEED();
}
-void IParentalControlService::ResetConfirmedStereoVisionPermission(HLERequestContext& ctx) {
+Result IParentalControlService::ResetConfirmedStereoVisionPermission() {
LOG_DEBUG(Service_PCTL, "called");
states.stereo_vision = false;
- IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(ResultSuccess);
+ R_SUCCEED();
}
} // namespace Service::PCTL
diff --git a/src/core/hle/service/pctl/parental_control_service.h b/src/core/hle/service/pctl/parental_control_service.h
index dcc357f65..03dbaa2e5 100644
--- a/src/core/hle/service/pctl/parental_control_service.h
+++ b/src/core/hle/service/pctl/parental_control_service.h
@@ -3,7 +3,9 @@
#pragma once
+#include "core/hle/service/cmif_types.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/service.h"
@@ -19,28 +21,38 @@ private:
bool ConfirmStereoVisionPermissionImpl() const;
void SetStereoVisionRestrictionImpl(bool is_restricted);
- void Initialize(HLERequestContext& ctx);
- void CheckFreeCommunicationPermission(HLERequestContext& ctx);
- void ConfirmSnsPostPermission(HLERequestContext& ctx);
- void IsRestrictionTemporaryUnlocked(HLERequestContext& ctx);
- void ConfirmStereoVisionPermission(HLERequestContext& ctx);
- void EndFreeCommunication(HLERequestContext& ctx);
- void IsFreeCommunicationAvailable(HLERequestContext& ctx);
- void IsRestrictionEnabled(HLERequestContext& ctx);
- void GetSafetyLevel(HLERequestContext& ctx);
- void GetCurrentSettings(HLERequestContext& ctx);
- void GetFreeCommunicationApplicationListCount(HLERequestContext& ctx);
- void ConfirmStereoVisionRestrictionConfigurable(HLERequestContext& ctx);
- void IsStereoVisionPermitted(HLERequestContext& ctx);
- void IsPairingActive(HLERequestContext& ctx);
- void GetSynchronizationEvent(HLERequestContext& ctx);
- void GetPlayTimerSettings(HLERequestContext& ctx);
- void GetPlayTimerEventToRequestSuspension(HLERequestContext& ctx);
- void IsPlayTimerAlarmDisabled(HLERequestContext& ctx);
- void GetUnlinkedEvent(HLERequestContext& ctx);
- void SetStereoVisionRestriction(HLERequestContext& ctx);
- void GetStereoVisionRestriction(HLERequestContext& ctx);
- void ResetConfirmedStereoVisionPermission(HLERequestContext& ctx);
+ Result Initialize();
+ Result CheckFreeCommunicationPermission();
+ Result ConfirmLaunchApplicationPermission(InBuffer<BufferAttr_HipcPointer> restriction_bitset,
+ u64 nacp_flag, u64 application_id);
+ Result ConfirmResumeApplicationPermission(InBuffer<BufferAttr_HipcPointer> restriction_bitset,
+ u64 nacp_flag, u64 application_id);
+ Result ConfirmSnsPostPermission();
+ Result IsRestrictionTemporaryUnlocked(Out<bool> out_is_temporary_unlocked);
+ Result IsRestrictedSystemSettingsEntered(Out<bool> out_is_restricted_system_settings_entered);
+ Result ConfirmStereoVisionPermission();
+ Result EndFreeCommunication();
+ Result IsFreeCommunicationAvailable();
+ Result IsRestrictionEnabled(Out<bool> out_restriction_enabled);
+ Result GetSafetyLevel(Out<u32> out_safety_level);
+ Result GetCurrentSettings(Out<RestrictionSettings> out_settings);
+ Result GetFreeCommunicationApplicationListCount(Out<s32> out_count);
+ Result ConfirmStereoVisionRestrictionConfigurable();
+ Result IsStereoVisionPermitted(Out<bool> out_is_permitted);
+ Result GetPinCodeLength(Out<s32> out_length);
+ Result IsPairingActive(Out<bool> out_is_pairing_active);
+ Result GetSynchronizationEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);
+ 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 {
u64 current_tid{};
@@ -65,10 +77,10 @@ private:
std::array<char, 8> pin_code{};
Capability capability{};
- Kernel::KEvent* synchronization_event;
- Kernel::KEvent* unlinked_event;
- Kernel::KEvent* request_suspension_event;
KernelHelpers::ServiceContext service_context;
+ Event synchronization_event;
+ Event unlinked_event;
+ Event request_suspension_event;
};
} // namespace Service::PCTL