HarmonyX icon indicating copy to clipboard operation
HarmonyX copied to clipboard

Wrong decode Bge_Un_S, decoding as Bge_Un ...

Open deltaone opened this issue 1 year ago • 4 comments

2023-03-26_222846 2023-03-26_222902

Use this patch function, original Harmony - ok, HarmonyX - failed ... After debugger - HarmonyX decode Bge_Un_S as Bge_Un ...

		static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{			
			return new CodeMatcher(instructions)
				.MatchEndForward(
					new CodeMatch(i => i.opcode == OpCodes.Ldsfld  && ((FieldInfo)i.operand).Name == "worldSurface"),
//					new CodeMatch(OpCodes.Bge_Un_S),
					new CodeMatch(OpCodes.Bge_Un),
					new CodeMatch(OpCodes.Ret))
				.ThrowIfInvalid("MinecartDiggerHelper.TryDigging(): Error! Can't find pattern!")
				.SetAndAdvance(OpCodes.Nop, null)
				.InstructionEnumeration();
		}

deltaone avatar Mar 26 '23 18:03 deltaone