ldr.cpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // Copyright 2018 yuzu emulator team
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include <memory>
  5. #include "core/hle/service/ldr/ldr.h"
  6. #include "core/hle/service/service.h"
  7. namespace Service::LDR {
  8. class DebugMonitor final : public ServiceFramework<DebugMonitor> {
  9. public:
  10. explicit DebugMonitor() : ServiceFramework{"ldr:dmnt"} {
  11. // clang-format off
  12. static const FunctionInfo functions[] = {
  13. {0, nullptr, "AddProcessToDebugLaunchQueue"},
  14. {1, nullptr, "ClearDebugLaunchQueue"},
  15. {2, nullptr, "GetNsoInfos"},
  16. };
  17. // clang-format on
  18. RegisterHandlers(functions);
  19. }
  20. };
  21. class ProcessManager final : public ServiceFramework<ProcessManager> {
  22. public:
  23. explicit ProcessManager() : ServiceFramework{"ldr:pm"} {
  24. // clang-format off
  25. static const FunctionInfo functions[] = {
  26. {0, nullptr, "CreateProcess"},
  27. {1, nullptr, "GetProgramInfo"},
  28. {2, nullptr, "RegisterTitle"},
  29. {3, nullptr, "UnregisterTitle"},
  30. };
  31. // clang-format on
  32. RegisterHandlers(functions);
  33. }
  34. };
  35. class Shell final : public ServiceFramework<Shell> {
  36. public:
  37. explicit Shell() : ServiceFramework{"ldr:shel"} {
  38. // clang-format off
  39. static const FunctionInfo functions[] = {
  40. {0, nullptr, "AddProcessToLaunchQueue"},
  41. {1, nullptr, "ClearLaunchQueue"},
  42. };
  43. // clang-format on
  44. RegisterHandlers(functions);
  45. }
  46. };
  47. class RelocatableObject final : public ServiceFramework<RelocatableObject> {
  48. public:
  49. explicit RelocatableObject() : ServiceFramework{"ldr:ro"} {
  50. // clang-format off
  51. static const FunctionInfo functions[] = {
  52. {0, nullptr, "LoadNro"},
  53. {1, nullptr, "UnloadNro"},
  54. {2, nullptr, "LoadNrr"},
  55. {3, nullptr, "UnloadNrr"},
  56. {4, nullptr, "Initialize"},
  57. };
  58. // clang-format on
  59. RegisterHandlers(functions);
  60. }
  61. };
  62. void InstallInterfaces(SM::ServiceManager& sm) {
  63. std::make_shared<DebugMonitor>()->InstallAsService(sm);
  64. std::make_shared<ProcessManager>()->InstallAsService(sm);
  65. std::make_shared<Shell>()->InstallAsService(sm);
  66. std::make_shared<RelocatableObject>()->InstallAsService(sm);
  67. }
  68. } // namespace Service::LDR