{"_id":"@bun-win32/dinput8","_rev":"4-cffd8b56780e0642fa46a04fbdf4fe97","name":"@bun-win32/dinput8","dist-tags":{"latest":"2.0.1"},"versions":{"1.0.0":{"name":"@bun-win32/dinput8","version":"1.0.0","keywords":["bun","ffi","win32","windows","dinput8","directinput","joystick","gamepad","controller","input","bindings","typescript","dll"],"author":"Stev Peifer <stev@bell.net>","license":"MIT","_id":"@bun-win32/dinput8@1.0.0","maintainers":[{"name":"obscuritysrl","email":"stev@bell.net"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"859466af497c2d16ef62b6af914ea0e1061b22f6","tarball":"https://registry.npmjs.org/@bun-win32/dinput8/-/dinput8-1.0.0.tgz","fileCount":6,"integrity":"sha512-fgbESRRypIo+qbnmY3KTYgP3et1ey8DSSfmwhS/E2ZqToH6uxTAiMPL4pQ5bvqE2QIOT/MjmTaCwNPi2Xrr9ug==","signatures":[{"sig":"MEUCICsav+IhJPeFxkHuvyUEjYDuPbSqxuyZfQm2C0tfV2WAAiEA7UZRgqC7FQ/OiYwspCuIOdfCS8jQ/GX89H6lQimqf/I=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":12644},"main":"./index.ts","type":"module","module":"index.ts","shasum":"859466af497c2d16ef62b6af914ea0e1061b22f6","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:device-census":"bun ./example/device-census.ts","example:controller-scope":"bun ./example/controller-scope.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-fgbESRRypIo+qbnmY3KTYgP3et1ey8DSSfmwhS/E2ZqToH6uxTAiMPL4pQ5bvqE2QIOT/MjmTaCwNPi2Xrr9ug==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/dinput8"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 DINPUT8 bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@bun-win32/core":"1.1.2"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","@types/node":"^25.6.0"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/dinput8_1.0.0_1779077506472_0.10130533640420936","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@bun-win32/dinput8","version":"1.0.1","keywords":["bun","ffi","win32","windows","dinput8","directinput","joystick","gamepad","controller","input","bindings","typescript","dll"],"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","_id":"@bun-win32/dinput8@1.0.1","maintainers":[{"name":"obscuritysrl","email":"stev@bell.net"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"87b9df58eaaf6e5cf06d4688b97e66253b2114da","tarball":"https://registry.npmjs.org/@bun-win32/dinput8/-/dinput8-1.0.1.tgz","fileCount":6,"integrity":"sha512-bQKLK+1iEekbAbEINeRnst01b4WAwnSaQvAY0sx/k5dcB1xgx3e8+XUAH3zCh0ijjZO8DxbRL5Jc7l9rjnxi0g==","signatures":[{"sig":"MEUCIQCLdqmMvtNuNoia5SzNDjtXifW/1FkhDLVcfIRF3hUDVQIgPDNfl9VW1sqeclNpu5GJ2YiDlbb1PZlhvwsYq/ecCVI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":12649},"main":"./index.ts","type":"module","module":"index.ts","shasum":"87b9df58eaaf6e5cf06d4688b97e66253b2114da","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:device-census":"bun ./example/device-census.ts","example:controller-scope":"bun ./example/controller-scope.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-bQKLK+1iEekbAbEINeRnst01b4WAwnSaQvAY0sx/k5dcB1xgx3e8+XUAH3zCh0ijjZO8DxbRL5Jc7l9rjnxi0g==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/dinput8"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 DINPUT8 bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@bun-win32/core":"1.1.4"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","@types/node":"^25.6.0"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/dinput8_1.0.1_1781130816357_0.481729344467001","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@bun-win32/dinput8","version":"2.0.0","keywords":["bun","ffi","win32","windows","dinput8","directinput","joystick","gamepad","controller","input","bindings","typescript","dll"],"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","_id":"@bun-win32/dinput8@2.0.0","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"5f75d77d17c4a5ca9f2044b24619c445b5bfeb31","tarball":"https://registry.npmjs.org/@bun-win32/dinput8/-/dinput8-2.0.0.tgz","fileCount":6,"integrity":"sha512-1wOqWhNEJyghqr3nA0NFF+0noyYHyh+aCLaFJhUr3hZXfD0lTCXHuQqM5szQwp+9/cCy5TxHDJAKCpOFuEx7GQ==","signatures":[{"sig":"MEYCIQDXjcvUpgKGueSJbP+GAImwfuiBIxitNsCg6IOzyzhz+QIhALYgoiy6jjgb/uQZX/XLjgwdqSnvWsdpjhnsWEH+XRn4","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13936},"main":"./index.ts","type":"module","module":"index.ts","shasum":"5f75d77d17c4a5ca9f2044b24619c445b5bfeb31","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:device-census":"bun ./example/device-census.ts","example:controller-scope":"bun ./example/controller-scope.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"_integrity":"sha512-1wOqWhNEJyghqr3nA0NFF+0noyYHyh+aCLaFJhUr3hZXfD0lTCXHuQqM5szQwp+9/cCy5TxHDJAKCpOFuEx7GQ==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/dinput8"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 DINPUT8 bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"26.3.0","dependencies":{"@bun-win32/core":"2.0.0"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","@types/node":"^25.6.0"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/dinput8_2.0.0_1782435294682_0.1057491473835448","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"author":"Stev Peifer <stev.p@outlook.com>","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dependencies":{"@bun-win32/core":"2.0.1"},"description":"Zero-dependency, zero-overhead Win32 DINPUT8 bindings for Bun (FFI) on Windows.","devDependencies":{"@types/bun":"latest","@types/node":"^25.6.0"},"exports":{".":"./index.ts"},"license":"MIT","module":"index.ts","name":"@bun-win32/dinput8","peerDependencies":{"typescript":"^5"},"private":false,"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/dinput8"},"type":"module","version":"2.0.1","main":"./index.ts","keywords":["bun","ffi","win32","windows","dinput8","directinput","joystick","gamepad","controller","input","bindings","typescript","dll"],"sideEffects":false,"engines":{"bun":">=1.1.0"},"scripts":{"example:controller-scope":"bun ./example/controller-scope.ts","example:device-census":"bun ./example/device-census.ts"},"_id":"@bun-win32/dinput8@2.0.1","_integrity":"sha512-t+M9/bhwwe9woXTO1oD5vkwcQnHebdBJTSZYbD5EwR+2VgnDJL5B8Dqqte39HkNUePyDlFwoSuMHFxlXh5akGw==","_nodeVersion":"26.3.0","_npmVersion":"10.8.3","shasum":"b8f37d83baa5e4d216245fc953e610d5599cd0ca","dist":{"integrity":"sha512-t+M9/bhwwe9woXTO1oD5vkwcQnHebdBJTSZYbD5EwR+2VgnDJL5B8Dqqte39HkNUePyDlFwoSuMHFxlXh5akGw==","shasum":"b8f37d83baa5e4d216245fc953e610d5599cd0ca","tarball":"https://registry.npmjs.org/@bun-win32/dinput8/-/dinput8-2.0.1.tgz","fileCount":6,"unpackedSize":13936,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIErsippJthFJ9TTUzMu8Yh/THJY4S63g7k0A6Ga68NipAiA/iNmB/BBXqlA53JP7FuFBeJhJ+ojcJSIGCt7ie6DPWQ=="}]},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"directories":{},"maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/dinput8_2.0.1_1782437753939_0.042368112238281075"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-18T04:11:46.339Z","modified":"2026-06-26T01:35:54.224Z","1.0.0":"2026-05-18T04:11:46.629Z","1.0.1":"2026-06-10T22:33:36.519Z","2.0.0":"2026-06-26T00:54:54.828Z","2.0.1":"2026-06-26T01:35:54.086Z"},"bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","homepage":"https://github.com/ObscuritySRL/bun-win32#readme","keywords":["bun","ffi","win32","windows","dinput8","directinput","joystick","gamepad","controller","input","bindings","typescript","dll"],"repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/dinput8"},"description":"Zero-dependency, zero-overhead Win32 DINPUT8 bindings for Bun (FFI) on Windows.","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"readme":"# @bun-win32/dinput8\n\nZero-dependency, zero-overhead Win32 Dinput8 bindings for [Bun](https://bun.sh) on Windows.\n\n## Overview\n\n`@bun-win32/dinput8` exposes the `dinput8.dll` exports using [Bun](https://bun.sh)'s FFI. It provides a single class, `Dinput8`, which lazily binds native symbols on first use. You can optionally preload a subset or all symbols up-front via `Preload()`.\n\n`dinput8.dll` is the DirectInput 8 runtime — the path to **every non-Xbox controller**: racing wheels, flight sticks / HOTAS, generic USB gamepads, and legacy adapters that `XInput` (Xbox-class only) cannot see. The flat `DirectInput8Create` export hands you an `IDirectInput8` COM object; from there device enumeration, acquisition, and polling are driven over the COM vtable (see the examples). `GetdfDIJoystick` returns the predefined joystick data format used with `IDirectInputDevice8::SetDataFormat`.\n\nThe bindings are strongly typed for a smooth DX in TypeScript.\n\n## Features\n\n- [Bun](https://bun.sh)-first ergonomics on Windows 10/11.\n- Direct FFI to `dinput8.dll` (DirectInput 8 object creation, COM class factory, and the predefined joystick data format).\n- In-source docs in `structs/Dinput8.ts` with links to Microsoft Docs.\n- Lazy binding on first call; optional eager preload (`Dinput8.Preload()`).\n- No wrapper overhead; calls map 1:1 to native APIs.\n- Strongly-typed Win32 aliases (see `types/Dinput8.ts`).\n\n## Requirements\n\n- [Bun](https://bun.sh) runtime\n- Windows 10 or later\n\n## Installation\n\n```sh\nbun add @bun-win32/dinput8\n```\n\n## Quick Start\n\n```ts\nimport Dinput8, { DIRECTINPUT_VERSION, IID_IDirectInput8W } from '@bun-win32/dinput8';\n\n// IID_IDirectInput8W → 16-byte little-endian GUID buffer\nconst guid = (s: string): Buffer => {\n  const m = /^(.{8})-(.{4})-(.{4})-(.{4})-(.{12})$/.exec(s)!;\n  const b = Buffer.alloc(16);\n  b.writeUInt32LE(parseInt(m[1], 16), 0);\n  b.writeUInt16LE(parseInt(m[2], 16), 4);\n  b.writeUInt16LE(parseInt(m[3], 16), 6);\n  const tail = m[4] + m[5];\n  for (let i = 0; i < 8; i += 1) b[8 + i] = parseInt(tail.slice(i * 2, i * 2 + 2), 16);\n  return b;\n};\n\nconst iid = guid(IID_IDirectInput8W);\nconst ppDI = Buffer.alloc(8);\n\n// hinst may be 0n — DirectInput uses it only for app-certification heuristics\nconst hr = Dinput8.DirectInput8Create(0n, DIRECTINPUT_VERSION, iid.ptr!, ppDI.ptr!, null);\nif (hr === 0) {\n  const pIDirectInput8 = ppDI.readBigUInt64LE(0);\n  console.log(`IDirectInput8 @ 0x${pIDirectInput8.toString(16)}`);\n}\n```\n\n> [!NOTE]\n> AI agents: see `AI.md` for the package binding contract and source-navigation guidance. It explains how to use the package without scanning the entire implementation.\n\n## Examples\n\nRun the included examples:\n\n```sh\nbun run example:controller-scope\nbun run example:device-census\n```\n\n## Notes\n\n- Either rely on lazy binding or call `Dinput8.Preload()`.\n- Windows only. Bun runtime required.\n- **SAL types & naming:** nullability is in the **type** — `Optional<T>` (formally optional, SAL `_*opt_`) and `Nullable<T>` (plain `[in]`/`[out]` the docs say can be NULL), the null sentinel derived from `T` (`null` for pointers `LP*`/`P*`, `0n` for handles/by-value addresses); direction is in the **parameter name** — `_out` (`_Out_`), `_in_out` (`_Inout_`), `_In_` bare. See `AI.md` and the repo `AGENTS.md`.\n","readmeFilename":"README.md"}