fix(launcher): handle Game-z.exe builds and ignore extendtext.exe
Soulstones 1 ships `Game-z.exe` rather than `Game.exe`. Find-GameExe preferred `Game.exe` and otherwise fell back to the shallowest non-ignored .exe, which for that build resolved to `extendtext.exe` — a dev tool that was missing from the ignore list — instead of the real launcher. Add extendtext.exe to $ignore and replace the single-name preference with a $launcherNames list (Game.exe, then Game-z.exe) before the shallowest-exe fallback. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
79ed715dbb
commit
a391292a6a
1 file changed
+11
-5
@@ -31,17 +31,23 @@ param(
|
|||||||
$ErrorActionPreference = 'Stop'
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
# dev/editor exes that ship alongside the game but are NOT the launcher
|
# dev/editor exes that ship alongside the game but are NOT the launcher
|
||||||
$ignore = @('animmaker.exe', 'rpgxp.exe', 'rgss', 'editor.exe', 'unins', 'setup.exe')
|
$ignore = @('animmaker.exe', 'rpgxp.exe', 'rgss', 'editor.exe', 'unins', 'setup.exe', 'extendtext.exe')
|
||||||
|
|
||||||
|
# launcher names in preference order — some builds ship mkxp-z as Game-z.exe
|
||||||
|
# instead of Game.exe (e.g. Soulstones 1).
|
||||||
|
$launcherNames = @('Game.exe', 'Game-z.exe')
|
||||||
|
|
||||||
function Find-GameExe([string]$root) {
|
function Find-GameExe([string]$root) {
|
||||||
# Prefer Game.exe; fall back to the shallowest non-ignored .exe.
|
# Prefer a known launcher name; fall back to the shallowest non-ignored .exe.
|
||||||
$candidates = Get-ChildItem -LiteralPath $root -Recurse -File -Filter '*.exe' -ErrorAction SilentlyContinue |
|
$candidates = Get-ChildItem -LiteralPath $root -Recurse -File -Filter '*.exe' -ErrorAction SilentlyContinue |
|
||||||
Where-Object { $n = $_.Name.ToLower(); -not ($ignore | Where-Object { $n -like "*$_*" }) } |
|
Where-Object { $n = $_.Name.ToLower(); -not ($ignore | Where-Object { $n -like "*$_*" }) } |
|
||||||
Sort-Object { ($_.FullName -split '[\\/]').Count } # shallowest first
|
Sort-Object { ($_.FullName -split '[\\/]').Count } # shallowest first
|
||||||
|
|
||||||
$game = $candidates | Where-Object { $_.Name -ieq 'Game.exe' } | Select-Object -First 1
|
foreach ($name in $launcherNames) {
|
||||||
if (-not $game) { $game = $candidates | Select-Object -First 1 }
|
$game = $candidates | Where-Object { $_.Name -ieq $name } | Select-Object -First 1
|
||||||
return $game
|
if ($game) { return $game }
|
||||||
|
}
|
||||||
|
return $candidates | Select-Object -First 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Resolve the starting directory from whatever Playnite passed.
|
# Resolve the starting directory from whatever Playnite passed.
|
||||||
|
|||||||
Reference in new issue
Block a user