Skip to content

Commit b339c67

Browse files
committed
Update EOS 1.17.1-43712763
1 parent 082c9a1 commit b339c67

File tree

1,144 files changed

+33514
-54784
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,144 files changed

+33514
-54784
lines changed

Assets/Scripts/EOSFriendsManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ public void SubscribeToFriendUpdates(EpicAccountId userId)
817817
var addNotifyFriendsUpdateOptions = new AddNotifyFriendsUpdateOptions();
818818
ulong notificationId = FriendsHandle.AddNotifyFriendsUpdate(ref addNotifyFriendsUpdateOptions, null, OnFriendsUpdateCallbackHandler);
819819

820-
if(notificationId == Common.InvalidNotificationid)
820+
if(notificationId == Common.INVALID_NOTIFICATIONID)
821821
{
822822
Debug.LogError("Friends (SubscribeToFriendUpdates): Could not subscribe to friend update notifications.");
823823
}
@@ -830,7 +830,7 @@ public void SubscribeToFriendUpdates(EpicAccountId userId)
830830
var addNotifyOnPresenceChangedOptions = new AddNotifyOnPresenceChangedOptions();
831831
ulong presenceNotificationId = PresenceHandle.AddNotifyOnPresenceChanged(ref addNotifyOnPresenceChangedOptions , null, OnPresenceChangedCallbackHandler);
832832

833-
if(presenceNotificationId == Common.InvalidNotificationid)
833+
if(presenceNotificationId == Common.INVALID_NOTIFICATIONID)
834834
{
835835
Debug.LogError("Friends (SubscribeToFriendUpdates): Could not subscribe to presence changed notifications.");
836836
}

Assets/Scripts/P2PNetcodeSample/Networking/EOSTransportManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ public class EOSTransportManager : IEOSSubManager
5050
/// Maximum packet byte length
5151
/// </summary>
5252
/// <value><c>1170</c> due to DTLS/SCTP/UDP packet overhead.</value>
53-
public const int MaxPacketSize = P2PInterface.MaxPacketSize;
53+
public const int MaxPacketSize = P2PInterface.MAX_PACKET_SIZE;
5454

5555
/// <summary>
5656
/// Maximum concurrent connections with any individual remote peer.
5757
/// </summary>
5858
/// <value><c>32</c></value>
59-
public const int MaxConnections = P2PInterface.MaxConnections;
59+
public const int MaxConnections = P2PInterface.MAX_CONNECTIONS;
6060

6161
// Connection data, socket name must be unique within an individual remote peer.
6262
public class Connection : IEquatable<Connection>

Assets/Scripts/StandardSamples/Services/TitleStorageService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,9 @@ private ReadResult OnFileDataReceived(ref ReadFileDataCallbackInfo data)
199199
{
200200
return ReceiveData(data.Filename, data.DataChunk, data.TotalFileSizeBytes) switch
201201
{
202-
FileTransferResult.FailRequest => ReadResult.RrFailrequest,
203-
FileTransferResult.CancelRequest => ReadResult.RrCancelrequest,
204-
FileTransferResult.ContinueReading => ReadResult.RrContinuereading,
202+
FileTransferResult.FailRequest => ReadResult.RrFailRequest,
203+
FileTransferResult.CancelRequest => ReadResult.RrCancelRequest,
204+
FileTransferResult.ContinueReading => ReadResult.RrContinueReading,
205205
_ => throw new ArgumentOutOfRangeException()
206206
};
207207
}

Assets/Tests/PlayMode/Services/FriendsTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,13 @@ public void SubscribeToFriendUpdates()
119119
{
120120
AddNotifyFriendsUpdateOptions updateOptions = new();
121121
ulong notificationId = _friendsInterface.AddNotifyFriendsUpdate(ref updateOptions, null, (ref OnFriendsUpdateInfo x) => { });
122-
Assert.AreNotEqual(Common.InvalidNotificationid, notificationId, "Could not subscribe to friends update.");
122+
Assert.AreNotEqual(Common.INVALID_NOTIFICATIONID, notificationId, "Could not subscribe to friends update.");
123123

124124
_friendsInterface.RemoveNotifyFriendsUpdate(notificationId);
125125

126126
AddNotifyOnPresenceChangedOptions changedOptions = new();
127127
ulong presenceNotificationId = _presenceInterface.AddNotifyOnPresenceChanged(ref changedOptions, null, (ref PresenceChangedCallbackInfo x) => { });
128-
Assert.AreNotEqual(Common.InvalidNotificationid, presenceNotificationId, "Could not subscribe to friends presence change.");
128+
Assert.AreNotEqual(Common.INVALID_NOTIFICATIONID, presenceNotificationId, "Could not subscribe to friends presence change.");
129129

130130
_presenceInterface.RemoveNotifyOnPresenceChanged(presenceNotificationId);
131131
}

