slp-enforcer
Version:
Finds violations of the Melee Controller Ruleset by inspecting SLP files (WASM-powered)
189 lines (170 loc) • 7.46 kB
TypeScript
/* tslint:disable */
/* eslint-disable */
/**
* A 2D coordinate representing joystick position
* Values are normalized from -1.0 to 1.0
*/
export class Coord {
free(): void;
[Symbol.dispose](): void;
constructor(x: number, y: number);
x: number;
y: number;
}
/**
* A parsed SLP game that can be queried without re-parsing.
* Construct with `new SlpGame(slpBytes)`, then call methods on it.
* Call `.free()` when done to release Wasm memory.
*/
export class SlpGame {
free(): void;
[Symbol.dispose](): void;
/**
* Run all applicable checks on a player and return structured results.
* Controller type is detected once; only relevant checks are run.
*/
analyzePlayer(player_index: number): any;
/**
* Extract C-stick coordinates for a player
*/
getCStickCoords(player_index: number): any;
/**
* Extract game settings (stage, players)
*/
getGameSettings(): any;
/**
* Extract main stick coordinates for a player
*/
getMainStickCoords(player_index: number): any;
/**
* Detect if a player is using a box controller
*/
isBoxController(player_index: number): boolean;
/**
* Check if the game is a handwarmer
*/
isHandwarmer(): boolean;
/**
* Check if SLP version is below 3.15.0
*/
isSlpMinVersion(): boolean;
/**
* Parse an SLP file. The parsed game is held in Wasm memory
* until `.free()` is called.
*/
constructor(slp_bytes: Uint8Array);
}
/**
* Calculate the average travel coordinate hit rate
*/
export function average_travel_coord_hit_rate(coords: any): number;
/**
* Float equality comparison with epsilon tolerance (0.0001)
*/
export function float_equals(a: number, b: number): boolean;
/**
* Get C-stick violations from a coordinate array
*/
export function get_cstick_violations(coords: any): any;
/**
* Classify joystick position into one of 9 regions
* Returns: 0=DZ, 1=NE, 2=SE, 3=SW, 4=NW, 5=N, 6=E, 7=S, 8=W
*/
export function get_joystick_region(x: number, y: number): number;
/**
* Get target coordinates (coords held for 2+ consecutive frames)
*/
export function get_target_coords(coords: any): any;
/**
* Get unique coordinates from a list (deduplicated by value)
*/
export function get_unique_coords(coords: any): any;
/**
* Check if coordinates show GoomWave clamping
*/
export function has_goomwave_clamping(coords: any): boolean;
export function init(): void;
/**
* Detect if coordinates match a box controller (from coord array)
*/
export function is_box_controller_from_coords(coords: any): boolean;
/**
* Check if two coordinates are equal within float tolerance
*/
export function is_equal(one: any, other: any): boolean;
/**
* Process raw analog stick values into normalized coordinates
*/
export function process_analog_stick(x: number, y: number, deadzone: boolean): any;
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
export interface InitOutput {
readonly memory: WebAssembly.Memory;
readonly __wbg_coord_free: (a: number, b: number) => void;
readonly __wbg_get_coord_x: (a: number) => number;
readonly __wbg_get_coord_y: (a: number) => number;
readonly __wbg_set_coord_x: (a: number, b: number) => void;
readonly __wbg_set_coord_y: (a: number, b: number) => void;
readonly __wbg_slpgame_free: (a: number, b: number) => void;
readonly average_travel_coord_hit_rate: (a: any) => [number, number, number];
readonly float_equals: (a: number, b: number) => number;
readonly get_cstick_violations: (a: any) => [number, number, number];
readonly get_joystick_region: (a: number, b: number) => number;
readonly get_target_coords: (a: any) => [number, number, number];
readonly get_unique_coords: (a: any) => [number, number, number];
readonly has_goomwave_clamping: (a: any) => [number, number, number];
readonly is_box_controller_from_coords: (a: any) => [number, number, number];
readonly is_equal: (a: any, b: any) => [number, number, number];
readonly process_analog_stick: (a: number, b: number, c: number) => [number, number, number];
readonly slpgame_analyzePlayer: (a: number, b: number) => [number, number, number];
readonly slpgame_getCStickCoords: (a: number, b: number) => [number, number, number];
readonly slpgame_getGameSettings: (a: number) => [number, number, number];
readonly slpgame_getMainStickCoords: (a: number, b: number) => [number, number, number];
readonly slpgame_isBoxController: (a: number, b: number) => [number, number, number];
readonly slpgame_isHandwarmer: (a: number) => number;
readonly slpgame_isSlpMinVersion: (a: number) => number;
readonly slpgame_new: (a: number, b: number) => [number, number, number];
readonly init: () => void;
readonly coord_new: (a: number, b: number) => number;
readonly rust_zstd_wasm_shim_calloc: (a: number, b: number) => number;
readonly rust_zstd_wasm_shim_free: (a: number) => void;
readonly rust_zstd_wasm_shim_malloc: (a: number) => number;
readonly rust_zstd_wasm_shim_memcmp: (a: number, b: number, c: number) => number;
readonly rust_zstd_wasm_shim_memcpy: (a: number, b: number, c: number) => number;
readonly rust_zstd_wasm_shim_memmove: (a: number, b: number, c: number) => number;
readonly rust_zstd_wasm_shim_memset: (a: number, b: number, c: number) => number;
readonly rust_zstd_wasm_shim_qsort: (a: number, b: number, c: number, d: number) => void;
readonly rust_lz4_wasm_shim_calloc: (a: number, b: number) => number;
readonly rust_lz4_wasm_shim_free: (a: number) => void;
readonly rust_lz4_wasm_shim_malloc: (a: number) => number;
readonly rust_lz4_wasm_shim_memcmp: (a: number, b: number, c: number) => number;
readonly rust_lz4_wasm_shim_memcpy: (a: number, b: number, c: number) => number;
readonly rust_lz4_wasm_shim_memmove: (a: number, b: number, c: number) => number;
readonly rust_lz4_wasm_shim_memset: (a: number, b: number, c: number) => number;
readonly __wbindgen_malloc: (a: number, b: number) => number;
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
readonly __wbindgen_exn_store: (a: number) => void;
readonly __externref_table_alloc: () => number;
readonly __wbindgen_externrefs: WebAssembly.Table;
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
readonly __externref_table_dealloc: (a: number) => void;
readonly __wbindgen_start: () => void;
}
export type SyncInitInput = BufferSource | WebAssembly.Module;
/**
* Instantiates the given `module`, which can either be bytes or
* a precompiled `WebAssembly.Module`.
*
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
*
* @returns {InitOutput}
*/
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
/**
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
* for everything else, calls `WebAssembly.instantiate` directly.
*
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
*
* @returns {Promise<InitOutput>}
*/
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;