now also assuring that -console is stripped out

This commit is contained in:
2026-09-21 12:39:26 +01:00
parent c0eb8abf85
commit 7604fbdd6b
+18 -8
View File
@@ -57,17 +57,26 @@ if [ ! -d "$GAME_ROOT" ]; then
exit 1
fi
# ── 1. rev.ini: ensure -vulkan launch parameter ──────────────────────────────
# ── 1. rev.ini: ensure -vulkan launch parameter, strip -console ─────────────
# Uses Python operating on the raw file bytes rather than sed — rev.ini has
# Windows-style CRLF line endings, and two earlier sed-based attempts here
# both mishandled embedded/stray \r characters in different ways, corrupting
# the ProcName line. This version is fully idempotent and self-correcting:
# it strips any \r and any existing -vulkan occurrence(s) from the matched
# span (using a lookahead for the TRUE \r?\n line ending, so it can't stop
# early on a stray embedded \r the way earlier attempts did), then cleanly
# re-adds -vulkan exactly once — producing the same correct result whether
# the line was already correct, missing -vulkan, or corrupted from a prior
# buggy run.
# it strips any \r, strips any existing -vulkan occurrence(s), and strips any
# existing -console occurrence(s) from the matched span (using a lookahead
# for the TRUE \r?\n line ending, so it can't stop early on a stray embedded
# \r the way earlier attempts did), then cleanly re-adds -vulkan exactly
# once — producing the same correct result whether the line was already
# correct, missing -vulkan, had -console, or corrupted from a prior buggy
# run.
#
# -console must never survive here: it forces the in-game developer console
# open from boot, which the whole autoexec.cfg console lockdown (con_enable
# 0, blanked toggleconsole/showconsole/hideconsole aliases) cannot suppress
# retroactively — those only stop it being toggled back OPEN after startup,
# they don't stop it opening in the first place. A shipped nosteam.zip's raw
# rev.ini has been observed to carry -console by default, so this has to be
# stripped on every prep run, the same way -vulkan has to be re-added.
REV_INI="$GAME_ROOT/rev.ini"
if [ -f "$REV_INI" ]; then
if grep -q "^ProcName=" "$REV_INI"; then
@@ -82,6 +91,7 @@ def fix_line(match):
line = match.group(0)
line = line.replace(b'\r', b'')
line = re.sub(rb'\s*-vulkan\s*', b'', line)
line = re.sub(rb'\s*-console\b', b'', line)
return line + b' -vulkan'
new_content, n = re.subn(
@@ -97,7 +107,7 @@ if n == 0:
with open(path, 'wb') as f:
f.write(new_content)
PYEOF
echo "[rev.ini] ProcName line normalized with -vulkan"
echo "[rev.ini] ProcName line normalized with -vulkan, -console stripped"
else
echo "WARNING: [rev.ini] no ProcName= line found — check manually" >&2
fi