diff options
| author | Ac_K <Acoustik666@gmail.com> | 2022-02-18 02:00:06 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-18 02:00:06 +0100 |
| commit | a113ed081145c36fab77ce17c838f75e61f4ee7e (patch) | |
| tree | 0555505d3f5e242493252b07058b3543ceaa10c0 /Ryujinx.HLE/HOS/Services/Mnpp | |
| parent | 747876dc6711b8cdf5751c1089b1f1311c46628d (diff) | |
Implement/Stub mnpp:app service and some hid calls (#3131)
* Implement/Stub mnpp:app service and some hid calls
This PR Implement/Stub the `mnpp:app` service (closes #3107) accordingly to RE, which seems to do some telemetry for China region only, so everything is stubbed.
This PR fixes some inconsistencies in the hid service too and stub EnableSixAxisSensorUnalteredPassthrough, IsSixAxisSensorUnalteredPassthroughEnabled, LoadSixAxisSensorCalibrationParameter, GetSixAxisSensorIcInformation calls (closes #3123 and closes #3124).
* Addresses Thog review
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Mnpp')
| -rw-r--r-- | Ryujinx.HLE/HOS/Services/Mnpp/IServiceForApplication.cs | 63 | ||||
| -rw-r--r-- | Ryujinx.HLE/HOS/Services/Mnpp/ResultCode.cs | 13 |
2 files changed, 76 insertions, 0 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Mnpp/IServiceForApplication.cs b/Ryujinx.HLE/HOS/Services/Mnpp/IServiceForApplication.cs new file mode 100644 index 00000000..8e52a94e --- /dev/null +++ b/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) { } + + [CommandHipc(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; + } + + [CommandHipc(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/Ryujinx.HLE/HOS/Services/Mnpp/ResultCode.cs b/Ryujinx.HLE/HOS/Services/Mnpp/ResultCode.cs new file mode 100644 index 00000000..dfc39a73 --- /dev/null +++ b/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 |
