Tutorial How to modify Unity's Il2cpp String method's

alsya

Solid & Active Platinian
Oct 21, 2021
80
18
8
unknown
ini membuat game saya crash? apakah yg salah??

C++:
monoString *(*String_CreateString)(void *instance, const char *str);


monoString* (*old_getLanguage)(void *instance);
monoString* get_String(void *instance) {
    if(instance != NULL && editText) {
    
      
   return String_CreateString(instance, "JP");
  
    
    }
    return old_getLanguage(instance);
}


[CODE]A64HookFunction((void *)getAbsoluteAddress(targetLibName, 0x9FF3D4), (void *)get_String, (void **)&old_getLanguage);
String_CreateString = (monoString*(*)(void *,const char *))getAbsoluteAddress(targetLibName, 0x14EE690);[/CODE]
 

Numark

Awesome Active Platinian
Original poster
May 23, 2017
116
929
193
ini membuat game saya crash? apakah yg salah??

C++:
monoString *(*String_CreateString)(void *instance, const char *str);


monoString* (*old_getLanguage)(void *instance);
monoString* get_String(void *instance) {
    if(instance != NULL && editText) {
   
     
   return String_CreateString(instance, "JP");
 
   
    }
    return old_getLanguage(instance);
}


[CODE]A64HookFunction((void *)getAbsoluteAddress(targetLibName, 0x9FF3D4), (void *)get_String, (void **)&old_getLanguage);
String_CreateString = (monoString*(*)(void *,const char *))getAbsoluteAddress(targetLibName, 0x14EE690);[/CODE]
This is an error you have to fix yourselves. You have to configure and change the files more. I suggest using LGL's latest template or another mod menu that is simple and plain
 

alsya

Solid & Active Platinian
Oct 21, 2021
80
18
8
unknown
Ini adalah kesalahan yang harus Anda perbaiki sendiri. Anda harus mengonfigurasi dan mengubah file lebih banyak. Saya sarankan menggunakan template terbaru LGL atau menu mod lain yang sederhana dan polos
[/MENGUTIP]
finally i fixed it and it works
 

Cyberattack

Platinian
Oct 12, 2018
8
1
3
33
Memek
Hey i just found CreateString on //RVA
C++:
private string CreateString(sbyte* value) { }
Is that can be use? Is not void, the others not similar.
Btw the game can't create name, just picking of list names
 

Lop_A1254

Platinian
Oct 12, 2020
9
1
3
Belgium
Hey i just found CreateString on //RVA
C++:
private string CreateString(sbyte* value) { }
Is that can be use? Is not void, the others not similar.
Btw the game can't create name, just picking of list names
Yes, use it then declare a pointer in ur main and include the header
 

mcoc13

Rookie
Jun 5, 2021
1
0
1
38
Türkiye
first of all sorry for the bad english

I added the mono String files given above to my project.
I hooked creatString from libil2cpp.so file with MSHookFunction

when i run the code the first char is null.
then second char and null again and then 3rd char and null again.
it goes this way.

I am working on armv7 (32 bit).

what could be the cause of the problem


//sample;
monoString * mName;
myName = createString("MYNAME");

char[] mResult="MyResult123456789")
for(int i=0; i<mName->getLengt(); i++){
char j=mName->getChars;
if(j==NULL)
j="n";
mResult=j;
}
printf(mResult)

result= nYnNnAnMnE;
 

Attachments

plengyt

Rookie
Dec 2, 2021
2
1
3
27
INDONESIA
How to hooking this bro? please help me


C++:
// Namespace:
public class CustomizeViewController : MonoBehaviour // TypeDefIndex: 7985
{
    // Fields
        private string skinID; // 0x18


    // RVA: 0x6A987C Offset: 0x6A987C VA: 0x6A987C
    public void OnSkinUseButton() { }
 

HorridModz

Rookie
Apr 10, 2022
2
0
1
24
United States
Thanks a lot, but I can't find CreateString in Polywars. All of the methods have return type of string, not public void. Could you help me find this method?
 

Kaorin333

Solid & Active Platinian
Jun 11, 2022
89
9
8
34
Germany
Nevermind i found a fix.
and what is the fix?

C++:
    // RVA: 0x2CDD134 Offset: 0x2CDD134 VA: 0x2CDD134
    private string CreateString(sbyte* value, int startIndex, int length) { }

    // RVA: 0x2CDEC74 Offset: 0x2CDEC74 VA: 0x2CDEC74
    private string CreateString(char* value, int startIndex, int length) { }

    // RVA: 0x2CDEC84 Offset: 0x2CDEC84 VA: 0x2CDEC84
    private string CreateString(char[] val, int startIndex, int length) { }

    // RVA: 0x2CD3458 Offset: 0x2CD3458 VA: 0x2CD3458
    private string CreateString(char[] val) { }

    // RVA: 0x2CDEC94 Offset: 0x2CDEC94 VA: 0x2CDEC94
    private string CreateString(char c, int count) { }

    // RVA: 0x2CDECA0 Offset: 0x2CDECA0 VA: 0x2CDECA0
    private string CreateString(sbyte* value, int startIndex, int length, Encoding enc) { }
 
  • Like
Reactions: Muhtoevill

2MS.ZIUR

Rookie
Aug 11, 2023
1
0
1
24
PHILIPPINES
How to hook this

// RVA: 0x39072C Offset: 0x39072C VA: 0x39072C
private void SpawnObj(string _name, Vector3 _pos, Vector3 _rot, Vector3 _scale, int _ID, string _customData, bool _duplicated) { }