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.