Skip to content

Better support for dll overriding with relative path #202

@A2uria

Description

@A2uria

Taking such a directory tree as an example.

Game/
  Plugins/
    Game.exe
    winmm.dll
    dlsstweaks.ini
    nvngx_dlss_new.dll
  Launcher.exe

Launcher.exe runs Game.exe, which is the real entry of the game and loads DLSSTweaks dll. On startup, current directory is .../Game/. However, the game itself will soon change the current directory to something like .../Game/Plugins/, breaking the dll overriding feature. It will complain about missing nvngx_dlss_new.dll if we use nvngx_dlss = nvngx_dlss_new.dll. And if we use nvngx_dlss = Plugins/nvngx_dlss_new.dll, it won't work as .../Game/Plugins/Plugins/nvngx_dlss_new.dll is non-existant.

Currently I simply removed the check here, however if we support overriding using relative path to the DLSSTweaks dll, it would be wonderful, as we can create relocatable config for certain games.

auto path = utility::ini_get_string_safe(ini, "DLLPathOverrides", key, "");
if (!path.empty() && !utility::exists_safe(path)) // empty path is allowed so that user can clear the override in local INIs
{
spdlog::warn("DLLPathOverrides: override for {} skipped as path {} doesn't exist", key, path);
continue;
}
settings.dllPathOverrides[dllFileName] = path;

Also, maybe we could log current directory when loading overridden dlls to better support trouble shooting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions