2018-08-16 19:47:36 -04:00
|
|
|
using Ryujinx.HLE.HOS.Ipc;
|
2019-06-16 19:08:32 -04:00
|
|
|
using Ryujinx.HLE.Utilities;
|
2018-02-09 19:14:55 -05:00
|
|
|
using System.Collections.Generic;
|
|
|
|
|
2019-06-27 08:05:30 -04:00
|
|
|
using static Ryujinx.HLE.HOS.ErrorCode;
|
|
|
|
|
2018-08-16 19:47:36 -04:00
|
|
|
namespace Ryujinx.HLE.HOS.Services.Friend
|
2018-02-09 19:14:55 -05:00
|
|
|
{
|
2018-04-06 00:01:52 -04:00
|
|
|
class IServiceCreator : IpcService
|
2018-02-09 19:14:55 -05:00
|
|
|
{
|
2018-12-06 06:16:24 -05:00
|
|
|
private Dictionary<int, ServiceProcessRequest> _commands;
|
2018-02-09 19:14:55 -05:00
|
|
|
|
2018-12-06 06:16:24 -05:00
|
|
|
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
|
2018-02-09 19:14:55 -05:00
|
|
|
|
2018-04-06 00:01:52 -04:00
|
|
|
public IServiceCreator()
|
2018-02-09 19:14:55 -05:00
|
|
|
{
|
2018-12-06 06:16:24 -05:00
|
|
|
_commands = new Dictionary<int, ServiceProcessRequest>
|
2018-02-09 19:14:55 -05:00
|
|
|
{
|
2019-06-16 19:08:32 -04:00
|
|
|
{ 0, CreateFriendService },
|
|
|
|
{ 1, CreateNotificationService }, // 2.0.0+
|
|
|
|
{ 2, CreateDaemonSuspendSessionService }, // 4.0.0+
|
2018-02-09 19:14:55 -05:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2019-06-16 19:08:32 -04:00
|
|
|
// CreateFriendService() -> object<nn::friends::detail::ipc::IFriendService>
|
2018-12-06 06:16:24 -05:00
|
|
|
public static long CreateFriendService(ServiceCtx context)
|
2018-02-09 19:14:55 -05:00
|
|
|
{
|
2018-12-06 06:16:24 -05:00
|
|
|
MakeObject(context, new IFriendService());
|
2018-02-24 23:34:16 -05:00
|
|
|
|
2018-02-09 19:14:55 -05:00
|
|
|
return 0;
|
|
|
|
}
|
2019-06-16 19:08:32 -04:00
|
|
|
|
|
|
|
// CreateNotificationService(nn::account::Uid) -> object<nn::friends::detail::ipc::INotificationService>
|
|
|
|
public static long CreateNotificationService(ServiceCtx context)
|
|
|
|
{
|
|
|
|
UInt128 userId = new UInt128(context.RequestData.ReadBytes(0x10));
|
|
|
|
|
2019-06-27 08:05:30 -04:00
|
|
|
if (userId.IsNull)
|
|
|
|
{
|
|
|
|
return MakeError(ErrorModule.Friends, FriendErr.InvalidArgument);
|
|
|
|
}
|
|
|
|
|
2019-06-16 19:08:32 -04:00
|
|
|
MakeObject(context, new INotificationService(userId));
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// CreateDaemonSuspendSessionService() -> object<nn::friends::detail::ipc::IDaemonSuspendSessionService>
|
|
|
|
public static long CreateDaemonSuspendSessionService(ServiceCtx context)
|
|
|
|
{
|
|
|
|
MakeObject(context, new IDaemonSuspendSessionService());
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2018-02-09 19:14:55 -05:00
|
|
|
}
|
2019-06-27 08:05:30 -04:00
|
|
|
}
|