Skip to content
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

Add a fix for TermInfoReader to prevent throws on boot #889

Open
wants to merge 1 commit into
base: alpha-development
Choose a base branch
from

Conversation

aldelaro5
Copy link

This fix is directly taken from bepinex: https://github.com/BepInEx/BepInEx/blob/master/Runtimes/Unity/BepInEx.Unity.Mono.Preloader/RuntimeFixes/XTermFix.cs#L16

It was found to affect melon in a bad way particularly when trying to load UE on old unity mono on linux (seems the fix only was applied on 2020.2). What would happen is a throw early on that prevents the C# console to function. The throw would typically say something like "Magic number is wrong: 542".

You will notice a...really nasty hacky workaround with MonoMod on both this PR and the bepinex version which is that legacy MonoMod will eventually cause the Console cctor to run....which eventually gets the TermInfoReader to kick in. This is bad because it means it gets to kick in unpatched...when we are trying to patch it!

The nasty workaround is to set DetourHelper.Native directly instead of letting MonoMod determine it. Since we use ifdef for this, it's fine, it just looks ugly :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant