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

    • Angry Birds 2 Cheats v4.0.2 +1 [ Infinite Currencies ]
      Modded/Hacked App: Angry Birds 2 By Rovio Entertainment Oyj
      Bundle ID: com.rovio.baba
      iTunes Store Link: https://apps.apple.com/us/app/angry-birds-2/id880047117?uo=4


      Hack Features:
      - Infinite Currencies ( Spend some/ Get some )


      Non-Jailbroken & No Jailbreak required hack(s):  https://iosgods.com/topic/70081-angry-birds-2-v2600-jailed-cheats-2/


      Hack Download Link: https://iosgods.com/topic/72039-angry-birds-2-cheats-v2600-1-infinite-currencies/
      • 1,960 replies
    • Alien Invasion: RPG Idle Space Cheats v4.18.00 +2
      Modded/Hacked App: Alien Invasion: RPG Idle Space By MULTICAST GAMES LIMITED
      Bundle ID: com.multicastgames.venomSurvive
      iTunes Store Link: https://apps.apple.com/us/app/alien-invasion-rpg-idle-space/id6443697602?uo=4


      Hack Features:
      - Infinite Currencies


      Non-Jailbroken & No Jailbreak required hack(s): https://iosgods.com/topic/167591-alien-invasion-rpg-idle-space-v204-jailed-cheats-1/


      iOS Hack Download Link: https://iosgods.com/topic/167589-alien-invasion-rpg-idle-space-cheats-v204-1/
        • Haha
        • Like
      • 414 replies
    • Airport City Cheats v8.39.01 +1
      Modded/Hacked App: Airport City by Game Insight UAB
      Bundle ID: com.gameinsight.airportcity
      iTunes Store Link: https://apps.apple.com/us/app/airport-city/id495637457?uo=4&at=1010lce4


      Hack Features:
      - Free Store


      Non-Jailbroken & No Jailbreak required hack(s): https://iosgods.com/topic/126716-arm64-airport-city-v717-jailed-cheats-1/


      iOS Hack Download Link: https://iosgods.com/topic/126714-arm64-airport-city-cheats-v717-1/
        • Agree
        • Winner
        • Like
      • 761 replies
    • Real Boxing 2 Cheats v1.55.2 +3
      Modded/Hacked App: Real Boxing 2 By Vivid Games S.A.
      Bundle ID: com.vividgames.realboxing2
      App Store Link: https://apps.apple.com/us/app/real-boxing-2/id932779605?uo=4

       

      📌 Mod Requirements

      - Jailbroken iPhone or iPad.
      - iGameGod / Filza / iMazing.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak (from Sileo, Cydia or Zebra).

       

      🤩 Hack Features

      - God Mode
      - One Hit Kill
      - No Punch Cooldown

       

      Non-Jailbroken Hack: https://iosgods.com/topic/195702-real-boxing-2-v1550-jailed-cheats-3/

       

      ⬇️ iOS Hack Download Link: https://iosgods.com/topic/195685-real-boxing-2-cheats-v1550-3/
      • 11 replies
    • Dead Trigger 2 Cheats v2.4.1 +10 [ God Mode & More ]
      Modded/Hacked App: DEAD TRIGGER 2: Zombie Games By Deca Games EOOD
      Bundle ID: com.madfingergames.deadtrigger2
      iTunes Store Link: https://apps.apple.com/us/app/dead-trigger-2-zombie-games/id720063540?uo=4

       

      📌 Mod Requirements

      - Jailbroken iPhone or iPad.
      - iGameGod / Filza / iMazing.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak (from Sileo, Cydia or Zebra).

       

      🤩 Hack Features

      - Infinite Ammo
      - No Reload
      - God Mode
      - Infinite Consumable
      - One Hit Kill
      - Drop Hacks
      - Instant Win
      - Better Aim
      - Aimbot
      - Kill All Zombies with 1 Tap

       

      Non-Jailbroken Hack: https://iosgods.com/topic/73791-dead-trigger-2-v230-jailed-cheats-10

       

      ⬇️ iOS Hack Download Link: https://iosgods.com/topic/78126-dead-trigger-2-cheats-v230-10-god-mode-more/
        • Agree
        • Haha
        • Winner
        • Like
      • 2,841 replies
    • Boxing Star: Real Boxing Fight Cheats v7.0.0 +4
      Modded/Hacked App: Boxing Star: Real Boxing Fight By THUMBAGE Co., Ltd
      Bundle ID: com.ftt.boxingstar.gl.ios
      iTunes Store Link: https://apps.apple.com/us/app/boxing-star-real-boxing-fight/id1241887528?uo=4


      Hack Features:
      - Multiply Attack
      - Multiply Defense
      - God Mode
      - One Touch & Win

      Free Non-Jailbroken Hack: https://iosgods.com/topic/92347-boxing-star-real-boxing-fight-v620-jailed-cheats-4/


      Hack Download Link: https://iosgods.com/topic/72805-boxing-star-real-boxing-fight-cheats-v620-4/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 1,685 replies
    • [ Chiikawa Pocket JP ] ちいかわぽけっと v1.2.10 Jailed Cheats +3
      Modded/Hacked App: ちいかわぽけっと By Applibot Inc.
      Bundle ID: jp.co.applibot.chiikawapocket
      iTunes Store Link: https://apps.apple.com/jp/app/%E3%81%A1%E3%81%84%E3%81%8B%E3%82%8F%E3%81%BD%E3%81%91%E3%81%A3%E3%81%A8/id6596745408?uo=4

       

      📌 Mod Requirements

      - Non-Jailbroken/Jailed or Jailbroken iPhone or iPad.
      - Sideloadly or alternatives.
      - Computer running Windows/macOS/Linux with iTunes installed.

       

      🤩 Hack Features

      - God Mode
      - Multiply Attack
      - Custom Speed (Customize before Login or Clear stage to get apply)

       

      ⬇️ iOS Hack Download IPA Link: https://iosgods.com/topic/194281-chiikawa-pocket-jp-%E3%81%A1%E3%81%84%E3%81%8B%E3%82%8F%E3%81%BD%E3%81%91%E3%81%A3%E3%81%A8-v1111-jailed-cheats-3/
      • 24 replies
    • Chiikawa Pocket Cheats v1.2.10 +3
      Modded/Hacked App: Chiikawa Pocket By Applibot Inc.
      Bundle ID: jp.co.applibot.chiikawapocketgl
      iTunes Store Link: https://apps.apple.com/us/app/chiikawa-pocket/id6740838442?uo=4

       

      📌 Mod Requirements

      - Jailbroken iPhone or iPad.
      - iGameGod / Filza / iMazing.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak (from Sileo, Cydia or Zebra).

       

      🤩 Hack Features

      - God Mode
      - Multiply Attack

       

      Non-Jailbroken Hack: https://iosgods.com/topic/193718-chiikawa-pocket-v111-jailed-cheats-2/

       

      ⬇️ iOS Hack Download Link: https://iosgods.com/topic/193717-chiikawa-pocket-cheats-v111-2/
      • 45 replies
    • Real Racing 3 Cheats v13.5.1 +4
      Modded/Hacked App: Real Racing 3 By Electronic Arts Inc.
      Bundle ID: com.ea.realracing3.inc
      iTunes Store Link: https://apps.apple.com/us/app/real-racing-3/id556164008?uo=4

       

      📌 Mod Requirements

      - Jailbroken iPhone or iPad.
      - iGameGod / Filza / iMazing.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak (from Sileo, Cydia or Zebra).

       

      🤩 Hack Features

      - Free Store
      - Freeze M$
      - Freeze R$
      - Freeze Gold

      Non-Jailbroken Hack: https://iosgods.com/topic/185163-real-racing-3-v1317-jailed-cheats-4/

       

      ⬇️ iOS Hack Download Link: https://iosgods.com/topic/147926-real-racing-3-cheats-v1318-4/
        • Agree
        • Haha
        • Like
      • 1,048 replies
    • Dream League Soccer 2025 v12.240 +12 Cheats
      Modded/Hacked App: Dream League Soccer 2024 By First Touch Games Ltd.
      Bundle ID: com.firsttouch.dls7
      iTunes Store Link: https://apps.apple.com/us/app/dream-league-soccer-2024/id1462911602?uo=4


      Hack Features:
      - Stupid AI
      - No Foul
      - No Injuries
      - No Offside
      - Freeze Stamina
      - No Substitutions Limit
      - No Forfeit Penalty
      - Custom Logo Unlocked
      - Custom Kit Unlocked
      - Unlock Customizations
      - Throw In to End Current Half
      - Freeze Match Clock

      Notes: Play offline if you get kicked out of match.


      Non-Jailbroken & No Jailbreak required hack(s): 
       

      iOS Hack Download Link: https://iosgods.com/topic/138633-dream-league-soccer-2024-v11230-12-cheats/
        • Informative
        • Agree
        • Haha
        • Winner
        • Like
      • 2,129 replies
    • Subway Surfers Cheats v3.48.10 +5
      Modded/Hacked App: Subway Surfers By Sybo Games ApS
      Bundle ID: com.kiloo.subwaysurfers
      iTunes Store Link: https://apps.apple.com/us/app/subway-surfers/id512939461?uo=4

       

      📌 Mod Requirements

      - Jailbroken iPhone or iPad.
      - iGameGod / Filza / iMazing.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak (from Sileo, Cydia or Zebra).

       

      🤩 Hack Features

      - Free Store (not Free iAP)
      - Free iAP (ViP Only)
      - Unlock Characters Outfit
      - Custom Jump Height
      - No Clip (To end level swipe to left til you get dizzy, swipe again and you will lose)

       

      Non-Jailbroken Hack: https://iosgods.com/topic/119795-subway-surfers-v3425-jailed-cheats-5/

       

      ⬇️ iOS Hack Download Link: https://iosgods.com/topic/119793-subway-surfers-cheats-v3430-5/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 2,334 replies
    • Dice Dreams Cheats v1.93.0 +2
      Modded/Hacked App: Dice Dreams™ By SuperPlay LTD
      Bundle ID: com.superplaystudios.dicedreams
      iTunes Store Link: https://apps.apple.com/us/app/dice-dreams/id1484468651?uo=4


      Hack Features:
      - Custom Rolls
      - Unlimited Coins - afford regardless of if you have enough


      iOS Hack Download Link: https://iosgods.com/topic/138011-dice-dreams%E2%84%A2-v1692-2-cheats/
        • Agree
        • Winner
        • Like
      • 636 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