com.playeveryware.eos/Runtime/EOS_SDK/Core/CallbackHelper.cs

Lines changed: 80 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,48 @@ public sealed partial class Helper
1010
/// <summary>
1111
/// Adds a callback to the wrapper.
1212
/// </summary>
13-
/// <param name="clientDataAddress">The generated client data address.</param>
13+
/// <param name="clientDataPointer">The generated client data pointer.</param>
1414
/// <param name="clientData">The client data of the callback.</param>
15-
/// <param name="publicDelegate">The public delegate of the callback.</param>
16-
/// <param name="privateDelegate">The private delegate of the callback.</param>
17-
/// <param name="structDelegates">Any delegates passed in with input structs.</param>
18-
internal static void AddCallback(out IntPtr clientDataAddress, object clientData, Delegate publicDelegate, Delegate privateDelegate, params Delegate[] structDelegates)
15+
/// <param name="delegates">The delegates to add.</param>
16+
internal static void AddCallback(out IntPtr clientDataPointer, object clientData, params Delegate[] delegates)
17+
{
18+
clientDataPointer = AddClientData(clientData);
19+
20+
lock (s_Callbacks)
21+
{
22+
s_Callbacks.Add(clientDataPointer, new DelegateHolder(delegates));
23+
}
24+
}
25+
26+
/// <summary>
27+
/// Adds a callback to the wrapper with an existing client data pointer.
28+
/// </summary>
29+
/// <param name="clientDataPointer">The client data pointer.</param>
30+
/// <param name="delegates">The delegates to add.</param>
31+
internal static void AddCallback(IntPtr clientDataPointer, params Delegate[] delegates)
1932
{
2033
lock (s_Callbacks)
2134
{
22-
clientDataAddress = AddClientData(clientData);
23-
s_Callbacks.Add(clientDataAddress, new DelegateHolder(publicDelegate, privateDelegate, structDelegates));
35+
DelegateHolder delegateHolder;
36+
if (s_Callbacks.TryGetValue(clientDataPointer, out delegateHolder))
37+
{
38+
delegateHolder.Delegates.AddRange(delegates.Where(d => d != null));
39+
}
2440
}
2541
}
2642

2743
/// <summary>
2844
/// Removes a callback from the wrapper.
2945
/// </summary>
30-
/// <param name="clientDataAddress">The client data address of the callback.</param>
31-
private static void RemoveCallback(IntPtr clientDataAddress)
46+
/// <param name="clientDataPointer">The client data pointer of the callback.</param>
47+
internal static void RemoveCallback(IntPtr clientDataPointer)
3248
{
3349
lock (s_Callbacks)
3450
{
35-
s_Callbacks.Remove(clientDataAddress);
36-
RemoveClientData(clientDataAddress);
51+
s_Callbacks.Remove(clientDataPointer);
3752
}
53+
54+
RemoveClientData(clientDataPointer);
3855
}
3956

