Hello,
The method works for one switch, but when I try on several switches the game crashes, why?
Code :
float userValue = [[switches getValueFromSwitch:NSSENCRYPT("Custom speed")] floatValue];
float(*old_get_speed)(void *this_);
float get_speed(void *this_) {
if([switches isSwitchOn:@"Custom speed"]) {
return old_get_speed(this_) * [[switches getValueFromSwitch:@"Custom speed"] floatValue];
}
return old_get_speed(this_);
}
float userValue2 = [[switches getValueFromSwitch:NSSENCRYPT("Custom speed2")] floatValue];
float(*old_get_speed2)(void *this_);
float get_speed2(void *this_) {
if([switches isSwitchOn:@"Custom speed2"]) {
return old_get_speed2(this_) * [[switches getValueFromSwitch:@"Custom speed2"] floatValue];
}
return old_get_speed2(this_);
}
float userValue3 = [[switches getValueFromSwitch:NSSENCRYPT("Custom FOV")] floatValue];
float(*old_get_fov)(void *this_);
float get_fov(void *this_) {
if([switches isSwitchOn:@"Custom FOV"]) {
return old_get_fov(this_) * [[switches getValueFromSwitch:@"Custom FOV"] floatValue];
}
return old_get_fov(this_);
}
%ctor {
MSHookFunction((void *)getRealOffset(0x101XXXXXX), (void *)get_speed, (void **)&old_get_speed);
MSHookFunction((void *)getRealOffset(0x101XXXXXX), (void *)get_speed2, (void **)&old_get_speed2);
MSHookFunction((void *)getRealOffset(0x101XXXXXX), (void *)get_fov, (void **)&old_get_fov);
}
void setup() {
Thank you in advance for your help