Uh oh!
There was an error while loading. Please reload this page.
Honor ignore_disable_switch for inherited DOORSTOP_INITIALIZED - #109
Honor ignore_disable_switch for inherited DOORSTOP_INITIALIZED#109mohui666 wants to merge 1 commit into
Conversation
Steam and self-restarts leak DOORSTOP_INITIALIZED into the new process. Doorstop then skips Mono bootstrap even when ignore_disable_switch is set, so BepInEx never reaches Doorstop.Entrypoint.Start. Clear the inherited flags after config load, and use a process-local flag for genuine in-process re-entry. Fixes the Steam/Windows case seen with Unity Mono titles (e.g. Legend of Mortal) and the restart path in NeighTools#73.
ManlyMarco
left a comment
There was a problem hiding this comment.
I think this is fine. I'll merge after giving others a chance to review.
arrowmaster
commented
Aug 14, 2026
This is an interesting conundrum. The original intent of the What situation have you found that needs this fixed? I know the common one where starting a game which requires SteamWorks without Steam running causes the game to launch Steam with arguments to launch itself again after Steam starts. I'm not objecting to the fix (although I would prefer the LOG messages for clearing the envvars to only happen when they are actually set), but I'm questioning why this setting is needed if its been broken for so long already and we have an open bug that would be made worse if it was used. If the setting is kept then it should actually work. |
mohui666
commented
Aug 14, 2026
This issue usually occurs at random. |
Summary
ignore_disable_switchalready exists so launchers that break environment isolation (Steam is called out inconfig.h) cannot kill Doorstop withDOORSTOP_DISABLE. The same launchers also leakDOORSTOP_INITIALIZED.mono_doorstop_bootstraptreats any inheritedDOORSTOP_INITIALIZEDas "we already ran" and returns before loading the target assembly. Verbose log from a Steam-launched Unity Mono game (Legend of Mortal / 活侠传):BepInEx never reaches
Doorstop.Entrypoint.Start.This also matches #73 (game process restarts itself and inherits both variables).
Change
ignore_disable_switchis on, clear inheritedDOORSTOP_INITIALIZEDandDOORSTOP_DISABLE(Windows + *nix).DOORSTOP_INITIALIZEDis set and the switch is off (existing behavior).Tested
Unity 2020.3 Mono x86, Steam app 1859910, BepInEx 6 BE,
ignore_disable_switch = true. After this change Doorstop logsOpening assemblyand BepInEx chainloader starts without running the game elevated.Notes
Not changing the default of
ignore_disable_switch(stillfalse). Callers that already set it for Steam should get the rest of the intended behavior.