Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -346,3 +346,6 @@ KSPDevPath.xml

# Binaries
GameData/KSPCommunityFixes/Plugins/*

# keep harmony PBD
!0Harmony.pdb
3 changes: 0 additions & 3 deletions KSPCommunityFixes/BasePatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,6 @@ private static IEnumerable<CodeInstruction> OverrideTranspiler(IEnumerable<CodeI
// This gets quite complicated because the ILGenerator isn't actually an ILGenerator from reflection, but a runtime
// generated replacement from MonoMod. Long story short, copying all the stuff require accessing all that internal
// MonoMod generator stuff, which we publicize for convenience.
// This however mean that this is very likely to break on updating MonoMod/Harmony, and as a matter of fact, will
// definitely break if we start using Harmony 2.3+, which is based on a new major version of MonoMod where all this
// stuff has been heavily refactored.
List<CodeInstruction> overrideIl = PatchProcessor.GetOriginalInstructions(patch.patchMethod, out ILGenerator overrideGen);
PatchProcessor.GetOriginalInstructions(__originalMethod, out ILGenerator originalGen);

Expand Down
4 changes: 4 additions & 0 deletions KSPCommunityFixes/BugFixes/ExtendedDeployableParts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ static IEnumerable<CodeInstruction> ModuleDeployableSolarPanel_OnStart_Transpile
{
code[i].opcode = OpCodes.Br_S;
code[i].operand = code[i + 2].operand; // grab the target instruction from the original jump
code[i + 1].opcode = OpCodes.Nop; // don't generate invalid IL
code[i + 1].operand = null;
code[i + 2].opcode = OpCodes.Nop; // don't generate invalid IL
code[i + 2].operand = null;
break;
}
}
Expand Down
23 changes: 15 additions & 8 deletions KSPCommunityFixes/KSPCommunityFixes.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -91,36 +91,43 @@
</ItemGroup>
<!--Krafs.Publicizer items-->
<ItemGroup>
<!-- Publicize the whole KSP assembly -->
<Publicize Include="Assembly-CSharp" />
<Publicize Include="Assembly-CSharp-firstpass" />
<!-- Prevent some name collisions due to publicizing the whole Assembly-CSharp -->
<DoNotPublicize Include="Assembly-CSharp:BaseField`1.OnValueModified" />
<DoNotPublicize Include="Assembly-CSharp:SaveUpgradePipeline.SaveUpgradePipeline.OnSetCfgNodeVersion" />
<!-- Direct access to UnityEngine.Object pointer to the native object (various optimizations) -->
<Publicize Include="UnityEngine.CoreModule:UnityEngine.Object.m_CachedPtr" />
<Publicize Include="UnityEngine.CoreModule:UnityEngine.Object.GetOffsetOfInstanceIDInCPlusPlusObject" />
<!-- IMGUIOptimization patch : allow access to internal IMGUI stuff -->
<Publicize Include="UnityEngine.IMGUIModule" />
<!-- low level access to a NativeArray data -->
<Publicize Include="UnityEngine.CoreModule:Unity.Collections.NativeArray`1.m_Buffer" />
<Publicize Include="mscorlib:System.Runtime.CompilerServices.Unsafe" />
<!-- FastLoader patch : lower level access to files creation / latswrite time -->
<Publicize Include="mscorlib:System.IO.MonoIO" />
<Publicize Include="mscorlib:System.IO.MonoIOError" />
<Publicize Include="mscorlib:System.IO.MonoIOStat" />
<!-- ReflectionTypeLoadExceptionHandler patch : reimplementation of GetTypes requires acces to the internal overload -->
<Publicize Include="mscorlib:System.Reflection.Assembly.GetTypes" />
<!-- Publicized for low level / unsafe access to strings -->
<Publicize Include="mscorlib:System.String.m_firstChar" />
<!-- We need to publicize some MonoMod stuff to implement the override patch type -->
<Publicize Include="0Harmony:MonoMod.Utils.Cil.ILGeneratorShimExt" />
<Publicize Include="0Harmony:MonoMod.Utils.Cil.CecilILGenerator+LabelInfo" />
<Publicize Include="0Harmony:MonoMod.Utils.Cil.CecilILGenerator+LabelledExceptionHandler" />
<Publicize Include="0Harmony:MonoMod.Utils.Cil.CecilILGenerator+ExceptionHandlerChain" />
<Publicize Include="0Harmony:MonoMod.Utils.Cil.CecilILGenerator._LabelInfos" />
<Publicize Include="0Harmony:MonoMod.Utils.Cil.CecilILGenerator._LabelsToMark" />
<Publicize Include="0Harmony:MonoMod.Utils.Cil.CecilILGenerator._ExceptionHandlersToMark" />
<Publicize Include="0Harmony:MonoMod.Utils.Cil.CecilILGenerator._Variables" />
<Publicize Include="0Harmony:MonoMod.Utils.Cil.CecilILGenerator._ExceptionHandlers" />
<Publicize Include="0Harmony:MonoMod.Utils.Cil.CecilILGenerator.labelCounter" />
<Publicize Include="0Harmony:MonoMod.Utils.Cil.CecilILGenerator._ILOffset" />
<Publicize Include="0Harmony:MonoMod.Utils.Cil.CecilILGenerator.IL" />
<Publicize Include="0Harmony:Mono.Collections.Generic.Collection`1" />
<Publicize Include="0Harmony:Mono.Cecil.Cil.VariableDefinition" />
<Publicize Include="0Harmony:Mono.Cecil.Cil.VariableReference.index" />
<Publicize Include="0Harmony:Mono.Cecil.Cil.ILProcessor" />
<Publicize Include="0Harmony:Mono.Cecil.Cil.MethodBody" />
<Publicize Include="mscorlib:System.Reflection.Emit.Label.label" />
<Publicize Include="mscorlib:System.Reflection.LocalVariableInfo.position" />
<Publicize Include="mscorlib:System.Reflection.LocalVariableInfo.is_pinned" />
<Publicize Include="mscorlib:System.Reflection.LocalVariableInfo.type" />
<Publicize Include="0Harmony:Mono.Cecil.Cil.VariableReference.index" />
</ItemGroup>
<ItemGroup>
<Compile Include="BasePatch.cs" />
Expand Down
Binary file modified KSPCommunityFixes/lib/0Harmony.dll
Binary file not shown.
Binary file added KSPCommunityFixes/lib/0Harmony.pdb
Binary file not shown.
Loading