aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.HLE/HOS/Services/Arp
diff options
context:
space:
mode:
authorTSR Berry <20988865+TSRBerry@users.noreply.github.com>2023-04-08 01:22:00 +0200
committerMary <thog@protonmail.com>2023-04-27 23:51:14 +0200
commitcee712105850ac3385cd0091a923438167433f9f (patch)
tree4a5274b21d8b7f938c0d0ce18736d3f2993b11b1 /src/Ryujinx.HLE/HOS/Services/Arp
parentcd124bda587ef09668a971fa1cac1c3f0cfc9f21 (diff)
Move solution and projects to src
Diffstat (limited to 'src/Ryujinx.HLE/HOS/Services/Arp')
-rw-r--r--src/Ryujinx.HLE/HOS/Services/Arp/ApplicationLaunchProperty.cs43
-rw-r--r--src/Ryujinx.HLE/HOS/Services/Arp/IReader.cs8
-rw-r--r--src/Ryujinx.HLE/HOS/Services/Arp/IWriter.cs8
-rw-r--r--src/Ryujinx.HLE/HOS/Services/Arp/LibHacIReader.cs76
4 files changed, 135 insertions, 0 deletions
diff --git a/src/Ryujinx.HLE/HOS/Services/Arp/ApplicationLaunchProperty.cs b/src/Ryujinx.HLE/HOS/Services/Arp/ApplicationLaunchProperty.cs
new file mode 100644
index 00000000..3e4eca0a
--- /dev/null
+++ b/src/Ryujinx.HLE/HOS/Services/Arp/ApplicationLaunchProperty.cs
@@ -0,0 +1,43 @@
+using LibHac.Ncm;
+
+namespace Ryujinx.HLE.HOS.Services.Arp
+{
+ class ApplicationLaunchProperty
+ {
+ public ulong TitleId;
+ public int Version;
+ public byte BaseGameStorageId;
+ public byte UpdateGameStorageId;
+#pragma warning disable CS0649
+ public short Padding;
+#pragma warning restore CS0649
+
+ public static ApplicationLaunchProperty Default
+ {
+ get
+ {
+ return new ApplicationLaunchProperty
+ {
+ TitleId = 0x00,
+ Version = 0x00,
+ BaseGameStorageId = (byte)StorageId.BuiltInSystem,
+ UpdateGameStorageId = (byte)StorageId.None
+ };
+ }
+ }
+
+ public static ApplicationLaunchProperty GetByPid(ServiceCtx context)
+ {
+ // TODO: Handle ApplicationLaunchProperty as array when pid will be supported and return the right item.
+ // For now we can hardcode values, and fix it after GetApplicationLaunchProperty is implemented.
+
+ return new ApplicationLaunchProperty
+ {
+ TitleId = context.Device.Processes.ActiveApplication.ProgramId,
+ Version = 0x00,
+ BaseGameStorageId = (byte)StorageId.BuiltInSystem,
+ UpdateGameStorageId = (byte)StorageId.None
+ };
+ }
+ }
+} \ No newline at end of file
diff --git a/src/Ryujinx.HLE/HOS/Services/Arp/IReader.cs b/src/Ryujinx.HLE/HOS/Services/Arp/IReader.cs
new file mode 100644
index 00000000..35a2de0c
--- /dev/null
+++ b/src/Ryujinx.HLE/HOS/Services/Arp/IReader.cs
@@ -0,0 +1,8 @@
+namespace Ryujinx.HLE.HOS.Services.Arp
+{
+ [Service("arp:r")]
+ class IReader : IpcService
+ {
+ public IReader(ServiceCtx context) { }
+ }
+} \ No newline at end of file
diff --git a/src/Ryujinx.HLE/HOS/Services/Arp/IWriter.cs b/src/Ryujinx.HLE/HOS/Services/Arp/IWriter.cs
new file mode 100644
index 00000000..8d13f0fb
--- /dev/null
+++ b/src/Ryujinx.HLE/HOS/Services/Arp/IWriter.cs
@@ -0,0 +1,8 @@
+namespace Ryujinx.HLE.HOS.Services.Arp
+{
+ [Service("arp:w")]
+ class IWriter : IpcService
+ {
+ public IWriter(ServiceCtx context) { }
+ }
+} \ No newline at end of file
diff --git a/src/Ryujinx.HLE/HOS/Services/Arp/LibHacIReader.cs b/src/Ryujinx.HLE/HOS/Services/Arp/LibHacIReader.cs
new file mode 100644
index 00000000..d7686871
--- /dev/null
+++ b/src/Ryujinx.HLE/HOS/Services/Arp/LibHacIReader.cs
@@ -0,0 +1,76 @@
+using LibHac;
+using LibHac.Common;
+using LibHac.Ncm;
+using LibHac.Ns;
+using System;
+
+using ApplicationId = LibHac.ApplicationId;
+
+namespace Ryujinx.HLE.HOS.Services.Arp
+{
+ class LibHacIReader : LibHac.Arp.Impl.IReader
+ {
+ public ApplicationId ApplicationId { get; set; }
+
+ public Result GetApplicationLaunchProperty(out LibHac.Arp.ApplicationLaunchProperty launchProperty, ulong processId)
+ {
+ launchProperty = new LibHac.Arp.ApplicationLaunchProperty
+ {
+ StorageId = StorageId.BuiltInUser,
+ ApplicationId = ApplicationId
+ };
+
+ return Result.Success;
+ }
+
+ public void Dispose() { }
+
+ public Result GetApplicationLaunchPropertyWithApplicationId(out LibHac.Arp.ApplicationLaunchProperty launchProperty, ApplicationId applicationId)
+ {
+ launchProperty = new LibHac.Arp.ApplicationLaunchProperty
+ {
+ StorageId = StorageId.BuiltInUser,
+ ApplicationId = applicationId
+ };
+
+ return Result.Success;
+ }
+
+ public Result GetApplicationControlProperty(out ApplicationControlProperty controlProperty, ulong processId)
+ {
+ throw new NotImplementedException();
+ }
+
+ public Result GetApplicationControlPropertyWithApplicationId(out ApplicationControlProperty controlProperty, ApplicationId applicationId)
+ {
+ throw new NotImplementedException();
+ }
+
+ public Result GetServiceObject(out object serviceObject)
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ internal class LibHacArpServiceObject : LibHac.Sm.IServiceObject
+ {
+ private SharedRef<LibHacIReader> _serviceObject;
+
+ public LibHacArpServiceObject(ref SharedRef<LibHacIReader> serviceObject)
+ {
+ _serviceObject = SharedRef<LibHacIReader>.CreateCopy(in serviceObject);
+ }
+
+ public void Dispose()
+ {
+ _serviceObject.Destroy();
+ }
+
+ public Result GetServiceObject(ref SharedRef<IDisposable> serviceObject)
+ {
+ serviceObject.SetByCopy(in _serviceObject);
+
+ return Result.Success;
+ }
+ }
+} \ No newline at end of file