fix: isolate PortMaster controller exit handling

This commit is contained in:
Alexander Sellite 2026-08-16 09:25:49 -04:00
parent a170922588
commit 4cffe47ba3
4 changed files with 80 additions and 15 deletions

View file

@ -32,9 +32,10 @@ directory. The templates in `scripts/portmaster/` are authoritative.
- The executable is `netfishing/NETfishing.aarch64`.
- The package declares AArch64, two analog sticks, GLIBC 2.28, and
`weston_pkg_0.2.squashfs`.
- The launcher starts GPTOKEYB in exit-only mode without a `-c` mapping file.
PortMaster therefore owns only its device-specific force-quit chord while
Godot and NETfishing's controller mapping manager handle gameplay input.
- The launcher starts GPTOKEYB with the explicit `netfishing.gptk` no-op map.
Every keyboard and mouse binding is disabled, leaving only PortMaster's
device-specific force-quit chord while Godot and NETfishing's controller
mapping manager handle gameplay input.
- The launcher calls `pm_platform_helper` for the game executable after
starting GPTOKEYB and calls `pm_finish` after the game exits.
- Persistent device data remains under `netfishing/conf/data`,
@ -98,7 +99,7 @@ Before upgrading an existing installation, preserve
1. Confirm the installed executable and PCK hashes match the staged release.
2. Confirm the installed launcher contains the canonical PortMaster header,
starts GPTOKEYB without a `-c` mapping file, and calls
starts GPTOKEYB with `netfishing.gptk`, and calls
`pm_platform_helper` for the game executable.
3. Confirm `conf/` was not replaced or removed.
4. Launch the installed port through the normal muOS menu.
@ -160,10 +161,12 @@ failure with the `GO-Super Gamepad` mapping. Export the single selected
`westonwrap.sh`, so Weston and the game inherit it without tokenizing the
mapping text.
Do not pass a `.gptk` controller mapping to GPTOKEYB. Its exit-only process
must retain PortMaster's controller configuration, while the verified Godot
mapping remains scoped to the game command. This prevents duplicate or
translated gameplay events while preserving the system force-quit chord.
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
sticks into keyboard or mouse events on top of Godot's native controller input.
Always pass `netfishing.gptk`, which explicitly unassigns every direct and
hotkey binding with GPTOKEYB's `\"` value. Do not add gameplay mappings to this
file. The Start+Select kill chord remains independent of the no-op bindings.
Do not call `Input.add_joy_mapping(..., true)` for a recognized connected muOS
controller. Updating this virtual controller after connection can stop Godot

View file

@ -115,6 +115,8 @@ mkdir -p -- "${GAME_ROOT}/licenses"
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 "${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"
@ -230,7 +232,9 @@ if [[ -z "${CONTROLLER_ENV_LINE}" || -z "${WESTON_LAUNCH_LINE}" || \
echo "SDL_GAMECONTROLLERCONFIG must be exported before westonwrap.sh." >&2
exit 1
fi
grep -Fq '$GPTOKEYB "NETfishing.aarch64" &' \
grep -Fq 'GPTOKEYB_CONFIG="$GAMEDIR/netfishing.gptk"' \
"${STAGE_ROOT}/NETfishing.sh"
grep -Fq '$GPTOKEYB "NETfishing.aarch64" -c "$GPTOKEYB_CONFIG" &' \
"${STAGE_ROOT}/NETfishing.sh"
grep -Fq 'pm_platform_helper "$GAME_EXECUTABLE"' \
"${STAGE_ROOT}/NETfishing.sh"
@ -240,9 +244,25 @@ if [[ "$(grep -Ec '^[[:space:]]*\$GPTOKEYB[[:space:]]' \
echo "NETfishing must start exactly one GPTOKEYB exit handler." >&2
exit 1
fi
if grep -Eq '\$GPTOKEYB.*[[:space:]]-c([[:space:]]|$)' \
"${STAGE_ROOT}/NETfishing.sh"; then
echo "GPTOKEYB controller mappings must not be enabled for NETfishing." >&2
readonly GPTOKEYB_NOOP_KEYS=(
back guide start
a a_hk b b_hk x x_hk y y_hk
l1 l1_hk l2 l2_hk l3 r1 r1_hk r2 r2_hk r3
up down left right
left_analog_up left_analog_down left_analog_left left_analog_right
right_analog_up right_analog_down right_analog_left right_analog_right
)
for noop_key in "${GPTOKEYB_NOOP_KEYS[@]}"; do
if ! grep -Eq \
"^[[:space:]]*${noop_key}[[:space:]]*=[[:space:]]*\\\\\"[[:space:]]*$" \
"${GAME_ROOT}/netfishing.gptk"; then
echo "GPTOKEYB no-op mapping is missing: ${noop_key}" >&2
exit 1
fi
done
if [[ "$(grep -Ec '^[[:space:]]*[a-z0-9_]+[[:space:]]*=' \
"${GAME_ROOT}/netfishing.gptk")" -ne "${#GPTOKEYB_NOOP_KEYS[@]}" ]]; then
echo "GPTOKEYB no-op mapping contains an unexpected assignment." >&2
exit 1
fi
if unzip -Z1 "${ARCHIVE}" | grep -E \

View file

@ -29,6 +29,7 @@ fi
CONFDIR="$GAMEDIR/conf"
GAME_EXECUTABLE="$GAMEDIR/NETfishing.aarch64"
GPTOKEYB_CONFIG="$GAMEDIR/netfishing.gptk"
WESTON_DIR="/tmp/netfishing-weston"
WESTON_RUNTIME="weston_pkg_0.2"
HARBOURMASTER="$controlfolder/harbourmaster"
@ -118,9 +119,10 @@ case "$PERFORMANCE_PROFILE" in
esac
# Keep NETfishing's native controller input separate from PortMaster's exit
# handling. Without a -c mapping file, GPTOKEYB only watches for the
# device-specific force-quit chord and does not inject gameplay inputs.
$GPTOKEYB "NETfishing.aarch64" &
# handling. Legacy GPTOKEYB builds can load their default keyboard map when no
# config is supplied, so the explicit no-op map preserves only the
# device-specific force-quit chord.
$GPTOKEYB "NETfishing.aarch64" -c "$GPTOKEYB_CONFIG" &
pm_platform_helper "$GAME_EXECUTABLE"
$ESUDO env \

View file

@ -0,0 +1,40 @@
# NETfishing reads the controller directly. GPTOKEYB is retained only for the
# PortMaster force-quit chord, so every keyboard and mouse binding is disabled.
back = \"
guide = \"
start = \"
a = \"
a_hk = \"
b = \"
b_hk = \"
x = \"
x_hk = \"
y = \"
y_hk = \"
l1 = \"
l1_hk = \"
l2 = \"
l2_hk = \"
l3 = \"
r1 = \"
r1_hk = \"
r2 = \"
r2_hk = \"
r3 = \"
up = \"
down = \"
left = \"
right = \"
left_analog_up = \"
left_analog_down = \"
left_analog_left = \"
left_analog_right = \"
right_analog_up = \"
right_analog_down = \"
right_analog_left = \"
right_analog_right = \"