application_proxy.cpp 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #include "core/hle/service/am/applet_common_functions.h"
  4. #include "core/hle/service/am/application_functions.h"
  5. #include "core/hle/service/am/application_proxy.h"
  6. #include "core/hle/service/am/audio_controller.h"
  7. #include "core/hle/service/am/common_state_getter.h"
  8. #include "core/hle/service/am/debug_functions.h"
  9. #include "core/hle/service/am/display_controller.h"
  10. #include "core/hle/service/am/library_applet_creator.h"
  11. #include "core/hle/service/am/library_applet_self_accessor.h"
  12. #include "core/hle/service/am/process_winding_controller.h"
  13. #include "core/hle/service/am/self_controller.h"
  14. #include "core/hle/service/am/window_controller.h"
  15. #include "core/hle/service/ipc_helpers.h"
  16. namespace Service::AM {
  17. IApplicationProxy::IApplicationProxy(Nvnflinger::Nvnflinger& nvnflinger_,
  18. std::shared_ptr<AppletMessageQueue> msg_queue_,
  19. Core::System& system_)
  20. : ServiceFramework{system_, "IApplicationProxy"}, nvnflinger{nvnflinger_},
  21. msg_queue{std::move(msg_queue_)} {
  22. // clang-format off
  23. static const FunctionInfo functions[] = {
  24. {0, &IApplicationProxy::GetCommonStateGetter, "GetCommonStateGetter"},
  25. {1, &IApplicationProxy::GetSelfController, "GetSelfController"},
  26. {2, &IApplicationProxy::GetWindowController, "GetWindowController"},
  27. {3, &IApplicationProxy::GetAudioController, "GetAudioController"},
  28. {4, &IApplicationProxy::GetDisplayController, "GetDisplayController"},
  29. {10, &IApplicationProxy::GetProcessWindingController, "GetProcessWindingController"},
  30. {11, &IApplicationProxy::GetLibraryAppletCreator, "GetLibraryAppletCreator"},
  31. {20, &IApplicationProxy::GetApplicationFunctions, "GetApplicationFunctions"},
  32. {1000, &IApplicationProxy::GetDebugFunctions, "GetDebugFunctions"},
  33. };
  34. // clang-format on
  35. RegisterHandlers(functions);
  36. }
  37. void IApplicationProxy::GetAudioController(HLERequestContext& ctx) {
  38. LOG_DEBUG(Service_AM, "called");
  39. IPC::ResponseBuilder rb{ctx, 2, 0, 1};
  40. rb.Push(ResultSuccess);
  41. rb.PushIpcInterface<IAudioController>(system);
  42. }
  43. void IApplicationProxy::GetDisplayController(HLERequestContext& ctx) {
  44. LOG_DEBUG(Service_AM, "called");
  45. IPC::ResponseBuilder rb{ctx, 2, 0, 1};
  46. rb.Push(ResultSuccess);
  47. rb.PushIpcInterface<IDisplayController>(system);
  48. }
  49. void IApplicationProxy::GetProcessWindingController(HLERequestContext& ctx) {
  50. LOG_DEBUG(Service_AM, "called");
  51. IPC::ResponseBuilder rb{ctx, 2, 0, 1};
  52. rb.Push(ResultSuccess);
  53. rb.PushIpcInterface<IProcessWindingController>(system);
  54. }
  55. void IApplicationProxy::GetDebugFunctions(HLERequestContext& ctx) {
  56. LOG_DEBUG(Service_AM, "called");
  57. IPC::ResponseBuilder rb{ctx, 2, 0, 1};
  58. rb.Push(ResultSuccess);
  59. rb.PushIpcInterface<IDebugFunctions>(system);
  60. }
  61. void IApplicationProxy::GetWindowController(HLERequestContext& ctx) {
  62. LOG_DEBUG(Service_AM, "called");
  63. IPC::ResponseBuilder rb{ctx, 2, 0, 1};
  64. rb.Push(ResultSuccess);
  65. rb.PushIpcInterface<IWindowController>(system);
  66. }
  67. void IApplicationProxy::GetSelfController(HLERequestContext& ctx) {
  68. LOG_DEBUG(Service_AM, "called");
  69. IPC::ResponseBuilder rb{ctx, 2, 0, 1};
  70. rb.Push(ResultSuccess);
  71. rb.PushIpcInterface<ISelfController>(system, nvnflinger);
  72. }
  73. void IApplicationProxy::GetCommonStateGetter(HLERequestContext& ctx) {
  74. LOG_DEBUG(Service_AM, "called");
  75. IPC::ResponseBuilder rb{ctx, 2, 0, 1};
  76. rb.Push(ResultSuccess);
  77. rb.PushIpcInterface<ICommonStateGetter>(system, msg_queue);
  78. }
  79. void IApplicationProxy::GetLibraryAppletCreator(HLERequestContext& ctx) {
  80. LOG_DEBUG(Service_AM, "called");
  81. IPC::ResponseBuilder rb{ctx, 2, 0, 1};
  82. rb.Push(ResultSuccess);
  83. rb.PushIpcInterface<ILibraryAppletCreator>(system);
  84. }
  85. void IApplicationProxy::GetApplicationFunctions(HLERequestContext& ctx) {
  86. LOG_DEBUG(Service_AM, "called");
  87. IPC::ResponseBuilder rb{ctx, 2, 0, 1};
  88. rb.Push(ResultSuccess);
  89. rb.PushIpcInterface<IApplicationFunctions>(system);
  90. }
  91. } // namespace Service::AM