From 6c2d6cff19dbd466269dd33bfef8756da68da6be Mon Sep 17 00:00:00 2001 From: Liam Date: Wed, 21 Feb 2024 21:55:03 -0500 Subject: psc: move IPmControl, IPmModule, IPmService --- src/core/CMakeLists.txt | 6 +++ src/core/hle/service/psc/pm_control.cpp | 28 ++++++++++++++ src/core/hle/service/psc/pm_control.h | 16 ++++++++ src/core/hle/service/psc/pm_module.cpp | 24 ++++++++++++ src/core/hle/service/psc/pm_module.h | 16 ++++++++ src/core/hle/service/psc/pm_service.cpp | 30 +++++++++++++++ src/core/hle/service/psc/pm_service.h | 19 ++++++++++ src/core/hle/service/psc/psc.cpp | 67 +-------------------------------- src/core/hle/service/psc/psc.h | 4 -- 9 files changed, 141 insertions(+), 69 deletions(-) create mode 100644 src/core/hle/service/psc/pm_control.cpp create mode 100644 src/core/hle/service/psc/pm_control.h create mode 100644 src/core/hle/service/psc/pm_module.cpp create mode 100644 src/core/hle/service/psc/pm_module.h create mode 100644 src/core/hle/service/psc/pm_service.cpp create mode 100644 src/core/hle/service/psc/pm_service.h diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index f67a12f8f..6610da751 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -891,6 +891,12 @@ add_library(core STATIC hle/service/pm/pm.h hle/service/prepo/prepo.cpp hle/service/prepo/prepo.h + hle/service/psc/pm_control.cpp + hle/service/psc/pm_control.h + hle/service/psc/pm_module.cpp + hle/service/psc/pm_module.h + hle/service/psc/pm_service.cpp + hle/service/psc/pm_service.h hle/service/psc/psc.cpp hle/service/psc/psc.h hle/service/psc/time/alarms.cpp diff --git a/src/core/hle/service/psc/pm_control.cpp b/src/core/hle/service/psc/pm_control.cpp new file mode 100644 index 000000000..7dedb7662 --- /dev/null +++ b/src/core/hle/service/psc/pm_control.cpp @@ -0,0 +1,28 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/hle/service/psc/pm_control.h" + +namespace Service::PSC { + +IPmControl::IPmControl(Core::System& system_) : ServiceFramework{system_, "psc:c"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "Initialize"}, + {1, nullptr, "DispatchRequest"}, + {2, nullptr, "GetResult"}, + {3, nullptr, "GetState"}, + {4, nullptr, "Cancel"}, + {5, nullptr, "PrintModuleInformation"}, + {6, nullptr, "GetModuleInformation"}, + {10, nullptr, "AcquireStateLock"}, + {11, nullptr, "HasStateLock"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +IPmControl::~IPmControl() = default; + +} // namespace Service::PSC diff --git a/src/core/hle/service/psc/pm_control.h b/src/core/hle/service/psc/pm_control.h new file mode 100644 index 000000000..e0ae2f39c --- /dev/null +++ b/src/core/hle/service/psc/pm_control.h @@ -0,0 +1,16 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/service.h" + +namespace Service::PSC { + +class IPmControl final : public ServiceFramework { +public: + explicit IPmControl(Core::System& system_); + ~IPmControl() override; +}; + +} // namespace Service::PSC diff --git a/src/core/hle/service/psc/pm_module.cpp b/src/core/hle/service/psc/pm_module.cpp new file mode 100644 index 000000000..74dc7ed4e --- /dev/null +++ b/src/core/hle/service/psc/pm_module.cpp @@ -0,0 +1,24 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/hle/service/psc/pm_module.h" + +namespace Service::PSC { + +IPmModule::IPmModule(Core::System& system_) : ServiceFramework{system_, "IPmModule"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "Initialize"}, + {1, nullptr, "GetRequest"}, + {2, nullptr, "Acknowledge"}, + {3, nullptr, "Finalize"}, + {4, nullptr, "AcknowledgeEx"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +IPmModule::~IPmModule() = default; + +} // namespace Service::PSC diff --git a/src/core/hle/service/psc/pm_module.h b/src/core/hle/service/psc/pm_module.h new file mode 100644 index 000000000..b3a2d2584 --- /dev/null +++ b/src/core/hle/service/psc/pm_module.h @@ -0,0 +1,16 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/service.h" + +namespace Service::PSC { + +class IPmModule final : public ServiceFramework { +public: + explicit IPmModule(Core::System& system_); + ~IPmModule() override; +}; + +} // namespace Service::PSC diff --git a/src/core/hle/service/psc/pm_service.cpp b/src/core/hle/service/psc/pm_service.cpp new file mode 100644 index 000000000..99b16bbb0 --- /dev/null +++ b/src/core/hle/service/psc/pm_service.cpp @@ -0,0 +1,30 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/hle/service/ipc_helpers.h" +#include "core/hle/service/psc/pm_module.h" +#include "core/hle/service/psc/pm_service.h" + +namespace Service::PSC { + +IPmService::IPmService(Core::System& system_) : ServiceFramework{system_, "psc:m"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &IPmService::GetPmModule, "GetPmModule"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +IPmService::~IPmService() = default; + +void IPmService::GetPmModule(HLERequestContext& ctx) { + LOG_DEBUG(Service_PSC, "called"); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(ResultSuccess); + rb.PushIpcInterface(system); +} + +} // namespace Service::PSC diff --git a/src/core/hle/service/psc/pm_service.h b/src/core/hle/service/psc/pm_service.h new file mode 100644 index 000000000..e8bd1fa6b --- /dev/null +++ b/src/core/hle/service/psc/pm_service.h @@ -0,0 +1,19 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/service.h" + +namespace Service::PSC { + +class IPmService final : public ServiceFramework { +public: + explicit IPmService(Core::System& system_); + ~IPmService() override; + +private: + void GetPmModule(HLERequestContext& ctx); +}; + +} // namespace Service::PSC diff --git a/src/core/hle/service/psc/psc.cpp b/src/core/hle/service/psc/psc.cpp index 44310756b..a086c13ed 100644 --- a/src/core/hle/service/psc/psc.cpp +++ b/src/core/hle/service/psc/psc.cpp @@ -1,11 +1,8 @@ // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include - -#include "common/logging/log.h" -#include "core/core.h" -#include "core/hle/service/ipc_helpers.h" +#include "core/hle/service/psc/pm_control.h" +#include "core/hle/service/psc/pm_service.h" #include "core/hle/service/psc/psc.h" #include "core/hle/service/psc/time/manager.h" #include "core/hle/service/psc/time/power_state_service.h" @@ -15,66 +12,6 @@ namespace Service::PSC { -class IPmControl final : public ServiceFramework { -public: - explicit IPmControl(Core::System& system_) : ServiceFramework{system_, "psc:c"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "Initialize"}, - {1, nullptr, "DispatchRequest"}, - {2, nullptr, "GetResult"}, - {3, nullptr, "GetState"}, - {4, nullptr, "Cancel"}, - {5, nullptr, "PrintModuleInformation"}, - {6, nullptr, "GetModuleInformation"}, - {10, nullptr, "AcquireStateLock"}, - {11, nullptr, "HasStateLock"}, - }; - // clang-format on - - RegisterHandlers(functions); - } -}; - -class IPmModule final : public ServiceFramework { -public: - explicit IPmModule(Core::System& system_) : ServiceFramework{system_, "IPmModule"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "Initialize"}, - {1, nullptr, "GetRequest"}, - {2, nullptr, "Acknowledge"}, - {3, nullptr, "Finalize"}, - {4, nullptr, "AcknowledgeEx"}, - }; - // clang-format on - - RegisterHandlers(functions); - } -}; - -class IPmService final : public ServiceFramework { -public: - explicit IPmService(Core::System& system_) : ServiceFramework{system_, "psc:m"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &IPmService::GetPmModule, "GetPmModule"}, - }; - // clang-format on - - RegisterHandlers(functions); - } - -private: - void GetPmModule(HLERequestContext& ctx) { - LOG_DEBUG(Service_PSC, "called"); - - IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(ResultSuccess); - rb.PushIpcInterface(system); - } -}; - void LoopProcess(Core::System& system) { auto server_manager = std::make_unique(system); diff --git a/src/core/hle/service/psc/psc.h b/src/core/hle/service/psc/psc.h index 459137f42..c83d07ca8 100644 --- a/src/core/hle/service/psc/psc.h +++ b/src/core/hle/service/psc/psc.h @@ -7,10 +7,6 @@ namespace Core { class System; } -namespace Service::SM { -class ServiceManager; -} - namespace Service::PSC { void LoopProcess(Core::System& system); -- cgit v1.2.3