mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-25 18:05:12 -04:00
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 <line>'.
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user