applet_ae.cpp 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. // Copyright 2018 yuzu emulator team
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include "common/logging/log.h"
  5. #include "core/hle/ipc_helpers.h"
  6. #include "core/hle/service/am/am.h"
  7. #include "core/hle/service/am/applet_ae.h"
  8. #include "core/hle/service/nvflinger/nvflinger.h"
  9. namespace Service::AM {
  10. class ILibraryAppletProxy final : public ServiceFramework<ILibraryAppletProxy> {
  11. public:
  12. ILibraryAppletProxy(std::shared_ptr<NVFlinger::NVFlinger> nvflinger)
  13. : ServiceFramework("ILibraryAppletProxy"), nvflinger(std::move(nvflinger)) {
  14. static const FunctionInfo functions[] = {
  15. {0, &ILibraryAppletProxy::GetCommonStateGetter, "GetCommonStateGetter"},
  16. {1, &ILibraryAppletProxy::GetSelfController, "GetSelfController"},
  17. {2, &ILibraryAppletProxy::GetWindowController, "GetWindowController"},
  18. {3, &ILibraryAppletProxy::GetAudioController, "GetAudioController"},
  19. {4, &ILibraryAppletProxy::GetDisplayController, "GetDisplayController"},
  20. {10, nullptr, "GetProcessWindingController"},
  21. {11, &ILibraryAppletProxy::GetLibraryAppletCreator, "GetLibraryAppletCreator"},
  22. {20, &ILibraryAppletProxy::GetApplicationFunctions, "GetApplicationFunctions"},
  23. {1000, &ILibraryAppletProxy::GetDebugFunctions, "GetDebugFunctions"},
  24. };
  25. RegisterHandlers(functions);
  26. }
  27. private:
  28. void GetCommonStateGetter(Kernel::HLERequestContext& ctx) {
  29. IPC::ResponseBuilder rb{ctx, 2, 0, 1};
  30. rb.Push(RESULT_SUCCESS);
  31. rb.PushIpcInterface<ICommonStateGetter>();
  32. NGLOG_DEBUG(Service_AM, "called");
  33. }
  34. void GetSelfController(Kernel::HLERequestContext& ctx) {
  35. IPC::ResponseBuilder rb{ctx, 2, 0, 1};
  36. rb.Push(RESULT_SUCCESS);
  37. rb.PushIpcInterface<ISelfController>(nvflinger);
  38. NGLOG_DEBUG(Service_AM, "called");
  39. }
  40. void GetWindowController(Kernel::HLERequestContext& ctx) {
  41. IPC::ResponseBuilder rb{ctx, 2, 0, 1};
  42. rb.Push(RESULT_SUCCESS);
  43. rb.PushIpcInterface<IWindowController>();
  44. NGLOG_DEBUG(Service_AM, "called");
  45. }
  46. void GetAudioController(Kernel::HLERequestContext& ctx) {
  47. IPC::ResponseBuilder rb{ctx, 2, 0, 1};
  48. rb.Push(RESULT_SUCCESS);
  49. rb.PushIpcInterface<IAudioController>();
  50. NGLOG_DEBUG(Service_AM, "called");
  51. }
  52. void GetDisplayController(Kernel::HLERequestContext& ctx) {
  53. IPC::ResponseBuilder rb{ctx, 2, 0, 1};
  54. rb.Push(RESULT_SUCCESS);
  55. rb.PushIpcInterface<IDisplayController>();
  56. NGLOG_DEBUG(Service_AM, "called");
  57. }
  58. void GetDebugFunctions(Kernel::HLERequestContext& ctx) {
  59. IPC::ResponseBuilder rb{ctx, 2, 0, 1};
  60. rb.Push(RESULT_SUCCESS);
  61. rb.PushIpcInterface<IDebugFunctions>();
  62. NGLOG_DEBUG(Service_AM, "called");
  63. }
  64. void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) {
  65. IPC::ResponseBuilder rb{ctx, 2, 0, 1};
  66. rb.Push(RESULT_SUCCESS);
  67. rb.PushIpcInterface<ILibraryAppletCreator>();
  68. NGLOG_DEBUG(Service_AM, "called");
  69. }
  70. void GetApplicationFunctions(Kernel::HLERequestContext& ctx) {
  71. IPC::ResponseBuilder rb{ctx, 2, 0, 1};
  72. rb.Push(RESULT_SUCCESS);
  73. rb.PushIpcInterface<IApplicationFunctions>();
  74. NGLOG_DEBUG(Service_AM, "called");
  75. }
  76. std::shared_ptr<NVFlinger::NVFlinger> nvflinger;
  77. };
  78. void AppletAE::OpenLibraryAppletProxyOld(Kernel::HLERequestContext& ctx) {
  79. IPC::ResponseBuilder rb{ctx, 2, 0, 1};
  80. rb.Push(RESULT_SUCCESS);
  81. rb.PushIpcInterface<ILibraryAppletProxy>(nvflinger);
  82. NGLOG_DEBUG(Service_AM, "called");
  83. }
  84. AppletAE::AppletAE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger)
  85. : ServiceFramework("appletAE"), nvflinger(std::move(nvflinger)) {
  86. static const FunctionInfo functions[] = {
  87. {100, nullptr, "OpenSystemAppletProxy"},
  88. {200, &AppletAE::OpenLibraryAppletProxyOld, "OpenLibraryAppletProxyOld"},
  89. {201, nullptr, "OpenLibraryAppletProxy"},
  90. {300, nullptr, "OpenOverlayAppletProxy"},
  91. {350, nullptr, "OpenSystemApplicationProxy"},
  92. {400, nullptr, "CreateSelfLibraryAppletCreatorForDevelop"},
  93. };
  94. RegisterHandlers(functions);
  95. }
  96. } // namespace Service::AM