Jump to content

NeverBeing

Senior Member
  • Posts

    160
  • Joined

  • Last visited

Posts posted by NeverBeing

  1. You can never ever, override a "void". Just remember that.

     

    And also, don't use "myvalue" it might not work in some cases. Though, you can use, "argument".

     

    Here's some example:

     

    %hook SomeClass

    -(void)someMethod:(unsigned int)arguement {

    if(GetPrefBool(@"k1")){

    arguement = 100;

    }

    return %orig;

    }

    %end

     

    --------------------------

     

    One last thing, "void" can never be override as "null" whereas "null" is equivalent to 0 or none.

     

    You can only use "null -> nil" and "%orig" to "(:id)"

     

    Here's some example:

     

    %hook SomeClass

    -(void)someMethod:(id)arguement {

    if(GetPrefBool(@"k1")){

    arguement = %orig; <----- this identify as the ":(id)". "%orig" means 'return to original state' and "nil" means 'wipe the current value'.

    }

    return %orig; <----- this identify as the "-(void)"

    }

    %end

    Thank you very much! ????

  2. There's an issue compiling or the hack doesn't work?

    No error while compiling, but the hack doesn't work ????

     

    Unsigned int :

    there shouldnt be any space between (unsigned int) and myvalue

    %hook SomeClass
    -(void)someMethod:(unsigned int)myvalue {
    if(GetPrefBool(@"k1")){
    myvalue = 100;
    }
    %orig;
    }
    %end
    

    Thank you, I'll try ????????????

  3. Guys, can have some help with this MS hook code? I try to convert from FLEX to PrefBundle tweak. I use PFHeader nic template from iOSGODS.

    Here is the code from FLEX that I wanna write to Tweak.xm:

     

    1. unsigned int

    Target Class
    SomeClass
    
    Target Method
    -(void) someMethod: (unsigned int)
    
    Return Value (void)
    pass-through
    
    Argument #1 (unsigned int)
    100
    

    2. void with FALSE/TRUE value

    Target Class
    SomeClass
    
    Target Method
    someMethod
    
    Return Value (void)
    TRUE
    

    3. void with integer value

    Target Class
    SomeClass
    
    Target Method
    someMethod:
    
    Return Value (void)
    0
    

    4. void with NULL value

    Target Class
    SomeClass
    
    Target Method
    someMethod:likeThis:
    
    Return Value (void)
    NULL 

    5. long long method

    Target Class
    _SomeClass
    
    Target Method
    -(long long) someMethod
    
    Return Value (long long)
    1

    And here is my Tweak.xm code, pelase correct me if me wrong.

    1. unsigned int
     

    %hook SomeClass
    -(void)someMethod:(unsigned int) myvalue {
    if(GetPrefBool(@"k1")){
    myvalue = 100;
    }
    %orig(myvalue);
    }
    %end
    

    2. void with TRUE/FALSE value

    %hook SomeClass
    - someMethod {
    if(GetPrefBool(@"k2")) {
    return true;
    }
    return %orig;
    }
    %end
    

    3. void with integer value

    %hook SomeClass
    - someMethod {
    if(GetPrefBool(@"k3")) {
    return: 0;
    }
    return %orig;
    }
    %end
    

    4. void with NULL value

    %hook SomeClass
    - someMethod:likeThis: {
    if(GetPrefBool(@"k3")) {
    return null;
    }
    return %orig;
    }
    %end
    

    5. long long method

    %hook _SomeClass
    -(long long) someMethod {
    if(GetPrefBool(@"k4")) {
    return:1;
    }
    return %orig;
    }
    %end
    

    Please correct my code. Sorry if there are annoying code, I just wanna learn. Thank you.

×
  • 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