Jump to content

Game crashes when using custom text switch


Enoch

23 posts in this topic

Recommended Posts

  • Replies 22
  • Created
  • Last Reply
Posted

Hm, weird. What happens when you just return a custom value? Not a slider switch value. Also, both functions seem to end with a return from another function, you’re probably better of hacking that.

Posted
1 minute ago, Ted2 said:

Hm, weird. What happens when you just return a custom value? Not a slider switch value. Also, both functions seem to end with a return from another function, you’re probably better of hacking that.

The game crashes. It works fine with the one offset patch which I can just use. Thanks for trying to help.

Posted
Just now, ZoZo said:

The game crashes. It works fine with the one offset patch which I can just use. Thanks for trying to help.

I know that you cannot hook functions with two instructions, that might be the case on this one due the weird function end (a function call instead of “RET”). You should try it on the function those two are calling.

Posted
7 minutes ago, Ted2 said:

I know that you cannot hook functions with two instructions, that might be the case on this one due the weird function end (a function call instead of “RET”). You should try it on the function those two are calling.

Alright I'll try it in a bit and get back to you.

Posted
int(*old_get_PointsKillMultiplier)(void *this_);
int get_PointsKillMultiplier(void *this_) {

  int userAmount = [[switches getValueFromSwitch:@"Custom Points:"] intValue];

  if([switches isSwitchOn:@"Custom Points:"]) {
    return userAmount;
  }
  return old_get_PointsKillMultiplier(this_);
}

int(*old_get_GemsRewardForKill)(void *this_);
int get_GemsRewardForKill(void *this_) {

  int userAmount = [[switches getValueFromSwitch:@"Custom Gems:"] intValue];

  if([switches isSwitchOn:@"Custom Gems:"]) {
    return userAmount;
  }
  return old_get_GemsRewardForKill(this_);
}

void setup() {


  HOOK(0x1015AD440, get_PointsKillMultiplier, old_get_PointsKillMultiplier);


  HOOK(0x1015A9F84, get_GemsRewardForKill, old_get_GemsRewardForKill);

    [switches addTextfieldSwitch:@"Custom Points:"
                description:@"Here you can enter your own points amount!"
                  inputBorderColor:[UIColor colorWithRed:0.74 green:0.00 blue:0.00 alpha:1.0]];

    [switches addTextfieldSwitch:@"Custom Gems:"
                description:@"Here you can enter your own coins amount!"
                  inputBorderColor:[UIColor colorWithRed:0.74 green:0.00 blue:0.00 alpha:1.0]];                                                                                      
}

try this, hope it work

Posted
6 minutes ago, Soud_0 said:

int(*old_get_PointsKillMultiplier)(void *this_);
int get_PointsKillMultiplier(void *this_) {

  int userAmount = [[switches getValueFromSwitch:@"Custom Points:"] intValue];

  if([switches isSwitchOn:@"Custom Points:"]) {
    return userAmount;
  }
  return old_get_PointsKillMultiplier(this_);
}

int(*old_get_GemsRewardForKill)(void *this_);
int get_GemsRewardForKill(void *this_) {

  int userAmount = [[switches getValueFromSwitch:@"Custom Gems:"] intValue];

  if([switches isSwitchOn:@"Custom Gems:"]) {
    return userAmount;
  }
  return old_get_GemsRewardForKill(this_);
}

void setup() {


  HOOK(0x1015AD440, get_PointsKillMultiplier, old_get_PointsKillMultiplier);


  HOOK(0x1015A9F84, get_GemsRewardForKill, old_get_GemsRewardForKill);

    [switches addTextfieldSwitch:@"Custom Points:"
                description:@"Here you can enter your own points amount!"
                  inputBorderColor:[UIColor colorWithRed:0.74 green:0.00 blue:0.00 alpha:1.0]];

    [switches addTextfieldSwitch:@"Custom Gems:"
                description:@"Here you can enter your own coins amount!"
                  inputBorderColor:[UIColor colorWithRed:0.74 green:0.00 blue:0.00 alpha:1.0]];                                                                                      
}

try this, hope it work

I still crashed when trying this.

Archived

This topic is now archived and is closed to further replies.

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