diff --git a/scripts/launch-pc-hack.ps1 b/scripts/launch-pc-hack.ps1 index 0e81bc6..c64acfb 100644 --- a/scripts/launch-pc-hack.ps1 +++ b/scripts/launch-pc-hack.ps1 @@ -31,17 +31,23 @@ param( $ErrorActionPreference = 'Stop' # 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) { - # 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 | Where-Object { $n = $_.Name.ToLower(); -not ($ignore | Where-Object { $n -like "*$_*" }) } | Sort-Object { ($_.FullName -split '[\\/]').Count } # shallowest first - $game = $candidates | Where-Object { $_.Name -ieq 'Game.exe' } | Select-Object -First 1 - if (-not $game) { $game = $candidates | Select-Object -First 1 } - return $game + foreach ($name in $launcherNames) { + $game = $candidates | Where-Object { $_.Name -ieq $name } | Select-Object -First 1 + if ($game) { return $game } + } + return $candidates | Select-Object -First 1 } # Resolve the starting directory from whatever Playnite passed.