aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.HLE/HOS/Services/Mnpp
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/Mnpp
parentcd124bda587ef09668a971fa1cac1c3f0cfc9f21 (diff)
Move solution and projects to src
Diffstat (limited to 'src/Ryujinx.HLE/HOS/Services/Mnpp')
-rw-r--r--src/Ryujinx.HLE/HOS/Services/Mnpp/IServiceForApplication.cs63
-rw-r--r--src/Ryujinx.HLE/HOS/Services/Mnpp/ResultCode.cs13
2 files changed, 76 insertions, 0 deletions
diff --git a/src/Ryujinx.HLE/HOS/Services/Mnpp/IServiceForApplication.cs b/src/Ryujinx.HLE/HOS/Services/Mnpp/IServiceForApplication.cs
new file mode 100644
index 00000000..c2a4345c
--- /dev/null
+++ b/src/Ryujinx.HLE/HOS/Services/Mnpp/IServiceForApplication.cs
@@ -0,0 +1,63 @@
+using Ryujinx.Common;
+using Ryujinx.Common.Logging;
+using Ryujinx.Cpu;
+using Ryujinx.HLE.HOS.Services.Account.Acc;
+
+namespace Ryujinx.HLE.HOS.Services.Mnpp
+{
+ [Service("mnpp:app")] // 13.0.0+
+ class IServiceForApplication : IpcService
+ {
+ public IServiceForApplication(ServiceCtx context) { }
+
+ [CommandCmif(0)]
+ // Initialize(pid)
+ public ResultCode Initialize(ServiceCtx context)
+ {
+ // Pid placeholder
+ context.RequestData.ReadInt64();
+ ulong pid = context.Request.HandleDesc.PId;
+
+ // TODO: Service calls set:sys GetPlatformRegion.
+ // If the result == 1 (China) it calls arp:r GetApplicationInstanceId and GetApplicationLaunchProperty to get the title id and store it internally.
+ // If not, it does nothing.
+
+ Logger.Stub?.PrintStub(LogClass.ServiceMnpp, new { pid });
+
+ return ResultCode.Success;
+ }
+
+ [CommandCmif(1)]
+ // SendRawTelemetryData(nn::account::Uid user_id, buffer<bytes, 5> title_id)
+ public ResultCode SendRawTelemetryData(ServiceCtx context)
+ {
+ ulong titleIdInputPosition = context.Request.SendBuff[0].Position;
+ ulong titleIdInputSize = context.Request.SendBuff[0].Size;
+
+ UserId userId = context.RequestData.ReadStruct<UserId>();
+
+ // TODO: Service calls set:sys GetPlatformRegion.
+ // If the result != 1 (China) it returns ResultCode.Success.
+
+ if (userId.IsNull)
+ {
+ return ResultCode.InvalidArgument;
+ }
+
+ if (titleIdInputSize <= 64)
+ {
+ string titleId = MemoryHelper.ReadAsciiString(context.Memory, titleIdInputPosition, (long)titleIdInputSize);
+
+ // TODO: The service stores the titleId internally and seems proceed to some telemetry for China, which is not needed here.
+
+ Logger.Stub?.PrintStub(LogClass.ServiceMnpp, new { userId, titleId });
+
+ return ResultCode.Success;
+ }
+
+ Logger.Stub?.PrintStub(LogClass.ServiceMnpp, new { userId });
+
+ return ResultCode.InvalidBufferSize;
+ }
+ }
+} \ No newline at end of file
diff --git a/src/Ryujinx.HLE/HOS/Services/Mnpp/ResultCode.cs b/src/Ryujinx.HLE/HOS/Services/Mnpp/ResultCode.cs
new file mode 100644
index 00000000..dfc39a73
--- /dev/null
+++ b/src/Ryujinx.HLE/HOS/Services/Mnpp/ResultCode.cs
@@ -0,0 +1,13 @@
+namespace Ryujinx.HLE.HOS.Services.Mnpp
+{
+ enum ResultCode
+ {
+ ModuleId = 239,
+ ErrorCodeShift = 9,
+
+ Success = 0,
+
+ InvalidArgument = (100 << ErrorCodeShift) | ModuleId,
+ InvalidBufferSize = (101 << ErrorCodeShift) | ModuleId
+ }
+} \ No newline at end of file