MonoMod
MonoMod copied to clipboard
Hookgen creates events that are impossible to subscribe to
Description
If the original dll has a private struct with methods, then HookGen creates events to Hook those methods, but it's impossible to subscribe to those events.
Example
There's a type in Hollow Knight that looks like
public class HealthManager
{
private struct HPScaleGG
{
public int GetScaledHP()
{
// Code goes here
}
}
}
HookGen creates the event On.HealthManager.HPScaleGG.GetScaledHP of type delegate int hook_GetScaledHP(... orig, ref ValueType self). But this event is unhookable, because the HookEndpointManager is expecting a parameter of type ref HealthManager.HPScaleGG which is not compatible with ref ValueType.
I'm not entirely sure what the best fix would be, but I feel that not creating the event is probably better than creating an event that can't be hooked.