@maaxyz/maa-node 5.3.3 → 5.4.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -125,6 +125,7 @@ declare global {
125
125
  ScreencapOrInputMethods
126
126
  >
127
127
  const DbgControllerType: Record<'CarouselImage' | 'ReplayRecording', Uint64>
128
+ const GamepadType: Record<'Xbox360' | 'DualShock4', Uint64>
128
129
  }
129
130
  }
130
131
  export {}
@@ -138,13 +138,20 @@ declare global {
138
138
  set screenshot_use_raw_size(value: boolean)
139
139
 
140
140
  post_connection(): Job<CtrlId, Controller>
141
- post_click(x: number, y: number): Job<CtrlId, Controller>
141
+ post_click(
142
+ x: number,
143
+ y: number,
144
+ contact?: number,
145
+ pressure?: number,
146
+ ): Job<CtrlId, Controller>
142
147
  post_swipe(
143
148
  x1: number,
144
149
  y1: number,
145
150
  x2: number,
146
151
  y2: number,
147
152
  duration: number,
153
+ contact?: number,
154
+ pressure?: number,
148
155
  ): Job<CtrlId, Controller>
149
156
  post_click_key(keycode: number): Job<CtrlId, Controller>
150
157
  post_input_text(text: string): Job<CtrlId, Controller>
@@ -180,6 +187,7 @@ declare global {
180
187
  get connected(): boolean
181
188
  get cached_image(): ImageData | null
182
189
  get uuid(): string | null
190
+ get resolution(): [width: number, height: number] | null
183
191
  }
184
192
 
185
193
  type AdbDevice = [
@@ -231,8 +239,28 @@ declare global {
231
239
  )
232
240
  }
233
241
 
242
+ /**
243
+ * Virtual gamepad controller for Windows (requires ViGEm Bus Driver).
244
+ *
245
+ * Control mapping:
246
+ * - click_key/key_down/key_up: Digital buttons (use GamepadButton constants)
247
+ * - touch_down/touch_move/touch_up: Analog sticks and triggers (use GamepadContact constants)
248
+ * - contact 0: Left stick (x, y: -32768~32767)
249
+ * - contact 1: Right stick (x, y: -32768~32767)
250
+ * - contact 2: Left trigger (pressure: 0~255)
251
+ * - contact 3: Right trigger (pressure: 0~255)
252
+ */
253
+ class GamepadController extends Controller {
254
+ constructor(
255
+ hwnd: DesktopHandle | null, // Window handle for screencap (can be null)
256
+ gamepad_type: Uint64, // GamepadType (Xbox360 or DualShock4)
257
+ screencap_method: ScreencapOrInputMethods,
258
+ )
259
+ }
260
+
234
261
  interface CustomControllerActor {
235
262
  connect?(): maa.MaybePromise<boolean>
263
+ connected?(): maa.MaybePromise<boolean>
236
264
  request_uuid?(): maa.MaybePromise<string | null>
237
265
  get_features?(): maa.MaybePromise<null | ('mouse' | 'keyboard')[]>
238
266
  start_app?(intent: string): maa.MaybePromise<boolean>
package/package.json CHANGED
@@ -28,13 +28,13 @@
28
28
  "prettier": "^3.5.2",
29
29
  "typescript": "^5.8.2"
30
30
  },
31
- "version": "5.3.3",
31
+ "version": "5.4.0-alpha.2",
32
32
  "optionalDependencies": {
33
- "@maaxyz/maa-node-darwin-arm64": "5.3.3",
34
- "@maaxyz/maa-node-darwin-x64": "5.3.3",
35
- "@maaxyz/maa-node-linux-arm64": "5.3.3",
36
- "@maaxyz/maa-node-linux-x64": "5.3.3",
37
- "@maaxyz/maa-node-win32-arm64": "5.3.3",
38
- "@maaxyz/maa-node-win32-x64": "5.3.3"
33
+ "@maaxyz/maa-node-darwin-arm64": "5.4.0-alpha.2",
34
+ "@maaxyz/maa-node-darwin-x64": "5.4.0-alpha.2",
35
+ "@maaxyz/maa-node-linux-arm64": "5.4.0-alpha.2",
36
+ "@maaxyz/maa-node-linux-x64": "5.4.0-alpha.2",
37
+ "@maaxyz/maa-node-win32-arm64": "5.4.0-alpha.2",
38
+ "@maaxyz/maa-node-win32-x64": "5.4.0-alpha.2"
39
39
  }
40
40
  }