From 9446038dbbfee316de16c379181d03f7d7ba06c1 Mon Sep 17 00:00:00 2001 From: Matthew Stanley <1379tech@gmail.com> Date: Mon, 20 Jul 2026 00:07:33 -0700 Subject: [PATCH] autocompile: survive quoted interpreter paths + pin Windows Python in launcher Two independent failures made every live reshard fail SILENTLY (runs counted, shard_ok stayed 0, the game just never got shards): - autocompile.c: the child line is executed via 'cmd.exe /C '. When the line BEGINS with a quoted path and contains further quotes, cmd.exe strips the first and last quote characters and mangles the command ('The filename, directory name, or volume label syntax is incorrect'). Wrap the whole line in one extra pair of quotes -- cmd then strips exactly those and executes the inner command verbatim. - launch_tomba2_interp_perf.ps1: the autocompile command used an unqualified 'python'; with an MSYS python first on the inherited PATH, it cannot open the Windows-style script path ('can't open file'). Use the canonical Windows Python312 explicitly and fail the launch loudly if it is absent. Co-Authored-By: Claude Fable 5 --- runtime/src/autocompile.c | 11 +++++++++-- tools/launch_tomba2_interp_perf.ps1 | 10 +++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/runtime/src/autocompile.c b/runtime/src/autocompile.c index 998bb77d..b8ebf17c 100644 --- a/runtime/src/autocompile.c +++ b/runtime/src/autocompile.c @@ -532,9 +532,16 @@ int autocompile_request(void) { SetEnvironmentVariableA("PSX_OVERLAY_LIVE_AUTOCOMPILE", "1"); /* cmd.exe /C resolves the command via PATH and supports the relative - * paths in the configured line (cwd = project root). */ + * paths in the configured line (cwd = project root). The WHOLE command is + * wrapped in one extra pair of quotes: when the line after /C BEGINS with + * a quote and contains further quotes (a quoted interpreter path plus + * quoted args), cmd.exe strips the first and last quote characters and + * mangles the line ("The filename, directory name, or volume label syntax + * is incorrect" — every autocompile run failed and the reshard silently + * never happened). With the outer quotes cmd strips exactly those two and + * executes the inner command verbatim. */ char full[4200]; - snprintf(full, sizeof(full), "cmd.exe /C %s", s_cmd); + snprintf(full, sizeof(full), "cmd.exe /C \"%s\"", s_cmd); STARTUPINFOA si; memset(&si, 0, sizeof(si)); diff --git a/tools/launch_tomba2_interp_perf.ps1 b/tools/launch_tomba2_interp_perf.ps1 index e7567113..ddcea7ca 100644 --- a/tools/launch_tomba2_interp_perf.ps1 +++ b/tools/launch_tomba2_interp_perf.ps1 @@ -85,8 +85,16 @@ foreach ($dir in @($stateDir, (Split-Path $capturePath -Parent), $runDir, $logDi New-Item -ItemType Directory -Force -Path $dir | Out-Null } +# Windows Python EXPLICITLY (never unqualified 'python'): the game process +# inherits whatever PATH the launching shell had, and an MSYS python first on +# PATH cannot open the Windows-style script path — every autocompile run then +# fails with "can't open file" and the reshard silently never happens. +$windowsPython = Join-Path $env:LOCALAPPDATA 'Programs\Python\Python312\python.exe' +if (-not (Test-Path -LiteralPath $windowsPython -PathType Leaf)) { + throw "Windows Python not found at $windowsPython (required for autocompile)." +} $autoCompile = @( - 'python', (Quote-ProcessArgument $compileTool), + (Quote-ProcessArgument $windowsPython), (Quote-ProcessArgument $compileTool), '--captures', (Quote-ProcessArgument $capturePath), '--game-toml', (Quote-ProcessArgument $gameConfig), '--recompiler', (Quote-ProcessArgument $recompiler),