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