Jump to content

How can i use on off with mshookfunction


z2x22
Go to solution Solved by Ted2,

4 posts in this topic

Recommended Posts

this is my tweak code 

 

#include "Macros.h"

BOOL mofeed = true;


/*****************************/
// Please see sample.xm for sample menu code.

// title of your menu
static NSString *const title = @""; 

// who made the hack?
static NSString *const credits = @"";

// what font do you want the text to be? don't put anything for the default font
static NSString *const font = @"";

// should the menu have a blurred background? true or false
// FYI: this won't always look pretty
static const bool blur = true;

// blur style
// you MUST pick from these three: UIBlurEffectStyleExtraLight, UIBlurEffectStyleLight, or UIBlurEffectStyleDark
// *** If you opted for no blur background, this is ignored. However, you still need to fill it in. ***
static const UIBlurEffectStyle blurStyle = UIBlurEffectStyleDark;

// A complete list of fonts can be found here: http://iosfonts.com/
/******************************/


%hook UnityAppController


- (void)applicationDidBecomeActive:(id)arg0 {

    /* For iOS 11 compatibility, the theme color must be here. */
    /* The overall color for the menu and the button. */
    /* If you want a custom color, use rgb(color code) */
    /* Use rgb(arc4random_uniform(0xFFFFFF)) for a random color each launch. */
    UIColor *themeColor = rgb(arc4random_uniform(0xFFFFFF));

    UIWindow *main = [UIApplication sharedApplication].keyWindow.rootViewController.view;

    UIButton *openButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    openButton.frame = CGRectMake((main.frame.size.width/2)-15, (main.frame.size.height/2)+75, 30, 30);
    openButton.backgroundColor = [UIColor clearColor];
    openButton.layer.cornerRadius = 16;
    openButton.layer.borderWidth = 2;
    openButton.layer.borderColor = themeColor.CGColor;
    [openButton addTarget:self action:@selector(wasDragged:withEvent:) 
    forControlEvents:UIControlEventTouchDragInside];
    [openButton addTarget:self action:@selector(showMenu) 
    forControlEvents:UIControlEventTouchDownRepeat];

    if(!buttonAdded){
        timer(5){
            UIWindow *main = [UIApplication sharedApplication].keyWindow.rootViewController.view;
            menu = [[ModMenu alloc] initWithTitle:title credits:credits fontName:font theme:themeColor blur:blur blurStyle:blurStyle];

            /*
            Add features below this comment. Feel free to delete this comment if you're comfortable with how this menu works.

            Things are added to the menu in the order you have added them.

            A Hack is a switch that contains offsets, hacked hexes, and original hexes. Straightforward.
            To create one, call addHack.
            addHack is called as follows: addHack(@"Hack Name", @"The description of your hack", themeColor, {offsets}, {hacked hexes}, {original hexes});
            For example:
            addHack(@"Infinite Ammo", @"Ammo doesn't run out.", themeColor, {0x1001B292A}, {0xC0035FD6}, {0xD213AEB5});
            You can also have multiple offsets, hacked hexes, and original hexes. There's no limit to the number of offsets you can have! For example:
            addHack(@"No Recoil", @"No recoil prevents any recoil from being applied when you shoot.", themeColor, {0x356a7c, 0x110f0a}, {0x7047, 0x7047}, {0xf0b5, 0xf0b5});
            
            A Hook is a switch that used to hook a function and apply a feature. This doesn't make much sense because you cannot "unhook" a function if
            the user wants the feature off. It currently serves no purpose except for backward compatibility. All it does is turn on or off now.

            A SliderHook is a slider that can be customized to have a minimum and maximum value.
            Good for hooking a function and returning user-specified values. To create one, call addSliderHook.
            addSliderHook is called as follows: addSliderHook(@"Hack Name", @"Description of your hack", themeColor, initial value, minimum value, maximum value);
            For example:
            addSliderHook(@"Adjust Field of View", @"Adjust your field of view.", themeColor, 0, 100, 50);
            To get the value of a SliderHook:
            float value = [SliderHook getSliderValueForHook:@"hack name here"];
            int value = (int)[SliderHook getSliderValueForHook:@"hack name here"];

            A TextfieldHook is a textfield. Again, good for hooking a function and returning user-specified values.
            To create one, call addTextfieldHook.
            addTextfieldHook is called as follows: addTextfieldHook(@"Hack name", @"Description of your hack", themeColor);
            For example:
            addTextfieldHook(@"Set Gems", @"Set your gem amount.", themeColor);
            To get the value of a TextfieldHook:
            NSString *value = [TextfieldHook getTextfieldValueForHook:@"hack name here"];
            float value = [[TextfieldHook getTextfieldValueForHook:@"hack name here"] floatValue];
            int value = [[TextfieldHook getTextfieldValueForHook:@"hack name here"] intValue];

            A Switch does nothing but turn on or off. Useful when you are in a hooked function and need to know when to call a function or mod an instance variable.
            Since it doesn't do anything but turn on or off, it is essentially the same thing as a Hook.
            To create one, call addSwitch.
            addSwitch is called as follows:
            addSwitch(@"Hack name", @"Description of your hack", themeColor);
            For example:
            addSwitch(@"Kill Everyone", @"Kill everyone in the lobby", themeColor);
            To test whether or not a Switch is on:
            bool on = [Switch getSwitchOnForSwitch:@"hack name here"];

            If you want to use writeData in your Tweak.xm, now you can! Call writeData like you normally would.
            Call writeData after the menu has been created. If you use it where you add features, you'll be fine.

            Handle hooking with the HOOK and HOOK_NO_ORIG macros. I decided to let you guys handle hooking because
            it is too troublesome to make sure I handle cases where you guys pass parameters incorrectly.

            If I wanted to hook a function called LocalPlayer::Update at 0x1001B762A with a pointer to the original function, I would do this:
            HOOK(0x1001B762A, _LocalPlayer_Update, LocalPlayer_Update);

            Where _LocalPlayer_Update is the function you write, and LocalPlayer_Update is the pointer to the original function.

            You can use HOOK_NO_ORIG if you don't need the pointer to the original function:
            HOOK_NO_ORIG(0x1001B762A, _LocalPlayer_Update);

            If that is too confusing, you can always just use MSHookFunction. HOOK and HOOK_NO_ORIG just wrap MSHookFunction in a cleaner call.
            */

MSHookFunction((void *)getRealOffset(0x101196238), (void *)_PlayerMovement_Update, (void **)&PlayerMovement_Update);


            // add features


addSwitch(@"test", @"Kill everyone in the lobby", themeColor);
            
            mofeed = [Switch getSwitchOnForSwitch:@"test"];

            [main addSubview:openButton];
            [main addSubview:menu];



            buttonAdded = true;
        });




    }

    %orig;
}

