VERY experimental Nintendo Switch 2 emulator
C++
am: move out omm interfaces to new module
Liam47d07fb3a198
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txtindex 8fd99a5e9a..5e2f4869e6 100644--- a/src/core/CMakeLists.txt+++ b/src/core/CMakeLists.txt@@ -425,14 +425,10 @@ add_library(core STATIChle/service/am/applet_message_queue.hhle/service/am/hid_registration.cpphle/service/am/hid_registration.h- hle/service/am/idle.cpp- hle/service/am/idle.hhle/service/am/library_applet_storage.cpphle/service/am/library_applet_storage.hhle/service/am/managed_layer_holder.cpphle/service/am/managed_layer_holder.h- hle/service/am/omm.cpp- hle/service/am/omm.hhle/service/am/process.cpphle/service/am/process.hhle/service/am/service/all_system_applet_proxies_service.cpp@@ -487,8 +483,6 @@ add_library(core STATIChle/service/am/service/window_controller.hhle/service/am/system_buffer_manager.cpphle/service/am/system_buffer_manager.h- hle/service/am/spsm.cpp- hle/service/am/spsm.hhle/service/aoc/aoc_u.cpphle/service/aoc/aoc_u.hhle/service/apm/apm.cpp@@ -815,6 +809,14 @@ add_library(core STATIChle/service/nvnflinger/window.hhle/service/olsc/olsc.cpphle/service/olsc/olsc.h+ hle/service/omm/omm.cpp+ hle/service/omm/omm.h+ hle/service/omm/operation_mode_manager.cpp+ hle/service/omm/operation_mode_manager.h+ hle/service/omm/policy_manager_system.cpp+ hle/service/omm/policy_manager_system.h+ hle/service/omm/power_state_interface.cpp+ hle/service/omm/power_state_interface.hhle/service/os/event.cpphle/service/os/event.hhle/service/os/multi_wait_holder.cppdiff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cppindex da0f9e3df5..9dc710ba90 100644--- a/src/core/hle/service/am/am.cpp+++ b/src/core/hle/service/am/am.cpp@@ -2,11 +2,8 @@// SPDX-License-Identifier: GPL-2.0-or-later#include "core/hle/service/am/am.h"-#include "core/hle/service/am/idle.h"-#include "core/hle/service/am/omm.h"#include "core/hle/service/am/service/all_system_applet_proxies_service.h"#include "core/hle/service/am/service/application_proxy_service.h"-#include "core/hle/service/am/spsm.h"#include "core/hle/service/server_manager.h"namespace Service::AM {@@ -18,9 +15,6 @@ void LoopProcess(Nvnflinger::Nvnflinger& nvnflinger, Core::System& system) {"appletAE", std::make_shared<IAllSystemAppletProxiesService>(system, nvnflinger));server_manager->RegisterNamedService("appletOE", std::make_shared<IApplicationProxyService>(system, nvnflinger));- server_manager->RegisterNamedService("idle:sys", std::make_shared<IdleSys>(system));- server_manager->RegisterNamedService("omm", std::make_shared<OMM>(system));- server_manager->RegisterNamedService("spsm", std::make_shared<SPSM>(system));ServerManager::RunServer(std::move(server_manager));}diff --git a/src/core/hle/service/am/idle.h b/src/core/hle/service/am/idle.hdeleted file mode 100644index 15b31f67ee..0000000000--- a/src/core/hle/service/am/idle.h+++ /dev/null@@ -1,20 +0,0 @@-// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project-// SPDX-License-Identifier: GPL-2.0-or-later--#pragma once--#include "core/hle/service/service.h"--namespace Core {-class System;-}--namespace Service::AM {--class IdleSys final : public ServiceFramework<IdleSys> {-public:- explicit IdleSys(Core::System& system_);- ~IdleSys() override;-};--} // namespace Service::AMdiff --git a/src/core/hle/service/am/omm.h b/src/core/hle/service/am/omm.hdeleted file mode 100644index 73d0c82d53..0000000000--- a/src/core/hle/service/am/omm.h+++ /dev/null@@ -1,20 +0,0 @@-// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project-// SPDX-License-Identifier: GPL-2.0-or-later--#pragma once--#include "core/hle/service/service.h"--namespace Core {-class System;-}--namespace Service::AM {--class OMM final : public ServiceFramework<OMM> {-public:- explicit OMM(Core::System& system_);- ~OMM() override;-};--} // namespace Service::AMdiff --git a/src/core/hle/service/am/spsm.h b/src/core/hle/service/am/spsm.hdeleted file mode 100644index 922f8863ea..0000000000--- a/src/core/hle/service/am/spsm.h+++ /dev/null@@ -1,20 +0,0 @@-// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project-// SPDX-License-Identifier: GPL-2.0-or-later--#pragma once--#include "core/hle/service/service.h"--namespace Core {-class System;-}--namespace Service::AM {--class SPSM final : public ServiceFramework<SPSM> {-public:- explicit SPSM(Core::System& system_);- ~SPSM() override;-};--} // namespace Service::AMdiff --git a/src/core/hle/service/omm/omm.cpp b/src/core/hle/service/omm/omm.cppnew file mode 100644index 0000000000..b95319e26b--- /dev/null+++ b/src/core/hle/service/omm/omm.cpp@@ -0,0 +1,22 @@+// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project+// SPDX-License-Identifier: GPL-2.0-or-later++#include "core/hle/service/omm/omm.h"+#include "core/hle/service/omm/operation_mode_manager.h"+#include "core/hle/service/omm/policy_manager_system.h"+#include "core/hle/service/omm/power_state_interface.h"+#include "core/hle/service/server_manager.h"++namespace Service::OMM {++void LoopProcess(Core::System& system) {+ auto server_manager = std::make_unique<ServerManager>(system);++ server_manager->RegisterNamedService("idle:sys",+ std::make_shared<IPolicyManagerSystem>(system));+ server_manager->RegisterNamedService("omm", std::make_shared<IOperationModeManager>(system));+ server_manager->RegisterNamedService("spsm", std::make_shared<IPowerStateInterface>(system));+ ServerManager::RunServer(std::move(server_manager));+}++} // namespace Service::OMMdiff --git a/src/core/hle/service/omm/omm.h b/src/core/hle/service/omm/omm.hnew file mode 100644index 0000000000..7bf04688ae--- /dev/null+++ b/src/core/hle/service/omm/omm.h@@ -0,0 +1,14 @@+// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project+// SPDX-License-Identifier: GPL-2.0-or-later++#pragma once++namespace Core {+class System;+}++namespace Service::OMM {++void LoopProcess(Core::System& system);++} // namespace Service::OMMdiff --git a/src/core/hle/service/am/omm.cpp b/src/core/hle/service/omm/operation_mode_manager.cppsimilarity index 86%rename from src/core/hle/service/am/omm.cpprename to src/core/hle/service/omm/operation_mode_manager.cppindex 66824e4955..fe7ed84a7f 100644--- a/src/core/hle/service/am/omm.cpp+++ b/src/core/hle/service/omm/operation_mode_manager.cpp@@ -1,11 +1,12 @@// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project// SPDX-License-Identifier: GPL-2.0-or-later-#include "core/hle/service/am/omm.h"+#include "core/hle/service/omm/operation_mode_manager.h"-namespace Service::AM {+namespace Service::OMM {-OMM::OMM(Core::System& system_) : ServiceFramework{system_, "omm"} {+IOperationModeManager::IOperationModeManager(Core::System& system_)+ : ServiceFramework{system_, "omm"} {// clang-format offstatic const FunctionInfo functions[] = {{0, nullptr, "GetOperationMode"},@@ -43,6 +44,6 @@ OMM::OMM(Core::System& system_) : ServiceFramework{system_, "omm"} {RegisterHandlers(functions);}-OMM::~OMM() = default;+IOperationModeManager::~IOperationModeManager() = default;-} // namespace Service::AM+} // namespace Service::OMMdiff --git a/src/core/hle/service/omm/operation_mode_manager.h b/src/core/hle/service/omm/operation_mode_manager.hnew file mode 100644index 0000000000..32bc7b2f93--- /dev/null+++ b/src/core/hle/service/omm/operation_mode_manager.h@@ -0,0 +1,20 @@+// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project+// SPDX-License-Identifier: GPL-2.0-or-later++#pragma once++#include "core/hle/service/service.h"++namespace Core {+class System;+}++namespace Service::OMM {++class IOperationModeManager final : public ServiceFramework<IOperationModeManager> {+public:+ explicit IOperationModeManager(Core::System& system_);+ ~IOperationModeManager() override;+};++} // namespace Service::OMMdiff --git a/src/core/hle/service/am/idle.cpp b/src/core/hle/service/omm/policy_manager_system.cppsimilarity index 64%rename from src/core/hle/service/am/idle.cpprename to src/core/hle/service/omm/policy_manager_system.cppindex 6035152843..1cd6fd807b 100644--- a/src/core/hle/service/am/idle.cpp+++ b/src/core/hle/service/omm/policy_manager_system.cpp@@ -1,11 +1,12 @@// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project// SPDX-License-Identifier: GPL-2.0-or-later-#include "core/hle/service/am/idle.h"+#include "core/hle/service/omm/policy_manager_system.h"-namespace Service::AM {+namespace Service::OMM {-IdleSys::IdleSys(Core::System& system_) : ServiceFramework{system_, "idle:sys"} {+IPolicyManagerSystem::IPolicyManagerSystem(Core::System& system_)+ : ServiceFramework{system_, "idle:sys"} {// clang-format offstatic const FunctionInfo functions[] = {{0, nullptr, "GetAutoPowerDownEvent"},@@ -20,6 +21,6 @@ IdleSys::IdleSys(Core::System& system_) : ServiceFramework{system_, "idle:sys"}RegisterHandlers(functions);}-IdleSys::~IdleSys() = default;+IPolicyManagerSystem::~IPolicyManagerSystem() = default;-} // namespace Service::AM+} // namespace Service::OMMdiff --git a/src/core/hle/service/omm/policy_manager_system.h b/src/core/hle/service/omm/policy_manager_system.hnew file mode 100644index 0000000000..151ca0d2ee--- /dev/null+++ b/src/core/hle/service/omm/policy_manager_system.h@@ -0,0 +1,20 @@+// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project+// SPDX-License-Identifier: GPL-2.0-or-later++#pragma once++#include "core/hle/service/service.h"++namespace Core {+class System;+}++namespace Service::OMM {++class IPolicyManagerSystem final : public ServiceFramework<IPolicyManagerSystem> {+public:+ explicit IPolicyManagerSystem(Core::System& system_);+ ~IPolicyManagerSystem() override;+};++} // namespace Service::OMMdiff --git a/src/core/hle/service/am/spsm.cpp b/src/core/hle/service/omm/power_state_interface.cppsimilarity index 75%rename from src/core/hle/service/am/spsm.cpprename to src/core/hle/service/omm/power_state_interface.cppindex ec581e32b0..22cac82595 100644--- a/src/core/hle/service/am/spsm.cpp+++ b/src/core/hle/service/omm/power_state_interface.cpp@@ -1,11 +1,12 @@// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project// SPDX-License-Identifier: GPL-2.0-or-later-#include "core/hle/service/am/spsm.h"+#include "core/hle/service/omm/power_state_interface.h"-namespace Service::AM {+namespace Service::OMM {-SPSM::SPSM(Core::System& system_) : ServiceFramework{system_, "spsm"} {+IPowerStateInterface::IPowerStateInterface(Core::System& system_)+ : ServiceFramework{system_, "spsm"} {// clang-format offstatic const FunctionInfo functions[] = {{0, nullptr, "GetState"},@@ -26,6 +27,6 @@ SPSM::SPSM(Core::System& system_) : ServiceFramework{system_, "spsm"} {RegisterHandlers(functions);}-SPSM::~SPSM() = default;+IPowerStateInterface::~IPowerStateInterface() = default;-} // namespace Service::AM+} // namespace Service::OMMdiff --git a/src/core/hle/service/omm/power_state_interface.h b/src/core/hle/service/omm/power_state_interface.hnew file mode 100644index 0000000000..825a6512d9--- /dev/null+++ b/src/core/hle/service/omm/power_state_interface.h@@ -0,0 +1,20 @@+// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project+// SPDX-License-Identifier: GPL-2.0-or-later++#pragma once++#include "core/hle/service/service.h"++namespace Core {+class System;+}++namespace Service::OMM {++class IPowerStateInterface final : public ServiceFramework<IPowerStateInterface> {+public:+ explicit IPowerStateInterface(Core::System& system_);+ ~IPowerStateInterface() override;+};++} // namespace Service::OMMdiff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cppindex f68c3c6869..fbdf217ba5 100644--- a/src/core/hle/service/service.cpp+++ b/src/core/hle/service/service.cpp@@ -52,6 +52,7 @@#include "core/hle/service/nvnflinger/hos_binder_driver_server.h"#include "core/hle/service/nvnflinger/nvnflinger.h"#include "core/hle/service/olsc/olsc.h"+#include "core/hle/service/omm/omm.h"#include "core/hle/service/pcie/pcie.h"#include "core/hle/service/pctl/pctl_module.h"#include "core/hle/service/pcv/pcv.h"@@ -266,6 +267,7 @@ Services::Services(std::shared_ptr<SM::ServiceManager>& sm, Core::System& systemkernel.RunOnGuestCoreProcess("npns", [&] { NPNS::LoopProcess(system); });kernel.RunOnGuestCoreProcess("ns", [&] { NS::LoopProcess(system); });kernel.RunOnGuestCoreProcess("olsc", [&] { OLSC::LoopProcess(system); });+ kernel.RunOnGuestCoreProcess("omm", [&] { OMM::LoopProcess(system); });kernel.RunOnGuestCoreProcess("pcie", [&] { PCIe::LoopProcess(system); });kernel.RunOnGuestCoreProcess("pctl", [&] { PCTL::LoopProcess(system); });kernel.RunOnGuestCoreProcess("pcv", [&] { PCV::LoopProcess(system); });