diff options
author | Liam <[email protected]> | 2024-02-21 20:52:51 -0500 |
---|---|---|
committer | Liam <[email protected]> | 2024-02-21 22:58:20 -0500 |
commit | 01d89acd139e50470c41e5cd04df4acd49b635c6 (patch) | |
tree | 314e77aff102c9d4422964b07d72ead777a07cdd | |
parent | e540757279ee2e9cc1ed395f0480d6136d57e1b9 (diff) | |
download | yuzu-android-01d89acd139e50470c41e5cd04df4acd49b635c6.tar.gz yuzu-android-01d89acd139e50470c41e5cd04df4acd49b635c6.zip |
pctl: move types and results
-rw-r--r-- | src/core/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/core/hle/service/pctl/pctl_module.cpp | 82 | ||||
-rw-r--r-- | src/core/hle/service/pctl/pctl_module.h | 13 | ||||
-rw-r--r-- | src/core/hle/service/pctl/pctl_results.h | 15 | ||||
-rw-r--r-- | src/core/hle/service/pctl/pctl_types.h | 43 |
5 files changed, 88 insertions, 67 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index d48696654..9e913fb10 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -897,6 +897,8 @@ add_library(core STATIC hle/service/pctl/pctl.h hle/service/pctl/pctl_module.cpp hle/service/pctl/pctl_module.h + hle/service/pctl/pctl_results.h + hle/service/pctl/pctl_types.h hle/service/pcv/pcv.cpp hle/service/pcv/pcv.h hle/service/pm/pm.cpp diff --git a/src/core/hle/service/pctl/pctl_module.cpp b/src/core/hle/service/pctl/pctl_module.cpp index 6a7fd72bc..dab37cdc4 100644 --- a/src/core/hle/service/pctl/pctl_module.cpp +++ b/src/core/hle/service/pctl/pctl_module.cpp @@ -9,18 +9,28 @@ #include "core/hle/service/kernel_helpers.h" #include "core/hle/service/pctl/pctl.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" 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> { public: @@ -214,7 +224,7 @@ private: states.free_communication = false; states.stereo_vision = false; states.application_info = ApplicationInfo{ - .tid = tid, + .application_id = tid, .age_rating = control.first->GetRatingAge(), .parental_control_flag = control.first->GetParentalControlFlag(), .capability = capability, @@ -234,7 +244,7 @@ private: IPC::ResponseBuilder rb{ctx, 2}; if (!CheckFreeCommunicationPermissionImpl()) { - rb.Push(Error::ResultNoFreeCommunication); + rb.Push(ResultNoFreeCommunication); } else { rb.Push(ResultSuccess); } @@ -246,7 +256,7 @@ private: LOG_WARNING(Service_PCTL, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(Error::ResultNoFreeCommunication); + rb.Push(ResultNoFreeCommunication); } void IsRestrictionTemporaryUnlocked(HLERequestContext& ctx) { @@ -280,7 +290,7 @@ private: IPC::ResponseBuilder rb{ctx, 2}; if (!CheckFreeCommunicationPermissionImpl()) { - rb.Push(Error::ResultNoFreeCommunication); + rb.Push(ResultNoFreeCommunication); } else { rb.Push(ResultSuccess); } @@ -292,7 +302,7 @@ private: 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(Error::ResultNoCapability); + rb.Push(ResultNoCapability); rb.Push(false); return; } @@ -335,12 +345,12 @@ private: if (False(capability & Capability::StereoVision)) { LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!"); - rb.Push(Error::ResultNoCapability); + rb.Push(ResultNoCapability); return; } if (pin_code[0] == '\0') { - rb.Push(Error::ResultNoRestrictionEnabled); + rb.Push(ResultNoRestrictionEnabled); return; } @@ -352,7 +362,7 @@ private: IPC::ResponseBuilder rb{ctx, 3}; if (!ConfirmStereoVisionPermissionImpl()) { - rb.Push(Error::ResultStereoVisionRestricted); + rb.Push(ResultStereoVisionRestricted); rb.Push(false); } else { rb.Push(ResultSuccess); @@ -423,7 +433,7 @@ private: IPC::ResponseBuilder rb{ctx, 2}; if (False(capability & Capability::StereoVision)) { LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!"); - rb.Push(Error::ResultNoCapability); + rb.Push(ResultNoCapability); return; } @@ -437,7 +447,7 @@ private: IPC::ResponseBuilder rb{ctx, 3}; if (False(capability & Capability::StereoVision)) { LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!"); - rb.Push(Error::ResultNoCapability); + rb.Push(ResultNoCapability); rb.Push(false); return; } @@ -455,44 +465,6 @@ private: 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{}; ParentalControlSettings settings{}; RestrictionSettings restriction_settings{}; diff --git a/src/core/hle/service/pctl/pctl_module.h b/src/core/hle/service/pctl/pctl_module.h index dff0d3f08..715c05b20 100644 --- a/src/core/hle/service/pctl/pctl_module.h +++ b/src/core/hle/service/pctl/pctl_module.h @@ -3,7 +3,7 @@ #pragma once -#include "common/common_funcs.h" +#include "core/hle/service/pctl/pctl_types.h" #include "core/hle/service/service.h" namespace Core { @@ -12,17 +12,6 @@ class System; namespace Service::PCTL { -enum class Capability : u32 { - None = 0, - Application = 1 << 0, - SnsPost = 1 << 1, - Recovery = 1 << 6, - Status = 1 << 8, - StereoVision = 1 << 9, - System = 1 << 15, -}; -DECLARE_ENUM_FLAG_OPERATORS(Capability); - class Module final { public: class Interface : public ServiceFramework<Interface> { diff --git a/src/core/hle/service/pctl/pctl_results.h b/src/core/hle/service/pctl/pctl_results.h new file mode 100644 index 000000000..1fc54727b --- /dev/null +++ b/src/core/hle/service/pctl/pctl_results.h @@ -0,0 +1,15 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/result.h" + +namespace Service::PCTL { + +constexpr Result ResultNoFreeCommunication{ErrorModule::PCTL, 101}; +constexpr Result ResultStereoVisionRestricted{ErrorModule::PCTL, 104}; +constexpr Result ResultNoCapability{ErrorModule::PCTL, 131}; +constexpr Result ResultNoRestrictionEnabled{ErrorModule::PCTL, 181}; + +} // namespace Service::PCTL diff --git a/src/core/hle/service/pctl/pctl_types.h b/src/core/hle/service/pctl/pctl_types.h new file mode 100644 index 000000000..daaecdf48 --- /dev/null +++ b/src/core/hle/service/pctl/pctl_types.h @@ -0,0 +1,43 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "common/common_funcs.h" + +namespace Service::PCTL { + +enum class Capability : u32 { + None = 0, + Application = 1 << 0, + SnsPost = 1 << 1, + Recovery = 1 << 6, + Status = 1 << 8, + StereoVision = 1 << 9, + System = 1 << 15, +}; +DECLARE_ENUM_FLAG_OPERATORS(Capability); + +struct ApplicationInfo { + u64 application_id{}; + std::array<u8, 32> age_rating{}; + u32 parental_control_flag{}; + Capability capability{}; +}; +static_assert(sizeof(ApplicationInfo) == 0x30, "ApplicationInfo has incorrect size."); + +// 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."); + +} // namespace Service::PCTL |