Skip to content

[FIX] Use gameportingtoolkit exectutable rather than wine to launch games #2879

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

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
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
11 changes: 10 additions & 1 deletion src/backend/launcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,16 @@ async function runWineCommand({
commandParts.unshift(protonVerb)
}

const wineBin = wineVersion.bin.replaceAll("'", '')
const isGPTK = wineVersion.type === 'toolkit'
if (isGPTK) {
const prefix = settings.winePrefix
commandParts.unshift(prefix)
}

const wineBin =
isGPTK && wineVersion.gptkBin !== null
? wineVersion.gptkBin!.replaceAll("'", '')
: wineVersion.bin.replaceAll("'", '')

logDebug(['Running Wine command:', commandParts.join(' ')], LogPrefix.Backend)

Expand Down
21 changes: 16 additions & 5 deletions src/backend/utils/compatibility_layers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,11 +340,16 @@ export async function getGamingPortingToolkitWine(): Promise<
}

logInfo('Searching for Gaming Porting Toolkit Wine', LogPrefix.GlobalConfig)
const { stdout } = await execAsync('mdfind wine64')
const wineBin = stdout.split('\n').filter((p) => {
const { stdout: wineStdout } = await execAsync('mdfind wine64')
const wineBin = wineStdout.split('\n').filter((p) => {
return p.match(/game-porting-toolkit.*\/wine64$/)
})[0]

const { stdout: gptkStdout } = await execAsync('mdfind gameportingtoolkit')
const gptkBin = gptkStdout.split('\n').filter((p) => {
return p.match(/.*\/gameportingtoolkit$/)
})[0]

if (existsSync(wineBin)) {
logInfo(
`Found Gaming Porting Toolkit Wine at ${dirname(wineBin)}`,
Expand All @@ -359,7 +364,8 @@ export async function getGamingPortingToolkitWine(): Promise<
type: 'toolkit',
lib: `${dirname(wineBin)}/../lib`,
lib32: `${dirname(wineBin)}/../lib`,
bin: wineBin
bin: wineBin,
gptkBin: gptkBin
})
} catch (error) {
logError(
Expand All @@ -375,13 +381,18 @@ export async function getGamingPortingToolkitWine(): Promise<
export function getWineFlags(
wineBin: string,
gameSettings: GameSettings,
wineType: string
wineType: string,
gptkBin?: string
) {
const wineFlags = []
const wineFlagsObj = {
proton: ['--no-wine', '--wrapper', `'${wineBin}' run`],
wine: ['--wine', wineBin],
toolkit: ['--wrapper', `${wineBin} ${gameSettings.winePrefix}`, '--no-wine']
toolkit: [
'--wrapper',
`${gptkBin} "${gameSettings.winePrefix}"`,
'--no-wine'
]
}

wineFlags.push(...(wineFlagsObj[wineType as keyof typeof wineFlagsObj] || []))
Expand Down
1 change: 1 addition & 0 deletions src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ export interface WineInstallation {
type: 'wine' | 'proton' | 'crossover' | 'toolkit'
lib?: string
lib32?: string
gptkBin?: string
wineserver?: string
}

Expand Down