void (* PlayerMovement_Update)(void *PlayerMovement);
void _PlayerMovement_Update(void *PlayerMovement) {

*(float *)((uint64_t)PlayerMovement + 0x48) = 100.0f;
*(float *)((uint64_t)PlayerMovement + 0x78) = 100.0f;
*(float *)((uint64_t)PlayerMovement + 0x80) = 0.0f;
*(float *)((uint64_t)PlayerMovement + 0x74) = 16.0f;
PlayerMovement_Update(PlayerMovement);
}

%new
- (void)showMenu {
    [menu show];
}

%new
- (void)wasDragged:(UIButton *)button withEvent:(UIEvent *)event
{
    UITouch *touch = [[event touchesForView:button] anyObject];

    CGPoint previousLocation = [touch previousLocationInView:button];
    CGPoint location = [touch locationInView:button];
    CGFloat delta_x = location.x - previousLocation.x;
    CGFloat delta_y = location.y - previousLocation.y;

    button.center = CGPointMake(button.center.x + delta_x, button.center.y + delta_y);
}
%end

%ctor {
MSHookFunction((void *)getRealOffset(0x101196238), (void *)_PlayerMovement_Update, (void **)&PlayerMovement_Update);

}
void addHack(NSString *name, NSString *description, UIColor *theme, std::initializer_list<uint64_t> offsets, std::initializer_list<uint64_t> hackedHexes, std::initializer_list<uint64_t> originalHexes){
    if(menu == nil)
        return;
    
    std::vector<uint64_t> offsetVector;
    std::vector<uint64_t> hackedHexVector;
    std::vector<uint64_t> originalHexVector;
    
    offsetVector.insert(offsetVector.begin(), offsets.begin(), offsets.end());
    hackedHexVector.insert(hackedHexVector.begin(), hackedHexes.begin(), hackedHexes.end());
    originalHexVector.insert(originalHexVector.begin(), originalHexes.begin(), originalHexes.end());
    
    Hack *h = [[Hack alloc] initWithHackName:name info:description fontName:font theme:theme offset:offsetVector hackedHex:hackedHexVector originalHex:originalHexVector];
    [menu addHack:h];
}

