Fixed bug with HarmonyXTranspilerFix

This commit is contained in:
LadyAliceMargatroid 2024-12-18 15:25:49 -08:00
parent aeae936540
commit fec9e35898
5 changed files with 15 additions and 5 deletions

View File

@ -14,6 +14,8 @@ using DunGenPlus.DevTools.Panels;
using DunGenPlus.DevTools.UIElements; using DunGenPlus.DevTools.UIElements;
using DunGenPlus.Generation; using DunGenPlus.Generation;
using DunGenPlus.DevTools.Panels.Collections; using DunGenPlus.DevTools.Panels.Collections;
using HarmonyLib;
using HarmonyLib.Public.Patching;
namespace DunGenPlus.DevTools { namespace DunGenPlus.DevTools {
internal partial class DevDebugManager : MonoBehaviour { internal partial class DevDebugManager : MonoBehaviour {

View File

@ -49,6 +49,13 @@
<Reference Include="LethalLevelLoader-publicized"> <Reference Include="LethalLevelLoader-publicized">
<HintPath>..\..\..\Libraries\LethalLevelLoader-publicized.dll</HintPath> <HintPath>..\..\..\Libraries\LethalLevelLoader-publicized.dll</HintPath>
</Reference> </Reference>
<Reference Include="Mono.Cecil">
<HintPath>..\..\..\Libraries\Mono.Cecil.dll</HintPath>
</Reference>
<Reference Include="MonoMod.Utils, Version=22.1.29.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Libraries\MonoMod.Utils.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />

View File

@ -373,16 +373,17 @@ namespace DunGenPlus.Patches {
endSequence.AddBasic(OpCodes.Callvirt); endSequence.AddBasic(OpCodes.Callvirt);
endSequence.AddBasic(OpCodes.Endfinally); endSequence.AddBasic(OpCodes.Endfinally);
// WE MUST INJECT BEFORE ENDFINALLY
// DiFFoZ says cause try/catch block something
// Idk that makes no sense
// But if it works it works
foreach(var instruction in instructions){ foreach(var instruction in instructions){
if (endSequence.VerifyStage(instruction)) { if (endSequence.VerifyStage(instruction)) {
yield return instruction;
var specialFunction = typeof(DunGenPlusGenerator).GetMethod("AddTileToMainPathDictionary", BindingFlags.Static | BindingFlags.Public); var specialFunction = typeof(DunGenPlusGenerator).GetMethod("AddTileToMainPathDictionary", BindingFlags.Static | BindingFlags.Public);
yield return new CodeInstruction(OpCodes.Ldloc_0); yield return new CodeInstruction(OpCodes.Ldloc_0);
yield return new CodeInstruction(OpCodes.Call, specialFunction); yield return new CodeInstruction(OpCodes.Call, specialFunction);
continue;
} }
yield return instruction; yield return instruction;
} }

View File

@ -25,7 +25,7 @@ namespace DunGenPlus {
internal const string modGUID = "dev.ladyalice.dungenplus"; internal const string modGUID = "dev.ladyalice.dungenplus";
private const string modName = "Dungeon Generation Plus"; private const string modName = "Dungeon Generation Plus";
private const string modVersion = "1.3.1"; private const string modVersion = "1.3.3";
internal readonly Harmony Harmony = new Harmony(modGUID); internal readonly Harmony Harmony = new Harmony(modGUID);