-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MAJOR] Support browser environments using WebHID (#81)
* Abstract HID provider to support WebHID * Rework HID report handling * Remove eventemitter from DualsenseHID * Stop using EventEmitter for Inputs * Clean up adoption business * Debug new inputs, clean up settings passthroughs * Adding webpack to the build * Fix types on event callbacks * Replace `setImmediate()`
- Loading branch information
Showing
26 changed files
with
2,510 additions
and
727 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* Input state change checker that always returns true. | ||
*/ | ||
export function VirtualComparator(): boolean { | ||
return true; | ||
} | ||
|
||
/** | ||
* Input state change checker that considers a numeric threshold. | ||
*/ | ||
export function ThresholdComparator( | ||
threshold: number, | ||
state: unknown, | ||
newState: unknown | ||
): boolean { | ||
if (typeof state !== "number" || typeof newState !== "number") | ||
throw new Error("Bad threshold comparison"); | ||
return Math.abs(state - newState) > threshold; | ||
} | ||
|
||
/** | ||
* Input state change checker for most values. | ||
*/ | ||
export function BasicComparator(state: unknown, newState: unknown): boolean { | ||
return state !== newState; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.