4057
/// <summary>
@@ -52,17 +69,17 @@ internal static bool TryGetCallback<TCallbackInfoInternal, TCallback, TCallbackI
5269
where TCallback : class
5370
where TCallbackInfo : struct, ICallbackInfo
5471
{
55-
IntPtr clientDataAddress;
56-
Get(ref callbackInfoInternal, out callbackInfo, out clientDataAddress);
72+
IntPtr clientDataPointer;
73+
Get(ref callbackInfoInternal, out callbackInfo, out clientDataPointer);
5774

5875
callback = null;
5976

6077
lock (s_Callbacks)
6178
{
6279
DelegateHolder delegateHolder;
63-
if (s_Callbacks.TryGetValue(clientDataAddress, out delegateHolder))
80+
if (s_Callbacks.TryGetValue(clientDataPointer, out delegateHolder))
6481
{
65-
callback = delegateHolder.Public as TCallback;
82+
callback = delegateHolder.Delegates.FirstOrDefault(d => d.GetType() == typeof(TCallback)) as TCallback;
6683
return callback != null;
6784
}
6885
}
@@ -86,33 +103,36 @@ internal static bool TryGetAndRemoveCallback<TCallbackInfoInternal, TCallback, T
86103
where TCallback : class
87104
where TCallbackInfo : struct, ICallbackInfo
88105
{
89-
IntPtr clientDataAddress;
90-
Get(ref callbackInfoInternal, out callbackInfo, out clientDataAddress);
106+
IntPtr clientDataPointer;
107+
Get(ref callbackInfoInternal, out callbackInfo, out clientDataPointer);
91108

92109
callback = null;
110+
ulong? notificationId = null;
93111

94112
lock (s_Callbacks)
95113
{
96114
DelegateHolder delegateHolder;
97-
if (s_Callbacks.TryGetValue(clientDataAddress, out delegateHolder))
115+
if (s_Callbacks.TryGetValue(clientDataPointer, out delegateHolder))
98116
{
99-
callback = delegateHolder.Public as TCallback;
100-
if (callback != null)
101-
{
102-
// If this delegate was added with an AddNotify, we should only ever remove it on RemoveNotify.
103-
if (delegateHolder.NotificationId.HasValue)
104-
{
105-
}
117+
callback = delegateHolder.Delegates.FirstOrDefault(d => d.GetType() == typeof(TCallback)) as TCallback;
118+
notificationId = delegateHolder.NotificationId;
119+
}
120+
}
106121

107-
// If the operation is complete, it's safe to remove.
108-
else if (callbackInfo.GetResultCode().HasValue && Common.IsOperationComplete(callbackInfo.GetResultCode().Value))
109-
{
110-
RemoveCallback(clientDataAddress);
111-
}
122+
if (callback != null)
123+
{
124+
// If this delegate was added with an AddNotify, we should only ever remove it on RemoveNotify.
125+
if (notificationId.HasValue)
126+
{
127+
}
112128

113-
return true;
114-
}
129+
// If the operation is complete, it's safe to remove.
130+
else if (callbackInfo.GetResultCode().HasValue && Common.IsOperationComplete(callbackInfo.GetResultCode().Value))
131+
{
132+
RemoveCallback(clientDataPointer);
115133
}
134+
135+
return true;
116136
}
117137

118138
return false;
@@ -133,16 +153,16 @@ internal static bool TryGetStructCallback<TCallbackInfoInternal, TCallback, TCal
133153
where TCallback : class
134154
where TCallbackInfo : struct
135155
{
136-
IntPtr clientDataAddress;
137-
Get(ref callbackInfoInternal, out callbackInfo, out clientDataAddress);
156+
IntPtr clientDataPointer;
157+
Get(ref callbackInfoInternal, out callbackInfo, out clientDataPointer);
138158

139159
callback = null;
140160
lock (s_Callbacks)
141161
{
142162
DelegateHolder delegateHolder;
143-
if (s_Callbacks.TryGetValue(clientDataAddress, out delegateHolder))
163+
if (s_Callbacks.TryGetValue(clientDataPointer, out delegateHolder))
144164
{
145-
callback = delegateHolder.StructDelegates.FirstOrDefault(structDelegate => structDelegate.GetType() == typeof(TCallback)) as TCallback;
165+
callback = delegateHolder.Delegates.FirstOrDefault(d => d.GetType() == typeof(TCallback)) as TCallback;
146166
if (callback != null)
147167
{
148168
return true;
@@ -159,11 +179,14 @@ internal static bool TryGetStructCallback<TCallbackInfoInternal, TCallback, TCal
159179
/// <param name="notificationId">The notification id associated with the callback.</param>
160180
internal static void RemoveCallbackByNotificationId(ulong notificationId)
161181
{
182+
IntPtr clientDataPointer = IntPtr.Zero;
183+
162184
lock (s_Callbacks)
163185
{
164-
var clientDataAddress = s_Callbacks.SingleOrDefault(pair => pair.Value.NotificationId.HasValue && pair.Value.NotificationId == notificationId);
165-
RemoveCallback(clientDataAddress.Key);
186+
clientDataPointer = s_Callbacks.SingleOrDefault(pair => pair.Value.NotificationId.HasValue && pair.Value.NotificationId == notificationId).Key;
166187
}
188+
189+
RemoveCallback(clientDataPointer);
167190
}
168191

169192
/// <summary>
@@ -172,12 +195,12 @@ internal static void RemoveCallbackByNotificationId(ulong notificationId)
172195
/// <param name="key">The key of the callback.</param>
173196
/// <param name="publicDelegate">The public delegate of the callback.</param>
174197
/// <param name="privateDelegate">The private delegate of the callback</param>
175-
internal static void AddStaticCallback(string key, Delegate publicDelegate, Delegate privateDelegate)
198+
internal static void AddStaticCallback(string key, params Delegate[] delegates)
176199
{
177200
lock (s_StaticCallbacks)
178201
{
179202
s_StaticCallbacks.Remove(key);
180-
s_StaticCallbacks.Add(key, new DelegateHolder(publicDelegate, privateDelegate));
203+
s_StaticCallbacks.Add(key, new DelegateHolder(delegates));
181204
}
182205
}
183206

@@ -198,7 +221,7 @@ internal static bool TryGetStaticCallback<TCallback>(string key, out TCallback c
198221
DelegateHolder delegateHolder;
199222
if (s_StaticCallbacks.TryGetValue(key, out delegateHolder))
200223
{
201-
callback = delegateHolder.Public as TCallback;
224+
callback = delegateHolder.Delegates.FirstOrDefault(d => d.GetType() == typeof(TCallback)) as TCallback;
202225
if (callback != null)
203226
{
204227
return true;
@@ -210,22 +233,22 @@ internal static bool TryGetStaticCallback<TCallback>(string key, out TCallback c
210233
}
211234

212235
/// <summary>
213-
/// Assigns a notification id to a callback by client data address associated with the callback.
236+
/// Assigns a notification id to a callback by client data pointer associated with the callback.
214237
/// </summary>
215238
/// <param name="clientDataAddress">The client data address associated with the callback.</param>
216239
/// <param name="notificationId">The notification id to assign.</param>
217-
internal static void AssignNotificationIdToCallback(IntPtr clientDataAddress, ulong notificationId)
240+
internal static void AssignNotificationIdToCallback(IntPtr clientDataPointer, ulong notificationId)
218241
{
219242
if (notificationId == 0)
220243
{
221-
RemoveCallback(clientDataAddress);
244+
RemoveCallback(clientDataPointer);
222245
return;
223246
}
224247

225248
lock (s_Callbacks)
226249
{
227250
DelegateHolder delegateHolder;
228-
if (s_Callbacks.TryGetValue(clientDataAddress, out delegateHolder))
251+
if (s_Callbacks.TryGetValue(clientDataPointer, out delegateHolder))
229252
{
230253
delegateHolder.NotificationId = notificationId;
231254
}
@@ -236,41 +259,41 @@ internal static void AssignNotificationIdToCallback(IntPtr clientDataAddress, ul
236259
/// Adds client data to the wrapper.
237260
/// </summary>
238261
/// <param name="clientData">The client data to add.</param>
239-
/// <returns>The address of the added client data.</returns>
262+
/// <returns>The pointer of the added client data.</returns>
240263
private static IntPtr AddClientData(object clientData)
241264
{
242265
lock (s_ClientDatas)
243266
{
244267
long clientDataId = ++s_LastClientDataId;
245-
IntPtr clientDataAddress = new IntPtr(clientDataId);
246-
s_ClientDatas.Add(clientDataAddress, clientData);
247-
return clientDataAddress;
268+
IntPtr clientDataPointer = new IntPtr(clientDataId);
269+
s_ClientDatas.Add(clientDataPointer, clientData);
270+
return clientDataPointer;
248271
}
249272
}
250273

251274
/// <summary>
252275
/// Removes a client data from the wrapper.
253276
/// </summary>
254-
/// <param name="clientDataAddress">The address of the client data to remove.</param>
255-
private static void RemoveClientData(IntPtr clientDataAddress)
277+
/// <param name="clientDataPointer">The pointer of the client data to remove.</param>
278+
private static void RemoveClientData(IntPtr clientDataPointer)
256279
{
257280
lock (s_ClientDatas)
258281
{
259-
s_ClientDatas.Remove(clientDataAddress);
282+
s_ClientDatas.Remove(clientDataPointer);
260283
}
261284
}
262285

263286
/// <summary>
264-
/// Gets client data by its address.
287+
/// Gets client data by its pointer.
265288
/// </summary>
266-
/// <param name="clientDataAddress">The address of the client data.</param>
267-
/// <returns>Th client data associated with the address.</returns>
268-
private static object GetClientData(IntPtr clientDataAddress)
289+
/// <param name="clientDataPointer">The pointer of the client data.</param>
290+
/// <returns>Th client data associated with the pointer.</returns>
291+
private static object GetClientData(IntPtr clientDataPointer)
269292
{
270293
lock (s_ClientDatas)
271294
{
272295
object clientData;
273-
s_ClientDatas.TryGetValue(clientDataAddress, out clientData);
296+
s_ClientDatas.TryGetValue(clientDataPointer, out clientData);
274297
return clientData;
275298
}
276299
}

0 commit comments

Comments
 (0)