UNPKG

slp-enforcer

Version:

Finds violations of the Melee Controller Ruleset by inspecting SLP files (WASM-powered)

83 lines (82 loc) 2.78 kB
import { SlpGame } from '../pkg/web/libenforcer_wasm.js'; /** A 2D coordinate representing joystick position (values normalized -1.0 to 1.0) */ export type Coord = { x: number; y: number; }; /** Represents a single violation of a rule */ export type Violation = { metric: number; reason: string; evidence: Coord[]; }; /** Result of running a single check */ export type CheckResult = { result: boolean; details: Violation[]; }; /** Controller type classification */ export type ControllerType = "Box" | "Analog"; /** Detailed statistical analysis of input fuzzing compliance */ export type FuzzAnalysis = { pass: boolean; llr_score: number; p_value_x: number | null; p_value_y: number | null; total_fuzz_events: number; observed_x: [number, number, number]; observed_y: [number, number, number]; violations: Violation[]; }; /** Full analysis results for a single player */ export type PlayerAnalysis = { controller_type: ControllerType; is_legal: boolean; travel_time?: CheckResult; disallowed_cstick?: CheckResult; crouch_uptilt?: CheckResult; sdi?: CheckResult; input_fuzzing?: FuzzAnalysis; goomwave?: CheckResult; uptilt_rounding?: CheckResult; }; export type GameSettings = { stageId: number; players: { playerIndex: number; characterId: number; playerType: number; characterColor: number; }[]; }; export declare enum JoystickRegion { DZ = 0, NE = 1, SE = 2, SW = 3, NW = 4, N = 5, E = 6, S = 7, W = 8 } /** * Initialize the WASM module. Must be called once before using any other function. * * Call with no arguments to load from the default URL (relative to the module), * or pass a custom URL/path/Response to the .wasm file if your bundler requires it. * You may also pass raw WASM bytes (ArrayBuffer/Uint8Array) for synchronous initialization. */ export default function init(wasmSource?: any): Promise<void>; export { init }; export { SlpGame }; export declare function isBoxControllerFromCoords(coords: Coord[]): boolean; export declare function getCStickViolations(coords: Coord[]): CheckResult; export declare function averageTravelCoordHitRate(coords: Coord[]): number; export declare function hasGoomwaveClamping(coords: Coord[]): boolean; export declare function getJoystickRegion(x: number, y: number): JoystickRegion; export declare function processAnalogStick(x: number, y: number, deadzone: boolean): Coord; export declare function FloatEquals(a: number, b: number): boolean; export declare function isEqual(one: Coord, other: Coord): boolean; export declare function getUniqueCoords(coords: Coord[]): Coord[]; export declare function getTargetCoords(coords: Coord[]): Coord[];