Skip to content

[GOG]: use native builds of ScummVM and DOSBox when available #3797

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading