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
|
|
@ -154,12 +154,18 @@ The device-verified Godot mapping is:
|
||||||
`scripts/portmaster/NETfishing.sh` must replace the incompatible SDL2 entry
|
`scripts/portmaster/NETfishing.sh` must replace the incompatible SDL2 entry
|
||||||
with the Godot entry when that SDL2 GUID is selected. Do not append the two
|
with the Godot entry when that SDL2 GUID is selected. Do not append the two
|
||||||
entries with a newline. WestonPack reconstructs the wrapped game command
|
entries with a newline. WestonPack reconstructs the wrapped game command
|
||||||
through a shell, so values passed in that command can be split into unintended
|
through a shell, so raw mapping values passed in that command can be split into
|
||||||
commands. Controller names may legally contain spaces, which caused this
|
unintended commands. Controller names may legally contain spaces, which caused
|
||||||
failure with the `GO-Super Gamepad` mapping. Export the single selected
|
this failure with the `GO-Super Gamepad` mapping. The outer Weston environment
|
||||||
`SDL_GAMECONTROLLERCONFIG` value through the outer `env` invocation, before
|
also does not reliably preserve the corrected muOS mapping for the game.
|
||||||
`westonwrap.sh`, so Weston and the game inherit it without tokenizing the
|
|
||||||
mapping text.
|
Write the exact selected mapping to `conf/cache/controller_mapping.txt` before
|
||||||
|
starting Weston. Weston must launch `launch-netfishing.sh`, which reads that
|
||||||
|
file, exports `SDL_GAMECONTROLLERCONFIG`, and immediately replaces itself with
|
||||||
|
the game process. This applies the mapping at the same point as the working
|
||||||
|
0.10.1 launcher without passing its raw text through WestonPack's command
|
||||||
|
reconstruction. Do not move the mapping back to either side of
|
||||||
|
`westonwrap.sh`.
|
||||||
|
|
||||||
Legacy GPTOKEYB builds can load their compiled default keyboard map when no
|
Legacy GPTOKEYB builds can load their compiled default keyboard map when no
|
||||||
`-c` file is supplied. That map translates face buttons, D-pad directions, and
|
`-c` file is supplied. That map translates face buttons, D-pad directions, and
|
||||||
|
|
|
||||||
|
|
@ -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}/port.json" "${GAME_ROOT}/port.json"
|
||||||
install -m 0644 "${TEMPLATE_ROOT}/netfishing.gptk" \
|
install -m 0644 "${TEMPLATE_ROOT}/netfishing.gptk" \
|
||||||
"${GAME_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 0755 "${ARM64_EXECUTABLE}" "${GAME_ROOT}/NETfishing.aarch64"
|
||||||
install -m 0644 "${ARM64_PCK}" "${GAME_ROOT}/NETfishing.pck"
|
install -m 0644 "${ARM64_PCK}" "${GAME_ROOT}/NETfishing.pck"
|
||||||
install -m 0644 "${TEMPLATE_ROOT}/gameinfo.xml" "${GAME_ROOT}/gameinfo.xml"
|
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"
|
"${STAGE_ROOT}/NETfishing.sh"
|
||||||
grep -Fq 'NETFISHING_PERFORMANCE_PROFILE=light' \
|
grep -Fq 'NETFISHING_PERFORMANCE_PROFILE=light' \
|
||||||
"${STAGE_ROOT}/NETfishing.sh"
|
"${STAGE_ROOT}/NETfishing.sh"
|
||||||
readonly CONTROLLER_ENV_LINE="$(
|
grep -Fq 'CONTROLLER_MAPPING_FILE="$CONFDIR/cache/controller_mapping.txt"' \
|
||||||
grep -nF 'SDL_GAMECONTROLLERCONFIG="$netfishing_controllerconfig"' \
|
"${STAGE_ROOT}/NETfishing.sh"
|
||||||
"${STAGE_ROOT}/NETfishing.sh" | cut -d: -f1
|
grep -Fq 'printf '\''%s\n'\'' "$netfishing_controllerconfig" > "$CONTROLLER_MAPPING_FILE"' \
|
||||||
)"
|
"${STAGE_ROOT}/NETfishing.sh"
|
||||||
readonly WESTON_LAUNCH_LINE="$(
|
grep -Fq '"$GAME_LAUNCHER"' "${STAGE_ROOT}/NETfishing.sh"
|
||||||
grep -nF '"$WESTON_DIR/westonwrap.sh" headless noop kiosk crusty_x11egl' \
|
grep -Fq '"$CONTROLLER_MAPPING_FILE"' "${STAGE_ROOT}/NETfishing.sh"
|
||||||
"${STAGE_ROOT}/NETfishing.sh" | cut -d: -f1
|
if grep -Fq 'SDL_GAMECONTROLLERCONFIG="$netfishing_controllerconfig"' \
|
||||||
)"
|
"${STAGE_ROOT}/NETfishing.sh"; then
|
||||||
if [[ -z "${CONTROLLER_ENV_LINE}" || -z "${WESTON_LAUNCH_LINE}" || \
|
echo "Raw controller mappings must not be passed through westonwrap.sh." >&2
|
||||||
"${CONTROLLER_ENV_LINE}" -ge "${WESTON_LAUNCH_LINE}" ]]; then
|
|
||||||
echo "SDL_GAMECONTROLLERCONFIG must be exported before westonwrap.sh." >&2
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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"' \
|
grep -Fq 'GPTOKEYB_CONFIG="$GAMEDIR/netfishing.gptk"' \
|
||||||
"${STAGE_ROOT}/NETfishing.sh"
|
"${STAGE_ROOT}/NETfishing.sh"
|
||||||
grep -Fq '$GPTOKEYB "NETfishing.aarch64" -c "$GPTOKEYB_CONFIG" &' \
|
grep -Fq '$GPTOKEYB "NETfishing.aarch64" -c "$GPTOKEYB_CONFIG" &' \
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,9 @@ fi
|
||||||
|
|
||||||
CONFDIR="$GAMEDIR/conf"
|
CONFDIR="$GAMEDIR/conf"
|
||||||
GAME_EXECUTABLE="$GAMEDIR/NETfishing.aarch64"
|
GAME_EXECUTABLE="$GAMEDIR/NETfishing.aarch64"
|
||||||
|
GAME_LAUNCHER="$GAMEDIR/launch-netfishing.sh"
|
||||||
GPTOKEYB_CONFIG="$GAMEDIR/netfishing.gptk"
|
GPTOKEYB_CONFIG="$GAMEDIR/netfishing.gptk"
|
||||||
|
CONTROLLER_MAPPING_FILE="$CONFDIR/cache/controller_mapping.txt"
|
||||||
WESTON_DIR="/tmp/netfishing-weston"
|
WESTON_DIR="/tmp/netfishing-weston"
|
||||||
WESTON_RUNTIME="weston_pkg_0.2"
|
WESTON_RUNTIME="weston_pkg_0.2"
|
||||||
HARBOURMASTER="$controlfolder/harbourmaster"
|
HARBOURMASTER="$controlfolder/harbourmaster"
|
||||||
|
|
@ -76,6 +78,7 @@ elif [ -n "$sdl_controllerconfig" ]; then
|
||||||
else
|
else
|
||||||
netfishing_controllerconfig="$GODOT_MUOS_MAPPING"
|
netfishing_controllerconfig="$GODOT_MUOS_MAPPING"
|
||||||
fi
|
fi
|
||||||
|
printf '%s\n' "$netfishing_controllerconfig" > "$CONTROLLER_MAPPING_FILE"
|
||||||
|
|
||||||
NETFISHING_GODOT_OPTIONS=()
|
NETFISHING_GODOT_OPTIONS=()
|
||||||
NETFISHING_GAME_ENVIRONMENT=()
|
NETFISHING_GAME_ENVIRONMENT=()
|
||||||
|
|
@ -125,15 +128,15 @@ esac
|
||||||
$GPTOKEYB "NETfishing.aarch64" -c "$GPTOKEYB_CONFIG" &
|
$GPTOKEYB "NETfishing.aarch64" -c "$GPTOKEYB_CONFIG" &
|
||||||
pm_platform_helper "$GAME_EXECUTABLE"
|
pm_platform_helper "$GAME_EXECUTABLE"
|
||||||
|
|
||||||
$ESUDO env \
|
$ESUDO env CRUSTY_RESOLUTION="${DISPLAY_WIDTH}x${DISPLAY_HEIGHT}" \
|
||||||
CRUSTY_RESOLUTION="${DISPLAY_WIDTH}x${DISPLAY_HEIGHT}" \
|
|
||||||
SDL_GAMECONTROLLERCONFIG="$netfishing_controllerconfig" \
|
|
||||||
"$WESTON_DIR/westonwrap.sh" headless noop kiosk crusty_x11egl \
|
"$WESTON_DIR/westonwrap.sh" headless noop kiosk crusty_x11egl \
|
||||||
XDG_DATA_HOME="$CONFDIR/data" \
|
XDG_DATA_HOME="$CONFDIR/data" \
|
||||||
XDG_CONFIG_HOME="$CONFDIR/config" \
|
XDG_CONFIG_HOME="$CONFDIR/config" \
|
||||||
XDG_CACHE_HOME="$CONFDIR/cache" \
|
XDG_CACHE_HOME="$CONFDIR/cache" \
|
||||||
GODOT_SILENCE_ROOT_WARNING=1 \
|
GODOT_SILENCE_ROOT_WARNING=1 \
|
||||||
"${NETFISHING_GAME_ENVIRONMENT[@]}" \
|
"${NETFISHING_GAME_ENVIRONMENT[@]}" \
|
||||||
|
"$GAME_LAUNCHER" \
|
||||||
|
"$CONTROLLER_MAPPING_FILE" \
|
||||||
"$GAME_EXECUTABLE" \
|
"$GAME_EXECUTABLE" \
|
||||||
"${NETFISHING_GODOT_OPTIONS[@]}" \
|
"${NETFISHING_GODOT_OPTIONS[@]}" \
|
||||||
--resolution "${DISPLAY_WIDTH}x${DISPLAY_HEIGHT}" \
|
--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