-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merging upstream #97
Merging upstream #97
Conversation
… in HarmonySharedState. - Bump the internal version field in HarmonySharedState
Fix Unpatch default parameter
Use complex LambdaExpression walking to allow GetMethodInfo (() => myMethod) rather than GetMethodInfo(() => myMethod(null,null,null....))
…decoding_pr Ok, after consideration, especially with the fact that you need the latest language version, I decided that the risk is minimal. I will just take it as it is since less experienced users are most likely to affected due to them not running the latest language features.
They are supported when just inspecting the IL code
mentions that filter blocks are unsupported in the documentation
Improve Performance of `FindReplacement`
Frankly I don't see any reason why mono wouldn't inline a purely throwing method without |
Watch out, bumping the MonoMod.RuntimeDetour version requires Harmony to target net452 instead of net45, otherwise it won't use the correct version of Mono.Cecil.
Yes, the usage is the same, as I said it was breaking patches that did work before and it breaks my test one as well, and as you can see that method isn't called before patching. Patching happens in [Plugin(RuntimeOptions.DynamicInit)]
public class Plugin
{
internal static IPALogger Log { get; private set; } = null!;
[Init]
public Plugin(IPALogger logger, PluginMetadata metadata)
{
Log = logger;
Harmony.CreateAndPatchAll(metadata.Assembly, "com.meivyn.BeatSaber.BSPlugin5");
}
[OnEnable]
public void OnEnable()
{
Patch.ReversePatch();
}
[OnDisable]
public void OnDisable()
{
}
public void TestMethod()
{
Log.Notice(nameof(TestMethod));
}
}
[HarmonyPatch(typeof(Plugin), nameof(Plugin.TestMethod))]
internal class Patch
{
[HarmonyReversePatch]
[MethodImpl(MethodImplOptions.NoInlining)] // breaks without this
public static void ReversePatch()
{
throw new NotImplementedException("Reverse patch has not been executed.");
IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
return new CodeMatcher(instructions)
.MatchStartForward(new CodeMatch(OpCodes.Ldstr))
.SetOperandAndAdvance("Reverse patched")
.InstructionEnumeration();
}
}
} |
Cannot confirm it. Used latest BSIPA 4.3.2 with your sample without |
Yeah, I actually cannot reproduce the same behavior with my patch as well. It seems to happen only to this patch: https://github.com/Aeroluna/Heck/blob/master/Heck/HarmonyPatches/PlayViewInterrupter.cs#L76, at least from my testing. Using Harmony 2.12.0 broke this patch, and it was not throwing before that. Reverting to Harmony 2.10.2 fixes it. |
Okay, reverse patches are broken in general in 1.11.0+, affirmative. GC collects them. I'll see what I can come up with |
Far from perfect, but let's call it a hotfix for now |
That doesn't fix the inline issue with my test patch, however it seems to have fixed the broken patch I mentioned earlier. Guess I'm only missing a fix for the IL error that happens when reverse patching some methods before using this PR in BSIPA. I highly doubt those are the only bugs we are gonna encounter, but I guess it is usable enough. Thanks for your fixes. |
Restructured. Last push in this PR, unless fixes related to it are needed. I'm planning some structural changes of project based on this PR, but as separate one |
Pardon, that fix was important. Also, friendly reminder that without |
As far as I can tell it should work the same way, but with two packages. Not sure about integration with jenkins though |
whats missing for this to be merged? CI? HarmonyX.Ref? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry it took me so long to review, most of the changes are just syntax fluff which makes it hard to spot and review any material changes.
As far as I can see this is good to merge and shouldn't break binary backwards compatibility. There may be some minor source code breaks but that's fine.
It might require a major version bump still, but that's for later.
My main worry is workflows and dealing with the ref/full situation. Ideally builds and packages would stay in the same format as they are now, in my opinion at least.
If no one else raises any issues with this PR in the meantime I'll merge this later next week.
Theoretically I can merge netstandard references into main package, will check. |
Okay, there's a reason for separate package (harmony's discord). |
Merging up to v2.3.1.1 of upstream + some fixes