Help! how to hack class constants

mbetixz

Platinian
Original poster
May 12, 2022
22
5
3
31
Indonesia
Can I patch or hook the class constants section "COST_SP = 5", can someone explain how to do this??

C++:
// Namespace: entity
public class LifeSkillDefs // TypeDefIndex: 11527
{
    // Fields
    public const int COOKING_SKILL_ID = 51008;
    public const int FISHING_SKILL_ID = 51007;
    public const int MUSIC_SKILL_ID = 51009;
    public const int COST_SP = 5;

    // Methods

    // RVA: 0x14AC724 Offset: 0x14AC724 VA: 0x14AC724
    public void .ctor() { }
}
 

Qnzboi102

Retired Staff
Retired but loved <3
Nov 7, 2019
3,558
49,110
1,213
Queenz NYC
Of course you can you need to find where it’s called and hook it to cost_sp. Are u familiar with C++?
 

mbetixz

Platinian
Original poster
May 12, 2022
22
5
3
31
Indonesia
Of course you can you need to find where it’s called and hook it to cost_sp. Are u familiar with C++?
I'm sorry if I bother you, but I'm new to c++, I understand hooking, but it's for something that has an offset, I don't know how to hook the field class, if you please, can you give me a little idea how to do it? it helped me a lot, and here is where it's called, i didn't find anything else, but it doesn't have an id offset
C++:
// Namespace: entity
public class ProductionItemBase // TypeDefIndex: 11645
{
    // Fields
    public int id; // 0x10
    public int skill_id; // 0x14
    public int res_id; // 0x18
    public string equip_ids; // 0x20
    private ArrayList __equip_ids; // 0x28
    public string consume_equips; // 0x30
    private ArrayList __consume_equips; // 0x38
    public int drop_id; // 0x40
    public string intro; // 0x48
    public string sound_id; // 0x50
    public int act_id; // 0x58
    public int cost_sp; // 0x5C
    public int show_equip_id; // 0x60
    public string sort_str; // 0x68

    // Properties
    public ArrayList equip_ids_val { get; }
    public ArrayList consume_equips_val { get; }

    // Methods

    // RVA: 0x1ABF360 Offset: 0x1ABF360 VA: 0x1ABF360
    public ArrayList get_equip_ids_val() { }

    // RVA: 0x1ABF3B4 Offset: 0x1ABF3B4 VA: 0x1ABF3B4
    public ArrayList get_consume_equips_val() { }

    // RVA: 0x1ABF408 Offset: 0x1ABF408 VA: 0x1ABF408
    public void .ctor() { }
}
 

Raebydett

Awesome Active Platinian
Jan 20, 2020
171
60
28
G
Theres alot tuto hook field around, how about u read them all and come back later? lol
You should read them first before asking but u doing the opposite way
 

mbetixz

Platinian
Original poster
May 12, 2022
22
5
3
31
Indonesia
[ HIDE ] [ / HIDE ]
Theres alot tuto hook field around, how about u read them all and come back later? lol
You should read them first before asking but u doing the opposite way
sorry bro, I have read from this forum and tried a few things especially hooking constructor class to change static field, I found similar forum topic about arraylist hooking but no answer there, before creating this topic I have explored this forum, and searched search site but minimal about this
 

Raebydett

Awesome Active Platinian
Jan 20, 2020
171
60
28
G

mbetixz

Platinian
Original poster
May 12, 2022
22
5
3
31
Indonesia
I guess u not finding things with your eyes ?
not working, i had trying before
 

mbetixz

Platinian
Original poster
May 12, 2022
22
5
3
31
Indonesia
old code was removed,
but something like this, i try same method in difference class with have a clue "_sp"

