forked from woofmeow/straywild
fix: preserve PortMaster controller mappings through Weston
This commit is contained in:
parent
4cffe47ba3
commit
364e7dc282
4 changed files with 57 additions and 20 deletions
|
|
@ -117,6 +117,8 @@ install -m 0755 "${TEMPLATE_ROOT}/NETfishing.sh" "${STAGE_ROOT}/NETfishing.sh"
|
|||
install -m 0644 "${TEMPLATE_ROOT}/port.json" "${GAME_ROOT}/port.json"
|
||||
install -m 0644 "${TEMPLATE_ROOT}/netfishing.gptk" \
|
||||
"${GAME_ROOT}/netfishing.gptk"
|
||||
install -m 0755 "${TEMPLATE_ROOT}/launch-netfishing.sh" \
|
||||
"${GAME_ROOT}/launch-netfishing.sh"
|
||||
install -m 0755 "${ARM64_EXECUTABLE}" "${GAME_ROOT}/NETfishing.aarch64"
|
||||
install -m 0644 "${ARM64_PCK}" "${GAME_ROOT}/NETfishing.pck"
|
||||
install -m 0644 "${TEMPLATE_ROOT}/gameinfo.xml" "${GAME_ROOT}/gameinfo.xml"
|
||||
|
|
@ -219,19 +221,22 @@ grep -Fq 'PROFILE_PATH="$CONFDIR/performance_profile"' \
|
|||
"${STAGE_ROOT}/NETfishing.sh"
|
||||
grep -Fq 'NETFISHING_PERFORMANCE_PROFILE=light' \
|
||||
"${STAGE_ROOT}/NETfishing.sh"
|
||||
readonly CONTROLLER_ENV_LINE="$(
|
||||
grep -nF 'SDL_GAMECONTROLLERCONFIG="$netfishing_controllerconfig"' \
|
||||
"${STAGE_ROOT}/NETfishing.sh" | cut -d: -f1
|
||||
)"
|
||||
readonly WESTON_LAUNCH_LINE="$(
|
||||
grep -nF '"$WESTON_DIR/westonwrap.sh" headless noop kiosk crusty_x11egl' \
|
||||
"${STAGE_ROOT}/NETfishing.sh" | cut -d: -f1
|
||||
)"
|
||||
if [[ -z "${CONTROLLER_ENV_LINE}" || -z "${WESTON_LAUNCH_LINE}" || \
|
||||
"${CONTROLLER_ENV_LINE}" -ge "${WESTON_LAUNCH_LINE}" ]]; then
|
||||
echo "SDL_GAMECONTROLLERCONFIG must be exported before westonwrap.sh." >&2
|
||||
grep -Fq 'CONTROLLER_MAPPING_FILE="$CONFDIR/cache/controller_mapping.txt"' \
|
||||
"${STAGE_ROOT}/NETfishing.sh"
|
||||
grep -Fq 'printf '\''%s\n'\'' "$netfishing_controllerconfig" > "$CONTROLLER_MAPPING_FILE"' \
|
||||
"${STAGE_ROOT}/NETfishing.sh"
|
||||
grep -Fq '"$GAME_LAUNCHER"' "${STAGE_ROOT}/NETfishing.sh"
|
||||
grep -Fq '"$CONTROLLER_MAPPING_FILE"' "${STAGE_ROOT}/NETfishing.sh"
|
||||
if grep -Fq 'SDL_GAMECONTROLLERCONFIG="$netfishing_controllerconfig"' \
|
||||
"${STAGE_ROOT}/NETfishing.sh"; then
|
||||
echo "Raw controller mappings must not be passed through westonwrap.sh." >&2
|
||||
exit 1
|
||||
fi
|
||||
grep -Fq 'SDL_GAMECONTROLLERCONFIG="$(<"$CONTROLLER_MAPPING_FILE")"' \
|
||||
"${GAME_ROOT}/launch-netfishing.sh"
|
||||
grep -Fq 'export SDL_GAMECONTROLLERCONFIG' \
|
||||
"${GAME_ROOT}/launch-netfishing.sh"
|
||||
grep -Fq 'exec "$@"' "${GAME_ROOT}/launch-netfishing.sh"
|
||||
grep -Fq 'GPTOKEYB_CONFIG="$GAMEDIR/netfishing.gptk"' \
|
||||
"${STAGE_ROOT}/NETfishing.sh"
|
||||
grep -Fq '$GPTOKEYB "NETfishing.aarch64" -c "$GPTOKEYB_CONFIG" &' \
|
||||
|
|
|
|||
|
|
@ -29,7 +29,9 @@ fi
|
|||
|
||||
CONFDIR="$GAMEDIR/conf"
|
||||
GAME_EXECUTABLE="$GAMEDIR/NETfishing.aarch64"
|
||||
GAME_LAUNCHER="$GAMEDIR/launch-netfishing.sh"
|
||||
GPTOKEYB_CONFIG="$GAMEDIR/netfishing.gptk"
|
||||
CONTROLLER_MAPPING_FILE="$CONFDIR/cache/controller_mapping.txt"
|
||||
WESTON_DIR="/tmp/netfishing-weston"
|
||||
WESTON_RUNTIME="weston_pkg_0.2"
|
||||
HARBOURMASTER="$controlfolder/harbourmaster"
|
||||
|
|
@ -76,6 +78,7 @@ elif [ -n "$sdl_controllerconfig" ]; then
|
|||
else
|
||||
netfishing_controllerconfig="$GODOT_MUOS_MAPPING"
|
||||
fi
|
||||
printf '%s\n' "$netfishing_controllerconfig" > "$CONTROLLER_MAPPING_FILE"
|
||||
|
||||
NETFISHING_GODOT_OPTIONS=()
|
||||
NETFISHING_GAME_ENVIRONMENT=()
|
||||
|
|
@ -125,15 +128,15 @@ esac
|
|||
$GPTOKEYB "NETfishing.aarch64" -c "$GPTOKEYB_CONFIG" &
|
||||
pm_platform_helper "$GAME_EXECUTABLE"
|
||||
|
||||
$ESUDO env \
|
||||
CRUSTY_RESOLUTION="${DISPLAY_WIDTH}x${DISPLAY_HEIGHT}" \
|
||||
SDL_GAMECONTROLLERCONFIG="$netfishing_controllerconfig" \
|
||||
$ESUDO env CRUSTY_RESOLUTION="${DISPLAY_WIDTH}x${DISPLAY_HEIGHT}" \
|
||||
"$WESTON_DIR/westonwrap.sh" headless noop kiosk crusty_x11egl \
|
||||
XDG_DATA_HOME="$CONFDIR/data" \
|
||||
XDG_CONFIG_HOME="$CONFDIR/config" \
|
||||
XDG_CACHE_HOME="$CONFDIR/cache" \
|
||||
GODOT_SILENCE_ROOT_WARNING=1 \
|
||||
"${NETFISHING_GAME_ENVIRONMENT[@]}" \
|
||||
"$GAME_LAUNCHER" \
|
||||
"$CONTROLLER_MAPPING_FILE" \
|
||||
"$GAME_EXECUTABLE" \
|
||||
"${NETFISHING_GODOT_OPTIONS[@]}" \
|
||||
--resolution "${DISPLAY_WIDTH}x${DISPLAY_HEIGHT}" \
|
||||
|
|
|
|||
23
scripts/portmaster/launch-netfishing.sh
Executable file
23
scripts/portmaster/launch-netfishing.sh
Executable 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 "$@"
|
||||
Loading…
Add table
Add a link
Reference in a new issue