Solved How can i call a function while i'm modifying libil2cpp?

Status
Not open for further replies.

M44d

Platinian
Original poster
Mar 10, 2022
10
3
1
34
US
Hi, thanks for your work in these forums.
I'm trying to learn how to MOD android games, i hope I'm doing well for now.
I have de-compiled all files and il2cppdecompiler to decompile metadata file to get function names.
But have a function like so.

With address "i think": 0xCE638C
HEX content: 00 58 40 BD
ARM64 converted: ldr s0, [x0, #0x58]

This function called when i want to use my MOD, when i change 0x58 to 0 i got exactly what i want in the game, but unfortunately, i have noticed that the application do some timer to calculate the time I'm trying to change. So it come to my mind that i have to call endtime function rather that line.

This is endtime function details from dump.cs

// RVA: 0xCE3CB0 Offset: 0xCE3CB0 VA: 0xCE3CB0
private void TimerEnded() { }

I has a lot of content so i can not share it here unless its so important.
But my question now is how to call that function in when i want?

Thanks advanced.
 
Last edited:
  • Like
Reactions: gnot17

M44d

Platinian
Original poster
Mar 10, 2022
10
3
1
34
US
For further details, i have tried to replace #0x58 with #0xCE3CB0 but the application keeps crashing, so i think its not how to call a function, and i have made my researching in google, i have found that "bl" and "b" are for calling a function, but when using like so.

b #0xCE3CB0
bl #0xCE3CB0

The application still crashes.
Thanks advanced.
 
  • Like
Reactions: gnot17

HolaAmigos27

Platinian
Oct 9, 2021
28
4
3
29
Moscow
For further details, i have tried to replace #0x58 with #0xCE3CB0 but the application keeps crashing, so i think its not how to call a function, and i have made my researching in google, i have found that "bl" and "b" are for calling a function, but when using like so.

b #0xCE3CB0
bl #0xCE3CB0

The application still crashes.
Thanks advanced.
Это и не будет работать, никогда. Используй хуки, а не патчи. Читай гайды про хуки в разделе tutorials. Удачи.
 
  • Like
Reactions: gnot17

M44d

Platinian
Original poster
Mar 10, 2022
10
3
1
34
US
Это и не будет работать, никогда. Используй хуки, а не патчи. Читай гайды про хуки в разделе tutorials. Удачи.
could you please give me an example of how to use hooks?
 
  • Like
Reactions: gnot17

HolaAmigos27

Platinian
Oct 9, 2021
28
4
3
29
Moscow
could you please give me an example of how to use hooks?
 

HolaAmigos27

Platinian
Oct 9, 2021
28
4
3
29
Moscow
Code:
bool dead = false;
int attr = 1;
int (*Camp)(void *instance);

int (*old_GetBaseAttr)(void *instance, int stat);
int GetBaseAttr(void *instance, int stat) {
    if (instance != NULL && stat == 1) {
        int variable = (int) Camp(instance);
        if (variable == 0 && attr > 1) {
            return (int) attr;
        }
        if (variable == 1 || variable == 2) {
            return (int) 0;
        }
    }
    return old_GetBaseAttr(instance, stat);
}

bool (*old_IsDie)(void *instance);
bool IsDie(void *instance) {
    if (instance != NULL && dead) {
        int variable = (int) Camp(instance);
        if (variable == 0) {
            return false;
        } else {
            return true;
        }
    }
    return old_IsDie(instance);
}
Camp = (int (*)(void *)) getAbsoluteAddress(targetLibName, 0x11F5B60);

MSHookFunction((void *)getAbsoluteAddress(targetLibName, 0x1226A98), (void*) GetBaseAttr, (void**)&old_GetBaseAttr);

MSHookFunction((void *)getAbsoluteAddress(targetLibName, 0x1211FDC), (void*) IsDie, (void**)&old_IsDie);

case 0:
    attr = value;
    break;
case 1:
    dead = boolean;
    break;
Я добрался до комьютера и вот тебе 2 хука - int и bool
 

HolaAmigos27

Platinian
Oct 9, 2021
28
4
3
29
Moscow
which specific video that talks because I haven't seen it
Читай уроки по smali, а потом декомпилируй апк файл и просматривай файлы в smali директориях.
Там ты будешь их редактировать. А чтобы читать было удобнее, я советую скачать программу, которая открывает апк файл и можно любой файл читать в виде java кода. Название программы ищи в интернете.
 

fredijaya

Platinian
Nov 4, 2020
5
0
1
33
malaysia
can u help me how to make hex code using ( uint )
i see in the game example: public uint get_Hp
how i can make value 50.000 or 100.000,,,,i not seen in all forum about (UINT)
 

HolaAmigos27

Platinian
Oct 9, 2021
28
4
3
29
Moscow
can u help me how to make hex code using ( uint )
i see in the game example: public uint get_Hp
how i can make value 50.000 or 100.000,,,,i not seen in all forum about (UINT)
UInt это такой же int, только он не может быть отрицательным. Короче меняй как и Int
 
Status
Not open for further replies.