iXit / wine-nine-standalone

Build Gallium Nine support on top of an existing WINE installation
GNU Lesser General Public License v2.1
272 stars 23 forks source link

allow to switch between current d3d9.dll and d3d9-nine.dll #147

Closed q4a closed 1 year ago

q4a commented 1 year ago

General problem: if WINEPREFIX already has d3d9.dll and you installing Nine, then old d3d9.dll will be deleted. After this change it will be stored as d3d9-nine.bac.

I hope, that it will be enough to close https://github.com/iXit/wine-nine-standalone/issues/136

dhewg commented 1 year ago

Thanks for the changes!

But why do you restore the backup in the get() function? If that would be done in set() instead (which also sounds like the more appropriate place), this symlink stuff in get() could also be simplified to just if (WasEnabled && ln && (!reg || !file_exists())

q4a commented 1 year ago

But why do you restore the backup in the get() function?

This will not work (at least with current changes). Here is example:

  1. Nine was enabled and d3d9-nine.bac is symlink to proton.
  2. You disable Nine and d3d9-nine.bac renamed to d3d9.dll in set() function. Also WasEnabled is true.
  3. Then you call get() function and got:
    reg = nine_registry_enabled(); // false
    ln = is_symlink(buf); // true
    ret = reg && ln;
    if (!reg && ln) // true
    {
        /* Sanity: Remove symlink if any */
        if (WasEnabled) // true
        {
            ERR("removing obsolete symlink\n");
            remove_file(buf); // remove d3d9.dll which already is symlink to proton.
        }
        ret = FALSE;
    }
q4a commented 1 year ago

Your if (WasEnabled && ln && (!reg || !file_exists()) looks strange. You 100% need to check if file_exists("d3d9-nine.bac") and then you can rename only if it's true.