fix(controller): save remaps per profile, gate modals on enabled (#69)

This commit is contained in:
2026-05-16 20:43:27 -07:00
committed by GitHub
parent 49f89e6452
commit 5250ca8214
31 changed files with 1639 additions and 463 deletions
+22
View File
@@ -0,0 +1,22 @@
import type { ResolvedControllerConfig, ResolvedControllerProfileConfig } from '../types';
export function getControllerProfile(
config: ResolvedControllerConfig | null,
gamepadId: string | null | undefined,
): ResolvedControllerProfileConfig | null {
if (!config || !gamepadId) return null;
return config.profiles[gamepadId] ?? null;
}
export function resolveControllerConfigForGamepad(
config: ResolvedControllerConfig,
gamepadId: string | null | undefined,
): ResolvedControllerConfig {
const profile = getControllerProfile(config, gamepadId);
if (!profile) return config;
return {
...config,
buttonIndices: profile.buttonIndices,
bindings: profile.bindings,
};
}