2018-06-10 17:46:42 -07:00
|
|
|
using Ryujinx.HLE.Input;
|
|
|
|
using Ryujinx.HLE.Logging;
|
|
|
|
using Ryujinx.HLE.OsHle.Ipc;
|
2018-08-13 14:31:09 -07:00
|
|
|
using Ryujinx.HLE.OsHle.Handles;
|
|
|
|
using System;
|
2018-02-24 20:34:16 -08:00
|
|
|
using System.Collections.Generic;
|
|
|
|
|
2018-06-10 17:46:42 -07:00
|
|
|
namespace Ryujinx.HLE.OsHle.Services.Hid
|
2018-02-24 20:34:16 -08:00
|
|
|
{
|
2018-08-13 14:31:09 -07:00
|
|
|
class IHidServer : IpcService, IDisposable
|
2018-02-24 20:34:16 -08:00
|
|
|
{
|
|
|
|
private Dictionary<int, ServiceProcessRequest> m_Commands;
|
|
|
|
|
2018-08-13 14:31:09 -07:00
|
|
|
private KEvent NpadStyleSetUpdateEvent;
|
|
|
|
|
2018-03-19 11:58:46 -07:00
|
|
|
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
|
2018-02-24 20:34:16 -08:00
|
|
|
|
2018-04-05 21:01:52 -07:00
|
|
|
public IHidServer()
|
2018-02-24 20:34:16 -08:00
|
|
|
{
|
|
|
|
m_Commands = new Dictionary<int, ServiceProcessRequest>()
|
|
|
|
{
|
2018-04-24 11:57:39 -07:00
|
|
|
{ 0, CreateAppletResource },
|
|
|
|
{ 1, ActivateDebugPad },
|
|
|
|
{ 11, ActivateTouchScreen },
|
|
|
|
{ 21, ActivateMouse },
|
|
|
|
{ 31, ActivateKeyboard },
|
|
|
|
{ 66, StartSixAxisSensor },
|
|
|
|
{ 79, SetGyroscopeZeroDriftMode },
|
2018-03-13 14:59:17 -07:00
|
|
|
{ 100, SetSupportedNpadStyleSet },
|
|
|
|
{ 101, GetSupportedNpadStyleSet },
|
|
|
|
{ 102, SetSupportedNpadIdType },
|
|
|
|
{ 103, ActivateNpad },
|
2018-08-13 14:31:09 -07:00
|
|
|
{ 106, AcquireNpadStyleSetUpdateEventHandle },
|
2018-04-17 09:40:22 -07:00
|
|
|
{ 108, GetPlayerLedPattern },
|
2018-03-13 14:59:17 -07:00
|
|
|
{ 120, SetNpadJoyHoldType },
|
2018-04-04 15:16:59 -07:00
|
|
|
{ 121, GetNpadJoyHoldType },
|
2018-03-13 14:59:17 -07:00
|
|
|
{ 122, SetNpadJoyAssignmentModeSingleByDefault },
|
|
|
|
{ 123, SetNpadJoyAssignmentModeSingle },
|
|
|
|
{ 124, SetNpadJoyAssignmentModeDual },
|
|
|
|
{ 125, MergeSingleJoyAsDualJoy },
|
2018-04-17 09:40:22 -07:00
|
|
|
{ 128, SetNpadHandheldActivationMode },
|
2018-03-13 14:59:17 -07:00
|
|
|
{ 200, GetVibrationDeviceInfo },
|
2018-04-17 09:40:22 -07:00
|
|
|
{ 201, SendVibrationValue },
|
2018-03-13 14:59:17 -07:00
|
|
|
{ 203, CreateActiveVibrationDeviceList },
|
|
|
|
{ 206, SendVibrationValues }
|
2018-02-24 20:34:16 -08:00
|
|
|
};
|
2018-08-13 14:31:09 -07:00
|
|
|
|
|
|
|
NpadStyleSetUpdateEvent = new KEvent();
|
2018-02-24 20:34:16 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
public long CreateAppletResource(ServiceCtx Context)
|
|
|
|
{
|
2018-03-11 21:04:52 -07:00
|
|
|
MakeObject(Context, new IAppletResource(Context.Ns.Os.HidSharedMem));
|
2018-02-24 20:34:16 -08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-04-04 15:16:59 -07:00
|
|
|
public long ActivateDebugPad(ServiceCtx Context)
|
|
|
|
{
|
2018-04-24 11:57:39 -07:00
|
|
|
Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
|
2018-04-16 17:24:42 -07:00
|
|
|
|
2018-04-04 15:16:59 -07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-02-24 20:34:16 -08:00
|
|
|
public long ActivateTouchScreen(ServiceCtx Context)
|
|
|
|
{
|
2018-04-04 15:39:47 -07:00
|
|
|
long AppletResourceUserId = Context.RequestData.ReadInt64();
|
|
|
|
|
2018-04-24 11:57:39 -07:00
|
|
|
Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
|
2018-04-16 17:24:42 -07:00
|
|
|
|
2018-04-04 15:39:47 -07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public long ActivateMouse(ServiceCtx Context)
|
|
|
|
{
|
|
|
|
long AppletResourceUserId = Context.RequestData.ReadInt64();
|
2018-02-24 20:34:16 -08:00
|
|
|
|
2018-04-24 11:57:39 -07:00
|
|
|
Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
|
2018-04-16 17:24:42 -07:00
|
|
|
|
2018-02-24 20:34:16 -08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-04-04 15:44:02 -07:00
|
|
|
public long ActivateKeyboard(ServiceCtx Context)
|
|
|
|
{
|
|
|
|
long AppletResourceUserId = Context.RequestData.ReadInt64();
|
|
|
|
|
2018-04-24 11:57:39 -07:00
|
|
|
Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
|
2018-04-16 17:24:42 -07:00
|
|
|
|
2018-04-04 15:44:02 -07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-03-13 17:26:14 -07:00
|
|
|
public long StartSixAxisSensor(ServiceCtx Context)
|
|
|
|
{
|
|
|
|
int Handle = Context.RequestData.ReadInt32();
|
|
|
|
|
|
|
|
long AppletResourceUserId = Context.RequestData.ReadInt64();
|
|
|
|
|
2018-04-24 11:57:39 -07:00
|
|
|
Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
|
2018-04-16 17:24:42 -07:00
|
|
|
|
2018-03-13 17:26:14 -07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-04-17 09:40:22 -07:00
|
|
|
public long SetGyroscopeZeroDriftMode(ServiceCtx Context)
|
|
|
|
{
|
2018-04-24 11:57:39 -07:00
|
|
|
int Handle = Context.RequestData.ReadInt32();
|
|
|
|
int Unknown = Context.RequestData.ReadInt32();
|
2018-04-17 09:40:22 -07:00
|
|
|
long AppletResourceUserId = Context.RequestData.ReadInt64();
|
|
|
|
|
2018-04-24 11:57:39 -07:00
|
|
|
Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
|
2018-04-17 09:40:22 -07:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-08-13 14:31:09 -07:00
|
|
|
public long AcquireNpadStyleSetUpdateEventHandle(ServiceCtx Context)
|
|
|
|
{
|
|
|
|
int Handle = Context.Process.HandleTable.OpenHandle(NpadStyleSetUpdateEvent);
|
|
|
|
|
|
|
|
Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-02-24 20:34:16 -08:00
|
|
|
public long GetSupportedNpadStyleSet(ServiceCtx Context)
|
|
|
|
{
|
|
|
|
Context.ResponseData.Write(0);
|
|
|
|
|
2018-04-24 11:57:39 -07:00
|
|
|
Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
|
2018-04-16 17:24:42 -07:00
|
|
|
|
2018-02-24 20:34:16 -08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public long SetSupportedNpadStyleSet(ServiceCtx Context)
|
|
|
|
{
|
|
|
|
long Unknown0 = Context.RequestData.ReadInt64();
|
|
|
|
long Unknown8 = Context.RequestData.ReadInt64();
|
|
|
|
|
2018-04-24 11:57:39 -07:00
|
|
|
Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
|
2018-04-16 17:24:42 -07:00
|
|
|
|
2018-02-24 20:34:16 -08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public long SetSupportedNpadIdType(ServiceCtx Context)
|
|
|
|
{
|
|
|
|
long Unknown = Context.RequestData.ReadInt64();
|
|
|
|
|
2018-04-24 11:57:39 -07:00
|
|
|
Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
|
2018-04-16 17:24:42 -07:00
|
|
|
|
2018-02-24 20:34:16 -08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public long ActivateNpad(ServiceCtx Context)
|
|
|
|
{
|
|
|
|
long Unknown = Context.RequestData.ReadInt64();
|
|
|
|
|
2018-04-24 11:57:39 -07:00
|
|
|
Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
|
2018-04-16 17:24:42 -07:00
|
|
|
|
2018-02-24 20:34:16 -08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-04-17 09:40:22 -07:00
|
|
|
public long GetPlayerLedPattern(ServiceCtx Context)
|
|
|
|
{
|
|
|
|
long Unknown = Context.RequestData.ReadInt32();
|
|
|
|
|
|
|
|
Context.ResponseData.Write(0L);
|
|
|
|
|
2018-04-24 11:57:39 -07:00
|
|
|
Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
|
2018-04-17 09:40:22 -07:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-02-24 20:34:16 -08:00
|
|
|
public long SetNpadJoyHoldType(ServiceCtx Context)
|
|
|
|
{
|
|
|
|
long Unknown0 = Context.RequestData.ReadInt64();
|
|
|
|
long Unknown8 = Context.RequestData.ReadInt64();
|
|
|
|
|
2018-04-24 11:57:39 -07:00
|
|
|
Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
|
2018-04-16 17:24:42 -07:00
|
|
|
|
2018-02-24 20:34:16 -08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public long GetNpadJoyHoldType(ServiceCtx Context)
|
|
|
|
{
|
|
|
|
Context.ResponseData.Write(0L);
|
|
|
|
|
2018-04-24 11:57:39 -07:00
|
|
|
Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
|
2018-04-16 17:24:42 -07:00
|
|
|
|
2018-02-24 20:34:16 -08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-03-13 14:59:17 -07:00
|
|
|
public long SetNpadJoyAssignmentModeSingleByDefault(ServiceCtx Context)
|
|
|
|
{
|
|
|
|
HidControllerId HidControllerId = (HidControllerId)Context.RequestData.ReadInt32();
|
2018-04-24 11:57:39 -07:00
|
|
|
|
2018-04-17 09:40:22 -07:00
|
|
|
long AppletUserResourceId = Context.RequestData.ReadInt64();
|
2018-03-13 14:59:17 -07:00
|
|
|
|
2018-04-24 11:57:39 -07:00
|
|
|
Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
|
2018-04-16 17:24:42 -07:00
|
|
|
|
2018-03-13 14:59:17 -07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public long SetNpadJoyAssignmentModeSingle(ServiceCtx Context)
|
|
|
|
{
|
|
|
|
HidControllerId HidControllerId = (HidControllerId)Context.RequestData.ReadInt32();
|
2018-04-24 11:57:39 -07:00
|
|
|
|
2018-04-17 09:40:22 -07:00
|
|
|
long AppletUserResourceId = Context.RequestData.ReadInt64();
|
2018-04-24 11:57:39 -07:00
|
|
|
long NpadJoyDeviceType = Context.RequestData.ReadInt64();
|
2018-04-04 15:39:47 -07:00
|
|
|
|
2018-04-24 11:57:39 -07:00
|
|
|
Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
|
2018-04-16 17:24:42 -07:00
|
|
|
|
2018-03-13 14:59:17 -07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public long SetNpadJoyAssignmentModeDual(ServiceCtx Context)
|
|
|
|
{
|
|
|
|
HidControllerId HidControllerId = (HidControllerId)Context.RequestData.ReadInt32();
|
2018-04-24 11:57:39 -07:00
|
|
|
|
2018-04-17 09:40:22 -07:00
|
|
|
long AppletUserResourceId = Context.RequestData.ReadInt64();
|
2018-03-13 14:59:17 -07:00
|
|
|
|
2018-04-24 11:57:39 -07:00
|
|
|
Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
|
2018-04-16 17:24:42 -07:00
|
|
|
|
2018-03-13 14:59:17 -07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public long MergeSingleJoyAsDualJoy(ServiceCtx Context)
|
|
|
|
{
|
2018-04-24 11:57:39 -07:00
|
|
|
long Unknown0 = Context.RequestData.ReadInt32();
|
|
|
|
long Unknown8 = Context.RequestData.ReadInt32();
|
2018-04-17 09:40:22 -07:00
|
|
|
long AppletUserResourceId = Context.RequestData.ReadInt64();
|
|
|
|
|
2018-04-24 11:57:39 -07:00
|
|
|
Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
|
2018-04-17 09:40:22 -07:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public long SetNpadHandheldActivationMode(ServiceCtx Context)
|
|
|
|
{
|
|
|
|
long AppletUserResourceId = Context.RequestData.ReadInt64();
|
2018-04-24 11:57:39 -07:00
|
|
|
long Unknown = Context.RequestData.ReadInt64();
|
2018-03-13 14:59:17 -07:00
|
|
|
|
2018-04-24 11:57:39 -07:00
|
|
|
Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
|
2018-04-16 17:24:42 -07:00
|
|
|
|
2018-03-13 14:59:17 -07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-02-25 10:58:16 -08:00
|
|
|
public long GetVibrationDeviceInfo(ServiceCtx Context)
|
|
|
|
{
|
|
|
|
int VibrationDeviceHandle = Context.RequestData.ReadInt32();
|
|
|
|
|
2018-04-24 11:57:39 -07:00
|
|
|
Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
|
2018-04-16 17:24:42 -07:00
|
|
|
|
2018-02-25 10:58:16 -08:00
|
|
|
Context.ResponseData.Write(0L); //VibrationDeviceInfoForIpc
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-04-17 09:40:22 -07:00
|
|
|
public long SendVibrationValue(ServiceCtx Context)
|
|
|
|
{
|
|
|
|
int VibrationDeviceHandle = Context.RequestData.ReadInt32();
|
|
|
|
|
|
|
|
int VibrationValue1 = Context.RequestData.ReadInt32();
|
|
|
|
int VibrationValue2 = Context.RequestData.ReadInt32();
|
|
|
|
int VibrationValue3 = Context.RequestData.ReadInt32();
|
|
|
|
int VibrationValue4 = Context.RequestData.ReadInt32();
|
|
|
|
|
|
|
|
long AppletUserResourceId = Context.RequestData.ReadInt64();
|
|
|
|
|
2018-04-24 11:57:39 -07:00
|
|
|
Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
|
2018-04-17 09:40:22 -07:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-02-24 20:34:16 -08:00
|
|
|
public long CreateActiveVibrationDeviceList(ServiceCtx Context)
|
|
|
|
{
|
|
|
|
MakeObject(Context, new IActiveApplicationDeviceList());
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2018-03-03 19:06:44 -08:00
|
|
|
|
|
|
|
public long SendVibrationValues(ServiceCtx Context)
|
|
|
|
{
|
2018-04-24 11:57:39 -07:00
|
|
|
Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
|
2018-04-16 17:24:42 -07:00
|
|
|
|
2018-03-03 19:06:44 -08:00
|
|
|
return 0;
|
|
|
|
}
|
2018-08-13 14:31:09 -07:00
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
{
|
|
|
|
Dispose(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected virtual void Dispose(bool Disposing)
|
|
|
|
{
|
|
|
|
if (Disposing)
|
|
|
|
{
|
|
|
|
NpadStyleSetUpdateEvent.Dispose();
|
|
|
|
}
|
|
|
|
}
|
2018-02-24 20:34:16 -08:00
|
|
|
}
|
2018-04-17 09:40:22 -07:00
|
|
|
}
|