Jump to content

3 posts in this topic

Recommended Posts

Posted

Hi All,

I'm currently creating a series of mod menu's using Ted2's template - I'm bumping into similar issues for a couple of mods.

I'm looking for a way to modify a field.

Hypothetical Example:

Assume we have this decompiled from il/dnSpy

[Token(Token = "0x2000342")]
public class Item {
  [Token(Token = "0x400131B")]
  [FieldOffset(Offset = "0x1C")]
  public int Amount;

  [Token(Token = "0x4001313")]
  [FieldOffset(Offset = "0x30")]
  public bool IsUnlimited;

  [Address(RVA = "0x1ABB3A8", Offset = "0x1ABB3A8", VA = "0x1ABB3A8")]
  public void Init(CRefItem refMain, int amount = 0, bool is_attached = false)
  {
  }
  
  ...
}

There is no getter or setter for the Amount or IsUnlimited field.

Goal:

Forceable set Amount  to 9999 for all Items.

Forceable set IsUnlimited to True for all Items.

 

Attempts and Theory:

In Ted2's template, the best approach i've been able to figure out to get anywhere close to a meaningful outcome is hooking to the init function and pass in desired Amount argument.

However,

Tweak.xm Doesnt know what a CRefItem is, So I cant pass this param into my reinterpreted cast

 

Heres an example Tweak.xm to show this

offset for the init function is 0x1ABB3A8

#import "Macros.h"

auto modInit = reinterpret_cast<void(*) (void *, CRefItem, int, bool)>(getRealOffset(0x1ABB3A8));
  
void(*oldInit)(void *this_);
void newInit(void *this_) {
    if ([switches isSwitchOn:@"9999 Items"]) {
      modInit(this_, ???????? ,9999, false);
      return;
    }
  
    old_Init(this_);
}
  
// SETUP
void setup() {
  HOOK(0x1ABB3A8, newInit, oldInit);
  
  [switches addSwitch:@"9999 Items"
    description:@"Enable on Oppenents Turn"
  ];
}
  
... Rest of Ted2 Stuff

Notice: This isnt working code - this is just an example of whats going through my mind :D

Issues I see:

1) I'm not too sure what to hook onto in the setup as i've already got a casted reference to the Init function - hooking into something im casting to and calling again seems like a bad idea.

2) Im not too sure how to pass the CRefItem argument into the modInit call.

3) IsAttached arg will always be False - which may not always be the case - would be nice to know how to get the original passed args

4) Does not deal with IsUnlimited field

5) I could go up the tree in the decompiled code and cast to functions elsewhere but they all require types which I dont understand how to pass (Vector3, CRefItem...)

 

Reading From Other NIC Templates:

I'v been digging around and noticed something in R16s template called UIKeyPatch, From the docs it seems like you're able to set the value of a field using the fields offset

//call these inside ur own custom functions
*(int*)[UIKeyPatch address:@"0x1C" ptr:this_] = 9999;
*(bool*)[UIKeyPatch address:@"0x30" ptr:this_] = true;

As we don't have UIKeyPatch in Ted2 and the R16 repo seems to be offline, I can't find out how UIKeyPatch was implemented. The example doesnt show what would be hooked into in the setup function in Tweak.xm as I assume the offsets wouldnt work be different if I hooked into the Init function. Correct me if im wrong.

 

Ask

I hope the above examples highlights the gaps in my knowledge and give enough info on what I'm trying to achieve. As I'm using Ted2 and given the R16 Nic Template is unavailable. I've come here to seek help on making this happen. Any advice which can put me on the right path will be greatly appreciated :)

Posted

Mhh Mhh okay that's what i would try, im not a pro, but this is what i would do :

35 minutes ago, rafgeekee said:

Forceable set Amount  to 9999 for all Items.

 

You can maybe try to get the field with the Update() function (if there is). else, ive seen somwhere on the web where you can use other function from the class but i didn't tried, Lmk if it worked. :)

So, if no Update() function :

//just a poc to get the idear
void(*old_func)(void *instance);
void func(void *instance) {
        if ([switches isSwitchOn:@"9999 Items"]) {
            //int Amount
            *(int *) ((uint64_t) instance + 0x1C) = 9999;
    }
    old_func(instance);
}

setup(){
	//a function in the same class. use Update if there is, if not try another function (Init for ex)
	HOOK(0x1ABB3A8, func, old_func);
}

 

42 minutes ago, rafgeekee said:

Forceable set IsUnlimited to True for all Items.

 

do the same thing.

 

43 minutes ago, rafgeekee said:
auto modInit = reinterpret_cast<void(*) (void *, CRefItem, int, bool)>(getRealOffset(0x1ABB3A8));

Afaik, when there is a Type and you don't have his definition, just make a pointer to it like this ;

//taking ur code
auto modInit = reinterpret_cast<void(*) (void *, void *, int, bool)>(getRealOffset(0x1ABB3A8));

replace the CRefItem with void *,  that way it gonna make a pointer on the undifined type and with luck it not gonna crash hahaa

 

50 minutes ago, rafgeekee said:
//this_ is probably a func where this_ + 0x1C = int Amount;
//you can't patch a field without its pointer. like search for "0x1C" in your dump.cs you gonna have a tons of results.
// but if u have pointer + 0x1C, its unique

*(int*)[UIKeyPatch address:@"0x1C" ptr:this_] = 9999;

 

using this is the same as . 

*(int *) ((uint64_t) instance + 0x1C) = 9999;

 

53 minutes ago, rafgeekee said:

3) IsAttached arg will always be False - which may not always be the case - would be nice to know how to get the original passed args

 

i guess, once you hooked Init, you can easly called it and put "true" on the func parameter, it gonna overwrite it probably.

//POC
modInit(this_, paramName ,9999, true);

 

Hope it could help you, tho all this is my knowledge, things might not be 100% right PepeCoffee

  • Thanks 1
  • Informative 1
Posted
On 1/16/2023 at 6:01 PM, ꞋꞌꞋꞌꞋꞌꞋꞌ said:

Mhh Mhh okay that's what i would try, im not a pro, but this is what i would do :

You can maybe try to get the field with the Update() function (if there is). else, ive seen somwhere on the web where you can use other function from the class but i didn't tried, Lmk if it worked. :)

So, if no Update() function :

//just a poc to get the idear
void(*old_func)(void *instance);
void func(void *instance) {
        if ([switches isSwitchOn:@"9999 Items"]) {
            //int Amount
            *(int *) ((uint64_t) instance + 0x1C) = 9999;
    }
    old_func(instance);
}

setup(){
	//a function in the same class. use Update if there is, if not try another function (Init for ex)
	HOOK(0x1ABB3A8, func, old_func);
}

 

do the same thing.

 

Afaik, when there is a Type and you don't have his definition, just make a pointer to it like this ;

//taking ur code
auto modInit = reinterpret_cast<void(*) (void *, void *, int, bool)>(getRealOffset(0x1ABB3A8));

replace the CRefItem with void *,  that way it gonna make a pointer on the undifined type and with luck it not gonna crash hahaa

 

using this is the same as . 

*(int *) ((uint64_t) instance + 0x1C) = 9999;

 

i guess, once you hooked Init, you can easly called it and put "true" on the func parameter, it gonna overwrite it probably.

//POC
modInit(this_, paramName ,9999, true);

 

Hope it could help you, tho all this is my knowledge, things might not be 100% right PepeCoffee

Thanks @ꞋꞌꞋꞌꞋꞌꞋꞌ This has helped get me in the right direction :) - As I've hooked into an instance, I'm able to reference the field pointer using the offest as described :). Although I am having difficulty getting my hook kick in at the right time. This is mostly down to finding a function which is called in a timely fasion which I need to dig more to find. 

This line has been a great help

*(int *) ((uint64_t) instance + 0x1C) = 9999;

For reference to anybody looking for similar help, This can be changed to any type, an example of a bool and float below:

*(bool *) ((uint64_t) instance + 0x1C) = true;

 

*(float *) ((uint64_t) instance + 0x1C) = 1.0f;

--

In view of Unknown types like CRefItem, passing in a void still needs the pointer which I'm struggling to understand. Could you help further on this?

Here is the code I'm looking at

auto modInit = reinterpret_cast<void(*) (void *, void *, int, bool)>(getRealOffset(0x1ABB3A8));
  
void(*oldInit)(void *this_);
void newInit(void *this_) {
    if ([switches isSwitchOn:@"9999 Items"]) {
      modInit(this_, paramName ,9999, false);
      return;
    }
  
    old_Init(this_);
}
  
// SETUP
void setup() {
  HOOK(0x1ABB3A8, newInit, oldInit);
  
  [switches addSwitch:@"9999 Items"
    description:@"Enable on Oppenents Turn"
  ];
}

