|
|
@ -9,18 +9,28 @@ |
|
|
#include "core/hle/service/kernel_helpers.h"
|
|
|
#include "core/hle/service/kernel_helpers.h"
|
|
|
#include "core/hle/service/pctl/pctl.h"
|
|
|
#include "core/hle/service/pctl/pctl.h"
|
|
|
#include "core/hle/service/pctl/pctl_module.h"
|
|
|
#include "core/hle/service/pctl/pctl_module.h"
|
|
|
|
|
|
#include "core/hle/service/pctl/pctl_results.h"
|
|
|
|
|
|
#include "core/hle/service/pctl/pctl_types.h"
|
|
|
#include "core/hle/service/server_manager.h"
|
|
|
#include "core/hle/service/server_manager.h"
|
|
|
|
|
|
|
|
|
namespace Service::PCTL { |
|
|
namespace Service::PCTL { |
|
|
|
|
|
|
|
|
namespace Error { |
|
|
|
|
|
|
|
|
|
|
|
constexpr Result ResultNoFreeCommunication{ErrorModule::PCTL, 101}; |
|
|
|
|
|
constexpr Result ResultStereoVisionRestricted{ErrorModule::PCTL, 104}; |
|
|
|
|
|
constexpr Result ResultNoCapability{ErrorModule::PCTL, 131}; |
|
|
|
|
|
constexpr Result ResultNoRestrictionEnabled{ErrorModule::PCTL, 181}; |
|
|
|
|
|
|
|
|
struct States { |
|
|
|
|
|
u64 current_tid{}; |
|
|
|
|
|
ApplicationInfo application_info{}; |
|
|
|
|
|
u64 tid_from_event{}; |
|
|
|
|
|
bool launch_time_valid{}; |
|
|
|
|
|
bool is_suspended{}; |
|
|
|
|
|
bool temporary_unlocked{}; |
|
|
|
|
|
bool free_communication{}; |
|
|
|
|
|
bool stereo_vision{}; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
} // namespace Error
|
|
|
|
|
|
|
|
|
struct ParentalControlSettings { |
|
|
|
|
|
bool is_stero_vision_restricted{}; |
|
|
|
|
|
bool is_free_communication_default_on{}; |
|
|
|
|
|
bool disabled{}; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
class IParentalControlService final : public ServiceFramework<IParentalControlService> { |
|
|
class IParentalControlService final : public ServiceFramework<IParentalControlService> { |
|
|
public: |
|
|
public: |
|
|
@ -214,7 +224,7 @@ private: |
|
|
states.free_communication = false; |
|
|
states.free_communication = false; |
|
|
states.stereo_vision = false; |
|
|
states.stereo_vision = false; |
|
|
states.application_info = ApplicationInfo{ |
|
|
states.application_info = ApplicationInfo{ |
|
|
.tid = tid, |
|
|
|
|
|
|
|
|
.application_id = tid, |
|
|
.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, |
|
|
@ -234,7 +244,7 @@ private: |
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2}; |
|
|
IPC::ResponseBuilder rb{ctx, 2}; |
|
|
if (!CheckFreeCommunicationPermissionImpl()) { |
|
|
if (!CheckFreeCommunicationPermissionImpl()) { |
|
|
rb.Push(Error::ResultNoFreeCommunication); |
|
|
|
|
|
|
|
|
rb.Push(ResultNoFreeCommunication); |
|
|
} else { |
|
|
} else { |
|
|
rb.Push(ResultSuccess); |
|
|
rb.Push(ResultSuccess); |
|
|
} |
|
|
} |
|
|
@ -246,7 +256,7 @@ private: |
|
|
LOG_WARNING(Service_PCTL, "(STUBBED) called"); |
|
|
LOG_WARNING(Service_PCTL, "(STUBBED) called"); |
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2}; |
|
|
IPC::ResponseBuilder rb{ctx, 2}; |
|
|
rb.Push(Error::ResultNoFreeCommunication); |
|
|
|
|
|
|
|
|
rb.Push(ResultNoFreeCommunication); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void IsRestrictionTemporaryUnlocked(HLERequestContext& ctx) { |
|
|
void IsRestrictionTemporaryUnlocked(HLERequestContext& ctx) { |
|
|
@ -280,7 +290,7 @@ private: |
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2}; |
|
|
IPC::ResponseBuilder rb{ctx, 2}; |
|
|
if (!CheckFreeCommunicationPermissionImpl()) { |
|
|
if (!CheckFreeCommunicationPermissionImpl()) { |
|
|
rb.Push(Error::ResultNoFreeCommunication); |
|
|
|
|
|
|
|
|
rb.Push(ResultNoFreeCommunication); |
|
|
} else { |
|
|
} else { |
|
|
rb.Push(ResultSuccess); |
|
|
rb.Push(ResultSuccess); |
|
|
} |
|
|
} |
|
|
@ -292,7 +302,7 @@ private: |
|
|
IPC::ResponseBuilder rb{ctx, 3}; |
|
|
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(Error::ResultNoCapability); |
|
|
|
|
|
|
|
|
rb.Push(ResultNoCapability); |
|
|
rb.Push(false); |
|
|
rb.Push(false); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
@ -335,12 +345,12 @@ private: |
|
|
|
|
|
|
|
|
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(Error::ResultNoCapability); |
|
|
|
|
|
|
|
|
rb.Push(ResultNoCapability); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (pin_code[0] == '\0') { |
|
|
if (pin_code[0] == '\0') { |
|
|
rb.Push(Error::ResultNoRestrictionEnabled); |
|
|
|
|
|
|
|
|
rb.Push(ResultNoRestrictionEnabled); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -352,7 +362,7 @@ private: |
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 3}; |
|
|
IPC::ResponseBuilder rb{ctx, 3}; |
|
|
if (!ConfirmStereoVisionPermissionImpl()) { |
|
|
if (!ConfirmStereoVisionPermissionImpl()) { |
|
|
rb.Push(Error::ResultStereoVisionRestricted); |
|
|
|
|
|
|
|
|
rb.Push(ResultStereoVisionRestricted); |
|
|
rb.Push(false); |
|
|
rb.Push(false); |
|
|
} else { |
|
|
} else { |
|
|
rb.Push(ResultSuccess); |
|
|
rb.Push(ResultSuccess); |
|
|
@ -423,7 +433,7 @@ private: |
|
|
IPC::ResponseBuilder rb{ctx, 2}; |
|
|
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(Error::ResultNoCapability); |
|
|
|
|
|
|
|
|
rb.Push(ResultNoCapability); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -437,7 +447,7 @@ private: |
|
|
IPC::ResponseBuilder rb{ctx, 3}; |
|
|
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(Error::ResultNoCapability); |
|
|
|
|
|
|
|
|
rb.Push(ResultNoCapability); |
|
|
rb.Push(false); |
|
|
rb.Push(false); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
@ -455,44 +465,6 @@ private: |
|
|
rb.Push(ResultSuccess); |
|
|
rb.Push(ResultSuccess); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
struct ApplicationInfo { |
|
|
|
|
|
u64 tid{}; |
|
|
|
|
|
std::array<u8, 32> age_rating{}; |
|
|
|
|
|
u32 parental_control_flag{}; |
|
|
|
|
|
Capability capability{}; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
struct States { |
|
|
|
|
|
u64 current_tid{}; |
|
|
|
|
|
ApplicationInfo application_info{}; |
|
|
|
|
|
u64 tid_from_event{}; |
|
|
|
|
|
bool launch_time_valid{}; |
|
|
|
|
|
bool is_suspended{}; |
|
|
|
|
|
bool temporary_unlocked{}; |
|
|
|
|
|
bool free_communication{}; |
|
|
|
|
|
bool stereo_vision{}; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
struct ParentalControlSettings { |
|
|
|
|
|
bool is_stero_vision_restricted{}; |
|
|
|
|
|
bool is_free_communication_default_on{}; |
|
|
|
|
|
bool disabled{}; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// This is nn::pctl::RestrictionSettings
|
|
|
|
|
|
struct RestrictionSettings { |
|
|
|
|
|
u8 rating_age; |
|
|
|
|
|
bool sns_post_restriction; |
|
|
|
|
|
bool free_communication_restriction; |
|
|
|
|
|
}; |
|
|
|
|
|
static_assert(sizeof(RestrictionSettings) == 0x3, "RestrictionSettings has incorrect size."); |
|
|
|
|
|
|
|
|
|
|
|
// This is nn::pctl::PlayTimerSettings
|
|
|
|
|
|
struct PlayTimerSettings { |
|
|
|
|
|
std::array<u32, 13> settings; |
|
|
|
|
|
}; |
|
|
|
|
|
static_assert(sizeof(PlayTimerSettings) == 0x34, "PlayTimerSettings has incorrect size."); |
|
|
|
|
|
|
|
|
|
|
|
States states{}; |
|
|
States states{}; |
|
|
ParentalControlSettings settings{}; |
|
|
ParentalControlSettings settings{}; |
|
|
RestrictionSettings restriction_settings{}; |
|
|
RestrictionSettings restriction_settings{}; |
|
|
|