IHidServer.cs 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. using Ryujinx.HLE.HOS.Ipc;
  2. using Ryujinx.HLE.HOS.Kernel;
  3. using Ryujinx.HLE.Input;
  4. using Ryujinx.HLE.Logging;
  5. using System.Collections.Generic;
  6. namespace Ryujinx.HLE.HOS.Services.Hid
  7. {
  8. class IHidServer : IpcService
  9. {
  10. private Dictionary<int, ServiceProcessRequest> m_Commands;
  11. private KEvent NpadStyleSetUpdateEvent;
  12. public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
  13. public IHidServer(Horizon System)
  14. {
  15. m_Commands = new Dictionary<int, ServiceProcessRequest>()
  16. {
  17. { 0, CreateAppletResource },
  18. { 1, ActivateDebugPad },
  19. { 11, ActivateTouchScreen },
  20. { 21, ActivateMouse },
  21. { 31, ActivateKeyboard },
  22. { 66, StartSixAxisSensor },
  23. { 79, SetGyroscopeZeroDriftMode },
  24. { 100, SetSupportedNpadStyleSet },
  25. { 101, GetSupportedNpadStyleSet },
  26. { 102, SetSupportedNpadIdType },
  27. { 103, ActivateNpad },
  28. { 106, AcquireNpadStyleSetUpdateEventHandle },
  29. { 108, GetPlayerLedPattern },
  30. { 120, SetNpadJoyHoldType },
  31. { 121, GetNpadJoyHoldType },
  32. { 122, SetNpadJoyAssignmentModeSingleByDefault },
  33. { 123, SetNpadJoyAssignmentModeSingle },
  34. { 124, SetNpadJoyAssignmentModeDual },
  35. { 125, MergeSingleJoyAsDualJoy },
  36. { 128, SetNpadHandheldActivationMode },
  37. { 200, GetVibrationDeviceInfo },
  38. { 201, SendVibrationValue },
  39. { 203, CreateActiveVibrationDeviceList },
  40. { 206, SendVibrationValues }
  41. };
  42. NpadStyleSetUpdateEvent = new KEvent(System);
  43. }
  44. public long CreateAppletResource(ServiceCtx Context)
  45. {
  46. MakeObject(Context, new IAppletResource(Context.Device.System.HidSharedMem));
  47. return 0;
  48. }
  49. public long ActivateDebugPad(ServiceCtx Context)
  50. {
  51. Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
  52. return 0;
  53. }
  54. public long ActivateTouchScreen(ServiceCtx Context)
  55. {
  56. long AppletResourceUserId = Context.RequestData.ReadInt64();
  57. Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
  58. return 0;
  59. }
  60. public long ActivateMouse(ServiceCtx Context)
  61. {
  62. long AppletResourceUserId = Context.RequestData.ReadInt64();
  63. Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
  64. return 0;
  65. }
  66. public long ActivateKeyboard(ServiceCtx Context)
  67. {
  68. long AppletResourceUserId = Context.RequestData.ReadInt64();
  69. Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
  70. return 0;
  71. }
  72. public long StartSixAxisSensor(ServiceCtx Context)
  73. {
  74. int Handle = Context.RequestData.ReadInt32();
  75. long AppletResourceUserId = Context.RequestData.ReadInt64();
  76. Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
  77. return 0;
  78. }
  79. public long SetGyroscopeZeroDriftMode(ServiceCtx Context)
  80. {
  81. int Handle = Context.RequestData.ReadInt32();
  82. int Unknown = Context.RequestData.ReadInt32();
  83. long AppletResourceUserId = Context.RequestData.ReadInt64();
  84. Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
  85. return 0;
  86. }
  87. public long AcquireNpadStyleSetUpdateEventHandle(ServiceCtx Context)
  88. {
  89. int Handle = Context.Process.HandleTable.OpenHandle(NpadStyleSetUpdateEvent);
  90. Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle);
  91. return 0;
  92. }
  93. public long GetSupportedNpadStyleSet(ServiceCtx Context)
  94. {
  95. Context.ResponseData.Write(0);
  96. Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
  97. return 0;
  98. }
  99. public long SetSupportedNpadStyleSet(ServiceCtx Context)
  100. {
  101. long Unknown0 = Context.RequestData.ReadInt64();
  102. long Unknown8 = Context.RequestData.ReadInt64();
  103. Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
  104. return 0;
  105. }
  106. public long SetSupportedNpadIdType(ServiceCtx Context)
  107. {
  108. long Unknown = Context.RequestData.ReadInt64();
  109. Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
  110. return 0;
  111. }
  112. public long ActivateNpad(ServiceCtx Context)
  113. {
  114. long Unknown = Context.RequestData.ReadInt64();
  115. Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
  116. return 0;
  117. }
  118. public long GetPlayerLedPattern(ServiceCtx Context)
  119. {
  120. long Unknown = Context.RequestData.ReadInt32();
  121. Context.ResponseData.Write(0L);
  122. Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
  123. return 0;
  124. }
  125. public long SetNpadJoyHoldType(ServiceCtx Context)
  126. {
  127. long Unknown0 = Context.RequestData.ReadInt64();
  128. long Unknown8 = Context.RequestData.ReadInt64();
  129. Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
  130. return 0;
  131. }
  132. public long GetNpadJoyHoldType(ServiceCtx Context)
  133. {
  134. Context.ResponseData.Write(0L);
  135. Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
  136. return 0;
  137. }
  138. public long SetNpadJoyAssignmentModeSingleByDefault(ServiceCtx Context)
  139. {
  140. HidControllerId HidControllerId = (HidControllerId)Context.RequestData.ReadInt32();
  141. long AppletUserResourceId = Context.RequestData.ReadInt64();
  142. Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
  143. return 0;
  144. }
  145. public long SetNpadJoyAssignmentModeSingle(ServiceCtx Context)
  146. {
  147. HidControllerId HidControllerId = (HidControllerId)Context.RequestData.ReadInt32();
  148. long AppletUserResourceId = Context.RequestData.ReadInt64();
  149. long NpadJoyDeviceType = Context.RequestData.ReadInt64();
  150. Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
  151. return 0;
  152. }
  153. public long SetNpadJoyAssignmentModeDual(ServiceCtx Context)
  154. {
  155. HidControllerId HidControllerId = (HidControllerId)Context.RequestData.ReadInt32();
  156. long AppletUserResourceId = Context.RequestData.ReadInt64();
  157. Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
  158. return 0;
  159. }
  160. public long MergeSingleJoyAsDualJoy(ServiceCtx Context)
  161. {
  162. long Unknown0 = Context.RequestData.ReadInt32();
  163. long Unknown8 = Context.RequestData.ReadInt32();
  164. long AppletUserResourceId = Context.RequestData.ReadInt64();
  165. Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
  166. return 0;
  167. }
  168. public long SetNpadHandheldActivationMode(ServiceCtx Context)
  169. {
  170. long AppletUserResourceId = Context.RequestData.ReadInt64();
  171. long Unknown = Context.RequestData.ReadInt64();
  172. Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
  173. return 0;
  174. }
  175. public long GetVibrationDeviceInfo(ServiceCtx Context)
  176. {
  177. int VibrationDeviceHandle = Context.RequestData.ReadInt32();
  178. Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
  179. Context.ResponseData.Write(0L); //VibrationDeviceInfoForIpc
  180. return 0;
  181. }
  182. public long SendVibrationValue(ServiceCtx Context)
  183. {
  184. int VibrationDeviceHandle = Context.RequestData.ReadInt32();
  185. int VibrationValue1 = Context.RequestData.ReadInt32();
  186. int VibrationValue2 = Context.RequestData.ReadInt32();
  187. int VibrationValue3 = Context.RequestData.ReadInt32();
  188. int VibrationValue4 = Context.RequestData.ReadInt32();
  189. long AppletUserResourceId = Context.RequestData.ReadInt64();
  190. Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
  191. return 0;
  192. }
  193. public long CreateActiveVibrationDeviceList(ServiceCtx Context)
  194. {
  195. MakeObject(Context, new IActiveApplicationDeviceList());
  196. return 0;
  197. }
  198. public long SendVibrationValues(ServiceCtx Context)
  199. {
  200. Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed.");
  201. return 0;
  202. }
  203. }
  204. }