2019-07-04 16:14:17 +01:00
|
|
|
using Ryujinx.Common;
|
2020-02-02 03:24:17 +00:00
|
|
|
using Ryujinx.HLE.HOS.Services.Account.Acc;
|
2019-09-19 01:45:11 +01:00
|
|
|
using Ryujinx.HLE.HOS.Services.Friend.ServiceCreator;
|
2019-06-17 00:08:32 +01:00
|
|
|
using Ryujinx.HLE.Utilities;
|
2018-02-10 00:14:55 +00:00
|
|
|
|
2018-08-17 00:47:36 +01:00
|
|
|
namespace Ryujinx.HLE.HOS.Services.Friend
|
2018-02-10 00:14:55 +00:00
|
|
|
{
|
2019-07-10 16:59:54 +01:00
|
|
|
[Service("friend:a", FriendServicePermissionLevel.Admin)]
|
|
|
|
[Service("friend:m", FriendServicePermissionLevel.Manager)]
|
|
|
|
[Service("friend:s", FriendServicePermissionLevel.System)]
|
|
|
|
[Service("friend:u", FriendServicePermissionLevel.User)]
|
|
|
|
[Service("friend:v", FriendServicePermissionLevel.Overlay)]
|
2018-04-06 05:01:52 +01:00
|
|
|
class IServiceCreator : IpcService
|
2018-02-10 00:14:55 +00:00
|
|
|
{
|
2019-07-04 16:14:17 +01:00
|
|
|
private FriendServicePermissionLevel _permissionLevel;
|
|
|
|
|
2019-07-10 16:59:54 +01:00
|
|
|
public IServiceCreator(ServiceCtx context, FriendServicePermissionLevel permissionLevel)
|
2018-02-10 00:14:55 +00:00
|
|
|
{
|
2019-07-04 16:14:17 +01:00
|
|
|
_permissionLevel = permissionLevel;
|
2018-02-10 00:14:55 +00:00
|
|
|
}
|
|
|
|
|
2019-07-12 02:13:43 +01:00
|
|
|
[Command(0)]
|
2019-06-17 00:08:32 +01:00
|
|
|
// CreateFriendService() -> object<nn::friends::detail::ipc::IFriendService>
|
2019-07-14 20:04:38 +01:00
|
|
|
public ResultCode CreateFriendService(ServiceCtx context)
|
2018-02-10 00:14:55 +00:00
|
|
|
{
|
2019-07-04 16:14:17 +01:00
|
|
|
MakeObject(context, new IFriendService(_permissionLevel));
|
2018-02-25 04:34:16 +00:00
|
|
|
|
2019-07-14 20:04:38 +01:00
|
|
|
return ResultCode.Success;
|
2018-02-10 00:14:55 +00:00
|
|
|
}
|
2019-06-17 00:08:32 +01:00
|
|
|
|
2019-07-12 02:13:43 +01:00
|
|
|
[Command(1)] // 2.0.0+
|
2020-02-02 03:24:17 +00:00
|
|
|
// CreateNotificationService(nn::account::Uid userId) -> object<nn::friends::detail::ipc::INotificationService>
|
2019-07-14 20:04:38 +01:00
|
|
|
public ResultCode CreateNotificationService(ServiceCtx context)
|
2019-06-17 00:08:32 +01:00
|
|
|
{
|
2020-02-02 03:24:17 +00:00
|
|
|
UserId userId = context.RequestData.ReadStruct<UserId>();
|
2019-06-17 00:08:32 +01:00
|
|
|
|
2019-06-27 13:05:30 +01:00
|
|
|
if (userId.IsNull)
|
|
|
|
{
|
2019-07-14 20:04:38 +01:00
|
|
|
return ResultCode.InvalidArgument;
|
2019-06-27 13:05:30 +01:00
|
|
|
}
|
|
|
|
|
2019-07-04 16:14:17 +01:00
|
|
|
MakeObject(context, new INotificationService(context, userId, _permissionLevel));
|
2019-06-17 00:08:32 +01:00
|
|
|
|
2019-07-14 20:04:38 +01:00
|
|
|
return ResultCode.Success;
|
2019-06-17 00:08:32 +01:00
|
|
|
}
|
|
|
|
|
2019-07-12 02:13:43 +01:00
|
|
|
[Command(2)] // 4.0.0+
|
2019-06-17 00:08:32 +01:00
|
|
|
// CreateDaemonSuspendSessionService() -> object<nn::friends::detail::ipc::IDaemonSuspendSessionService>
|
2019-07-14 20:04:38 +01:00
|
|
|
public ResultCode CreateDaemonSuspendSessionService(ServiceCtx context)
|
2019-06-17 00:08:32 +01:00
|
|
|
{
|
2019-07-04 16:14:17 +01:00
|
|
|
MakeObject(context, new IDaemonSuspendSessionService(_permissionLevel));
|
2019-06-17 00:08:32 +01:00
|
|
|
|
2019-07-14 20:04:38 +01:00
|
|
|
return ResultCode.Success;
|
2019-06-17 00:08:32 +01:00
|
|
|
}
|
2018-02-10 00:14:55 +00:00
|
|
|
}
|
2019-07-12 02:13:43 +01:00
|
|
|
}
|