Skip to content

Commit

Permalink
[Fix] Support DXVK installation on 32-bit prefixes (#3749)
Browse files Browse the repository at this point in the history
Fix support for DXVK installation on 32-bit prefixes
  • Loading branch information
casasfernando authored May 17, 2024
1 parent 1472855 commit 05df7af
Showing 1 changed file with 83 additions and 54 deletions.
137 changes: 83 additions & 54 deletions src/backend/tools/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@ export const DXVK = {

tool = isMac ? 'dxvk-macOS' : tool

const is64bitPrefix = existsSync(`${winePrefix}/drive_c/windows/syswow64`)

if (!is64bitPrefix) {
logWarning('Installing DXVK on a 32-bit prefix!', LogPrefix.DXVKInstaller)
}

if (!existsSync(`${toolsPath}/${tool}/latest_${tool}`)) {
logWarning('dxvk not found!', LogPrefix.DXVKInstaller)
await DXVK.getLatest()
Expand Down Expand Up @@ -249,23 +255,25 @@ export const DXVK = {
logInfo('Removing DLL overrides', LogPrefix.DXVKInstaller)

// unregister the dlls on the wine prefix
dlls64.forEach(async (dll) => {
dll = dll.replace('.dll', '')
const unregisterDll = [
'reg',
'delete',
'HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides',
'/v',
dll,
'/f'
]
await runWineCommand({
gameSettings,
commandParts: unregisterDll,
wait: true,
protonVerb: 'run'
if (is64bitPrefix) {
dlls64.forEach(async (dll) => {
dll = dll.replace('.dll', '')
const unregisterDll = [
'reg',
'delete',
'HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides',
'/v',
dll,
'/f'
]
await runWineCommand({
gameSettings,
commandParts: unregisterDll,
wait: true,
protonVerb: 'run'
})
})
})
}
dlls32.forEach(async (dll) => {
dll = dll.replace('.dll', '')
const unregisterDll = [
Expand Down Expand Up @@ -294,11 +302,27 @@ export const DXVK = {
}

// copy the new dlls to the prefix
dlls32.forEach((dll) => {
if (!isMac) {
if (is64bitPrefix) {
dlls32.forEach((dll) => {
if (!isMac) {
copyFile(
`${toolPathx32}/${dll}`,
`${winePrefix}/drive_c/windows/syswow64/${dll}`,
(err) => {
if (err) {
logError(
[`Error when copying ${dll}`, err],
LogPrefix.DXVKInstaller
)
}
}
)
}
})
dlls64.forEach((dll) => {
copyFile(
`${toolPathx32}/${dll}`,
`${winePrefix}/drive_c/windows/syswow64/${dll}`,
`${toolPathx64}/${dll}`,
`${winePrefix}/drive_c/windows/system32/${dll}`,
(err) => {
if (err) {
logError(
Expand All @@ -308,44 +332,49 @@ export const DXVK = {
}
}
)
}
})
dlls64.forEach((dll) => {
copyFile(
`${toolPathx64}/${dll}`,
`${winePrefix}/drive_c/windows/system32/${dll}`,
(err) => {
if (err) {
logError(
[`Error when copying ${dll}`, err],
LogPrefix.DXVKInstaller
)
}
})
} else {
dlls32.forEach((dll) => {
if (!isMac) {
copyFile(
`${toolPathx32}/${dll}`,
`${winePrefix}/drive_c/windows/system32/${dll}`,
(err) => {
if (err) {
logError(
[`Error when copying ${dll}`, err],
LogPrefix.DXVKInstaller
)
}
}
)
}
)
})
})
}

// register dlls on the wine prefix
dlls64.forEach(async (dll) => {
// remove the .dll extension otherwise will fail
dll = dll.replace('.dll', '')
const registerDll = [
'reg',
'add',
'HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides',
'/v',
dll,
'/d',
'native,builtin',
'/f'
]
await runWineCommand({
gameSettings,
commandParts: registerDll,
wait: true,
protonVerb: 'run'
if (is64bitPrefix) {
dlls64.forEach(async (dll) => {
// remove the .dll extension otherwise will fail
dll = dll.replace('.dll', '')
const registerDll = [
'reg',
'add',
'HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides',
'/v',
dll,
'/d',
'native,builtin',
'/f'
]
await runWineCommand({
gameSettings,
commandParts: registerDll,
wait: true,
protonVerb: 'run'
})
})
})
}
dlls32.forEach(async (dll) => {
// remove the .dll extension otherwise will fail
dll = dll.replace('.dll', '')
Expand Down

0 comments on commit 05df7af

Please sign in to comment.