applet_oe.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #include "core/hle/service/am/am.h"
  4. #include "core/hle/service/am/applet_manager.h"
  5. #include "core/hle/service/am/applet_oe.h"
  6. #include "core/hle/service/am/application_proxy.h"
  7. #include "core/hle/service/ipc_helpers.h"
  8. namespace Service::AM {
  9. AppletOE::AppletOE(Nvnflinger::Nvnflinger& nvnflinger_, Core::System& system_)
  10. : ServiceFramework{system_, "appletOE"}, nvnflinger{nvnflinger_} {
  11. static const FunctionInfo functions[] = {
  12. {0, &AppletOE::OpenApplicationProxy, "OpenApplicationProxy"},
  13. };
  14. RegisterHandlers(functions);
  15. }
  16. AppletOE::~AppletOE() = default;
  17. void AppletOE::OpenApplicationProxy(HLERequestContext& ctx) {
  18. LOG_DEBUG(Service_AM, "called");
  19. if (const auto applet = GetAppletFromContext(ctx)) {
  20. IPC::ResponseBuilder rb{ctx, 2, 0, 1};
  21. rb.Push(ResultSuccess);
  22. rb.PushIpcInterface<IApplicationProxy>(nvnflinger, applet, system);
  23. } else {
  24. UNIMPLEMENTED();
  25. IPC::ResponseBuilder rb{ctx, 2};
  26. rb.Push(ResultUnknown);
  27. }
  28. }
  29. std::shared_ptr<Applet> AppletOE::GetAppletFromContext(HLERequestContext& ctx) {
  30. const auto aruid = ctx.GetPID();
  31. return system.GetAppletManager().GetByAppletResourceUserId(aruid);
  32. }
  33. } // namespace Service::AM