ModOrganizer2 / modorganizer

Mod manager for various PC games. Discord Server: https://discord.gg/ewUVAqyrQX if you would like to be more involved
http://www.nexusmods.com/skyrimspecialedition/mods/6194
GNU General Public License v3.0
2.21k stars 163 forks source link

NVidia Optimus makes Morrowind randomly fail to launch through Mo2 #584

Open VictorDragonslayer opened 5 years ago

VictorDragonslayer commented 5 years ago

The problem

Mod Organizer 2.1.5 randomly fails to launch Morrowind - yesterday everything worked, today you receive "Application stopped working", the next day Morrowind launches again (nothing was changed - no ini values tweaked, no mods moved up/down or disabled/enabled).

Environment

Details

The issue appears randomly: I was neither able to reliably reproduce it or find a reliable fix. I compared the logs and noticed that they are similar at lines 1-90, but at line 91 log of failed launch mentions missing folder \AppData\Local\Morrowind, while log of successful launch says nothing about it (it ends at line 90). There is no such folder (and I don't know whether or not it should exist), but the fact that during one launch MO tried to access it and during another launch didn't care about this folder at all seems weird.

Links to Mod Organizer logs

USVFS

Failed launch Successful launch

MO Interface

Interface log

Al12rs commented 5 years ago

New version have been reported to work so I'm closing this. If you can reproduce reopen this.

VictorDragonslayer commented 4 years ago

Test failed. Scenario and preconditions are the same.

Mod Organizer Version that exhibits the issue: 2.2.1 Last Mod Organizer Verison that did not exhibit the issue: 2.2.0

USVFS: https://gist.github.com/VictorDragonslayer/2813500fa11eaa14689fff27323683c6

MO Interface: https://gist.github.com/VictorDragonslayer/4e4ca2a9bef344d7896b151da01921d5 "Не удается найти указанный файл" means "can't find specified file". "В системе отображения конечных точек не осталось доступных конечных точек" means "no available endpoints left in endpoint mapping system". I don't know what endpoint is, so translation may be inaccurate, so you better use error code - 0x800706d9.

Rolling back to version 2.2.0 fixes the issue - more than 20 runs in total at different days since 17th May were successful.

@Al12rs Can you reopen this issue or I should create a new one?

Al12rs commented 4 years ago

From the log it would seem that you have something called CoProcManager by nvidia installing detours in MO2, and probably the games as well. I'm not sure what that is but googling it brought out a number of other issues related to it with other applications crashing due to it. Do you know if you can figure out what it is and if you can avoid it hooking your applications?

VictorDragonslayer commented 4 years ago

Quick search turned out this article: https://community.kaspersky.com/kaspersky-free-for-windows-73/kasperskiy-free-ne-zapuskaetsya-oshibka-s-grafikoy-chto-mozhet-byt-moved-2618?sort=dateline.desc A person is having problems with Kaspersky Free (I'm using this antivirus). There is also a mention of CoProcManager - in order to fix the problem a file C:\Program Files (x86)\NVIDIA Corporation\coprocmanager\nvd3d9wrap.dll should be renamed to something else. I wonder if it relates to https://github.com/ModOrganizer2/modorganizer/issues/956 I'll investigate it and report back.

VictorDragonslayer commented 4 years ago

Test 1.

MO version: 2.2.1

Scenario:

  1. C:\Program Files (x86)\NVIDIA Corporation\coprocmanager\nvd3d9wrap.dll was renamed to C:\Program Files (x86)\NVIDIA Corporation\coprocmanager\nvd3d9wrap.dll.old.
  2. Launched Morrowind.

Expected result: game launched. Actual result: game launched.

USVFS: https://gist.github.com/VictorDragonslayer/df63d169bb1ca6545b2f96651236f5ed MO Interface: https://gist.github.com/VictorDragonslayer/7dc160d4ab0680bba8f0fb693cfc7b0b

Test 2.

MO version: 2.2.1

Scenario:

  1. All contents (detoured.dll, nvd3d9wrap.dll and nvdxgiwrap.dll) of C:\Program Files\NVIDIA Corporation\coprocmanager\ and C:\Program Files (x86)\NVIDIA Corporation\coprocmanager\ were renamed from ".dll" to ".dll.old".
  2. Launched Morrowind.

Expected result: game launched. Actual result: game launched.

USVFS: https://gist.github.com/VictorDragonslayer/61e4b7cecfdcd316e093148566a1ede6 MO Interface: https://gist.github.com/VictorDragonslayer/4a4355ab73b7a0a5c6f630c4873fec2b

Interesting fact: in Test 1 dlls were hooked from C:\Program Files\, but crash did not occur.

Workaround:

  1. Open NVIDIA Control Panel and set NVIDIA card as preferred graphics processor.
  2. Rename contents of C:\Program Files\NVIDIA Corporation\coprocmanager\ and C:\Program Files (x86)\NVIDIA Corporation\coprocmanager\. Tested on ASUS X550L.

Details. CoProcManager is related to NVIDIA Optimus. I was unable to find a proper explanation of how it works, just mentions of libraries from \NVIDIA Corporation\coprocmanager\ being buggy. In NVIDIA Control Panel my GT 740M is set as preferred graphics processor, so games are using it - tested on Skyrim and League of Legends after renaming libraries. I can't imagine why Optimus may clash with MO 2 and why it happens on 2.2.1, but not on 2.2.0.

Al12rs commented 4 years ago

Thank you for the very detailed testing and reports. The reason the two programs clash is most likely because Nvidia is trying to reroute some of the same function calls that usvfs is trying to reroute, making one of the two fail and causing a crash since the applications are not able to correctly do what they are supposed to.

In theory detours should not be interfering with Mo2, as we have an example of another program working perfectly with Mo2 that uses detours on some of the Mo2 hooked functions, but I'm not too knowledgeable on this stuff. Maybe there is the possibility to avoid this issue after a proper instigation.

VictorDragonslayer commented 4 years ago

I ran several more tests, here is the summary.

  1. Bug can be reproduced on 364.51 (initial) and 425.31 (latest) NVIDIA drivers with MO 2.2.1.
  2. Bug affects both Morrowind and Oblivion installations, meaning that the problem is not tied to a game, but to a USVFS in general.
  3. Scenario seems stable - I was unable to get at least one successful run with active dlls.
  4. Workaround seems stable - got zero failed runs with deactivated dlls.