IHidServer.cs 8.6 KB

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