Skip to content

Commit

Permalink
[Fix] Fix DXVK uninstallation from prefix (#3760)
Browse files Browse the repository at this point in the history
* Fix DXVK uninstallation by restoring Wine DLLs after DXVK DLL overrides are removed

* Improved log messages

* Check for undefined library paths before trying to remove DXVK DLLs

* Fixed typo in log message

* Remove isMac check for 32 bit DXVK

* Use wineboot -u to restore Wine stock DLLs after removing DXVK ones

* DXVK DLL removal code refactoring

* Switch from rm to rmSync
  • Loading branch information
casasfernando authored Nov 1, 2024
1 parent 44c4269 commit 8bd1165
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion src/backend/tools/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export const DXVK = {
const is64bitPrefix = existsSync(`${winePrefix}/drive_c/windows/syswow64`)

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

if (!existsSync(`${toolsPath}/${tool}/latest_${tool}`)) {
Expand Down Expand Up @@ -285,6 +285,40 @@ export const DXVK = {
protonVerb: 'run'
})
})

logInfo('Removing DXVK DLLs', LogPrefix.DXVKInstaller)

// removing DXVK dlls
let dllsToRemove
if (is64bitPrefix) {
dllsToRemove = dlls64.map(
(dll) => `${winePrefix}/drive_c/windows/system32/${dll}`
)
dllsToRemove.concat(
dlls32.map((dll) => `${winePrefix}/drive_c/windows/syswow64/${dll}`)
)
} else {
dllsToRemove = dlls32.map(
(dll) => `${winePrefix}/drive_c/windows/system32/${dll}`
)
}
dllsToRemove.forEach((dllFile) => {
try {
rmSync(dllFile)
} catch (err) {
logError([`Error removing ${dllFile}`, err], LogPrefix.DXVKInstaller)
}
})

// Restore stock Wine libraries
logInfo('Restoring Wine stock DLLs', LogPrefix.DXVKInstaller)

await runWineCommand({
gameSettings,
commandParts: ['wineboot', '-u'],
wait: true,
protonVerb: 'run'
})
return true
}

Expand Down

0 comments on commit 8bd1165

Please sign in to comment.