aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator
diff options
context:
space:
mode:
authorThog <me@thog.eu>2020-02-02 04:24:17 +0100
committerGitHub <noreply@github.com>2020-02-02 14:24:17 +1100
commitea14a955243705b5d5b22868c30c174e6524b4d3 (patch)
tree038589c60aedc54e83b98954dbf0f8ce4813df52 /Ryujinx.HLE/HOS/Services/Friend/ServiceCreator
parentf373f870f769ef65c435aa307dc3fa1be6dc6fae (diff)
Fix inconsistencies with UserId (#906)
* Fix inconsistencies with UserId The account user id isn't an UUID. This PR adds a new UserId type with the correct value ordering to avoid mismatch with LibHac's Uid. This also fix an hardcoded value of the UserId. As the userid has been invalid for quite some time (and to avoid forcing users to their recreate saves), the userid has been changed to "00000000000000010000000000000000". Also implement a stub for IApplicationFunctions::GetSaveDataSize. (see the sources for the reason) Fix #626 * Address jd's & Ac_k's comments
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Friend/ServiceCreator')
-rw-r--r--Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/FriendService/Types/Friend.cs4
-rw-r--r--Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/FriendService/Types/UserPresence.cs4
-rw-r--r--Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/IFriendService.cs39
-rw-r--r--Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/INotificationService.cs10
-rw-r--r--Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/NotificationService/NotificationEventHandler.cs7
5 files changed, 32 insertions, 32 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/FriendService/Types/Friend.cs b/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/FriendService/Types/Friend.cs
index 4947a5ce..87f54bf3 100644
--- a/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/FriendService/Types/Friend.cs
+++ b/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/FriendService/Types/Friend.cs
@@ -1,4 +1,4 @@
-using Ryujinx.HLE.Utilities;
+using Ryujinx.HLE.HOS.Services.Account.Acc;
using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Friend.ServiceCreator.FriendService
@@ -6,7 +6,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend.ServiceCreator.FriendService
[StructLayout(LayoutKind.Sequential, Pack = 0x8, Size = 0x200, CharSet = CharSet.Ansi)]
struct Friend
{
- public UInt128 UserId;
+ public UserId UserId;
public long NetworkUserId;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x21)]
diff --git a/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/FriendService/Types/UserPresence.cs b/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/FriendService/Types/UserPresence.cs
index 5fe8bfd7..e7568a4a 100644
--- a/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/FriendService/Types/UserPresence.cs
+++ b/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/FriendService/Types/UserPresence.cs
@@ -1,4 +1,4 @@
-using Ryujinx.HLE.Utilities;
+using Ryujinx.HLE.HOS.Services.Account.Acc;
using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Friend.ServiceCreator.FriendService
@@ -6,7 +6,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend.ServiceCreator.FriendService
[StructLayout(LayoutKind.Sequential, Pack = 0x8, CharSet = CharSet.Ansi)]
struct UserPresence
{
- public UInt128 UserId;
+ public UserId UserId;
public long LastTimeOnlineTimestamp;
public PresenceStatus Status;
diff --git a/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/IFriendService.cs b/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/IFriendService.cs
index 7492c5a7..fa1b4738 100644
--- a/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/IFriendService.cs
+++ b/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/IFriendService.cs
@@ -2,7 +2,6 @@ using Ryujinx.Common;
using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Services.Account.Acc;
using Ryujinx.HLE.HOS.Services.Friend.ServiceCreator.FriendService;
-using Ryujinx.HLE.Utilities;
using System.IO;
using System.Runtime.InteropServices;
@@ -18,7 +17,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend.ServiceCreator
}
[Command(10100)]
- // nn::friends::GetFriendListIds(int offset, nn::account::Uid userUUID, nn::friends::detail::ipc::SizedFriendFilter friendFilter, ulong pidPlaceHolder, pid)
+ // nn::friends::GetFriendListIds(int offset, nn::account::Uid userId, nn::friends::detail::ipc::SizedFriendFilter friendFilter, ulong pidPlaceHolder, pid)
// -> int outCount, array<nn::account::NetworkServiceAccountId, 0xa>
public ResultCode GetFriendListIds(ServiceCtx context)
{
@@ -27,13 +26,13 @@ namespace Ryujinx.HLE.HOS.Services.Friend.ServiceCreator
// Padding
context.RequestData.ReadInt32();
- UInt128 uuid = context.RequestData.ReadStruct<UInt128>();
+ UserId userId = context.RequestData.ReadStruct<UserId>();
FriendFilter filter = context.RequestData.ReadStruct<FriendFilter>();
// Pid placeholder
context.RequestData.ReadInt64();
- if (uuid.IsNull)
+ if (userId.IsNull)
{
return ResultCode.InvalidArgument;
}
@@ -43,7 +42,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend.ServiceCreator
Logger.PrintStub(LogClass.ServiceFriend, new
{
- UserId = uuid.ToString(),
+ UserId = userId.ToString(),
offset,
filter.PresenceStatus,
filter.IsFavoriteOnly,
@@ -57,7 +56,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend.ServiceCreator
}
[Command(10101)]
- // nn::friends::GetFriendList(int offset, nn::account::Uid userUUID, nn::friends::detail::ipc::SizedFriendFilter friendFilter, ulong pidPlaceHolder, pid)
+ // nn::friends::GetFriendList(int offset, nn::account::Uid userId, nn::friends::detail::ipc::SizedFriendFilter friendFilter, ulong pidPlaceHolder, pid)
// -> int outCount, array<nn::friends::detail::FriendImpl, 0x6>
public ResultCode GetFriendList(ServiceCtx context)
{
@@ -66,13 +65,13 @@ namespace Ryujinx.HLE.HOS.Services.Friend.ServiceCreator
// Padding
context.RequestData.ReadInt32();
- UInt128 uuid = context.RequestData.ReadStruct<UInt128>();
+ UserId userId = context.RequestData.ReadStruct<UserId>();
FriendFilter filter = context.RequestData.ReadStruct<FriendFilter>();
// Pid placeholder
context.RequestData.ReadInt64();
- if (uuid.IsNull)
+ if (userId.IsNull)
{
return ResultCode.InvalidArgument;
}
@@ -81,7 +80,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend.ServiceCreator
context.ResponseData.Write(0);
Logger.PrintStub(LogClass.ServiceFriend, new {
- UserId = uuid.ToString(),
+ UserId = userId.ToString(),
offset,
filter.PresenceStatus,
filter.IsFavoriteOnly,
@@ -95,43 +94,43 @@ namespace Ryujinx.HLE.HOS.Services.Friend.ServiceCreator
}
[Command(10600)]
- // nn::friends::DeclareOpenOnlinePlaySession(nn::account::Uid)
+ // nn::friends::DeclareOpenOnlinePlaySession(nn::account::Uid userId)
public ResultCode DeclareOpenOnlinePlaySession(ServiceCtx context)
{
- UInt128 uuid = context.RequestData.ReadStruct<UInt128>();
+ UserId userId = context.RequestData.ReadStruct<UserId>();
- if (uuid.IsNull)
+ if (userId.IsNull)
{
return ResultCode.InvalidArgument;
}
- if (context.Device.System.State.Account.TryGetUser(uuid, out UserProfile profile))
+ if (context.Device.System.State.Account.TryGetUser(userId, out UserProfile profile))
{
profile.OnlinePlayState = AccountState.Open;
}
- Logger.PrintStub(LogClass.ServiceFriend, new { UserId = uuid.ToString(), profile.OnlinePlayState });
+ Logger.PrintStub(LogClass.ServiceFriend, new { UserId = userId.ToString(), profile.OnlinePlayState });
return ResultCode.Success;
}
[Command(10601)]
- // nn::friends::DeclareCloseOnlinePlaySession(nn::account::Uid)
+ // nn::friends::DeclareCloseOnlinePlaySession(nn::account::Uid userId)
public ResultCode DeclareCloseOnlinePlaySession(ServiceCtx context)
{
- UInt128 uuid = context.RequestData.ReadStruct<UInt128>();
+ UserId userId = context.RequestData.ReadStruct<UserId>();
- if (uuid.IsNull)
+ if (userId.IsNull)
{
return ResultCode.InvalidArgument;
}
- if (context.Device.System.State.Account.TryGetUser(uuid, out UserProfile profile))
+ if (context.Device.System.State.Account.TryGetUser(userId, out UserProfile profile))
{
profile.OnlinePlayState = AccountState.Closed;
}
- Logger.PrintStub(LogClass.ServiceFriend, new { UserId = uuid.ToString(), profile.OnlinePlayState });
+ Logger.PrintStub(LogClass.ServiceFriend, new { UserId = userId.ToString(), profile.OnlinePlayState });
return ResultCode.Success;
}
@@ -140,7 +139,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend.ServiceCreator
// nn::friends::UpdateUserPresence(nn::account::Uid, u64, pid, buffer<nn::friends::detail::UserPresenceImpl, 0x19>)
public ResultCode UpdateUserPresence(ServiceCtx context)
{
- UInt128 uuid = context.RequestData.ReadStruct<UInt128>();
+ UserId uuid = context.RequestData.ReadStruct<UserId>();
// Pid placeholder
context.RequestData.ReadInt64();
diff --git a/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/INotificationService.cs b/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/INotificationService.cs
index 1ff37442..87d998c3 100644
--- a/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/INotificationService.cs
+++ b/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/INotificationService.cs
@@ -2,8 +2,8 @@ using Ryujinx.Common;
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel.Common;
using Ryujinx.HLE.HOS.Kernel.Threading;
+using Ryujinx.HLE.HOS.Services.Account.Acc;
using Ryujinx.HLE.HOS.Services.Friend.ServiceCreator.NotificationService;
-using Ryujinx.HLE.Utilities;
using System;
using System.Collections.Generic;
@@ -11,7 +11,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend.ServiceCreator
{
class INotificationService : IpcService, IDisposable
{
- private readonly UInt128 _userId;
+ private readonly UserId _userId;
private readonly FriendServicePermissionLevel _permissionLevel;
private readonly object _lock = new object();
@@ -24,7 +24,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend.ServiceCreator
private bool _hasNewFriendRequest;
private bool _hasFriendListUpdate;
- public INotificationService(ServiceCtx context, UInt128 userId, FriendServicePermissionLevel permissionLevel)
+ public INotificationService(ServiceCtx context, UserId userId, FriendServicePermissionLevel permissionLevel)
{
_userId = userId;
_permissionLevel = permissionLevel;
@@ -98,7 +98,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend.ServiceCreator
return ResultCode.NotificationQueueEmpty;
}
- public void SignalFriendListUpdate(UInt128 targetId)
+ public void SignalFriendListUpdate(UserId targetId)
{
lock (_lock)
{
@@ -140,7 +140,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend.ServiceCreator
}
}
- public void SignalNewFriendRequest(UInt128 targetId)
+ public void SignalNewFriendRequest(UserId targetId)
{
lock (_lock)
{
diff --git a/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/NotificationService/NotificationEventHandler.cs b/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/NotificationService/NotificationEventHandler.cs
index 19b15416..4a698f81 100644
--- a/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/NotificationService/NotificationEventHandler.cs
+++ b/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/NotificationService/NotificationEventHandler.cs
@@ -1,4 +1,5 @@
-using Ryujinx.HLE.Utilities;
+using Ryujinx.HLE.HOS.Services.Account.Acc;
+using Ryujinx.HLE.Utilities;
namespace Ryujinx.HLE.HOS.Services.Friend.ServiceCreator.NotificationService
{
@@ -57,7 +58,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend.ServiceCreator.NotificationService
}
// TODO: Use this when we will have enough things to go online.
- public void SignalFriendListUpdate(UInt128 targetId)
+ public void SignalFriendListUpdate(UserId targetId)
{
for (int i = 0; i < _registry.Length; i++)
{
@@ -69,7 +70,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend.ServiceCreator.NotificationService
}
// TODO: Use this when we will have enough things to go online.
- public void SignalNewFriendRequest(UInt128 targetId)
+ public void SignalNewFriendRequest(UserId targetId)
{
for (int i = 0; i < _registry.Length; i++)
{