yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

Addressed issues

This commit is contained in:
Chloe Marcec 2021-03-30 20:27:27 +11:00
parent e9a1f29e93
commit 4930242c20
2 changed files with 22 additions and 21 deletions

View File

@ -17,7 +17,7 @@ namespace Error {
constexpr ResultCode ResultNoFreeCommunication{ErrorModule::PCTL, 101}; constexpr ResultCode ResultNoFreeCommunication{ErrorModule::PCTL, 101};
constexpr ResultCode ResultStereoVisionRestricted{ErrorModule::PCTL, 104}; constexpr ResultCode ResultStereoVisionRestricted{ErrorModule::PCTL, 104};
constexpr ResultCode ResultNoCapatability{ErrorModule::PCTL, 131}; constexpr ResultCode ResultNoCapability{ErrorModule::PCTL, 131};
constexpr ResultCode ResultNoRestrictionEnabled{ErrorModule::PCTL, 181}; constexpr ResultCode ResultNoRestrictionEnabled{ErrorModule::PCTL, 181};
} // namespace Error } // namespace Error
@ -133,7 +133,7 @@ public:
} }
private: private:
bool CheckFreeCommunicationPermissionImpl() { bool CheckFreeCommunicationPermissionImpl() const {
if (states.temporary_unlocked) { if (states.temporary_unlocked) {
return true; return true;
} }
@ -146,11 +146,13 @@ private:
if (!settings.is_free_communication_default_on) { if (!settings.is_free_communication_default_on) {
return true; return true;
} }
// TODO(ogniK): Check for blacklisted/exempted applications // TODO(ogniK): Check for blacklisted/exempted applications. Return false can happen here
// but as we don't have multiproceses support yet, we can just assume our application is
// valid for the time being
return true; return true;
} }
bool ConfirmStereoVisionPermissionImpl() { bool ConfirmStereoVisionPermissionImpl() const {
if (states.temporary_unlocked) { if (states.temporary_unlocked) {
return true; return true;
} }
@ -179,12 +181,11 @@ private:
IPC::ResponseBuilder rb{ctx, 2}; 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}", LOG_ERROR(Service_PCTL, "Invalid capability! capability={:X}", capability);
static_cast<s32>(capability));
return; return;
} }
// TODO(ogniK): Recovery // TODO(ogniK): Recovery flag initialization for pctl:r
const auto tid = system.CurrentProcess()->GetTitleID(); const auto tid = system.CurrentProcess()->GetTitleID();
if (tid != 0) { if (tid != 0) {
@ -251,7 +252,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::ResultNoCapatability); rb.Push(Error::ResultNoCapability);
rb.Push(false); rb.Push(false);
return; return;
} }
@ -264,9 +265,9 @@ private:
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
if (False(capability & Capability::SteroVision)) { if (False(capability & Capability::StereoVision)) {
LOG_ERROR(Service_PCTL, "Application does not have SteroVision capability!"); LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!");
rb.Push(Error::ResultNoCapatability); rb.Push(Error::ResultNoCapability);
return; return;
} }
@ -297,9 +298,9 @@ private:
LOG_DEBUG(Service_PCTL, "called, can_use={}", can_use); LOG_DEBUG(Service_PCTL, "called, can_use={}", can_use);
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
if (False(capability & Capability::SteroVision)) { if (False(capability & Capability::StereoVision)) {
LOG_ERROR(Service_PCTL, "Application does not have SteroVision capability!"); LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!");
rb.Push(Error::ResultNoCapatability); rb.Push(Error::ResultNoCapability);
return; return;
} }
@ -311,9 +312,9 @@ private:
LOG_DEBUG(Service_PCTL, "called"); LOG_DEBUG(Service_PCTL, "called");
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
if (False(capability & Capability::SteroVision)) { if (False(capability & Capability::StereoVision)) {
LOG_ERROR(Service_PCTL, "Application does not have SteroVision capability!"); LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!");
rb.Push(Error::ResultNoCapatability); rb.Push(Error::ResultNoCapability);
rb.Push(false); rb.Push(false);
return; return;
} }
@ -391,7 +392,7 @@ void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system
auto module = std::make_shared<Module>(); auto module = std::make_shared<Module>();
std::make_shared<PCTL>(system, module, "pctl", std::make_shared<PCTL>(system, module, "pctl",
Capability::Application | Capability::SnsPost | Capability::Status | Capability::Application | Capability::SnsPost | Capability::Status |
Capability::SteroVision) Capability::StereoVision)
->InstallAsService(service_manager); ->InstallAsService(service_manager);
// TODO(ogniK): Implement remaining capabilities // TODO(ogniK): Implement remaining capabilities
std::make_shared<PCTL>(system, module, "pctl:a", Capability::None) std::make_shared<PCTL>(system, module, "pctl:a", Capability::None)

View File

@ -13,13 +13,13 @@ class System;
namespace Service::PCTL { namespace Service::PCTL {
enum class Capability : s32 { enum class Capability : u32 {
None = 0x0, None = 0,
Application = 1 << 0, Application = 1 << 0,
SnsPost = 1 << 1, SnsPost = 1 << 1,
Recovery = 1 << 6, Recovery = 1 << 6,
Status = 1 << 8, Status = 1 << 8,
SteroVision = 1 << 9, StereoVision = 1 << 9,
System = 1 << 15, System = 1 << 15,
}; };
DECLARE_ENUM_FLAG_OPERATORS(Capability); DECLARE_ENUM_FLAG_OPERATORS(Capability);