aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Horizon/Sdk/Account
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2024-01-29 18:45:40 -0300
committerGitHub <noreply@github.com>2024-01-29 22:45:40 +0100
commit4117c13377b51b83ff87b1d00393be1a5ab5bfff (patch)
treec59181e229947070b76c20d88e7b9cbba314a4e9 /src/Ryujinx.Horizon/Sdk/Account
parent20a392ad552ce5cdbff1cb74f1d26d2f797cca31 (diff)
Migrate friends service to new IPC (#6174)
* Migrate friends service to new IPC * Add a note that the pointer buffer size and domain counts are wrong * Wrong length * Format whitespace * PR feedback * Fill in structs from PR feedback * Missed that one * Somehow forgot to save that one * Fill in enums from PR review * Language enum, NotificationTime * Format whitespace * Fix the warning
Diffstat (limited to 'src/Ryujinx.Horizon/Sdk/Account')
-rw-r--r--src/Ryujinx.Horizon/Sdk/Account/IEmulatorAccountManager.cs8
-rw-r--r--src/Ryujinx.Horizon/Sdk/Account/NetworkServiceAccountId.cs20
-rw-r--r--src/Ryujinx.Horizon/Sdk/Account/Nickname.cs29
-rw-r--r--src/Ryujinx.Horizon/Sdk/Account/Uid.cs16
4 files changed, 65 insertions, 8 deletions
diff --git a/src/Ryujinx.Horizon/Sdk/Account/IEmulatorAccountManager.cs b/src/Ryujinx.Horizon/Sdk/Account/IEmulatorAccountManager.cs
new file mode 100644
index 00000000..af02cc8e
--- /dev/null
+++ b/src/Ryujinx.Horizon/Sdk/Account/IEmulatorAccountManager.cs
@@ -0,0 +1,8 @@
+namespace Ryujinx.Horizon.Sdk.Account
+{
+ public interface IEmulatorAccountManager
+ {
+ void OpenUserOnlinePlay(Uid userId);
+ void CloseUserOnlinePlay(Uid userId);
+ }
+}
diff --git a/src/Ryujinx.Horizon/Sdk/Account/NetworkServiceAccountId.cs b/src/Ryujinx.Horizon/Sdk/Account/NetworkServiceAccountId.cs
new file mode 100644
index 00000000..2512975e
--- /dev/null
+++ b/src/Ryujinx.Horizon/Sdk/Account/NetworkServiceAccountId.cs
@@ -0,0 +1,20 @@
+using System.Runtime.InteropServices;
+
+namespace Ryujinx.Horizon.Sdk.Account
+{
+ [StructLayout(LayoutKind.Sequential, Size = 0x8, Pack = 0x8)]
+ readonly record struct NetworkServiceAccountId
+ {
+ public readonly ulong Id;
+
+ public NetworkServiceAccountId(ulong id)
+ {
+ Id = id;
+ }
+
+ public override readonly string ToString()
+ {
+ return Id.ToString("x16");
+ }
+ }
+}
diff --git a/src/Ryujinx.Horizon/Sdk/Account/Nickname.cs b/src/Ryujinx.Horizon/Sdk/Account/Nickname.cs
new file mode 100644
index 00000000..1f351ee3
--- /dev/null
+++ b/src/Ryujinx.Horizon/Sdk/Account/Nickname.cs
@@ -0,0 +1,29 @@
+using Ryujinx.Common.Memory;
+using System;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace Ryujinx.Horizon.Sdk.Account
+{
+ [StructLayout(LayoutKind.Sequential, Size = 0x21, Pack = 0x1)]
+ readonly struct Nickname
+ {
+ public readonly Array33<byte> Name;
+
+ public Nickname(in Array33<byte> name)
+ {
+ Name = name;
+ }
+
+ public override string ToString()
+ {
+ int length = ((ReadOnlySpan<byte>)Name.AsSpan()).IndexOf((byte)0);
+ if (length < 0)
+ {
+ length = 33;
+ }
+
+ return Encoding.UTF8.GetString(Name.AsSpan()[..length]);
+ }
+ }
+}
diff --git a/src/Ryujinx.Horizon/Sdk/Account/Uid.cs b/src/Ryujinx.Horizon/Sdk/Account/Uid.cs
index a76e6d25..ada2c02b 100644
--- a/src/Ryujinx.Horizon/Sdk/Account/Uid.cs
+++ b/src/Ryujinx.Horizon/Sdk/Account/Uid.cs
@@ -6,16 +6,16 @@ using System.Runtime.InteropServices;
namespace Ryujinx.Horizon.Sdk.Account
{
[StructLayout(LayoutKind.Sequential)]
- readonly record struct Uid
+ public readonly record struct Uid
{
- public readonly long High;
- public readonly long Low;
+ public readonly ulong High;
+ public readonly ulong Low;
public bool IsNull => (Low | High) == 0;
public static Uid Null => new(0, 0);
- public Uid(long low, long high)
+ public Uid(ulong low, ulong high)
{
Low = low;
High = high;
@@ -23,8 +23,8 @@ namespace Ryujinx.Horizon.Sdk.Account
public Uid(byte[] bytes)
{
- High = BitConverter.ToInt64(bytes, 0);
- Low = BitConverter.ToInt64(bytes, 8);
+ High = BitConverter.ToUInt64(bytes, 0);
+ Low = BitConverter.ToUInt64(bytes, 8);
}
public Uid(string hex)
@@ -34,8 +34,8 @@ namespace Ryujinx.Horizon.Sdk.Account
throw new ArgumentException("Invalid Hex value!", nameof(hex));
}
- Low = Convert.ToInt64(hex[16..], 16);
- High = Convert.ToInt64(hex[..16], 16);
+ Low = Convert.ToUInt64(hex[16..], 16);
+ High = Convert.ToUInt64(hex[..16], 16);
}
public void Write(BinaryWriter binaryWriter)