fix: a GOG install launches the game, not its config tool (#1644)

Blood Omen ships dxconfig.exe beside kain.exe and the shortcut pointed at
the config tool: pickExe kept the first .exe the folder listing returned
when no title match was found. Read the game's play task from GOG's own
goggame-<id>.info manifest first - a primary game task, or a primary
launcher task for launcher games, and the product's manifest ahead of any
other goggame-*.info - then the product's temp_executable; without either,
rank the folder's exes so a word of the title wins, config and tool names
lose, and depth then size break the remaining ties.

GOG's galaxy_*.exe support installer is not the game either. The Witcher:
Enhanced Edition ships galaxy_the_witcher_enhanced_edition_2.1.0.15.exe
beside launcher.exe, and its build metadata names that file as the
product's temp executable, so launching it starts a 32-bit installer that
stops at "Path not found" under ARM64 FEX - the same dialog as the setup
stub #1174 removed. Play tasks, the hint and the name search skip it.

Fixes #680
Fixes #694

Only a primary launcher task counts as a launch task: GOG files the
configuration tool beside a game as a non-primary launcher, so it now falls
through to the executable search instead of becoming the game.

The temp_executable hint is matched by basename with either separator and
must resolve inside the install folder, so a nested galaxy_*.exe is skipped
too and a hint cannot point outside the game.

GOG runs a task from the working directory it declares, and from the install
root when it declares none. That directory now reaches the sidecar and the
shortcut's Start In: a game in a subfolder (System/witcher.exe) starts where
GOG starts it instead of in System/, where it cannot find its Data folder.
This commit is contained in:
Moroni Granja authored and GitHub committed 2026-11-04 11:38:02 -05:00
1 parent d849e6ae0a
commit 0110dc3c0f
10 files changed
+625 -22

No files matched your search

@@ -426,7 +426,14 @@ object AddedGames {
?.takeIf { SessionPrefs.adoptAddedGameExe(context, folder.path, picked, it.path, rev) }
val exe = adopted ?: found
val guestExe = if (adopted != null) guestPath(context, adopted) ?: return else foundGuest
val storeExe = sidecar?.exeFile(folder)
val launched = adopted ?: chosen ?: storeExe?.takeIf { it.isFile }
val storeOwnExe = launched != null && storeExe != null && canonical(launched) == canonical(storeExe)
val sidecarDir = sidecar?.workdir?.takeIf { storeOwnExe }?.let { dir ->
guestPath(context, if (dir.isEmpty()) folder else File(folder, dir))
}
val guestDir = SessionPrefs.addedGameStartIn(context, folder.path).takeIf { sidecar == null && it.isNotEmpty() }
?: sidecarDir
?: guestPath(context, (if (adopted != null) adopted else launch).parentFile ?: folder) ?: return
val steamId = config?.let { steamRoute(it, appId) }
out.add(Game(folder, name, exe, guestExe, guestDir, appId,