blob: 61c692a6efd276acdd9fd14c94080b50c41b4e75 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
using Ryujinx.Horizon.Sdk.Account;
namespace Ryujinx.Horizon.Sdk.Friends.Detail.Ipc
{
sealed class NotificationEventHandler
{
private readonly NotificationService[] _registry;
public NotificationEventHandler()
{
_registry = new NotificationService[0x20];
}
public void RegisterNotificationService(NotificationService service)
{
// NOTE: When there's no enough space in the registry array, Nintendo doesn't return any errors.
for (int i = 0; i < _registry.Length; i++)
{
if (_registry[i] == null)
{
_registry[i] = service;
break;
}
}
}
public void UnregisterNotificationService(NotificationService service)
{
// NOTE: When there's no enough space in the registry array, Nintendo doesn't return any errors.
for (int i = 0; i < _registry.Length; i++)
{
if (_registry[i] == service)
{
_registry[i] = null;
break;
}
}
}
// TODO: Use this when we have enough things to go online.
public void SignalFriendListUpdate(Uid targetId)
{
for (int i = 0; i < _registry.Length; i++)
{
_registry[i]?.SignalFriendListUpdate(targetId);
}
}
// TODO: Use this when we have enough things to go online.
public void SignalNewFriendRequest(Uid targetId)
{
for (int i = 0; i < _registry.Length; i++)
{
_registry[i]?.SignalNewFriendRequest(targetId);
}
}
}
}
|