IServiceCreator.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using Ryujinx.HLE.HOS.Ipc;
  2. using Ryujinx.HLE.Utilities;
  3. using System.Collections.Generic;
  4. namespace Ryujinx.HLE.HOS.Services.Friend
  5. {
  6. class IServiceCreator : IpcService
  7. {
  8. private Dictionary<int, ServiceProcessRequest> _commands;
  9. public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
  10. public IServiceCreator()
  11. {
  12. _commands = new Dictionary<int, ServiceProcessRequest>
  13. {
  14. { 0, CreateFriendService },
  15. { 1, CreateNotificationService }, // 2.0.0+
  16. { 2, CreateDaemonSuspendSessionService }, // 4.0.0+
  17. };
  18. }
  19. // CreateFriendService() -> object<nn::friends::detail::ipc::IFriendService>
  20. public static long CreateFriendService(ServiceCtx context)
  21. {
  22. MakeObject(context, new IFriendService());
  23. return 0;
  24. }
  25. // CreateNotificationService(nn::account::Uid) -> object<nn::friends::detail::ipc::INotificationService>
  26. public static long CreateNotificationService(ServiceCtx context)
  27. {
  28. UInt128 userId = new UInt128(context.RequestData.ReadBytes(0x10));
  29. MakeObject(context, new INotificationService(userId));
  30. return 0;
  31. }
  32. // CreateDaemonSuspendSessionService() -> object<nn::friends::detail::ipc::IDaemonSuspendSessionService>
  33. public static long CreateDaemonSuspendSessionService(ServiceCtx context)
  34. {
  35. MakeObject(context, new IDaemonSuspendSessionService());
  36. return 0;
  37. }
  38. }
  39. }