Could you help me understand how i'd pull and pass paramName with the correct CRefItem pointer?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Our picks

    • Marble Match Origin v1.1.138 [ +6 Cheats ] Currency Max
      Modded/Hacked App: Marble Match Origin By 阳 李
      Bundle ID: com.marble.core.ios
      App Store Link: https://apps.apple.com/us/app/marble-match-origin/id6446502265?uo=4


      🤩 Hack Features

      - ViP

      - Auto ADS OFF

      - Coin

      - Life

      - Booster

      - Score
      • 3 replies
    • Minions World v1.2.0 [ +4 Cheats ] Currency Max
      Modded/Hacked App: Minions World By Bugnone Michael
      Bundle ID: com.mikapps.minionsconquest
      App Store Link: https://apps.apple.com/ph/app/minions-world/id6503263089?uo=4
       

      🤩 Hack Features

      - Gems
      - Gold
      - Energy
      - Keys
      • 5 replies
    • Minions World v1.2.0 [ +4 Jailed ] Currency Max
      Modded/Hacked App: Minions World By Bugnone Michael
      Bundle ID: com.mikapps.minionsconquest
      App Store Link: https://apps.apple.com/ph/app/minions-world/id6503263089?uo=4


      🤩 Hack Features

      - Gems
      - Gold
      - Energy
      - Keys
      • 3 replies
    • Marble Match Origin v1.1.138 [ +6 Jailed ] Currency Max
      Modded/Hacked App: Marble Match Origin By 阳 李
      Bundle ID: com.marble.core.ios
      App Store Link: https://apps.apple.com/us/app/marble-match-origin/id6446502265?uo=4
       

      🤩 Hack Features

      - ViP

      - Auto ADS OFF

      - Coin

      - Life

      - Booster

      - Score
      • 5 replies
    • Stickman vs Zombie: Idle RPG v1.0.20 [ +5 Cheats ] Easy Win
      Modded/Hacked App: Stickman vs Zombie: Idle RPG By Pusilung HK Limited
      Bundle ID: com.TSH011.stickman.zombie.epic.war.idle.rpg.warfare
      App Store Link: https://apps.apple.com/us/app/stickman-vs-zombie-idle-rpg/id6743597727?uo=4

       
      🤩 Hack Features

      - Currency [ No Need ]

      - Resources [ No Need ]

      - Hero Status

      - Pet Status

      - Skill Status

      Note:- Hero Pet Skill After Hack Game Close Reopen Then Work
      • 7 replies
    • Stickman vs Zombie: Idle RPG v1.0.20 [ +5 Jailed ] Easy Win
      Modded/Hacked App: Stickman vs Zombie: Idle RPG By Pusilung HK Limited
      Bundle ID: com.TSH011.stickman.zombie.epic.war.idle.rpg.warfare
      App Store Link: https://apps.apple.com/us/app/stickman-vs-zombie-idle-rpg/id6743597727?uo=4


      🤩 Hack Features

      - Currency [ No Need ]

      - Resources [ No Need ]

      - Hero Status

      - Pet Status

      - Skill Status

      Note:- Hero Pet Skill After Hack Game Close Reopen Then Work
      • 10 replies
    • Candy Pop Story : Match 3 v1.25.0729 [ +3 Cheats ] Auto Win
      Modded/Hacked App: Candy Pop Story : Match 3 By F.O.G LIMITED
      Bundle ID: com.gamoper.candysweetstory.ios
      App Store Link: https://apps.apple.com/us/app/candy-pop-story-match-3/id6670773988?uo=4


      🤩 Hack Features

      - Auto Win
      - Coins
      - Moves
      -
      • 8 replies
    • Candy Pop Story : Match 3 v1.25.0729 [ +3 Jailed ] Auto Win
      Modded/Hacked App: Candy Pop Story : Match 3 By F.O.G LIMITED
      Bundle ID: com.gamoper.candysweetstory.ios
      App Store Link: https://apps.apple.com/us/app/candy-pop-story-match-3/id6670773988?uo=4
       

      🤩 Hack Features

      - Auto Win
      - Coins
      - Moves
      • 7 replies
    • Pocket Necro v1.6.3 [ +11 Cheats ] Gold Unlimited
      Modded/Hacked App: Pocket Necromancer By Sandsoft Publishing Company
      Bundle ID: com.quicksand.pocketnecromancer
      iTunes Store Link: https://apps.apple.com/us/app/pocket-necromancer/id6450004790?uo=4


      Hack Features:
      - ADS NO [ Reward Fee ]

      - Premium Active

      - Energy Cost 0

      - Energy Increaser

      - Gold Unlimited [ Win Battle ] Rewards

      - Stage Unlocked

      - Chapter Unlocked +2

      - Play Any [ Stage & Ch ]

      - Never Die

      - DMG

      - Speed Mov

      - Bullet Max [ Works With Weapon Only Just Equip ]


      Non-Jailbroken & No Jailbreak required hack(s): https://iosgods.com/forum/79-no-jailbreak-section/
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
        • Informative
      • 57 replies
    • [Free] Asphalt 8: Airborne Hack v8.4.1 +4 Cheats
      Modded/Hacked App: Asphalt 8: Airborne by Gameloft
      Bundle ID: com.gameloft.asphalt8
      iTunes Store Link: https://apps.apple.com/us/app/asphalt-8-airborne/id610391947


      Hack Features:
      - Unlimited Nitro Use / Nitro Doesn't Decrease
      - No Car Crash / No Wrecks
      - Anti-Ban -> Does not mean you can abuse the hack.
      - No Rank Required to do Mastery Missions

      This hack only works on x64 or ARM64 iDevices: iPhone 5s, 6, 6 Plus, 6s, 6s Plus, 7, 7 Plus, 8, 8 Plus, X, iPod Touch 6G, iPad Air, Air 2, Pro & iPad Mini 2, 3, 4 and later. This hack is an In-Game Mod Menu (iGMM). In order to activate the Mod Menu, tap on the iOSGods button found inside the app.

      ViP version of this hack with more features: https://iosgods.com/topic/39095-vip-asphalt-8-airborne-v321-13-cheats/
      Non-Jailbroken version of this hack: https://iosgods.com/topic/38140-hack-asphalt-8-airborne-v310-4-cheats-for-jailed-idevices-ios-10/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 8,881 replies
    • [Hack] Asphalt 8: Airborne v8.4.1 +10 Cheats for Jailed iDevices! [ iOS 26 ]
      Modded/Hacked App: Asphalt 8: Airborne By Gameloft
      Bundle ID: com.gameloft.asphalt8
      iTunes Link: https://itunes.apple.com/us/app/asphalt-8-airborne/id610391947

      Hack Features:
      - Unlimited Nitro Use. Use Unlimited Nitro!
      - No Car Crash/Wreck
      - All Cars Unlocked
      - Unlimited Coins -> Coins will still decrease and go negative after buying and turning the hack off. Caused issues after uninstalling the hack. Removed.
      - Free Store - Buy any item for free which cost coins Patched. Removed.
      This hack only works on x64 or ARM64 iDevices: iPhone 5s, 6, 6 Plus, 6s, 6s Plus, 7, 7 Plus, 8, 8 Plus, X, SE, iPod Touch 6G, iPad Air, Air 2, Pro & iPad Mini 2, 3, 4 and later.

      Jailbroken version of this hack: https://iosgods.com/topic/23005-free-asphalt-8-airborne-hack-v321-4-cheats/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 774 replies
    • [ViP] Asphalt 8: Airborne v8.4.1 +13 Cheats!
      Modded/Hacked App: Asphalt 8: Airborne By Gameloft
      Bundle ID: com.gameloft.asphalt8
      iTunes Link: https://itunes.apple.com/us/app/asphalt-8-airborne/id610391947


      Hack Features:
      - Unlimited Nitro Use / Nitro Doesn't Decrease
      - 0 Coin Cost to buy Decals
      - All Seasons Unlocked
      - Tag Season Unlocked
      - Coins Hack (Enter your own amount in settings)
      - 0 Cost to Apply ProKits
      - Free Store (only works with coins. Blue tokens cost is server sided)
      - Mastery Unlocked at any Level (choose the amount of stars you want in settings to unlock early)
      - Anti-Ban -> Does not mean you can abuse the hack.
      - No Rank Required to do Mastery Missions
      - All Cars Unlocked
      - No Speed Limit
      - No Car Crash
       
      Free Version of this hack: https://iosgods.com/topic/23005-updated-asphalt-8-airborne-hack-v260-13-cheats/
      ViP No-Jailbreak Version of this Hack: https://iosgods.com/forum/78-vip-non-jailbroken-hacks-cheats/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 2,162 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