void addHook(NSString *name, NSString *description, UIColor *theme){
    if(menu == nil)
        return;
    
    Hook *h = [[Hook alloc] initWithHookName:name info:description fontName:font theme:theme];
    [menu addHook:h];
}

void addSliderHook(NSString *name, NSString *description, UIColor *theme, float initialValue, float minValue, float maxValue){
    if(menu == nil)
        return;

    if(minValue > maxValue)
        return;
    
    SliderHook *sh = [[SliderHook alloc] initWithSliderHookName:name info:description fontName:font theme:theme initialValue:initialValue minValue:minValue maxValue:maxValue];
    [menu addHook:sh];
}

void addTextfieldHook(NSString *name, NSString *description, UIColor *theme){
    if(menu == nil)
        return;
    
    TextfieldHook *th = [[TextfieldHook alloc] initWithTextfieldHookName:name info:description fontName:font theme:theme];
    [menu addHook:th];
}

void addSwitch(NSString *name, NSString *description, UIColor *theme){
    if(menu == nil)
        return;
    
    Switch *s = [[Switch alloc] initWithSwitchName:name info:description fontName:font theme:theme];
    [menu addHook:s];
}

void writeData(uint64_t offset, uint64_t hex){
    if(menu == nil)
        return;
    
    [menu writeTo:offset withHex:hex];
}



 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below. For more information, please read our Posting Guidelines.
