feat: automate PortMaster save directory

This commit is contained in:
Alexander Sellite 2026-08-16 20:57:54 -04:00
parent 7aaed6393b
commit 01e534e278
5 changed files with 53 additions and 6 deletions

View file

@ -181,7 +181,10 @@ Install the complete \`netfishing.zip\` archive with PortMaster or HarbourMaster
The package requires an ARM64 device, two analog sticks, GLIBC 2.28 or newer,
and the \`weston_pkg_0.2\` runtime.
Save data and device-local configuration remain under \`netfishing/conf/\`.
New installations store player data under \`ports/saves/netfishing/\` without
opening a folder picker. Existing installations preserve their previously
selected data root. Device-local configuration remains under
\`netfishing/conf/\`.
PortMaster launches use the light performance profile by default. Put the word
\`normal\` in \`netfishing/conf/performance_profile\` to opt a capable device
into the normal rendering profile. See \`netfishing/licenses/\` for bundled
@ -223,6 +226,12 @@ grep -Fq 'NETFISHING_PERFORMANCE_PROFILE=light' \
"${STAGE_ROOT}/NETfishing.sh"
grep -Fq 'CONTROLLER_MAPPING_FILE="$CONFDIR/cache/controller_mapping.txt"' \
"${STAGE_ROOT}/NETfishing.sh"
grep -Fq 'SAVEDIR="$PORTS_ROOT/saves/netfishing"' \
"${STAGE_ROOT}/NETfishing.sh"
grep -Fq '"NETFISHING_DATA_DIR=$SAVEDIR"' \
"${STAGE_ROOT}/NETfishing.sh"
grep -Fq '"NETFISHING_CREATE_DATA_DIR=1"' \
"${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"

View file

@ -28,6 +28,9 @@ if [ ! -d "$GAMEDIR" ] && [ -d "/mnt/mmc/ports/netfishing" ]; then
fi
CONFDIR="$GAMEDIR/conf"
PORTS_ROOT="${GAMEDIR%/netfishing}"
SAVEDIR="$PORTS_ROOT/saves/netfishing"
DATA_BOOTSTRAP_DIR="$CONFDIR/data/godot/app_userdata/NETFISHING"
GAME_EXECUTABLE="$GAMEDIR/NETfishing.aarch64"
GAME_LAUNCHER="$GAMEDIR/launch-netfishing.sh"
GPTOKEYB_CONFIG="$GAMEDIR/netfishing.gptk"
@ -42,6 +45,21 @@ fi
mkdir -p "$CONFDIR/data" "$CONFDIR/config" "$CONFDIR/cache" "$WESTON_DIR"
chmod +x "$GAME_EXECUTABLE"
# New PortMaster installs use a predictable save directory beside the port
# instead of presenting a folder picker on a small screen. Preserve an
# established data-root choice when upgrading an existing installation.
NETFISHING_DATA_ENVIRONMENT=()
if [ -f "$SAVEDIR/netfishing_data.json" ] || {
[ ! -f "$DATA_BOOTSTRAP_DIR/data_root_bootstrap.json" ] &&
[ ! -f "$DATA_BOOTSTRAP_DIR/data_root_bootstrap.json.backup" ]
}; then
mkdir -p "$SAVEDIR"
NETFISHING_DATA_ENVIRONMENT+=(
"NETFISHING_DATA_DIR=$SAVEDIR"
"NETFISHING_CREATE_DATA_DIR=1"
)
fi
> "$GAMEDIR/log.txt" && exec > >(tee "$GAMEDIR/log.txt") 2>&1
if [ ! -f "$controlfolder/libs/${WESTON_RUNTIME}.squashfs" ]; then
@ -134,6 +152,7 @@ $ESUDO env CRUSTY_RESOLUTION="${DISPLAY_WIDTH}x${DISPLAY_HEIGHT}" \
XDG_CONFIG_HOME="$CONFDIR/config" \
XDG_CACHE_HOME="$CONFDIR/cache" \
GODOT_SILENCE_ROOT_WARNING=1 \
"${NETFISHING_DATA_ENVIRONMENT[@]}" \
"${NETFISHING_GAME_ENVIRONMENT[@]}" \
"$GAME_LAUNCHER" \
"$CONTROLLER_MAPPING_FILE" \