File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Source/ModuleManagerWatchDog Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,9 @@ private void Start()
43
43
if ( null == msg && SanityLib . IsEnforceable ( 1 , 12 ) )
44
44
msg = CheckModuleManagerConflict112 ( ) ;
45
45
46
+ if ( null == msg && SanityLib . IsEnforceable ( 1 , 12 ) )
47
+ msg = CheckModuleManagerDoppelganger112 ( ) ;
48
+
46
49
47
50
if ( null != msg )
48
51
GUI . ShowStopperAlertBox . Show ( msg ) ;
@@ -135,5 +138,28 @@ private string CheckModuleManagerConflict112()
135
138
return "There're conflicting Module Manager versions on your instalment! You need to choose one version and remove the other(s)!" ;
136
139
return null ;
137
140
}
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
+
138
164
}
139
165
}
You can’t perform that action at this time.
0 commit comments