Solved Unity Hook Crashes

·҉ dollaz·҉. .

Approved iModder
Original poster
Approved iModder
Mar 26, 2021
159
1,819
193
Somewhere
So this happens to every unity framework game I try and mod, I can never hook anything without the game crashing. here's an example
(by unityframework I mean games that need to be dumped using the unityframework file, like among us or bullet force)

Code:
float(*old_speed)(void *_this);

float speed(void *_this){


if([switches isSwitchOn:@"Speed"]) {

return old_speed(_this) * [[switches getValueFromSwitch:@"Speed"] floatValue];

}

return old_speed(_this);
}


%ctor {
     
    MSHookFunction((void *)getRealOffset(0x13A1B08), (void *)speed, (void **)&old_speed);
}
and my tweak.xm already has the framework set as unityframework
Code:
void setupMenu() {


  [menu setFrameworkName: "UnityFramework"];


  menu = [[Menu alloc]
  //my other shit that isnt important to this
is there a special way that I need to hook UnityFramework games or am I just fucking up on something?
 
  • Like
Reactions: RedXen