ns.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. // Copyright 2018 yuzu emulator team
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include "core/hle/service/service.h"
  6. namespace Service::NS {
  7. class IAccountProxyInterface final : public ServiceFramework<IAccountProxyInterface> {
  8. public:
  9. explicit IAccountProxyInterface();
  10. ~IAccountProxyInterface() override;
  11. };
  12. class IApplicationManagerInterface final : public ServiceFramework<IApplicationManagerInterface> {
  13. public:
  14. explicit IApplicationManagerInterface();
  15. ~IApplicationManagerInterface() override;
  16. ResultVal<u8> GetApplicationDesiredLanguage(u32 supported_languages);
  17. ResultVal<u64> ConvertApplicationLanguageToLanguageCode(u8 application_language);
  18. private:
  19. void GetApplicationControlData(Kernel::HLERequestContext& ctx);
  20. void GetApplicationDesiredLanguage(Kernel::HLERequestContext& ctx);
  21. void ConvertApplicationLanguageToLanguageCode(Kernel::HLERequestContext& ctx);
  22. };
  23. class IApplicationVersionInterface final : public ServiceFramework<IApplicationVersionInterface> {
  24. public:
  25. explicit IApplicationVersionInterface();
  26. ~IApplicationVersionInterface() override;
  27. };
  28. class IContentManagerInterface final : public ServiceFramework<IContentManagerInterface> {
  29. public:
  30. explicit IContentManagerInterface();
  31. ~IContentManagerInterface() override;
  32. };
  33. class IDocumentInterface final : public ServiceFramework<IDocumentInterface> {
  34. public:
  35. explicit IDocumentInterface();
  36. ~IDocumentInterface() override;
  37. };
  38. class IDownloadTaskInterface final : public ServiceFramework<IDownloadTaskInterface> {
  39. public:
  40. explicit IDownloadTaskInterface();
  41. ~IDownloadTaskInterface() override;
  42. };
  43. class IECommerceInterface final : public ServiceFramework<IECommerceInterface> {
  44. public:
  45. explicit IECommerceInterface();
  46. ~IECommerceInterface() override;
  47. };
  48. class IFactoryResetInterface final : public ServiceFramework<IFactoryResetInterface> {
  49. public:
  50. explicit IFactoryResetInterface();
  51. ~IFactoryResetInterface() override;
  52. };
  53. class NS final : public ServiceFramework<NS> {
  54. public:
  55. explicit NS(const char* name);
  56. ~NS() override;
  57. std::shared_ptr<IApplicationManagerInterface> GetApplicationManagerInterface() const;
  58. private:
  59. template <typename T>
  60. void PushInterface(Kernel::HLERequestContext& ctx) {
  61. LOG_DEBUG(Service_NS, "called");
  62. IPC::ResponseBuilder rb{ctx, 2, 0, 1};
  63. rb.Push(RESULT_SUCCESS);
  64. rb.PushIpcInterface<T>();
  65. }
  66. template <typename T>
  67. std::shared_ptr<T> GetInterface() const {
  68. static_assert(std::is_base_of_v<Kernel::SessionRequestHandler, T>,
  69. "Not a base of ServiceFrameworkBase");
  70. return std::make_shared<T>();
  71. }
  72. };
  73. /// Registers all NS services with the specified service manager.
  74. void InstallInterfaces(SM::ServiceManager& service_manager);
  75. } // namespace Service::NS