ns.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include "core/hle/service/service.h"
  5. namespace Core {
  6. class System;
  7. }
  8. namespace Service {
  9. namespace FileSystem {
  10. class FileSystemController;
  11. } // namespace FileSystem
  12. namespace NS {
  13. class IAccountProxyInterface final : public ServiceFramework<IAccountProxyInterface> {
  14. public:
  15. explicit IAccountProxyInterface(Core::System& system_);
  16. ~IAccountProxyInterface() override;
  17. };
  18. class IApplicationManagerInterface final : public ServiceFramework<IApplicationManagerInterface> {
  19. public:
  20. explicit IApplicationManagerInterface(Core::System& system_);
  21. ~IApplicationManagerInterface() override;
  22. ResultVal<u8> GetApplicationDesiredLanguage(u32 supported_languages);
  23. ResultVal<u64> ConvertApplicationLanguageToLanguageCode(u8 application_language);
  24. private:
  25. void GetApplicationControlData(HLERequestContext& ctx);
  26. void GetApplicationDesiredLanguage(HLERequestContext& ctx);
  27. void ConvertApplicationLanguageToLanguageCode(HLERequestContext& ctx);
  28. };
  29. class IApplicationVersionInterface final : public ServiceFramework<IApplicationVersionInterface> {
  30. public:
  31. explicit IApplicationVersionInterface(Core::System& system_);
  32. ~IApplicationVersionInterface() override;
  33. };
  34. class IContentManagementInterface final : public ServiceFramework<IContentManagementInterface> {
  35. public:
  36. explicit IContentManagementInterface(Core::System& system_);
  37. ~IContentManagementInterface() override;
  38. };
  39. class IDocumentInterface final : public ServiceFramework<IDocumentInterface> {
  40. public:
  41. explicit IDocumentInterface(Core::System& system_);
  42. ~IDocumentInterface() override;
  43. };
  44. class IDownloadTaskInterface final : public ServiceFramework<IDownloadTaskInterface> {
  45. public:
  46. explicit IDownloadTaskInterface(Core::System& system_);
  47. ~IDownloadTaskInterface() override;
  48. };
  49. class IECommerceInterface final : public ServiceFramework<IECommerceInterface> {
  50. public:
  51. explicit IECommerceInterface(Core::System& system_);
  52. ~IECommerceInterface() override;
  53. };
  54. class IFactoryResetInterface final : public ServiceFramework<IFactoryResetInterface> {
  55. public:
  56. explicit IFactoryResetInterface(Core::System& system_);
  57. ~IFactoryResetInterface() override;
  58. };
  59. class IReadOnlyApplicationControlDataInterface final
  60. : public ServiceFramework<IReadOnlyApplicationControlDataInterface> {
  61. public:
  62. explicit IReadOnlyApplicationControlDataInterface(Core::System& system_);
  63. ~IReadOnlyApplicationControlDataInterface() override;
  64. private:
  65. void GetApplicationControlData(HLERequestContext& ctx);
  66. };
  67. class NS final : public ServiceFramework<NS> {
  68. public:
  69. explicit NS(const char* name, Core::System& system_);
  70. ~NS() override;
  71. std::shared_ptr<IApplicationManagerInterface> GetApplicationManagerInterface() const;
  72. private:
  73. template <typename T, typename... Args>
  74. void PushInterface(HLERequestContext& ctx) {
  75. LOG_DEBUG(Service_NS, "called");
  76. IPC::ResponseBuilder rb{ctx, 2, 0, 1};
  77. rb.Push(ResultSuccess);
  78. rb.PushIpcInterface<T>(system);
  79. }
  80. void PushIApplicationManagerInterface(HLERequestContext& ctx) {
  81. LOG_DEBUG(Service_NS, "called");
  82. IPC::ResponseBuilder rb{ctx, 2, 0, 1};
  83. rb.Push(ResultSuccess);
  84. rb.PushIpcInterface<IApplicationManagerInterface>(system);
  85. }
  86. template <typename T, typename... Args>
  87. std::shared_ptr<T> GetInterface(Args&&... args) const {
  88. static_assert(std::is_base_of_v<SessionRequestHandler, T>,
  89. "Not a base of ServiceFrameworkBase");
  90. return std::make_shared<T>(std::forward<Args>(args)...);
  91. }
  92. };
  93. void LoopProcess(Core::System& system);
  94. } // namespace NS
  95. } // namespace Service