Reply to this topic... Posting Guidelines

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Our picks

    • WAR OF THE VISIONS FFBE Cheats v8.6.0 +3 [ Multiply Damage & Defense ]
      Modded/Hacked App: FINAL FANTASY BE:WOTV By SQUARE ENIX Co., Ltd.
      Bundle ID: com.square-enix.WOTVffbeww
      iTunes Store Link: https://apps.apple.com/us/app/final-fantasy-be-wotv/id1484937345?uo=4


      Hack Features:
      - Multiply Attack
      - Multiply Defense
      - Full Map Movement


      Non-Jailbroken & No Jailbreak required hack(s): https://iosgods.com/topic/173485-final-fantasy-bewotv-v730-jailed-cheats-3/


      iOS Hack Download Link: https://iosgods.com/topic/173483-war-of-the-visions-ffbe-cheats-v740-3-multiply-damage-defense/
        • Informative
        • Agree
        • Thanks
        • Winner
        • Like
      • 124 replies
    • Slash & Girl - Endless Run By Shenzhen Qingtian IE Technology Co., Ltd v7.9.981 Cheats +4
      Modded/Hacked App: Slash & Girl - Endless Run By Shenzhen Qingtian IE Technology Co., Ltd
      Bundle ID: com.slash.girl.redfish
      iTunes Store Link: https://apps.apple.com/vn/app/slash-girl-endless-run/id1484766098?uo=4

      Mod Requirements:
      - Non-Jailbroken/Jailed or Jailbroken iPhone/iPad/iPod Touch.
      - Sideloadly / Cydia Impactor or alternatives.
      - A Computer Running Windows/macOS/Linux with iTunes installed.


      Hack Features:
      - No die
      - One hit
      - Freeze combo
      - Freeze lighting
        • Informative
        • Thanks
        • Like
      • 3 replies
    • Slash & Girl - Endless Run By Shenzhen Qingtian IE Technology Co., Ltd v7.9.981 Cheats +7
      Modded/Hacked App: Slash & Girl - Endless Run By Shenzhen Qingtian IE Technology Co., Ltd
      Bundle ID: com.slash.girl.redfish
      iTunes Store Link: https://apps.apple.com/vn/app/slash-girl-endless-run/id1484766098?uo=4

      Mod Requirements:
      - Jailbroken iPhone/iPad/iPod Touch.
      - iGameGod / Filza / iMazing / or any other file managers for iOS.
      - Cydia Substrate, Substitute or libhooker depending on your jailbreak.
      - PreferenceLoader (from Cydia, Sileo or Zebra).
       

      Hack Features:
      - No die
      - One hit
      - Earn more currencies
      - Custom score
      - Freeze combo
      - Freeze lighting
      - Jump height
        • Informative
        • Agree
        • Thanks
        • Winner
        • Like
      • 32 replies
    • Blood Knight : 3D Idle RPG v2.98 Cheats +1
      Modded/Hacked App: Blood Knight : 3D Idle RPG By SUPERBOX. Inc
      Bundle ID: com.superbox.ios.blood
      iTunes Store Link: https://apps.apple.com/us/app/blood-knight-3d-idle-rpg/id6443827240?uo=4

       


      Mod Requirements:
      - Non-Jailbroken/Jailed or Jailbroken iPhone/iPad/iPod Touch.
      - Sideloadly / Cydia Impactor or alternatives.
      - A Computer Running Windows/macOS/Linux with iTunes installed.


      Hack Features:
      - High damage
        • Informative
        • Agree
        • Thanks
        • Winner
        • Like
      • 75 replies
    • Blood Knight : 3D Idle RPG v2.98 Cheats +1
      Modded/Hacked App: Blood Knight : 3D Idle RPG By SUPERBOX. Inc
      Bundle ID: com.superbox.ios.blood
      iTunes Store Link: https://apps.apple.com/us/app/blood-knight-3d-idle-rpg/id6443827240?uo=4

       


      Mod Requirements:
      - Jailbroken iPhone/iPad/iPod Touch.
      - iGameGod / Filza / iMazing or any other file managers for iOS.
      - Cydia Substrate, Substitute or libhooker depending on your jailbreak.
      - PreferenceLoader (from Cydia, Sileo or Zebra).


      Hack Features:
      - High damage
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 37 replies
    • [ Dead by Daylight TW ] 黎明死線M - Envoy v1.0.32 +27 Cheats
      Modded/Hacked App: 黎明死線M - Envoy [ Dead by Daylight Mobile TW ] By Envoy Interactive Entertainment Co., Ltd.
      Bundle ID: com.netease.dbdtw
      iTunes Store Link: https://apps.apple.com/tw/app/%E9%BB%8E%E6%98%8E%E6%AD%BB%E7%B7%9Am-envoy/id1504610184?uo=4


      Hack Features:
      - No Skill Check
      - No Killer Attack/Miss Cooldown
      - Custom Speed
      - Killer Location Cham
      - Survivor Location Cham
      - Generator Cham
      - Totems Cham
      - Chest Cham
      - Portal Cham
      - Hatch Cham
      - Hooks Cham
      - Trap Cham
      - Escape Switch Cham
      - Normal Pallet Cham
      - Dream Pallet Cham
      - Lockers Cham
      - Survivor Trap Immunity
      - Instant Window Vault*
      - Instant Destroy Pallets*
      - Instant Pickup Downed Players*
      - Custom FOV
      - Disable Footsteps - use as a survivor.
      - No Nurse Fatigue
      - Instant Nurse Teleport
      - Nurse Teleport Through Anything
      - Better Aim Assist
      - No Heartbeat

      * Under one switch


      iOS Hack Download Link: https://iosgods.com/topic/164639-dead-by-daylight-tw-%E9%BB%8E%E6%98%8E%E6%AD%BB%E7%B7%9Am-envoy-v1024-27-cheats/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 95 replies
    • OUTERPLANE - Strategy Anime v1.1.92 Cheats +4
      Modded/Hacked App: OUTERPLANE - Strategy Anime By Smilegate Holdings, Inc.
      Bundle ID: com.smilegate.outerplane.stove.ios
      iTunes Store Link: https://apps.apple.com/us/app/outerplane-strategy-anime/id1630880836?uo=4

       

      Mod Requirements:
      - Jailbroken iPhone/iPad/iPod Touch.
      - iGameGod / Filza / iMazing or any other file managers for iOS.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak.
      - PreferenceLoader (from Cydia, Sileo or Zebra).


      Hack Features:
      - God mode
      - OHK
      - Unlimited AP
      - No CD skill
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 68 replies
    • Boomerang RPG v1.0.18 Cheats +3
      Modded/Hacked App: Boomerang RPG By SuperPlanet corp.
      Bundle ID: com.superplanet.boomerang
      iTunes Store Link: https://apps.apple.com/us/app/boomerang-rpg/id6472151756?uo=4


      Mod Requirements:
      - Non-Jailbroken/Jailed or Jailbroken iPhone/iPad/iPod Touch.
      - Sideloadly / Cydia Impactor or alternatives.
      - A Computer Running Windows/macOS/Linux with iTunes installed.


      Hack Features:
      - God mode
      - High damage
      - Fast attack
        • Informative
        • Agree
        • Haha
        • Thanks
        • Like
      • 17 replies
    • Boomerang RPG v1.0.18 Cheats +3
      Modded/Hacked App: Boomerang RPG By SuperPlanet corp.
      Bundle ID: com.superplanet.boomerang
      iTunes Store Link: https://apps.apple.com/us/app/boomerang-rpg/id6472151756?uo=4


      Mod Requirements:
      - Jailbroken iPhone/iPad/iPod Touch.
      - iGameGod / Filza / iMazing or any other file managers for iOS.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak.
      - PreferenceLoader (from Cydia, Sileo or Zebra).


      Hack Features:
      - God mode
      - Fast attack
      - High damage
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 58 replies
    • 菇勇者傳說-送3000抽 v2.0.13 Cheats +2
      Modded/Hacked App: 菇勇者傳說-送3000抽 By JOY MOBILE NETWORK PTE. LTD.
      Bundle ID: com.mxdzz.tw.ios
      iTunes Store Link: https://apps.apple.com/tw/app/%E8%8F%87%E5%8B%87%E8%80%85%E5%82%B3%E8%AA%AA-%E9%80%813000%E6%8A%BD/id6466405648?uo=4

       

      Mod Requirements:
      - Non-Jailbroken/Jailed or Jailbroken iPhone/iPad/iPod Touch.
      - Sideloadly / Cydia Impactor or alternatives.
      - A Computer Running Windows/macOS/Linux with iTunes installed.


      Hack Features:
      - God mode
      - OHK
        • Informative
        • Haha
        • Winner
        • Like
      • 52 replies
    • BiliBili - HD Anime, Videos v2.81.0 Cheats +4
      Modded/Hacked App: BiliBili - HD Anime, Videos By BALABOOM PTE LTD
      Bundle ID: com.bstar.intl
      iTunes Store Link: https://apps.apple.com/vn/app/bilibili-hd-anime-videos/id1548857482?uo=4

       


      Mod Requirements:
      - Non-Jailbroken/Jailed or Jailbroken iPhone/iPad/iPod Touch.
      - Sideloadly / Cydia Impactor or alternatives.
      - A Computer Running Windows/macOS/Linux with iTunes installed.


      Hack Features:
      - No ads
      - Minimize watermark
      - Watch 4k
      - Can download 4k
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 101 replies
    • BiliBili - HD Anime, Videos v2.81.0 Cheats +4
      Modded/Hacked App: BiliBili - HD Anime, Videos By BALABOOM PTE LTD
      Bundle ID: com.bstar.intl
      iTunes Store Link: https://apps.apple.com/vn/app/bilibili-hd-anime-videos/id1548857482?uo=4

       

      Mod Requirements:
      - Jailbroken iPhone/iPad/iPod Touch.
      - iGameGod / Filza / iMazing or any other file managers for iOS.
      - Cydia Substrate, Substitute or libhooker depending on your jailbreak.
      - PreferenceLoader (from Cydia, Sileo or Zebra).


      Hack Features:
      - No ads
      - Minimize watermark
      - Watch 4k
      - Can download 4k
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 51 replies
×
  • 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