mirror of https://github.com/yuzu-mirror/yuzu
am: rewrite appletAE, appletOE
parent
2ff45cd0da
commit
b2e140b032
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
Loading…
Reference in New Issue