From 486f3163f399fb8751939bd7e9b31d0471e841d2 Mon Sep 17 00:00:00 2001 From: Thog Date: Tue, 28 Apr 2020 03:44:29 +0200 Subject: [PATCH] Fix hbl 2.3.1 and hbmenu 3.3.0 (#1171) * Fix hbl 2.3.1 and hbmenu 3.3.0 * log class: Add ServicePtm * fix build issue * do not cast titleId to byte * Address Ac_K's comment --- Ryujinx.Common/Logging/LogClass.cs | 1 + .../Ns/IApplicationManagerInterface.cs | 2 +- ...ReadOnlyApplicationControlDataInterface.cs | 23 +++++++++++++++++++ .../Services/Ns/IServiceGetterInterface.cs | 9 ++++++++ .../HOS/Services/Ptm/Ts/IMeasurementServer.cs | 20 +++++++++++++++- .../HOS/Services/Ptm/Ts/Types/Location.cs | 8 +++++++ 6 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 Ryujinx.HLE/HOS/Services/Ns/IReadOnlyApplicationControlDataInterface.cs create mode 100644 Ryujinx.HLE/HOS/Services/Ptm/Ts/Types/Location.cs diff --git a/Ryujinx.Common/Logging/LogClass.cs b/Ryujinx.Common/Logging/LogClass.cs index ab83bdc2e..dcf380a17 100644 --- a/Ryujinx.Common/Logging/LogClass.cs +++ b/Ryujinx.Common/Logging/LogClass.cs @@ -40,6 +40,7 @@ namespace Ryujinx.Common.Logging ServicePl, ServicePrepo, ServicePsm, + ServicePtm, ServiceSet, ServiceSfdnsres, ServiceSm, diff --git a/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs b/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs index e185233be..3920030e3 100644 --- a/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs @@ -10,7 +10,7 @@ public ResultCode GetApplicationControlData(ServiceCtx context) { byte source = (byte)context.RequestData.ReadInt64(); - ulong titleId = (byte)context.RequestData.ReadUInt64(); + ulong titleId = context.RequestData.ReadUInt64(); long position = context.Request.ReceiveBuff[0].Position; diff --git a/Ryujinx.HLE/HOS/Services/Ns/IReadOnlyApplicationControlDataInterface.cs b/Ryujinx.HLE/HOS/Services/Ns/IReadOnlyApplicationControlDataInterface.cs new file mode 100644 index 000000000..a7f20bc75 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Ns/IReadOnlyApplicationControlDataInterface.cs @@ -0,0 +1,23 @@ +namespace Ryujinx.HLE.HOS.Services.Ns +{ + class IReadOnlyApplicationControlDataInterface : IpcService + { + public IReadOnlyApplicationControlDataInterface(ServiceCtx context) { } + + [Command(0)] + // GetApplicationControlData(u8, u64) -> (unknown<4>, buffer) + public ResultCode GetApplicationControlData(ServiceCtx context) + { + byte source = (byte)context.RequestData.ReadInt64(); + ulong titleId = context.RequestData.ReadUInt64(); + + long position = context.Request.ReceiveBuff[0].Position; + + byte[] nacpData = context.Device.System.ControlData.ByteSpan.ToArray(); + + context.Memory.WriteBytes(position, nacpData); + + return ResultCode.Success; + } + } +} diff --git a/Ryujinx.HLE/HOS/Services/Ns/IServiceGetterInterface.cs b/Ryujinx.HLE/HOS/Services/Ns/IServiceGetterInterface.cs index 713316672..a16f76f44 100644 --- a/Ryujinx.HLE/HOS/Services/Ns/IServiceGetterInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Ns/IServiceGetterInterface.cs @@ -17,5 +17,14 @@ namespace Ryujinx.HLE.HOS.Services.Ns return ResultCode.Success; } + + [Command(7989)] + // GetReadOnlyApplicationControlDataInterface() -> object + public ResultCode GetReadOnlyApplicationControlDataInterface(ServiceCtx context) + { + MakeObject(context, new IReadOnlyApplicationControlDataInterface(context)); + + return ResultCode.Success; + } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Ptm/Ts/IMeasurementServer.cs b/Ryujinx.HLE/HOS/Services/Ptm/Ts/IMeasurementServer.cs index f3b37d67d..942fab87a 100644 --- a/Ryujinx.HLE/HOS/Services/Ptm/Ts/IMeasurementServer.cs +++ b/Ryujinx.HLE/HOS/Services/Ptm/Ts/IMeasurementServer.cs @@ -1,8 +1,26 @@ -namespace Ryujinx.HLE.HOS.Services.Ptm.Ts +using Ryujinx.Common.Logging; +using Ryujinx.HLE.HOS.Services.Ptm.Ts.Types; + +namespace Ryujinx.HLE.HOS.Services.Ptm.Ts { [Service("ts")] class IMeasurementServer : IpcService { + private const uint DefaultTemperature = 42000u; + public IMeasurementServer(ServiceCtx context) { } + + [Command(3)] + // GetTemperatureMilliC(Location location) -> u32 + public ResultCode GetTemperatureMilliC(ServiceCtx context) + { + Location location = (Location)context.RequestData.ReadByte(); + + Logger.PrintStub(LogClass.ServicePtm, new { location }); + + context.ResponseData.Write(DefaultTemperature); + + return ResultCode.Success; + } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Ptm/Ts/Types/Location.cs b/Ryujinx.HLE/HOS/Services/Ptm/Ts/Types/Location.cs new file mode 100644 index 000000000..e72491d51 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Ptm/Ts/Types/Location.cs @@ -0,0 +1,8 @@ +namespace Ryujinx.HLE.HOS.Services.Ptm.Ts.Types +{ + enum Location : byte + { + Internal, + External + } +}