Jump to content

6 posts in this topic

Recommended Posts

Posted

So i'd like to get a working slider but even with the help inside the tweak.xm i wasn't able to get it working. I don't know where to put the offset/hex for the slider at. :/

Can someone please reply with a the same tweak.xm just with a working slider for the offset 0x123456? I apprechiate any help!

	#import "APMenu.h"
	/*
// 
// You can use: [mm getFloat:@"SOME HACK KEY"];
// You can use: [mm getBool:@"SOME HACK KEY"];
// 
// For customizing the hack inside your hooks
// see an example below:
// 
// EXAMPLE OF HOOK FUNCTIONS
// THAT GETS THE VALUE DEFINED
// OF AN INTERFACE "KEY" ELEMENT
   
	float (*orig_func)(void *self);
	float new_func(void *self)
{
    float newValue = [mm getFloat:@"aSliderKey"];
    if (newValue)
        return newValue;
    else
        return orig_func(self);
}
	*/
	
%ctor
{
    // the mod menu core
    mm = [APMenu sharedInstance];
	    // a writeData.h rewritten to my APMenu
    mp = [MemoryPatcher sharedInstance];
	    NSDictionary *hacks =
    @{
        @"k01BasicSwitcher":@{
            @"offsets": @[@"0xABFD78"],
            @"orig":    @[@"0x80A9BED"],
            @"patched": @[@"0x40AB2EE"],
            @"desc": @"",
            @"label": @"A basic switcher"
            },
	        @"k05SimpleUiSlider":@{
            @"type": @"modslider",
            @"typecfg": @{
                    @"minimumValue":@0,
                    @"maximumValue":@1
                },
            @"desc": @"",
            @"label": @"Normal UI Slider"
            },
    };
	
    // HERE IS WHERE ALL THE FUN BEGINS 
    [mm init:hacks
                openAfter: 1                                                                          // seconds (I like to use average game loading time)               (OBLIGATORY)
                    width: 260                                                                        // width in pixels                                                 (OBLIGATORY)
        maxVisibleToggles: 5                                                                          // only shows N first hacks, the others needs to be scrolled       (OBLIGATORY)
                    theme: rgb(0xbef7d9)                                                              // the main color for you hack menu (you can use any color       (OBLIGATORY)
                    title: @"MY GAME HACK"                                                            // your hack titlebar text upper case is better  (OBLIGATORY)
                  credits: @"Hack by (your nickname). Thanks to DiDA n' shmoo for inspiration <3"     // pretty self explicative, no? (Leave @"" for empty)
               creditsURL: nil                                                                        // a URL for the user to visit on credits menu screen @"http://www.myblog.com" or simple: nil
	                // CHOOSE YOUR INTERFACE TOGGLE GESTURE
                // APGestureTwoFingerTap
                // APGestureThreeFingerTap
                // APGestureFourFingerTap
                // APGestureTwoFingerSwipeUp
                // APGestureTwoFingerSwipeDown
                // APGestureTwoFingerSwipeLeft
                // APGestureTwoFingerSwipeRight
                // APGestureThreeFingerSwipeUp
                // APGestureThreeFingerSwipeDown
                // APGestureThreeFingerSwipeLeft
                // APGestureThreeFingerSwipeRight
                  gesture: APGestureThreeFingerTap
            onFirstLaunch:^{
	            // this method listens to Mod Menu controller changes
            // and gets it's values according to the type of
            // UIControl you are dealing with
            // if you don't need this, just comment or remove these lines
            [mm listenChanges:^(id sender)
            {
                if ([mm ismodtext:sender])
                {
                    UIKeyTextField *textField = (UIKeyTextField*) sender;
                    NSString *key             = textField.featureKey;
                    float value               = textField.text.floatValue;
	                    NSLog(@"Value of modtext %@: %f", key, value);
                }
                if ([mm ismodslider:sender])
                {
                    UIKeySlider *slider = (UIKeySlider*) sender;
                    NSString *key       = slider.featureKey;
                    float value         = slider.value;
	                    NSLog(@"Value of modslider %@: %f", key, value);
	                    /* SIMPLE EXAMPLE OF USING THIS
                        switch (value)
                        {
                            case 1:
                                [mp write:0xbadf00d data:0xf33dbac];
                            break;
	                            case 2:
                                [mp write:0xbadf00d data:0xf33dbac];
                            break;
	                            ...
                        }
                    */
                }
                if ([mm ismodswitcher:sender])
                {
                    UIViewSwitcher *switcher = (UIViewSwitcher*) sender;
                    NSString *key            = switcher.featureKey;
                    BOOL value               = switcher.isOn;
	                    NSLog(@"Value of modslider %@: %d", key, value);
                }
            }];
	
        /* DO SOMETHING AFTER HACK INTERFACE LAUNCH 
        designed for customized hooks or you can popup an alert to warn the user
        that hack is already active and maybe send an UIAlertControl informing Gesture you have used
        
	        ******** THIS IS HOW TO HOOK
        ******** (if you need hooking some internal function):
        ********
        ******** MSHookFunction((void*)[mp calculateAddress:0xb4df00d], (void*)new_func, (void**)&orig_func);
        ********
        ******** Please, notice that new_func and orig_func are declared at
        ******** the top of the file (before %ctor)
	        */
	        NSLog(@"Initialized");
    }];
}
	

Posted

So. What you are trying to achieve? A simple writeData(0x123456, 0xbadf00d)  ????

 

You don't need an UISlider for this. You just need to setup a basic switcher:

 

 @"k01BasicSwitcher":@{
            @"offsets": @[@"0x123456"],
            @"orig":    @[@"0xORIGINAL_OFFSET_HERE"],
            @"patched": @[@"0xAPATCHED_OFFSET_HERE"],
            @"desc": @"",
            @"label": @"A basic switcher"
            },

 

UISlider is for more complex stuff or for MSHooking into sub_functions or methods of classes.

Posted
18 minutes ago, arthurdapaz said:

So. What you are trying to achieve? A simple writeData(0x123456, 0xbadf00d)  ????

 

You don't need an UISlider for this. You just need to setup a basic switcher:

 


 @"k01BasicSwitcher":@{
            @"offsets": @[@"0x123456"],
            @"orig":    @[@"0xORIGINAL_OFFSET_HERE"],
            @"patched": @[@"0xAPATCHED_OFFSET_HERE"],
            @"desc": @"",
            @"label": @"A basic switcher"
            },

 

UISlider is for more complex stuff or for MSHooking into sub_functions or methods of classes.

I know how to make a simple switch, but i wanna make a UISlider. Like for gravity so one can adjust the gravity scale. Well now i just realized that theres no need for offsets to make a slider...Seems to be too complicated for my brain.

Posted

No,  nothing can be more simple. Calm. Take a look at [mm listenChanges] method...

 

it it gets the value of the UISlider for you

Every time you slide / change a value on an interface controller, this methods gets the KEY and VALUE for the cobtroller

Search for: "EXAMPLE OF USING THIS"... that's exactly what you want.

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