fix: preserve PortMaster controller mappings through Weston

This commit is contained in:
Alexander Sellite 2026-08-16 10:38:24 -04:00
parent 4cffe47ba3
commit 364e7dc282
4 changed files with 57 additions and 20 deletions

View file

@ -0,0 +1,23 @@
#!/bin/bash
if [[ $# -lt 2 ]]; then
echo "Usage: $0 <controller-mapping-file> <game-command> [arguments...]" >&2
exit 2
fi
CONTROLLER_MAPPING_FILE="$1"
shift
if [[ ! -r "$CONTROLLER_MAPPING_FILE" ]]; then
echo "Controller mapping file is not readable: $CONTROLLER_MAPPING_FILE" >&2
exit 1
fi
SDL_GAMECONTROLLERCONFIG="$(<"$CONTROLLER_MAPPING_FILE")"
if [[ "$SDL_GAMECONTROLLERCONFIG" != *,*,* ]]; then
echo "Controller mapping file is malformed: $CONTROLLER_MAPPING_FILE" >&2
exit 1
fi
export SDL_GAMECONTROLLERCONFIG
exec "$@"