This is the AMP version of this page.
If you want to load the real page instead, click this text.

Solved How to hooking function that has class and enum parameters in LGL mod menu?

Status
Not open for further replies.

thienha1

Approved Modder
Approved Modder
I tried too many times search overall the forum, even Google, but still no hope, so I need modders can analyze this function that how to hook!
Example Code:
C#:
//  Token: 0x06029FCC RID: 171980 RVA: 0x00002050 File Offset: 0x00000250 
        [Token(Token = "0x6029FCC")]
        [Address(RVA = "0x2BC7B2C", Offset = "0x2BC7B2C", VA = "0x2BC7B2C")]
        public float Method(Class1 class1, Enum1 enum1)
        {
            return 0f;
        }
Then I wrote code C++ in Main.cpp and i fixed Class1, Enum1 that added 2 class Class1 and Enum1 C++ in project:
C++:
float (*old_Method)(void *instance, Class1 class1, Enum1 enum1);
float Method(void *instance, Class1 class1, Enum1 enum1) {
    if (instance != NULL && value > 1) {
        return (float) value;
    }
    return old_Method(instance, class1, enum1);
}
And Build and Running App then tried set slider in menu mod and crashed immediately!
Hope you all can help me solve this problem!
 
Ex:
C++:
float (*old_Method)(void *instance, void class1, void enum1);
float Method(void *instance, void class1, void enum1) {
    if (instance != NULL && value > 1) {
        return (float) value;
    }
    return old_Method(instance, class1, enum1);
}
 
Last edited:
It work perfect, thank you for your guide!
 
Status
Not open for further replies.