C++:
bool GodMode = false;
C++:
// MainRoleControl
void (*old_MainRoleControl)(void *instance);
void MainRoleControl(void *instance) {
    if (instance != NULL)
    {
        if (RoleControl != false)
        {
            //private long _main_hp; // 0x78
            void* _main_hp = *(void**) ((uint64_t) instance + 0x78);
            if (_main_hp != NULL)
            {
                *(long *) ((uint64_t) instance + 0x78) = 999999999;
            }
            //private int _main_sp; // 0x80
            void* _main_sp = *(void**) ((uint64_t) instance + 0x80);
            if (_main_sp != NULL)
            {
                *(int *) ((uint64_t) instance + 0x80) = 999999;
            }
            //private int _main_mp; // 0x84
            void* _main_mp = *(void**) ((uint64_t) instance + 0x84);
            if (_main_mp != NULL)
            {
                *(int *) ((uint64_t) instance + 0x84) = 999999;
            }
            //private int _main_hp_level; // 0x88
            void* _main_hpl = *(void**) ((uint64_t) instance + 0x88);
            if (_main_hpl != NULL)
            {
                *(int *) ((uint64_t) instance + 0x88) = 999999;
            }
        }
    }   old_MainRoleControl(instance);
}
C++:
// internal class MainRoleControl : Control 
// RVA: 0x1599964 Offset: 0x1599964 VA: 0x1599964
// public void Update() { }
   A64HookFunction((void*)getAbsoluteAddress("libil2cpp.so", 0x1599964),(void*)MainRoleControl, (void**)&old_MainRoleControl);
Code:
case 1004:
            RoleControl = !RoleControl;
            break;
 

l300M

Rookie
May 23, 2022
1
1
3
31
no where
i'm sorry about that, but can you spesific where is wrong?
Ignore this guy @Raebydett he clearly doesn't know what he's talking about or what you were asking about for that matter, all his answers were rubbish and will confuse you.. This isn't a normal field where you can just hook something and then access it...

Anyways.

Since its constant and doesnt have an offset, it might be possible that once its converted into C++ cost_sp is being optimized away.

Can you find any functions that are supposed to make use of cost_sp? if you are familiar with dissassembly and Arm see if you can find where it should be used, I have a feeling you might find a 5 hardcoded in the arm assembly when checked with IDA/Ghidra etc.

Also send the link of the game or game name
 
  • Like
Reactions: Bhone This Htoo

mbetixz

Platinian
Original poster
May 12, 2022
22
5
3
31
Indonesia
[ QUOTE = "l300M, pos: 3481379, anggota: 2901123" ]
Abaikan orang ini [ USER = 786694 ] @ Raebydett [ / USER ] dia jelas tidak tahu apa yang dia bicarakan atau apa yang Anda tanyakan tentang hal itu, semua jawabannya adalah sampah dan akan membingungkan Anda.. Ini bukan bidang normal di mana Anda bisa mengaitkan sesuatu dan kemudian mengaksesnya...

Bagaimanapun.

Karena konstanta dan tidak memiliki offset, mungkin saja setelah dikonversi menjadi C + + cost_sp sedang dioptimalkan.

Bisakah Anda menemukan fungsi yang seharusnya menggunakan cost_sp? jika Anda terbiasa dengan pembongkaran dan Arm lihat apakah Anda dapat menemukan di mana ia harus digunakan, Saya merasa Anda mungkin menemukan 5 hardcoded di unit lengan ketika diperiksa dengan IDA / Ghidra dll.

Juga kirim tautan game atau nama game
[ / QUOTE ]
itu sebabnya saya bertanya di forum ini, jika saya mengerti apa yang saya lakukan, saya mungkin tidak akan repot bertanya di sini.

nama: The Legend of Neverland ( Versi LAUT )
 

mbetixz

Platinian
Original poster
May 12, 2022
22
5
3
31
Indonesia
Ignore this guy @Raebydett he clearly doesn't know what he's talking about or what you were asking about for that matter, all his answers were rubbish and will confuse you.. This isn't a normal field where you can just hook something and then access it...

Anyways.

Since its constant and doesnt have an offset, it might be possible that once its converted into C++ cost_sp is being optimized away.

Can you find any functions that are supposed to make use of cost_sp? if you are familiar with dissassembly and Arm see if you can find where it should be used, I have a feeling you might find a 5 hardcoded in the arm assembly when checked with IDA/Ghidra etc.

Also send the link of the game or game name
look second post there are class with cost_sp field, i try find other class but didn't find, in second post there only get function, nothing any update function, i trying unlink constructor but not work
 

mbetixz

Platinian
Original poster
May 12, 2022
22
5
3
31
Indonesia
oh well sorry about my quoted post before, i'm trying to translated to indonesian, because i didn't know english, the game name is "the legend of meverland (SEA Version)"