Jump to content

error: use of undeclared identifier 'mp'


Go to solution Solved by Sakanya,

3 posts in this topic

Recommended Posts

Posted

Heya

 

So I'm trying to add a hook into the MM, since this worked on shmoo's MM, but the mm is buggy, I wanna do it on Arthurs.

 

This is the code I'm using:

    int (*orig_func)(void *self);

    int new_func(void *self)
    {
        
        BOOL featureIsActive = [menu getBool:@"k02BasicSwitcher"];
        
        if (featureIsActive)
            return 999999;
        else
            return orig_func(self);
    }

%ctor
{
    NSDictionary *hacks =
    @{

        @"k02BasicSwitcher":@{
            @"offsets": @[@"0x0ffset"],
            @"desc": @"This will make the enemy dead within one hit.",
            @"label": @"One Hit Kill"
            },
    };


MSHookFunction((void*)[mp calculateAddress:0x0ffset], (void*)new_func, (void**)&orig_func);

 

What's wrong?

Why I'm getting the error?

  • Solution
Posted (edited)

You're getting this error because the given example for hooking has not been updated to conform with the rest of the changes made to the library and template.

 

You can work around this issue by trying the following :

// You must do this if you're working with a 64-bit binary because of ASLR
MSHookFunction((void*)(_dyld_get_image_vmaddr_slide(0) + 0x000000000), (void*)newFunction, (void**)&oldFunction);

//Otherwise, you can omit "_dyld_get_image_vmaddr_slide(0)"
MSHookFunction((void*)(0x000000000), (void*)newFunction, (void**)&oldFunction);

 

Moreover, if you're only applying a hook, you don't need to define offsets or patches. All you need is the label and description.

Updated by Sakanya
Removed unnecessary comma.
Posted
On 1-11-2017 at 2:38 AM, Sakanya said:

You're getting this error because the given example for hooking has not been updated to conform with the rest of the changes made to the library and template.

 

You can work around this issue by trying the following :


// You must do this if you're working with a 64-bit binary because of ASLR
MSHookFunction((void*)(_dyld_get_image_vmaddr_slide(0) + 0x000000000), (void*)newFunction, (void**)&oldFunction);

//Otherwise, you can omit "_dyld_get_image_vmaddr_slide(0)"
MSHookFunction((void*)(0x000000000), (void*)newFunction, (void**)&oldFunction);

 

Moreover, if you're only applying a hook, you don't need to define offsets or patches. All you need is the label and description.

Never saw someone answered this. I just tried it & worked perfectly. 

Thankyou!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...

Important Information

We would like to place cookies on your device to help make this website better. The website cannot give you the best user experience without cookies. You can accept or decline our cookies. You may also adjust your cookie settings. Privacy Policy - Guidelines