#[Hyperline] turning off/on no longer fixes dash trails.
91 messages · Page 1 of 1 (latest)
@neat cliff @rugged lake that looks like hook order isn't accurate. neither hyperline nor moredasheline use detourcontexts. both of them hook Player.GetTrailColor, which is the relevant method here. hyperline removes its hooks when disabled in settings and readds them when enabled (more dasheline's are only applied on startup as usual).
ideally one of these mods should use a DetourContext to make this not dependent on toggling settings like that, but this still signifies that hook order doesn't work as it used to

I'll look into it tomorrow its getting late for me
Still the same bug
I disabled DetourContext dispose and it works
prob some kinda jank hell with other mods that IL hooks somewhere that Hyperline hooks
Ill debug more after 💤

God damnit
@quiet osprey see above, not hook ordering but another instance of DetourContexts
It probably is a combination of it relying on implicit order of the hook load (which causes it to break when you toggle on/off), but outside of that a leaked detourcontext usually prevents this
didn't you say leaked detourcontexts wouldn't happen because of some kind of scoping thing?
Ok it hopefully shouldn't be
Bad news it does
wait nvm it does by some magic voodoo this method leeks it context to Hyperline
Currently investigating why not Disposing LegacyDetourContext casues that
nvm it was a false positive, in core if you reintroduce the Disposed bug it leaks the context and somehow that fixed the issue but stable doesn't leak
Okay no idea how to fix this cuz Monomod , but the TLDR is that Hyperline isn't hooking correctly, it relays on the player unhooking and rehooking via the settings menu, this causes the hook to get placed in the correct place, but the issue with core is that LegacyHookEndpointManager.IsLegacyMMCaller return false because it cant find RelinkedMonoModLegacyAttribute in Hyperline EverestModuleAssemblyContext when the player rehooks the method from the settings menu.
@neat cliff
Okay after looking into the monomod stuff it seems that if a mod isn't using an assembly ref that contains MonoMod. it wont be considered legacy even if it uses MMHOOK_Celeste
Yap no mono.
My unprofessional fix https://github.com/EverestAPI/Everest/pull/662
btw found this while debugging https://github.com/swoolcock/GravityHelper/pull/82#issuecomment-1687699310 
so GH hooks are not useless
me with my purple hair that just glows blue, watching how all this is blowing up

does core not have MMHOOK_Celeste?
it does
core relinks all calls from HookEndpointManager in MMHOOK_Celsete to LegacyHookEndpointManager, the issue is that LegacyHookEndpointManager wont give a default config if the mod Assembly has no AssemblyReferences that stats with "MonoMod." .
it seems like we need a better way to detect the version. do assemblies store the versions of assemblies they're linked against? we could bump the mmhook_celeste version on core
I'll look into it
I checked if you can get the .net version an assembly is targeting, but it seems you can only get the version it was compiled on
not sure if dotpeek is anything to go by but it says that all mods are targeting MMHOOK_Celsete version 0.0.0.0
I'm also not convinced having hook ordering differ between legacy and core mods is a good idea in the first place, that sounds like it'd make porting mods to core super annoying
that's a good point
cc @neat cliff
since I assume the hope is that most mods won't use legacyRef forever
I mean that's good we could just search for version 0.0.0.0 and bump core to something else
oh I assume IsNetCoreOnlyMod checks for the EverestCore dependency?
Yep
I was hoping that'd be a thing of the past once core hits stable
anyway what are your thoughts on this
My thoughts are that the alternative is worse
The fundamental issue here is that legacy and reorg MonoMod mods both link against the same MMHOOK dll
However, the compat layer should only kick in for, well, compatibility reasons
And long term we want everyone to switch to reorg
I mean "not having to change your dozens of hooks when moving your mod to core" is a compatibility reason
That's why it checks whether the caller of the MMHOOK method has been relinked against the monomod compat layer, which means that MMHOOK should also emulate the old hook ordering
imagine when like extvar and gravityhelper start moving to core only mods
Core mods can still link against legacy monomod
That's orthagonal
huh
The specific issue we encountered here is that if the mod links against no monomod version at all, we don't know whether it wants to use legacy or reorg monomod
Non-core only mods will always link against legacy, so we always use the fallback
However, for core-only mods we don't want to use the compat layer unless absolutely required
that's why I suggested changing the mmhook_celeste version (assuming we can detect that). I don't think a mod that's not linked against monomod or mmhook_celeste can use hooks
If someone e.g. starts writing a new mod from scratch on core then they probably don't want the reorg layer
actually no how would we handle the case of hyperline moving to core. it'd be linked against the new mmhook too
If someone moves to core-only however wants to force the compat layer (remember, this shouldn't be required at all because if you don't use MonoMod itself you as the modder don't seem to care at all about hook ordering), they can just add a reference to legacy MonoMod and not do anything more than that+
only a handful of people intentionally care about hook ordering. but as we've seen repeatedly now, that doesn't mean they aren't relying on it implicitly
(fix pushed btw)
this'll definitely require an expansive section in the porting guide 
My idea is that someone entering the modding scene in 2024 will not have to care about anything fw or legacy mm related
what is bro hooking /j
yeah no I'm talking about people porting their mods
If you start a completely new mod, and use MMHOOKs in a core-only setting, you definitely don't want to use a compatbility layer for some ancient out-of-date monomod version
They can either add a legacy monomod ref to force the compat layer (in case they implicitly relied on the old hook ordering), or they can just... not (in case they don't care, which should apply to 99% of people)
also someone should make a pr to hyperline that (in a legacy compatible way) adds a detourcontext to that hook to make it take priority (since that seems to be the expected behavior)
Yep
and hope that sean is still semi-active 
As a quick overview, this only is an issue when:
- a non-core mod switches to core-only
- which doesn't reference any MonoMod dlls
- but adds an MMHOOK on a critical method
- in a way which only works with really specific hook ordering
- which is not explicitily specified using DetourContexts
In which case the fix is not to just make core restore the implicit hook ordering, but to just add a fricking DetourContext and make your intentions explicit like you are supposed to do 
And if you keep your mod as a fw one (because you can't be bothered porting it), then you don't have to bother with anything
@royal schooner Core build 4171 is live now, which should fix the issue
the workaround is back :} thank you all
Marked as resolved 
i'm sorry, i been busy with work as of late
give me a moment to look through the whole thing
so, from what im seeing, this is an issue to swapping to a new system and causing the hooks to get out of order
what can i do to port/resolve this?
It issue was in Everest and was fixed, now Hyperline works fine on core 
the issue that made it behave differently on core has been fixed. however, ideally toggling it off and on to change hook order shouldn't be required at all, it should specify that its hooks should take precedence using detourcontexts. I'm not fully sure off the top of my head what the correct syntax for that would be because this stuff also has me thoroughly confused, but I can get back to you

