summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/service')
-rw-r--r--src/core/hle/service/am/am.cpp12
-rw-r--r--src/core/hle/service/am/am_types.h6
-rw-r--r--src/core/hle/service/am/applet_ae.cpp73
-rw-r--r--src/core/hle/service/am/applet_ae.h39
-rw-r--r--src/core/hle/service/am/applet_oe.cpp42
-rw-r--r--src/core/hle/service/am/applet_oe.h37
-rw-r--r--src/core/hle/service/am/frontend/applets.cpp3
-rw-r--r--src/core/hle/service/am/service/all_system_applet_proxies_service.cpp80
-rw-r--r--src/core/hle/service/am/service/all_system_applet_proxies_service.h47
-rw-r--r--src/core/hle/service/am/service/application_proxy_service.cpp42
-rw-r--r--src/core/hle/service/am/service/application_proxy_service.h35
11 files changed, 216 insertions, 200 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index 8f90eba34..da0f9e3df 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -2,10 +2,10 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "core/hle/service/am/am.h"
-#include "core/hle/service/am/applet_ae.h"
-#include "core/hle/service/am/applet_oe.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"
@@ -14,10 +14,10 @@ namespace Service::AM {
void LoopProcess(Nvnflinger::Nvnflinger& nvnflinger, Core::System& system) {
auto server_manager = std::make_unique<ServerManager>(system);
- server_manager->RegisterNamedService("appletAE",
- std::make_shared<AppletAE>(nvnflinger, system));
- server_manager->RegisterNamedService("appletOE",
- std::make_shared<AppletOE>(nvnflinger, system));
+ server_manager->RegisterNamedService(
+ "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));
diff --git a/src/core/hle/service/am/am_types.h b/src/core/hle/service/am/am_types.h
index 8c33feb15..749081e3d 100644
--- a/src/core/hle/service/am/am_types.h
+++ b/src/core/hle/service/am/am_types.h
@@ -169,6 +169,12 @@ struct AppletIdentityInfo {
};
static_assert(sizeof(AppletIdentityInfo) == 0x10, "AppletIdentityInfo has incorrect size.");
+struct AppletAttribute {
+ u8 flag;
+ INSERT_PADDING_BYTES_NOINIT(0x7F);
+};
+static_assert(sizeof(AppletAttribute) == 0x80, "AppletAttribute has incorrect size.");
+
using AppletResourceUserId = u64;
using ProgramId = u64;
diff --git a/src/core/hle/service/am/applet_ae.cpp b/src/core/hle/service/am/applet_ae.cpp
deleted file mode 100644
index 1b715dea6..000000000
--- a/src/core/hle/service/am/applet_ae.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#include "core/hle/service/am/applet_ae.h"
-#include "core/hle/service/am/applet_manager.h"
-#include "core/hle/service/am/library_applet_proxy.h"
-#include "core/hle/service/am/system_applet_proxy.h"
-#include "core/hle/service/ipc_helpers.h"
-
-namespace Service::AM {
-
-AppletAE::AppletAE(Nvnflinger::Nvnflinger& nvnflinger_, Core::System& system_)
- : ServiceFramework{system_, "appletAE"}, nvnflinger{nvnflinger_} {
- // clang-format off
- static const FunctionInfo functions[] = {
- {100, &AppletAE::OpenSystemAppletProxy, "OpenSystemAppletProxy"},
- {200, &AppletAE::OpenLibraryAppletProxyOld, "OpenLibraryAppletProxyOld"},
- {201, &AppletAE::OpenLibraryAppletProxy, "OpenLibraryAppletProxy"},
- {300, nullptr, "OpenOverlayAppletProxy"},
- {350, nullptr, "OpenSystemApplicationProxy"},
- {400, nullptr, "CreateSelfLibraryAppletCreatorForDevelop"},
- {410, nullptr, "GetSystemAppletControllerForDebug"},
- {1000, nullptr, "GetDebugFunctions"},
- };
- // clang-format on
-
- RegisterHandlers(functions);
-}
-
-AppletAE::~AppletAE() = default;
-
-void AppletAE::OpenSystemAppletProxy(HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
-
- if (const auto applet = GetAppletFromContext(ctx)) {
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(ResultSuccess);
- rb.PushIpcInterface<ISystemAppletProxy>(nvnflinger, applet, system);
- } else {
- UNIMPLEMENTED();
-
- IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(ResultUnknown);
- }
-}
-
-void AppletAE::OpenLibraryAppletProxy(HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
-
- if (const auto applet = GetAppletFromContext(ctx)) {
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(ResultSuccess);
- rb.PushIpcInterface<ILibraryAppletProxy>(nvnflinger, applet, system);
- } else {
- UNIMPLEMENTED();
-
- IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(ResultUnknown);
- }
-}
-
-void AppletAE::OpenLibraryAppletProxyOld(HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
-
- return OpenLibraryAppletProxy(ctx);
-}
-
-std::shared_ptr<Applet> AppletAE::GetAppletFromContext(HLERequestContext& ctx) {
- const auto aruid = ctx.GetPID();
- return system.GetAppletManager().GetByAppletResourceUserId(aruid);
-}
-
-} // namespace Service::AM
diff --git a/src/core/hle/service/am/applet_ae.h b/src/core/hle/service/am/applet_ae.h
deleted file mode 100644
index 3d7961fa1..000000000
--- a/src/core/hle/service/am/applet_ae.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#pragma once
-
-#include <memory>
-
-#include "core/hle/service/service.h"
-
-namespace Service {
-namespace FileSystem {
-class FileSystemController;
-}
-
-namespace Nvnflinger {
-class Nvnflinger;
-}
-
-namespace AM {
-
-struct Applet;
-
-class AppletAE final : public ServiceFramework<AppletAE> {
-public:
- explicit AppletAE(Nvnflinger::Nvnflinger& nvnflinger_, Core::System& system_);
- ~AppletAE() override;
-
-private:
- void OpenSystemAppletProxy(HLERequestContext& ctx);
- void OpenLibraryAppletProxy(HLERequestContext& ctx);
- void OpenLibraryAppletProxyOld(HLERequestContext& ctx);
-
- std::shared_ptr<Applet> GetAppletFromContext(HLERequestContext& ctx);
-
- Nvnflinger::Nvnflinger& nvnflinger;
-};
-
-} // namespace AM
-} // namespace Service
diff --git a/src/core/hle/service/am/applet_oe.cpp b/src/core/hle/service/am/applet_oe.cpp
deleted file mode 100644
index 56bafd162..000000000
--- a/src/core/hle/service/am/applet_oe.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#include "core/hle/service/am/am.h"
-#include "core/hle/service/am/applet_manager.h"
-#include "core/hle/service/am/applet_oe.h"
-#include "core/hle/service/am/application_proxy.h"
-#include "core/hle/service/ipc_helpers.h"
-
-namespace Service::AM {
-
-AppletOE::AppletOE(Nvnflinger::Nvnflinger& nvnflinger_, Core::System& system_)
- : ServiceFramework{system_, "appletOE"}, nvnflinger{nvnflinger_} {
- static const FunctionInfo functions[] = {
- {0, &AppletOE::OpenApplicationProxy, "OpenApplicationProxy"},
- };
- RegisterHandlers(functions);
-}
-
-AppletOE::~AppletOE() = default;
-
-void AppletOE::OpenApplicationProxy(HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
-
- if (const auto applet = GetAppletFromContext(ctx)) {
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(ResultSuccess);
- rb.PushIpcInterface<IApplicationProxy>(nvnflinger, applet, system);
- } else {
- UNIMPLEMENTED();
-
- IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(ResultUnknown);
- }
-}
-
-std::shared_ptr<Applet> AppletOE::GetAppletFromContext(HLERequestContext& ctx) {
- const auto aruid = ctx.GetPID();
- return system.GetAppletManager().GetByAppletResourceUserId(aruid);
-}
-
-} // namespace Service::AM
diff --git a/src/core/hle/service/am/applet_oe.h b/src/core/hle/service/am/applet_oe.h
deleted file mode 100644
index f2ba1c924..000000000
--- a/src/core/hle/service/am/applet_oe.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#pragma once
-
-#include <memory>
-
-#include "core/hle/service/service.h"
-
-namespace Service {
-namespace FileSystem {
-class FileSystemController;
-}
-
-namespace Nvnflinger {
-class Nvnflinger;
-}
-
-namespace AM {
-
-struct Applet;
-
-class AppletOE final : public ServiceFramework<AppletOE> {
-public:
- explicit AppletOE(Nvnflinger::Nvnflinger& nvnflinger_, Core::System& system_);
- ~AppletOE() override;
-
-private:
- void OpenApplicationProxy(HLERequestContext& ctx);
-
- std::shared_ptr<Applet> GetAppletFromContext(HLERequestContext& ctx);
-
- Nvnflinger::Nvnflinger& nvnflinger;
-};
-
-} // namespace AM
-} // namespace Service
diff --git a/src/core/hle/service/am/frontend/applets.cpp b/src/core/hle/service/am/frontend/applets.cpp
index db2b04575..944d8b105 100644
--- a/src/core/hle/service/am/frontend/applets.cpp
+++ b/src/core/hle/service/am/frontend/applets.cpp
@@ -15,11 +15,8 @@
#include "core/frontend/applets/web_browser.h"
#include "core/hle/kernel/k_event.h"
#include "core/hle/service/am/am.h"
-#include "core/hle/service/am/applet_ae.h"
#include "core/hle/service/am/applet_data_broker.h"
#include "core/hle/service/am/applet_manager.h"
-#include "core/hle/service/am/applet_message_queue.h"
-#include "core/hle/service/am/applet_oe.h"
#include "core/hle/service/am/frontend/applet_cabinet.h"
#include "core/hle/service/am/frontend/applet_controller.h"
#include "core/hle/service/am/frontend/applet_error.h"
diff --git a/src/core/hle/service/am/service/all_system_applet_proxies_service.cpp b/src/core/hle/service/am/service/all_system_applet_proxies_service.cpp
new file mode 100644
index 000000000..66c23a749
--- /dev/null
+++ b/src/core/hle/service/am/service/all_system_applet_proxies_service.cpp
@@ -0,0 +1,80 @@
+// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "core/core.h"
+#include "core/hle/service/am/applet_manager.h"
+#include "core/hle/service/am/library_applet_proxy.h"
+#include "core/hle/service/am/service/all_system_applet_proxies_service.h"
+#include "core/hle/service/am/system_applet_proxy.h"
+#include "core/hle/service/cmif_serialization.h"
+
+namespace Service::AM {
+
+IAllSystemAppletProxiesService::IAllSystemAppletProxiesService(Core::System& system_,
+ Nvnflinger::Nvnflinger& nvnflinger)
+ : ServiceFramework{system_, "appletAE"}, m_nvnflinger{nvnflinger} {
+ // clang-format off
+ static const FunctionInfo functions[] = {
+ {100, D<&IAllSystemAppletProxiesService::OpenSystemAppletProxy>, "OpenSystemAppletProxy"},
+ {200, D<&IAllSystemAppletProxiesService::OpenLibraryAppletProxyOld>, "OpenLibraryAppletProxyOld"},
+ {201, D<&IAllSystemAppletProxiesService::OpenLibraryAppletProxy>, "OpenLibraryAppletProxy"},
+ {300, nullptr, "OpenOverlayAppletProxy"},
+ {350, nullptr, "OpenSystemApplicationProxy"},
+ {400, nullptr, "CreateSelfLibraryAppletCreatorForDevelop"},
+ {410, nullptr, "GetSystemAppletControllerForDebug"},
+ {1000, nullptr, "GetDebugFunctions"},
+ };
+ // clang-format on
+
+ RegisterHandlers(functions);
+}
+
+IAllSystemAppletProxiesService::~IAllSystemAppletProxiesService() = default;
+
+Result IAllSystemAppletProxiesService::OpenSystemAppletProxy(
+ Out<SharedPointer<ISystemAppletProxy>> out_system_applet_proxy, ClientProcessId pid,
+ InCopyHandle<Kernel::KProcess> process_handle) {
+ LOG_DEBUG(Service_AM, "called");
+
+ if (const auto applet = this->GetAppletFromProcessId(pid); applet) {
+ *out_system_applet_proxy =
+ std::make_shared<ISystemAppletProxy>(m_nvnflinger, applet, system);
+ R_SUCCEED();
+ } else {
+ UNIMPLEMENTED();
+ R_THROW(ResultUnknown);
+ }
+}
+
+Result IAllSystemAppletProxiesService::OpenLibraryAppletProxy(
+ Out<SharedPointer<ILibraryAppletProxy>> out_library_applet_proxy, ClientProcessId pid,
+ InCopyHandle<Kernel::KProcess> process_handle,
+ InLargeData<AppletAttribute, BufferAttr_HipcMapAlias> attribute) {
+ LOG_DEBUG(Service_AM, "called");
+
+ if (const auto applet = this->GetAppletFromProcessId(pid); applet) {
+ *out_library_applet_proxy =
+ std::make_shared<ILibraryAppletProxy>(m_nvnflinger, applet, system);
+ R_SUCCEED();
+ } else {
+ UNIMPLEMENTED();
+ R_THROW(ResultUnknown);
+ }
+}
+
+Result IAllSystemAppletProxiesService::OpenLibraryAppletProxyOld(
+ Out<SharedPointer<ILibraryAppletProxy>> out_library_applet_proxy, ClientProcessId pid,
+ InCopyHandle<Kernel::KProcess> process_handle) {
+ LOG_DEBUG(Service_AM, "called");
+
+ AppletAttribute attribute{};
+ R_RETURN(
+ this->OpenLibraryAppletProxy(out_library_applet_proxy, pid, process_handle, attribute));
+}
+
+std::shared_ptr<Applet> IAllSystemAppletProxiesService::GetAppletFromProcessId(
+ ProcessId process_id) {
+ return system.GetAppletManager().GetByAppletResourceUserId(process_id.pid);
+}
+
+} // namespace Service::AM
diff --git a/src/core/hle/service/am/service/all_system_applet_proxies_service.h b/src/core/hle/service/am/service/all_system_applet_proxies_service.h
new file mode 100644
index 000000000..38b1ca2ea
--- /dev/null
+++ b/src/core/hle/service/am/service/all_system_applet_proxies_service.h
@@ -0,0 +1,47 @@
+// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "core/hle/service/cmif_types.h"
+#include "core/hle/service/service.h"
+
+namespace Service {
+
+namespace Nvnflinger {
+class Nvnflinger;
+}
+
+namespace AM {
+
+struct Applet;
+struct AppletAttribute;
+class ILibraryAppletProxy;
+class ISystemAppletProxy;
+
+class IAllSystemAppletProxiesService final
+ : public ServiceFramework<IAllSystemAppletProxiesService> {
+public:
+ explicit IAllSystemAppletProxiesService(Core::System& system_,
+ Nvnflinger::Nvnflinger& nvnflinger);
+ ~IAllSystemAppletProxiesService() override;
+
+private:
+ Result OpenSystemAppletProxy(Out<SharedPointer<ISystemAppletProxy>> out_system_applet_proxy,
+ ClientProcessId pid,
+ InCopyHandle<Kernel::KProcess> process_handle);
+ Result OpenLibraryAppletProxy(Out<SharedPointer<ILibraryAppletProxy>> out_library_applet_proxy,
+ ClientProcessId pid,
+ InCopyHandle<Kernel::KProcess> process_handle,
+ InLargeData<AppletAttribute, BufferAttr_HipcMapAlias> attribute);
+ Result OpenLibraryAppletProxyOld(
+ Out<SharedPointer<ILibraryAppletProxy>> out_library_applet_proxy, ClientProcessId pid,
+ InCopyHandle<Kernel::KProcess> process_handle);
+
+private:
+ std::shared_ptr<Applet> GetAppletFromProcessId(ProcessId pid);
+ Nvnflinger::Nvnflinger& m_nvnflinger;
+};
+
+} // namespace AM
+} // namespace Service
diff --git a/src/core/hle/service/am/service/application_proxy_service.cpp b/src/core/hle/service/am/service/application_proxy_service.cpp
new file mode 100644
index 000000000..b8532d047
--- /dev/null
+++ b/src/core/hle/service/am/service/application_proxy_service.cpp
@@ -0,0 +1,42 @@
+// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "core/core.h"
+#include "core/hle/service/am/am.h"
+#include "core/hle/service/am/applet_manager.h"
+#include "core/hle/service/am/application_proxy.h"
+#include "core/hle/service/am/service/application_proxy_service.h"
+#include "core/hle/service/cmif_serialization.h"
+
+namespace Service::AM {
+
+IApplicationProxyService::IApplicationProxyService(Core::System& system_,
+ Nvnflinger::Nvnflinger& nvnflinger)
+ : ServiceFramework{system_, "appletOE"}, m_nvnflinger{nvnflinger} {
+ static const FunctionInfo functions[] = {
+ {0, D<&IApplicationProxyService::OpenApplicationProxy>, "OpenApplicationProxy"},
+ };
+ RegisterHandlers(functions);
+}
+
+IApplicationProxyService::~IApplicationProxyService() = default;
+
+Result IApplicationProxyService::OpenApplicationProxy(
+ Out<SharedPointer<IApplicationProxy>> out_application_proxy, ClientProcessId pid,
+ InCopyHandle<Kernel::KProcess> process_handle) {
+ LOG_DEBUG(Service_AM, "called");
+
+ if (const auto applet = this->GetAppletFromProcessId(pid)) {
+ *out_application_proxy = std::make_shared<IApplicationProxy>(m_nvnflinger, applet, system);
+ R_SUCCEED();
+ } else {
+ UNIMPLEMENTED();
+ R_THROW(ResultUnknown);
+ }
+}
+
+std::shared_ptr<Applet> IApplicationProxyService::GetAppletFromProcessId(ProcessId process_id) {
+ return system.GetAppletManager().GetByAppletResourceUserId(process_id.pid);
+}
+
+} // namespace Service::AM
diff --git a/src/core/hle/service/am/service/application_proxy_service.h b/src/core/hle/service/am/service/application_proxy_service.h
new file mode 100644
index 000000000..1c1d32d0b
--- /dev/null
+++ b/src/core/hle/service/am/service/application_proxy_service.h
@@ -0,0 +1,35 @@
+// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "core/hle/service/cmif_types.h"
+#include "core/hle/service/service.h"
+
+namespace Service {
+
+namespace Nvnflinger {
+class Nvnflinger;
+}
+
+namespace AM {
+
+struct Applet;
+class IApplicationProxy;
+
+class IApplicationProxyService final : public ServiceFramework<IApplicationProxyService> {
+public:
+ explicit IApplicationProxyService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger);
+ ~IApplicationProxyService() override;
+
+private:
+ Result OpenApplicationProxy(Out<SharedPointer<IApplicationProxy>> out_application_proxy,
+ ClientProcessId pid, InCopyHandle<Kernel::KProcess> process_handle);
+
+private:
+ std::shared_ptr<Applet> GetAppletFromProcessId(ProcessId pid);
+ Nvnflinger::Nvnflinger& m_nvnflinger;
+};
+
+} // namespace AM
+} // namespace Service