hidpi.odin 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. // +build windows
  2. package sys_windows
  3. import "core:c"
  4. USAGE :: distinct USHORT
  5. PUSAGE :: ^USAGE
  6. HIDP_CAPS :: struct {
  7. Usage: USAGE,
  8. UsagePage: USAGE,
  9. InputReportByteLength: USHORT,
  10. OutputReportByteLength: USHORT,
  11. FeatureReportByteLength: USHORT,
  12. Reserved: [17]USHORT,
  13. NumberLinkCollectionNodes: USHORT,
  14. NumberInputButtonCaps: USHORT,
  15. NumberInputValueCaps: USHORT,
  16. NumberInputDataIndices: USHORT,
  17. NumberOutputButtonCaps: USHORT,
  18. NumberOutputValueCaps: USHORT,
  19. NumberOutputDataIndices: USHORT,
  20. NumberFeatureButtonCaps: USHORT,
  21. NumberFeatureValueCaps: USHORT,
  22. NumberFeatureDataIndices: USHORT,
  23. }
  24. PHIDP_CAPS :: ^HIDP_CAPS
  25. HIDP_BUTTON_CAPS :: struct {
  26. UsagePage: USAGE,
  27. ReportID: UCHAR,
  28. IsAlias: BOOLEAN,
  29. BitField: USHORT,
  30. LinkCollection: USHORT,
  31. LinkUsage: USAGE,
  32. LinkUsagePage: USAGE,
  33. IsRange: BOOLEAN,
  34. IsStringRange: BOOLEAN,
  35. IsDesignatorRange: BOOLEAN,
  36. IsAbsolute: BOOLEAN,
  37. ReportCount: USHORT,
  38. Reserved2: USHORT,
  39. Reserved: [9]ULONG,
  40. using _: struct #raw_union {
  41. Range: struct {
  42. UsageMin: USAGE,
  43. UsageMax: USAGE,
  44. StringMin: USHORT,
  45. StringMax: USHORT,
  46. DesignatorMin: USHORT,
  47. DesignatorMax: USHORT,
  48. DataIndexMin: USHORT,
  49. DataIndexMax: USHORT,
  50. },
  51. NotRange: struct {
  52. Usage: USAGE,
  53. Reserved1: USAGE,
  54. StringIndex: USHORT,
  55. Reserved2: USHORT,
  56. DesignatorIndex: USHORT,
  57. Reserved3: USHORT,
  58. DataIndex: USHORT,
  59. Reserved4: USHORT,
  60. },
  61. },
  62. }
  63. PHIDP_BUTTON_CAPS :: ^HIDP_BUTTON_CAPS
  64. HIDP_VALUE_CAPS :: struct {
  65. UsagePage: USAGE,
  66. ReportID: UCHAR,
  67. IsAlias: BOOLEAN,
  68. BitField: USHORT,
  69. LinkCollection: USHORT,
  70. LinkUsage: USAGE,
  71. LinkUsagePage: USAGE,
  72. IsRange: BOOLEAN,
  73. IsStringRange: BOOLEAN,
  74. IsDesignatorRange: BOOLEAN,
  75. IsAbsolute: BOOLEAN,
  76. HasNull: BOOLEAN,
  77. Reserved: UCHAR,
  78. BitSize: USHORT,
  79. ReportCount: USHORT,
  80. Reserved2: [5]USHORT,
  81. UnitsExp: ULONG,
  82. Units: ULONG,
  83. LogicalMin: LONG,
  84. LogicalMax: LONG,
  85. PhysicalMin: LONG,
  86. PhysicalMax: LONG,
  87. using _: struct #raw_union {
  88. Range: struct {
  89. UsageMin: USAGE,
  90. UsageMax: USAGE,
  91. StringMin: USHORT,
  92. StringMax: USHORT,
  93. DesignatorMin: USHORT,
  94. DesignatorMax: USHORT,
  95. DataIndexMin: USHORT,
  96. DataIndexMax: USHORT,
  97. },
  98. NotRange: struct {
  99. Usage: USAGE,
  100. Reserved1: USAGE,
  101. StringIndex: USHORT,
  102. Reserved2: USHORT,
  103. DesignatorIndex: USHORT,
  104. Reserved3: USHORT,
  105. DataIndex: USHORT,
  106. Reserved4: USHORT,
  107. },
  108. },
  109. }
  110. PHIDP_VALUE_CAPS :: ^HIDP_VALUE_CAPS
  111. PHIDP_PREPARSED_DATA :: rawptr
  112. HIDP_REPORT_TYPE :: enum c.int {
  113. Input,
  114. Output,
  115. Feature,
  116. }
  117. HIDP_STATUS_SUCCESS : NTSTATUS : 0x110000
  118. foreign import hid "system:hid.lib"
  119. @(default_calling_convention="system")
  120. foreign hid {
  121. HidP_GetCaps :: proc(PreparsedData: PHIDP_PREPARSED_DATA, Capabilities: PHIDP_CAPS) -> NTSTATUS ---
  122. HidP_GetButtonCaps :: proc(ReportType: HIDP_REPORT_TYPE, ButtonCaps: PHIDP_BUTTON_CAPS, ButtonCapsLength: PUSHORT, PreparsedData: PHIDP_PREPARSED_DATA) -> NTSTATUS ---
  123. HidP_GetValueCaps :: proc(ReportType: HIDP_REPORT_TYPE, ValueCaps: PHIDP_VALUE_CAPS, ValueCapsLength: PUSHORT, PreparsedData: PHIDP_PREPARSED_DATA) -> NTSTATUS ---
  124. HidP_GetUsages :: proc(ReportType: HIDP_REPORT_TYPE, UsagePage: USAGE, LinkCollection: USHORT, UsageList: PUSAGE, UsageLength: PULONG, PreparsedData: PHIDP_PREPARSED_DATA, Report: PCHAR, ReportLength: ULONG) -> NTSTATUS ---
  125. HidP_GetUsageValue :: proc(ReportType: HIDP_REPORT_TYPE, UsagePage: USAGE, LinkCollection: USHORT, Usage: USAGE, UsageValue: PULONG, PreparsedData: PHIDP_PREPARSED_DATA, Report: PCHAR, ReportLength: ULONG) -> NTSTATUS ---
  126. }