service.cpp 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. // Copyright 2014 Citra Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include "common/common.h"
  5. #include "common/string_util.h"
  6. #include "core/hle/service/service.h"
  7. #include "core/hle/service/ac_u.h"
  8. #include "core/hle/service/act_u.h"
  9. #include "core/hle/service/am_app.h"
  10. #include "core/hle/service/am_net.h"
  11. #include "core/hle/service/am_sys.h"
  12. #include "core/hle/service/boss_p.h"
  13. #include "core/hle/service/boss_u.h"
  14. #include "core/hle/service/cam_u.h"
  15. #include "core/hle/service/cecd_u.h"
  16. #include "core/hle/service/cecd_s.h"
  17. #include "core/hle/service/csnd_snd.h"
  18. #include "core/hle/service/dsp_dsp.h"
  19. #include "core/hle/service/err_f.h"
  20. #include "core/hle/service/frd_a.h"
  21. #include "core/hle/service/frd_u.h"
  22. #include "core/hle/service/gsp_gpu.h"
  23. #include "core/hle/service/gsp_lcd.h"
  24. #include "core/hle/service/http_c.h"
  25. #include "core/hle/service/ldr_ro.h"
  26. #include "core/hle/service/mic_u.h"
  27. #include "core/hle/service/ndm_u.h"
  28. #include "core/hle/service/news_s.h"
  29. #include "core/hle/service/news_u.h"
  30. #include "core/hle/service/nim_aoc.h"
  31. #include "core/hle/service/nim_u.h"
  32. #include "core/hle/service/ns_s.h"
  33. #include "core/hle/service/nwm_uds.h"
  34. #include "core/hle/service/pm_app.h"
  35. #include "core/hle/service/soc_u.h"
  36. #include "core/hle/service/srv.h"
  37. #include "core/hle/service/ssl_c.h"
  38. #include "core/hle/service/y2r_u.h"
  39. #include "core/hle/service/apt/apt.h"
  40. #include "core/hle/service/fs/archive.h"
  41. #include "core/hle/service/cfg/cfg.h"
  42. #include "core/hle/service/hid/hid.h"
  43. #include "core/hle/service/ir/ir.h"
  44. #include "core/hle/service/ptm/ptm.h"
  45. namespace Service {
  46. std::unordered_map<std::string, Kernel::SharedPtr<Interface>> g_kernel_named_ports;
  47. std::unordered_map<std::string, Kernel::SharedPtr<Interface>> g_srv_services;
  48. ////////////////////////////////////////////////////////////////////////////////////////////////////
  49. // Module interface
  50. static void AddNamedPort(Interface* interface_) {
  51. g_kernel_named_ports.emplace(interface_->GetPortName(), interface_);
  52. }
  53. void AddService(Interface* interface_) {
  54. g_srv_services.emplace(interface_->GetPortName(), interface_);
  55. }
  56. /// Initialize ServiceManager
  57. void Init() {
  58. AddNamedPort(new SRV::Interface);
  59. AddNamedPort(new ERR_F::Interface);
  60. Service::FS::ArchiveInit();
  61. Service::CFG::Init();
  62. Service::APT::Init();
  63. Service::PTM::Init();
  64. Service::HID::Init();
  65. Service::IR::Init();
  66. AddService(new AC_U::Interface);
  67. AddService(new ACT_U::Interface);
  68. AddService(new AM_APP::Interface);
  69. AddService(new AM_NET::Interface);
  70. AddService(new AM_SYS::Interface);
  71. AddService(new BOSS_P::Interface);
  72. AddService(new BOSS_U::Interface);
  73. AddService(new CAM_U::Interface);
  74. AddService(new CECD_S::Interface);
  75. AddService(new CECD_U::Interface);
  76. AddService(new CSND_SND::Interface);
  77. AddService(new DSP_DSP::Interface);
  78. AddService(new FRD_A::Interface);
  79. AddService(new FRD_U::Interface);
  80. AddService(new GSP_GPU::Interface);
  81. AddService(new GSP_LCD::Interface);
  82. AddService(new HTTP_C::Interface);
  83. AddService(new LDR_RO::Interface);
  84. AddService(new MIC_U::Interface);
  85. AddService(new NDM_U::Interface);
  86. AddService(new NEWS_S::Interface);
  87. AddService(new NEWS_U::Interface);
  88. AddService(new NIM_AOC::Interface);
  89. AddService(new NIM_U::Interface);
  90. AddService(new NS_S::Interface);
  91. AddService(new NWM_UDS::Interface);
  92. AddService(new PM_APP::Interface);
  93. AddService(new SOC_U::Interface);
  94. AddService(new SSL_C::Interface);
  95. AddService(new Y2R_U::Interface);
  96. LOG_DEBUG(Service, "initialized OK");
  97. }
  98. /// Shutdown ServiceManager
  99. void Shutdown() {
  100. Service::IR::Shutdown();
  101. Service::HID::Shutdown();
  102. Service::PTM::Shutdown();
  103. Service::APT::Shutdown();
  104. Service::CFG::Shutdown();
  105. Service::FS::ArchiveShutdown();
  106. g_srv_services.clear();
  107. g_kernel_named_ports.clear();
  108. LOG_DEBUG(Service, "shutdown OK");
  109. }
  110. }