mirror of
https://github.com/ryujinx-mirror/ryujinx.git
synced 2025-09-08 10:56:26 -05:00
ts: Migrate service to Horizon project (#6514)
* ts: Migrate service to Horizon project This PR migrate the `ts` service (stored in `ptm`) to the Horizon project: - It stubs all known IPCs. - IpcServer consts are checked by RE. Closes #6480 * Fix args
This commit is contained in:
63
src/Ryujinx.Horizon/Ptm/Ipc/MeasurementServer.cs
Normal file
63
src/Ryujinx.Horizon/Ptm/Ipc/MeasurementServer.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.Horizon.Common;
|
||||
using Ryujinx.Horizon.Sdk.Sf;
|
||||
using Ryujinx.Horizon.Sdk.Ts;
|
||||
using Ryujinx.Horizon.Ts.Ipc;
|
||||
|
||||
namespace Ryujinx.Horizon.Ptm.Ipc
|
||||
{
|
||||
partial class MeasurementServer : IMeasurementServer
|
||||
{
|
||||
// NOTE: Values are randomly choosen.
|
||||
public const int DefaultTemperature = 42;
|
||||
public const int MinimumTemperature = 0;
|
||||
public const int MaximumTemperature = 100;
|
||||
|
||||
[CmifCommand(0)] // 1.0.0-16.1.0
|
||||
public Result GetTemperatureRange(out int minimumTemperature, out int maximumTemperature, Location location)
|
||||
{
|
||||
Logger.Stub?.PrintStub(LogClass.ServicePtm, new { location });
|
||||
|
||||
minimumTemperature = MinimumTemperature;
|
||||
maximumTemperature = MaximumTemperature;
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
[CmifCommand(1)] // 1.0.0-16.1.0
|
||||
public Result GetTemperature(out int temperature, Location location)
|
||||
{
|
||||
Logger.Stub?.PrintStub(LogClass.ServicePtm, new { location });
|
||||
|
||||
temperature = DefaultTemperature;
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
[CmifCommand(2)] // 1.0.0-13.2.1
|
||||
public Result SetMeasurementMode(Location location, byte measurementMode)
|
||||
{
|
||||
Logger.Stub?.PrintStub(LogClass.ServicePtm, new { location, measurementMode });
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
[CmifCommand(3)] // 1.0.0-13.2.1
|
||||
public Result GetTemperatureMilliC(out int temperatureMilliC, Location location)
|
||||
{
|
||||
Logger.Stub?.PrintStub(LogClass.ServicePtm, new { location });
|
||||
|
||||
temperatureMilliC = DefaultTemperature * 1000;
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
[CmifCommand(4)] // 8.0.0+
|
||||
public Result OpenSession(out ISession session, DeviceCode deviceCode)
|
||||
{
|
||||
session = new Session(deviceCode);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
}
|
||||
}
|
47
src/Ryujinx.Horizon/Ptm/Ipc/Session.cs
Normal file
47
src/Ryujinx.Horizon/Ptm/Ipc/Session.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.Horizon.Common;
|
||||
using Ryujinx.Horizon.Ptm.Ipc;
|
||||
using Ryujinx.Horizon.Sdk.Sf;
|
||||
using Ryujinx.Horizon.Sdk.Ts;
|
||||
|
||||
namespace Ryujinx.Horizon.Ts.Ipc
|
||||
{
|
||||
partial class Session : ISession
|
||||
{
|
||||
private readonly DeviceCode _deviceCode;
|
||||
|
||||
public Session(DeviceCode deviceCode)
|
||||
{
|
||||
_deviceCode = deviceCode;
|
||||
}
|
||||
|
||||
[CmifCommand(0)]
|
||||
public Result GetTemperatureRange(out int minimumTemperature, out int maximumTemperature)
|
||||
{
|
||||
Logger.Stub?.PrintStub(LogClass.ServicePtm, new { _deviceCode });
|
||||
|
||||
minimumTemperature = MeasurementServer.MinimumTemperature;
|
||||
maximumTemperature = MeasurementServer.MaximumTemperature;
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
[CmifCommand(2)]
|
||||
public Result SetMeasurementMode(byte measurementMode)
|
||||
{
|
||||
Logger.Stub?.PrintStub(LogClass.ServicePtm, new { _deviceCode, measurementMode });
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
[CmifCommand(4)]
|
||||
public Result GetTemperature(out int temperature)
|
||||
{
|
||||
Logger.Stub?.PrintStub(LogClass.ServicePtm, new { _deviceCode });
|
||||
|
||||
temperature = MeasurementServer.DefaultTemperature;
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user