File tree Expand file tree Collapse file tree
Source/ModuleManagerWatchDog Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,6 +43,9 @@ private void Start()
4343 if ( null == msg && SanityLib . IsEnforceable ( 1 , 12 ) )
4444 msg = CheckModuleManagerConflict112 ( ) ;
4545
46+ if ( null == msg && SanityLib . IsEnforceable ( 1 , 12 ) )
47+ msg = CheckModuleManagerDoppelganger112 ( ) ;
48+
4649
4750 if ( null != msg )
4851 GUI . ShowStopperAlertBox . Show ( msg ) ;
@@ -135,5 +138,28 @@ private string CheckModuleManagerConflict112()
135138 return "There're conflicting Module Manager versions on your instalment! You need to choose one version and remove the other(s)!" ;
136139 return null ;
137140 }
141+
142+ // Trashing KSP's Assembly Loader/Resolver is essemtially common place, but sometimes these guys outdo themselves.
143+ //
144+ // Besides preventing multiple instances of the ModuleManager Assembly from being loaded, since KSP 1.12
145+ // **they still start them nevertheless**! This means the multiple ModuleManager's instances from the same Assembly can run
146+ // in parallel, **duplicating** all patching!
147+ //
148+ // DAMN, SQUAD!!! :(
149+ //
150+ // See https://github.com/net-lisias-ksp/ModuleManagerWatchDog/issues/6 for details.
151+ //
152+ private string CheckModuleManagerDoppelganger112 ( )
153+ {
154+ Log . dbg ( "CheckModuleManagerDoppelganger112" ) ;
155+
156+ int hits = 0 ;
157+ foreach ( AssemblyLoader . LoadedAssembly m in AssemblyLoader . loadedAssemblies )
158+ if ( ASSEMBLY_NAME . Equals ( m . assembly . GetName ( ) . Name ) ) ++ hits ;
159+
160+ if ( hits > 1 ) return "There're more than one Module Manager on this KSP installment! Please delete all but the one you intend to use!" ;
161+ return null ;
162+ }
163+
138164 }
139165}
You can’t perform that action at this time.
0 commit comments