Skip to content

Commit

Permalink
[GOG]: use native builds of ScummVM and DOSBox when available (#3797)
Browse files Browse the repository at this point in the history
* feat(gog): use native builds of ScummVM and DOSBox when available

update gogdl to 1.1.0

* fix: use linux paths for scummvm setup only
  • Loading branch information
imLinguin authored Jul 23, 2024
1 parent cfbdc4d commit a519c74
Showing 1 changed file with 35 additions and 27 deletions.
62 changes: 35 additions & 27 deletions src/backend/storeManagers/gog/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,20 +125,46 @@ async function setup(
return
}

const gameSupportDir = path.join(gogSupportPath, appName) // This doesn't need to exist, scriptinterpreter.exe will handle it gracefully
let gameSupportDir = path.join(gogSupportPath, appName) // This doesn't need to exist, scriptinterpreter.exe will handle it gracefully

const installLanguage = gameInfo.install.language?.split('-')[0]
const languages = new Intl.DisplayNames(['en'], { type: 'language' })
const lang: string | undefined = languages.of(installLanguage!)

const dependencies: string[] = []
const gameDirectoryPath = isWindows
? gameInfo.install.install_path!
: await getWinePath({
path: gameInfo.install.install_path!,
variant: 'win',
gameSettings
let gameDirectoryPath = gameInfo.install.install_path!

// Do a pass on dependencies
if (manifestData.version === 1) {
// Find redist depots and push to dependency installer
for (const depot of manifestData.product.depots) {
if ('redist' in depot && !dependencies.includes(depot.redist)) {
dependencies.push(depot.redist)
}
}
} else {
for (const dep of manifestData.dependencies || []) {
if (!dependencies.includes(dep)) {
dependencies.push(dep)
}
}
}

// When there is no scummvm in dependencies, proceed with windows paths
if (!isWindows) {
if (!dependencies.find((dep) => dep.toLowerCase() === 'scummvm')) {
gameSupportDir = await getWinePath({
path: gameSupportDir,
gameSettings,
variant: 'win'
})
gameDirectoryPath = await getWinePath({
path: gameDirectoryPath,
gameSettings,
variant: 'win'
})
}
}

sendGameStatusUpdate({
appName,
Expand Down Expand Up @@ -186,22 +212,9 @@ async function setup(
}
}
}
// Find redist depots and push to dependency installer
for (const depot of manifestData.product.depots) {
if ('redist' in depot && !dependencies.includes(depot.redist)) {
dependencies.push(depot.redist)
}
}
} else {
// check if scriptinterpreter is required based on manifest
if (manifestData.scriptInterpreter) {
const wineGameSupportDir = isWindows
? gameSupportDir
: await getWinePath({
path: gameSupportDir,
variant: 'win',
gameSettings
})
const isiPath = path.join(
gogRedistPath,
'__redist/ISI/scriptinterpreter.exe'
Expand Down Expand Up @@ -240,7 +253,8 @@ async function setup(
`/galaxyclient`,
`/buildId=${gameInfo.install.buildId}`,
`/versionName=${gameInfo.install.version}`,
`/supportDir=${wineGameSupportDir}`,
`/lang-code=${gameInfo.install.language || 'en-US'}`,
`/supportDir=${gameSupportDir}`,
'/nodesktopshorctut',
'/nodesktopshortcut'
]
Expand Down Expand Up @@ -299,12 +313,6 @@ async function setup(
})
}
}

for (const dep of manifestData.dependencies || []) {
if (!dependencies.includes(dep)) {
dependencies.push(dep)
}
}
}

// Install redistributables according to redist manifest
Expand Down

0 comments on commit a519c74

Please sign in to comment.